Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid storing timestamp in Gradle.properties #41762

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ updates:
- dependency-name: biz.paluch.logging:logstash-gelf
- dependency-name: org.bitbucket.b_c:jose4j
- dependency-name: io.fabric8:maven-model-helper
- dependency-name: org.codejive:java-properties
ignore:
# this one cannot be upgraded due to the usage of proxies in new versions
# the proxy implements interfaces in a random order which causes issues
Expand Down
Original file line number Diff line number Diff line change
@@ -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}
Expand Down
Original file line number Diff line number Diff line change
@@ -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}
quarkusPlatformVersion={quarkus.platform.version}
Original file line number Diff line number Diff line change
@@ -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}
quarkusPlatformVersion={quarkus.platform.version}
4 changes: 4 additions & 0 deletions independent-projects/tools/devtools-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
</dependency>
<dependency>
<groupId>org.codejive</groupId>
<artifactId>java-properties</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package io.quarkus.devtools.project.buildfile;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.StringWriter;
import java.io.UncheckedIOException;
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;
Expand Down Expand Up @@ -47,22 +48,22 @@ 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());
try (StringWriter sw = new StringWriter()) {
getModel().getRootPropertiesContent().store(sw, "Gradle properties");
Files.writeString(rootProjectPath.resolve(GRADLE_PROPERTIES_PATH),
sw.toString());
Comment on lines +51 to +54
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using StringWriter because of codejive/java-properties#23

}
}
} else {
writeToProjectFile(getSettingsGradlePath(), getModel().getSettingsContent().getBytes());
if (hasProjectFile(GRADLE_PROPERTIES_PATH)) {
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
getModel().getPropertiesContent().store(out, "Gradle properties");
writeToProjectFile(GRADLE_PROPERTIES_PATH, out.toByteArray());
try (StringWriter sw = new StringWriter()) {
getModel().getPropertiesContent().store(sw, "Gradle properties");
writeToProjectFile(GRADLE_PROPERTIES_PATH, sw.toString());
}
}
}
writeToProjectFile(getBuildGradlePath(), getModel().getBuildContent().getBytes());
writeToProjectFile(getBuildGradlePath(), getModel().getBuildContent());
}

static boolean containsProperty(ArtifactCoords coords) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -122,6 +123,10 @@ protected void writeToProjectFile(final String fileName, final byte[] content) t
Files.write(quarkusProject.getProjectDirPath().resolve(fileName), content);
}

protected void writeToProjectFile(final String fileName, final String content) throws IOException {
Files.writeString(quarkusProject.getProjectDirPath().resolve(fileName), content);
}

private void createProperties() throws IOException {
final ExtensionCatalog platform = quarkusProject.getExtensionsCatalog();
Properties props = getModel().getPropertiesContent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ protected void writeToProjectFile(final String fileName, final byte[] content) t
Files.write(projectDirPath.resolve(fileName), content);
}

protected void writeToProjectFile(final String fileName, final String content) throws IOException {
Files.writeString(projectDirPath.resolve(fileName), content);
}

private Set<ArtifactKey> getDependenciesKeys() throws IOException {
return getDependencies().stream().map(ArtifactCoords::getKey).collect(Collectors.toSet());
}
Expand Down
6 changes: 6 additions & 0 deletions independent-projects/tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<jandex.version>3.2.0</jandex.version>
<system-stubs-jupiter.version>2.0.2</system-stubs-jupiter.version>
<awaitility.version>4.2.1</awaitility.version>
<java-properties.version>0.0.7</java-properties.version>
</properties>
<modules>
<module>registry-client</module>
Expand Down Expand Up @@ -175,6 +176,11 @@
<artifactId>jboss-logging</artifactId>
<version>${jboss-logging.version}</version>
</dependency>
<dependency>
<groupId>org.codejive</groupId>
<artifactId>java-properties</artifactId>
<version>${java-properties.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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
lombokVersion=1.18.12
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Gradle properties
#Tue Aug 25 06:41:36 GMT 2020
# Gradle properties

quarkusPlatformArtifactId=quarkus-bom
quarkusPlatformGroupId=io.quarkus
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Gradle properties
#Wed May 06 08:31:08 UTC 2020
# Gradle properties

quarkusPlatformArtifactId=quarkus-bom
quarkusPlatformGroupId=io.quarkus

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#Gradle properties
# Gradle properties

quarkusPlatformArtifactId=quarkus-bom
quarkusPlatformGroupId=io.quarkus
quarkusPlatformGroupId=io.quarkus