Skip to content

Commit a95bead

Browse files
authored
Merge pull request #49490 from gsmet/3.25.3-backports-1
[3.25] 3.25.3 backports 1
2 parents 173e0d7 + a675f4f commit a95bead

File tree

27 files changed

+129
-54
lines changed

27 files changed

+129
-54
lines changed

bom/application/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
<h2.version>2.3.230</h2.version> <!-- When updating, needs to be matched in io.quarkus.hibernate.orm.runtime.config.DialectVersions
121121
and the dependency jts-core needs to be updated in extensions/jdbc/jdbc-h2/runtime/pom.xml -->
122122
<postgresql-jdbc.version>42.7.7</postgresql-jdbc.version>
123-
<mariadb-jdbc.version>3.5.4</mariadb-jdbc.version>
123+
<mariadb-jdbc.version>3.5.5</mariadb-jdbc.version>
124124
<mysql-jdbc.version>8.3.0</mysql-jdbc.version>
125125
<mssql-jdbc.version>12.10.0.jre11</mssql-jdbc.version>
126126
<adal4j.version>1.6.7</adal4j.version>
@@ -679,6 +679,11 @@
679679
<artifactId>quarkus-devui-deployment-spi</artifactId>
680680
<version>${project.version}</version>
681681
</dependency>
682+
<dependency>
683+
<groupId>io.quarkus</groupId>
684+
<artifactId>quarkus-extension-processor</artifactId>
685+
<version>${project.version}</version>
686+
</dependency>
682687
<dependency>
683688
<groupId>io.quarkus</groupId>
684689
<artifactId>quarkus-jacoco</artifactId>

build-parent/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103

104104
<unboundid-ldap.version>7.0.3</unboundid-ldap.version>
105105

106-
<assertj.version>3.27.3</assertj.version>
106+
<assertj.version>3.27.4</assertj.version>
107107

108108
<wiremock.version>3.13.1</wiremock.version>
109109
<wiremock-maven-plugin.version>7.3.0</wiremock-maven-plugin.version>

core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesResultBuildItem.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.util.Collections;
66
import java.util.HashMap;
77
import java.util.Map;
8+
import java.util.Objects;
89
import java.util.function.Consumer;
910
import java.util.function.Function;
1011
import java.util.function.Supplier;
@@ -177,8 +178,10 @@ public Map<String, String> getConfig(Startable startable) {
177178
if (config != null && !config.isEmpty()) {
178179
map.putAll(config);
179180
}
180-
for (Map.Entry<String, Function<Startable, String>> entry : applicationConfigProvider.entrySet()) {
181-
map.put(entry.getKey(), () -> entry.getValue().apply(startable));
181+
if (applicationConfigProvider != null) {
182+
for (Map.Entry<String, Function<Startable, String>> entry : applicationConfigProvider.entrySet()) {
183+
map.put(entry.getKey(), () -> entry.getValue().apply(startable));
184+
}
182185
}
183186
return map;
184187
}
@@ -190,7 +193,7 @@ public static class DiscoveredServiceBuilder {
190193
private String description;
191194

192195
public DiscoveredServiceBuilder name(String name) {
193-
this.name = name;
196+
this.name = Objects.requireNonNull(name, "name cannot be null");
194197
return this;
195198
}
196199

@@ -215,6 +218,9 @@ public DiscoveredServiceBuilder description(String description) {
215218
}
216219

217220
public DevServicesResultBuildItem build() {
221+
if (name == null) {
222+
throw new IllegalStateException("name cannot be null");
223+
}
218224
return new DevServicesResultBuildItem(name, description, containerId, config);
219225
}
220226
}
@@ -259,6 +265,7 @@ public OwnedServiceBuilder<T> serviceConfig(Object serviceConfig) {
259265
return this;
260266
}
261267

268+
@SuppressWarnings("unchecked")
262269
public <S extends Startable> OwnedServiceBuilder<S> startable(Supplier<S> startableSupplier) {
263270
this.startableSupplier = startableSupplier;
264271
return (OwnedServiceBuilder<S>) this;
@@ -269,11 +276,13 @@ public OwnedServiceBuilder<T> postStartHook(Consumer<T> postStartAction) {
269276
return this;
270277
}
271278

279+
@SuppressWarnings({ "unchecked", "rawtypes" })
272280
public OwnedServiceBuilder<T> configProvider(Map<String, Function<T, String>> applicationConfigProvider) {
273281
this.applicationConfigProvider = (Map<String, Function<Startable, String>>) (Map) applicationConfigProvider;
274282
return this;
275283
}
276284

285+
@SuppressWarnings("unchecked")
277286
public DevServicesResultBuildItem build() {
278287
return new DevServicesResultBuildItem(name, description, serviceName, serviceConfig, config,
279288
(Supplier<Startable>) startableSupplier,

core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,7 @@ public Runnable prepare() {
153153
ClassLoader old = Thread.currentThread().getContextClassLoader();
154154
QuarkusClassLoader tcl = testApplication.createDeploymentClassLoader();
155155
deploymentClassLoader = tcl;
156-
if (firstDeploymentClassLoader == null) {
157-
firstDeploymentClassLoader = deploymentClassLoader;
158-
}
156+
159157
LogCapturingOutputFilter logHandler = new LogCapturingOutputFilter(testApplication, true, true,
160158
TestSupport.instance()
161159
.get()::isDisplayTestOutput);
@@ -724,9 +722,13 @@ private DiscoveryResult discoverTestClasses() {
724722
ClassLoader classLoaderForLoadingTests;
725723
Closeable classLoaderToClose = null;
726724
ClassLoader orig = Thread.currentThread().getContextClassLoader();
725+
// JUnitTestRunner is loaded with an augmentation classloader which does not have visibility of FacadeClassLoader, but the deployment classloader can see it
726+
// We need a consistent classloader or we leak curated applications, so use a static classloader we stashed away
727+
// In a multi-module project we will have several deployment classloaders, but it's ok
728+
if (firstDeploymentClassLoader == null) {
729+
firstDeploymentClassLoader = deploymentClassLoader;
730+
}
727731
try {
728-
// JUnitTestRunner is loaded with an augmentation classloader which does not have visibility of FacadeClassLoader, but the deployment classloader can see it
729-
// We need a consistent classloader or we leak curated applications, so use a static classloader we stashed away
730732
Class fclClazz = firstDeploymentClassLoader.loadClass(FACADE_CLASS_LOADER_NAME);
731733
Constructor constructor = fclClazz.getConstructor(ClassLoader.class, boolean.class, CuratedApplication.class,
732734
Map.class,
@@ -746,6 +748,8 @@ private DiscoveryResult discoverTestClasses() {
746748
.setContextClassLoader(classLoaderForLoadingTests);
747749
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InstantiationException
748750
| InvocationTargetException e) {
751+
// If the first deployment classloader cannot load a facade classloader, don't keep using it, let the next module provide one
752+
firstDeploymentClassLoader = null;
749753
// This is fine, and usually just means that test-framework/junit5 isn't one of the project dependencies
750754
// In that case, fallback to loading classes as we normally would, using a TCCL
751755
log.debug(

core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildContainerRunner.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,12 @@ private void pull(String effectiveBuilderImage, boolean processInheritIODisabled
9999
// todo: maybe this should just be logged or something?
100100
if (processInheritIODisabled) {
101101
pb.output().consumeLinesWith(8192, System.out::println);
102-
pb.error().consumeLinesWith(8192, System.err::println);
102+
// logOnSuccess(false) avoids WARNING from io.smallrye.common.process.Logging
103+
pb.error().logOnSuccess(false).consumeLinesWith(8192, System.err::println);
103104
} else {
104-
pb.output().inherited().error().inherited();
105+
pb.output().inherited();
106+
// logOnSuccess(false) avoids WARNING from io.smallrye.common.process.Logging
107+
pb.error().logOnSuccess(false).inherited();
105108
}
106109
try {
107110
pb.run();

core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildLocalContainerRunner.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ public NativeImageBuildLocalContainerRunner(NativeConfig nativeConfig) {
2727
}
2828

2929
public static List<String> getVolumeAccessArguments(ContainerRuntime containerRuntime) {
30+
if (containerRuntime.isUnavailable()) {
31+
return List.of();
32+
}
33+
3034
final List<String> result = new ArrayList<>();
3135
if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC) {
3236
if (containerRuntime.isDocker() && containerRuntime.isRootless()) {

core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildRunner.java

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -47,32 +47,34 @@ public void build(List<String> args, String nativeImageName, String resultingExe
4747
try {
4848
final String[] buildCommand = getBuildCommand(outputDir, args);
4949
log.info(String.join(" ", buildCommand).replace("$", "\\$"));
50-
ProcessBuilder.newBuilder(buildCommand[0])
50+
ProcessBuilder<Void> pb = ProcessBuilder.newBuilder(buildCommand[0])
5151
.arguments(Arrays.copyOfRange(buildCommand, 1, buildCommand.length))
52-
.directory(outputDir)
53-
.whileRunning(ph -> {
54-
if (!ph.isAlive()) {
55-
return;
56-
}
57-
// todo: maybe have a "destroy-on-shutdown" switch?
58-
Thread hook = new Thread(() -> {
59-
if (ph.supportsNormalTermination()) {
60-
// ask nicely (not supported on Windows)
61-
ph.destroy();
62-
}
63-
ph.waitUninterruptiblyFor(10, TimeUnit.SECONDS);
64-
ProcessUtil.destroyAllForcibly(ph);
65-
}, "GraalVM terminator");
66-
Runtime.getRuntime().addShutdownHook(hook);
67-
try {
68-
ph.waitUninterruptiblyFor();
69-
} finally {
70-
Runtime.getRuntime().removeShutdownHook(hook);
71-
}
72-
})
73-
.output().consumeLinesWith(8192, log::info)
74-
.error().consumeWith(br -> new ErrorReplacingProcessReader(br, outputDir.resolve("reports").toFile()).run())
75-
.run();
52+
.directory(outputDir);
53+
pb.whileRunning(ph -> {
54+
if (!ph.isAlive()) {
55+
return;
56+
}
57+
// todo: maybe have a "destroy-on-shutdown" switch?
58+
Thread hook = new Thread(() -> {
59+
if (ph.supportsNormalTermination()) {
60+
// ask nicely (not supported on Windows)
61+
ph.destroy();
62+
}
63+
ph.waitUninterruptiblyFor(10, TimeUnit.SECONDS);
64+
ProcessUtil.destroyAllForcibly(ph);
65+
}, "GraalVM terminator");
66+
Runtime.getRuntime().addShutdownHook(hook);
67+
try {
68+
ph.waitUninterruptiblyFor();
69+
} finally {
70+
Runtime.getRuntime().removeShutdownHook(hook);
71+
}
72+
});
73+
pb.output().consumeLinesWith(8192, System.out::println);
74+
// Why logOnSuccess(false) and then consumeWith? Because we get the stdErr twice otherwise.
75+
pb.error().logOnSuccess(false)
76+
.consumeWith(br -> new ErrorReplacingProcessReader(br, outputDir.resolve("reports").toFile()).run());
77+
pb.run();
7678
boolean objcopyExists = objcopyExists();
7779

7880
if (!debugSymbolsEnabled) {
@@ -121,11 +123,13 @@ protected void postBuild(Path outputDir, String nativeImageName, String resultin
121123
static void runCommand(String[] command, String errorMsg, File workingDirectory) {
122124
log.info(String.join(" ", command).replace("$", "\\$"));
123125
try {
124-
var pb = ProcessBuilder.newBuilder(command[0])
126+
final ProcessBuilder<Void> pb = ProcessBuilder.newBuilder(command[0])
125127
.arguments(Arrays.copyOfRange(command, 1, command.length));
126128
if (workingDirectory != null) {
127129
pb.directory(workingDirectory.toPath());
128130
}
131+
// Without logOnSuccess(false) the error stream is printed twice and with a "WARNING".
132+
pb.error().logOnSuccess(false);
129133
pb.run();
130134
} catch (Exception e) {
131135
if (errorMsg != null) {

core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,9 @@ private static String detectPIE() {
566566

567567
private static String testGCCArgument(String argument) {
568568
try {
569-
ProcessBuilder.exec("cc", "-v", "-E", argument, "-");
569+
ProcessBuilder<Void> pb = ProcessBuilder.newBuilder("cc", "-v", "-E", argument, "-");
570+
pb.error().logOnSuccess(log.isTraceEnabled());
571+
pb.run();
570572
return argument;
571573
} catch (Exception ignored) {
572574
return "";

core/deployment/src/main/java/io/quarkus/deployment/util/ContainerRuntimeUtil.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public String getExecutableName() {
245245
}
246246

247247
public boolean isDocker() {
248-
return this.executableName.equals("docker");
248+
return this == DOCKER || this == DOCKER_ROOTLESS || this == WSL || this == WSL_ROOTLESS;
249249
}
250250

251251
public boolean isPodman() {
@@ -260,6 +260,10 @@ public boolean isRootless() {
260260
return rootless;
261261
}
262262

263+
public boolean isUnavailable() {
264+
return this == UNAVAILABLE;
265+
}
266+
263267
public static ContainerRuntime of(String value) {
264268
for (ContainerRuntime containerRuntime : values()) {
265269
if (containerRuntime.name().equalsIgnoreCase(value)) {

devtools/gradle/gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ kotlin = "2.2.0"
55
smallrye-config = "3.13.4"
66

77
junit5 = "5.13.4"
8-
assertj = "3.27.3"
8+
assertj = "3.27.4"
99

1010
[plugins]
1111
plugin-publish = { id = "com.gradle.plugin-publish", version.ref = "plugin-publish" }

0 commit comments

Comments
 (0)