Skip to content

Commit 1562880

Browse files
authored
Merge pull request #946 from gsmet/quarkus-3.3.1
Upgrade to Quarkus 3.3.1
2 parents 5844f67 + 184527c commit 1562880

File tree

8 files changed

+1288
-1301
lines changed

8 files changed

+1288
-1301
lines changed

generated-platform-project/quarkus-maven-plugin/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ private MavenArtifactResolver artifactResolver(QuarkusBootstrapMojo mojo, Launch
185185
.setUserSettings(mojo.mavenSession().getRequest().getUserSettingsFile())
186186
.setCurrentProject(mojo.mavenProject().getFile().toString())
187187
.setPreferPomsFromWorkspace(true)
188-
.setProjectModelProvider(getProjectMap(mojo.mavenSession())::get));
188+
.setProjectModelProvider(getProjectMap(mojo.mavenSession())::get)
189+
// pass the repositories since Maven extensions could manipulate repository configs
190+
.setRemoteRepositories(mojo.remoteRepositories()));
189191
}
190192
// PROD packaging mode with workspace discovery disabled
191193
return MavenArtifactResolver.builder()

generated-platform-project/quarkus-maven-plugin/src/main/java/io/quarkus/maven/TrackConfigChangesMojo.java

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
package io.quarkus.maven;
22

33
import java.io.BufferedReader;
4-
import java.io.BufferedWriter;
54
import java.io.File;
65
import java.io.IOException;
7-
import java.io.UncheckedIOException;
86
import java.lang.reflect.Method;
97
import java.nio.file.Files;
108
import java.nio.file.Path;
11-
import java.util.ArrayList;
12-
import java.util.Collections;
13-
import java.util.List;
149
import java.util.Properties;
1510

1611
import org.apache.maven.plugin.MojoExecutionException;
@@ -23,7 +18,6 @@
2318
import io.quarkus.bootstrap.app.CuratedApplication;
2419
import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
2520
import io.quarkus.bootstrap.model.ApplicationModel;
26-
import io.quarkus.deployment.configuration.tracker.ConfigTrackingWriter;
2721
import io.quarkus.runtime.LaunchMode;
2822

2923
/**
@@ -58,6 +52,12 @@ public class TrackConfigChangesMojo extends QuarkusBootstrapMojo {
5852
@Parameter(property = "quarkus.recorded-build-config.file", required = false)
5953
File recordedBuildConfigFile;
6054

55+
/**
56+
* Whether to dump the current build configuration in case the configuration from the previous build isn't found
57+
*/
58+
@Parameter(defaultValue = "false", property = "quarkus.track-config-changes.dump-current-when-recorded-unavailable")
59+
boolean dumpCurrentWhenRecordedUnavailable;
60+
6161
@Override
6262
protected boolean beforeExecute() throws MojoExecutionException, MojoFailureException {
6363
if (skip) {
@@ -102,16 +102,17 @@ protected void doExecute() throws MojoExecutionException, MojoFailureException {
102102
compareFile = recordedBuildConfigDirectory.toPath().resolve(this.recordedBuildConfigFile.toPath());
103103
}
104104

105-
if (!Files.exists(compareFile)) {
105+
final Properties compareProps = new Properties();
106+
if (Files.exists(compareFile)) {
107+
try (BufferedReader reader = Files.newBufferedReader(compareFile)) {
108+
compareProps.load(reader);
109+
} catch (IOException e) {
110+
throw new RuntimeException("Failed to read " + compareFile, e);
111+
}
112+
} else if (!dumpCurrentWhenRecordedUnavailable) {
106113
getLog().info(compareFile + " not found");
107114
return;
108115
}
109-
final Properties compareProps = new Properties();
110-
try (BufferedReader reader = Files.newBufferedReader(compareFile)) {
111-
compareProps.load(reader);
112-
} catch (IOException e) {
113-
throw new RuntimeException("Failed to read " + compareFile, e);
114-
}
115116

116117
CuratedApplication curatedApplication = null;
117118
QuarkusClassLoader deploymentClassLoader = null;
@@ -124,11 +125,11 @@ protected void doExecute() throws MojoExecutionException, MojoFailureException {
124125
Thread.currentThread().setContextClassLoader(deploymentClassLoader);
125126

126127
final Class<?> codeGenerator = deploymentClassLoader.loadClass("io.quarkus.deployment.CodeGenerator");
127-
final Method dumpConfig = codeGenerator.getMethod("readCurrentConfigValues", ApplicationModel.class, String.class,
128-
Properties.class, QuarkusClassLoader.class, Properties.class);
129-
actualProps = (Properties) dumpConfig.invoke(null, curatedApplication.getApplicationModel(),
128+
final Method dumpConfig = codeGenerator.getMethod("dumpCurrentConfigValues", ApplicationModel.class, String.class,
129+
Properties.class, QuarkusClassLoader.class, Properties.class, Path.class);
130+
dumpConfig.invoke(null, curatedApplication.getApplicationModel(),
130131
launchMode.name(), getBuildSystemProperties(true),
131-
deploymentClassLoader, compareProps);
132+
deploymentClassLoader, compareProps, targetFile);
132133
} catch (Exception any) {
133134
throw new MojoExecutionException("Failed to bootstrap Quarkus application", any);
134135
} finally {
@@ -140,24 +141,5 @@ protected void doExecute() throws MojoExecutionException, MojoFailureException {
140141
deploymentClassLoader.close();
141142
}
142143
}
143-
144-
final List<String> names = new ArrayList<>(actualProps.stringPropertyNames());
145-
Collections.sort(names);
146-
147-
final Path outputDir = targetFile.getParent();
148-
if (outputDir != null && !Files.exists(outputDir)) {
149-
try {
150-
Files.createDirectories(outputDir);
151-
} catch (IOException e) {
152-
throw new UncheckedIOException(e);
153-
}
154-
}
155-
try (BufferedWriter writer = Files.newBufferedWriter(targetFile)) {
156-
for (var name : names) {
157-
ConfigTrackingWriter.write(writer, name, actualProps.getProperty(name));
158-
}
159-
} catch (IOException e) {
160-
throw new UncheckedIOException(e);
161-
}
162144
}
163145
}

generated-platform-project/quarkus-maven-plugin/src/main/java/io/quarkus/maven/UpdateMojo.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import io.quarkus.devtools.commands.data.QuarkusCommandOutcome;
1717
import io.quarkus.devtools.project.QuarkusProject;
1818
import io.quarkus.devtools.project.QuarkusProjectHelper;
19+
import io.quarkus.devtools.project.update.rewrite.QuarkusUpdateExitErrorException;
1920
import io.quarkus.maven.dependency.ArtifactCoords;
2021
import io.quarkus.registry.RegistryResolutionException;
2122
import io.quarkus.registry.catalog.ExtensionCatalog;
@@ -129,10 +130,12 @@ protected void processProjectState(QuarkusProject quarkusProject) throws MojoExe
129130
final QuarkusCommandOutcome result = invoker.execute();
130131
if (!result.isSuccess()) {
131132
throw new MojoExecutionException(
132-
"The command did not succeed.");
133+
"Failed to apply the updates.");
133134
}
135+
} catch (QuarkusUpdateExitErrorException e) {
136+
throw new MojoExecutionException(e.getMessage());
134137
} catch (QuarkusCommandException e) {
135-
throw new MojoExecutionException("Failed to resolve the available updates", e);
138+
throw new MojoExecutionException("Failed to apply the updates", e);
136139
}
137140
}
138141

0 commit comments

Comments
 (0)