Skip to content

Commit

Permalink
build: fix version parsing
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Bricon <[email protected]>
  • Loading branch information
fbricon committed Oct 27, 2023
1 parent 1fc336e commit 72fffcf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 28 deletions.
8 changes: 4 additions & 4 deletions get_timestamp_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# Path to your gradle.properties file
GRADLE_PROPERTIES_FILE="gradle.properties"

# Read the current version from gradle.properties
CURRENT_VERSION=$(grep "pluginVersion=" "$GRADLE_PROPERTIES_FILE" | cut -d'=' -f2)
# Read the current version from gradle.properties, ignoring spaces around the equals sign
CURRENT_VERSION=$(grep -E "pluginVersion\s*=\s*" "$GRADLE_PROPERTIES_FILE" | sed -E 's/.*=\s*([^[:space:]]*).*/\1/')

# Extract the version part before any hyphen
BASE_VERSION=$(echo "$CURRENT_VERSION" | awk -F'-' '{print $1}')
Expand All @@ -13,7 +13,7 @@ BASE_VERSION=$(echo "$CURRENT_VERSION" | awk -F'-' '{print $1}')
TIMESTAMP=$(date +'%Y%m%d-%H%M%S')
NEW_VERSION="${BASE_VERSION}-$TIMESTAMP"

# Use awk to update the gradle.properties file
awk -v new_version="$NEW_VERSION" '/pluginVersion=/{sub(/=.*/, "=" new_version)}1' "$GRADLE_PROPERTIES_FILE" > tmpfile && mv tmpfile "$GRADLE_PROPERTIES_FILE"
# Use awk to update the gradle.properties file, allowing spaces around the equals sign
awk -v new_version="$NEW_VERSION" '/pluginVersion\s*=\s*/{sub(/=.*/, "=" new_version)}1' "$GRADLE_PROPERTIES_FILE" > tmpfile && mv tmpfile "$GRADLE_PROPERTIES_FILE"

echo $NEW_VERSION
39 changes: 15 additions & 24 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,40 +1,31 @@
# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html

pluginGroup = com.redhat.devtools.intellij
pluginName = Quarkus Tools
pluginRepositoryUrl = https://github.com/redhat-developer/intellij-quarkus
pluginGroup=com.redhat.devtools.intellij
pluginName=Quarkus Tools
pluginRepositoryUrl=https://github.com/redhat-developer/intellij-quarkus
# SemVer format -> https://semver.org
pluginVersion = 1.29.1-SNAPSHOT

# NO SPACES AROUND THE EQUALS SIGN!!
pluginVersion=1.29.1-SNAPSHOT
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 222
#pluginUntilBuild = 233.*

pluginSinceBuild=222
#pluginUntilBuild=233.*
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IC
platformVersion = 2022.2.3

platformType=IC
platformVersion=2022.2.3
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins = com.intellij.java, maven, gradle-java, properties, yaml, com.redhat.devtools.intellij.telemetry:1.0.0.44

platformPlugins=com.intellij.java, maven, gradle-java, properties, yaml, com.redhat.devtools.intellij.telemetry:1.0.0.44
# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.4

gradleVersion=8.4
channel=nightly
quarkusVersion=3.1.2.Final
lsp4mpVersion=0.10.0
quarkusLsVersion=0.17.0
quteLsVersion=0.17.0

# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency = false

kotlin.stdlib.default.dependency=false
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.configuration-cache = true

org.gradle.configuration-cache=true
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching = true

org.gradle.caching=true
# Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment
systemProp.org.gradle.unsafe.kotlin.assignment = true
systemProp.org.gradle.unsafe.kotlin.assignment=true

0 comments on commit 72fffcf

Please sign in to comment.