From 3ae02fb03876c07031250cf3ce5b80708c49811d Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Mon, 8 Jul 2024 13:03:31 -0300 Subject: [PATCH] Avoid storing timestamp in Gradle.properties --- .../resources/archetype-resources/gradle.properties | 4 ++-- .../gradle-kotlin-dsl/base/gradle.tpl.qute.properties | 5 +++-- .../buildtool/gradle/base/gradle.tpl.qute.properties | 5 +++-- independent-projects/tools/devtools-common/pom.xml | 4 ++++ .../project/buildfile/AbstractGradleBuildFile.java | 10 ++++------ .../buildfile/AbstractGradleBuildFilesCreator.java | 3 ++- independent-projects/tools/pom.xml | 6 ++++++ .../resources/compile-only-lombok/gradle.properties | 6 +++--- .../multi-module-included-build/gradle.properties | 4 ++-- .../multi-module-kotlin-project/gradle.properties | 4 ++-- .../multi-module-with-empty-module/gradle.properties | 5 +++-- 11 files changed, 34 insertions(+), 22 deletions(-) diff --git a/extensions/amazon-lambda/maven-archetype/src/main/resources/archetype-resources/gradle.properties b/extensions/amazon-lambda/maven-archetype/src/main/resources/archetype-resources/gradle.properties index 644310c2b3a94..c77b7693b0052 100644 --- a/extensions/amazon-lambda/maven-archetype/src/main/resources/archetype-resources/gradle.properties +++ b/extensions/amazon-lambda/maven-archetype/src/main/resources/archetype-resources/gradle.properties @@ -1,5 +1,5 @@ -#Gradle properties -#Tue Mar 17 10:20:48 UTC 2020 +# Gradle properties + quarkusPluginVersion=${project.version} quarkusPlatformArtifactId=quarkus-bom quarkusPlatformVersion=${project.version} diff --git a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/buildtool/gradle-kotlin-dsl/base/gradle.tpl.qute.properties b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/buildtool/gradle-kotlin-dsl/base/gradle.tpl.qute.properties index d3160667382c5..80d94672c2262 100644 --- a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/buildtool/gradle-kotlin-dsl/base/gradle.tpl.qute.properties +++ b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/buildtool/gradle-kotlin-dsl/base/gradle.tpl.qute.properties @@ -1,6 +1,7 @@ -#Gradle properties +# Gradle properties + quarkusPluginId={quarkus.gradle-plugin.id} quarkusPluginVersion={quarkus.gradle-plugin.version} quarkusPlatformGroupId={quarkus.platform.group-id} quarkusPlatformArtifactId={quarkus.platform.artifact-id} -quarkusPlatformVersion={quarkus.platform.version} \ No newline at end of file +quarkusPlatformVersion={quarkus.platform.version} diff --git a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/buildtool/gradle/base/gradle.tpl.qute.properties b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/buildtool/gradle/base/gradle.tpl.qute.properties index d3160667382c5..80d94672c2262 100644 --- a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/buildtool/gradle/base/gradle.tpl.qute.properties +++ b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/buildtool/gradle/base/gradle.tpl.qute.properties @@ -1,6 +1,7 @@ -#Gradle properties +# Gradle properties + quarkusPluginId={quarkus.gradle-plugin.id} quarkusPluginVersion={quarkus.gradle-plugin.version} quarkusPlatformGroupId={quarkus.platform.group-id} quarkusPlatformArtifactId={quarkus.platform.artifact-id} -quarkusPlatformVersion={quarkus.platform.version} \ No newline at end of file +quarkusPlatformVersion={quarkus.platform.version} diff --git a/independent-projects/tools/devtools-common/pom.xml b/independent-projects/tools/devtools-common/pom.xml index 2e5832fddb6af..e7b70a29daea2 100644 --- a/independent-projects/tools/devtools-common/pom.xml +++ b/independent-projects/tools/devtools-common/pom.xml @@ -106,6 +106,10 @@ jakarta.enterprise jakarta.enterprise.cdi-api + + org.codejive + java-properties + org.junit.jupiter junit-jupiter diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java index dd5ea2931ce1e..1eb851393c53e 100644 --- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java +++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java @@ -7,12 +7,13 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Properties; import java.util.Scanner; import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.codejive.properties.Properties; + import io.quarkus.maven.dependency.ArtifactCoords; import io.quarkus.maven.dependency.ArtifactKey; import io.quarkus.registry.catalog.ExtensionCatalog; @@ -47,11 +48,8 @@ public void writeToDisk() throws IOException { if (rootProjectPath != null) { Files.write(rootProjectPath.resolve(getSettingsGradlePath()), getModel().getRootSettingsContent().getBytes()); if (hasRootProjectFile(GRADLE_PROPERTIES_PATH)) { - try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { - getModel().getRootPropertiesContent().store(out, "Gradle properties"); - Files.write(rootProjectPath.resolve(GRADLE_PROPERTIES_PATH), - out.toByteArray()); - } + getModel().getRootPropertiesContent().store(rootProjectPath.resolve(GRADLE_PROPERTIES_PATH), + "Gradle properties"); } } else { writeToProjectFile(getSettingsGradlePath(), getModel().getSettingsContent().getBytes()); diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFilesCreator.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFilesCreator.java index 5d6ad5618536f..fe67d10e8dd70 100644 --- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFilesCreator.java +++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFilesCreator.java @@ -8,9 +8,10 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.List; -import java.util.Properties; import java.util.concurrent.atomic.AtomicReference; +import org.codejive.properties.Properties; + import io.quarkus.devtools.project.QuarkusProject; import io.quarkus.devtools.project.buildfile.AbstractGradleBuildFile.Model; import io.quarkus.maven.dependency.ArtifactCoords; diff --git a/independent-projects/tools/pom.xml b/independent-projects/tools/pom.xml index fdb667652e510..28abaed4649c6 100644 --- a/independent-projects/tools/pom.xml +++ b/independent-projects/tools/pom.xml @@ -60,6 +60,7 @@ 3.2.0 2.0.2 4.2.1 + 0.0.7 registry-client @@ -175,6 +176,11 @@ jboss-logging ${jboss-logging.version} + + org.codejive + java-properties + ${java-properties.version} + org.junit.jupiter junit-jupiter diff --git a/integration-tests/gradle/src/main/resources/compile-only-lombok/gradle.properties b/integration-tests/gradle/src/main/resources/compile-only-lombok/gradle.properties index cac35f5608ec1..542d9cf933db7 100644 --- a/integration-tests/gradle/src/main/resources/compile-only-lombok/gradle.properties +++ b/integration-tests/gradle/src/main/resources/compile-only-lombok/gradle.properties @@ -1,6 +1,6 @@ -#Gradle properties -#Tue Aug 04 17:04:55 CEST 2020 +# Gradle properties + quarkusPlatformArtifactId=quarkus-bom quarkusPlatformGroupId=io.quarkus org.gradle.logging.level=INFO -lombokVersion=1.18.12 \ No newline at end of file +lombokVersion=1.18.12 diff --git a/integration-tests/gradle/src/main/resources/multi-module-included-build/gradle.properties b/integration-tests/gradle/src/main/resources/multi-module-included-build/gradle.properties index a0bb7cd4da3b4..0b9b349582ac3 100644 --- a/integration-tests/gradle/src/main/resources/multi-module-included-build/gradle.properties +++ b/integration-tests/gradle/src/main/resources/multi-module-included-build/gradle.properties @@ -1,4 +1,4 @@ -#Gradle properties -#Tue Aug 25 06:41:36 GMT 2020 +# Gradle properties + quarkusPlatformArtifactId=quarkus-bom quarkusPlatformGroupId=io.quarkus diff --git a/integration-tests/gradle/src/main/resources/multi-module-kotlin-project/gradle.properties b/integration-tests/gradle/src/main/resources/multi-module-kotlin-project/gradle.properties index b8ff81712a497..d54b9c8a6b92b 100644 --- a/integration-tests/gradle/src/main/resources/multi-module-kotlin-project/gradle.properties +++ b/integration-tests/gradle/src/main/resources/multi-module-kotlin-project/gradle.properties @@ -1,5 +1,5 @@ -#Gradle properties -#Wed May 06 08:31:08 UTC 2020 +# Gradle properties + quarkusPlatformArtifactId=quarkus-bom quarkusPlatformGroupId=io.quarkus diff --git a/integration-tests/gradle/src/main/resources/multi-module-with-empty-module/gradle.properties b/integration-tests/gradle/src/main/resources/multi-module-with-empty-module/gradle.properties index e6b64c6a56957..0b9b349582ac3 100644 --- a/integration-tests/gradle/src/main/resources/multi-module-with-empty-module/gradle.properties +++ b/integration-tests/gradle/src/main/resources/multi-module-with-empty-module/gradle.properties @@ -1,3 +1,4 @@ -#Gradle properties +# Gradle properties + quarkusPlatformArtifactId=quarkus-bom -quarkusPlatformGroupId=io.quarkus \ No newline at end of file +quarkusPlatformGroupId=io.quarkus