Skip to content

Commit 74af53c

Browse files
authored
Merge branch 'main' into issue/48641
2 parents 44581c9 + 9ac65b1 commit 74af53c

File tree

87 files changed

+1971
-471
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1971
-471
lines changed

bom/application/pom.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
<!-- liquibase-mongodb is not released everytime with liquibase anymore, but the two versions need to be compatible -->
166166
<liquibase.version>4.33.0</liquibase.version>
167167
<liquibase-mongodb.version>4.33.0.1</liquibase-mongodb.version>
168-
<snakeyaml.version>2.4</snakeyaml.version>
168+
<snakeyaml.version>2.5</snakeyaml.version>
169169
<osgi.version>6.0.0</osgi.version>
170170
<mongo-client.version>5.5.1</mongo-client.version>
171171
<proton-j.version>0.34.1</proton-j.version>
@@ -4391,6 +4391,11 @@
43914391
<artifactId>smallrye-fault-tolerance-api</artifactId>
43924392
<version>${smallrye-fault-tolerance.version}</version>
43934393
</dependency>
4394+
<dependency>
4395+
<groupId>io.smallrye</groupId>
4396+
<artifactId>smallrye-fault-tolerance-apiimpl</artifactId>
4397+
<version>${smallrye-fault-tolerance.version}</version>
4398+
</dependency>
43944399
<dependency>
43954400
<groupId>io.smallrye</groupId>
43964401
<artifactId>smallrye-fault-tolerance-autoconfig-core</artifactId>
@@ -4416,6 +4421,11 @@
44164421
<artifactId>smallrye-fault-tolerance-mutiny</artifactId>
44174422
<version>${smallrye-fault-tolerance.version}</version>
44184423
</dependency>
4424+
<dependency>
4425+
<groupId>io.smallrye</groupId>
4426+
<artifactId>smallrye-fault-tolerance-standalone</artifactId>
4427+
<version>${smallrye-fault-tolerance.version}</version>
4428+
</dependency>
44194429
<dependency>
44204430
<groupId>io.smallrye</groupId>
44214431
<artifactId>smallrye-fault-tolerance-tracing-propagation</artifactId>

build-parent/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<!-- These properties are needed in order for them to be resolvable by the generated projects -->
2222
<compiler-plugin.version>${version.compiler.plugin}</compiler-plugin.version>
2323
<kotlin.version>2.2.10</kotlin.version>
24+
<ksp-gradle-plugin.version>2.2.10-2.0.2</ksp-gradle-plugin.version> <!-- Kotlin Symbol Processing plugin used in a test -->
2425
<dokka.version>2.0.0</dokka.version>
2526
<scala.version>2.13.12</scala.version>
2627
<scala-maven-plugin.version>4.9.5</scala-maven-plugin.version>

core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.net.URI;
1111
import java.net.URISyntaxException;
1212
import java.net.URL;
13+
import java.nio.file.FileSystemException;
1314
import java.nio.file.Files;
1415
import java.nio.file.Path;
1516
import java.nio.file.Paths;
@@ -26,6 +27,7 @@
2627
import io.quarkus.dev.spi.DevModeType;
2728
import io.quarkus.maven.dependency.ArtifactKey;
2829
import io.quarkus.paths.PathList;
30+
import io.smallrye.common.os.OS;
2931

3032
/**
3133
* The main entry point for the dev mojo execution
@@ -196,7 +198,18 @@ private void linkDotEnvFile() {
196198
silentDeleteFile(link);
197199
try {
198200
// create a symlink to ensure that user updates to the file have the expected effect in dev-mode
199-
Files.createSymbolicLink(link, dotEnvPath);
201+
try {
202+
Files.createSymbolicLink(link, dotEnvPath);
203+
} catch (FileSystemException e) {
204+
// on Windows fall back to hard link if symlink cannot be created (due to insufficient permissions)
205+
// see https://github.com/quarkusio/quarkus/issues/49785
206+
if (OS.WINDOWS.isCurrent()) {
207+
log.debug("Falling back to hard link on Windows after FileSystemException", e);
208+
Files.createLink(link, dotEnvPath);
209+
} else {
210+
throw e;
211+
}
212+
}
200213
} catch (IOException e) {
201214
log.warn("Unable to link .env file", e);
202215
}

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.ArrayList;
55
import java.util.Collections;
66
import java.util.List;
7+
import java.util.concurrent.atomic.AtomicBoolean;
78
import java.util.function.Function;
89
import java.util.stream.Stream;
910

@@ -22,6 +23,7 @@ public abstract class NativeImageBuildContainerRunner extends NativeImageBuildRu
2223
protected final ContainerRuntimeUtil.ContainerRuntime containerRuntime;
2324
String[] baseContainerRuntimeArgs;
2425
private final String containerName;
26+
private final AtomicBoolean setupInvoked = new AtomicBoolean();
2527

2628
protected NativeImageBuildContainerRunner(NativeConfig nativeConfig) {
2729
this.nativeConfig = nativeConfig;
@@ -39,7 +41,10 @@ public boolean isContainer() {
3941

4042
@Override
4143
public void setup(boolean processInheritIODisabled) {
42-
if (containerRuntime != ContainerRuntimeUtil.ContainerRuntime.UNAVAILABLE) {
44+
if (containerRuntime == ContainerRuntimeUtil.ContainerRuntime.UNAVAILABLE) {
45+
return;
46+
}
47+
if (setupInvoked.compareAndSet(false, true)) {
4348
log.infof("Using %s to run the native image builder", containerRuntime.getExecutableName());
4449
// we pull the docker image in order to give users an indication of which step the process is at
4550
// it's not strictly necessary we do this, however if we don't the subsequent version command
@@ -91,6 +96,7 @@ public void setup(boolean processInheritIODisabled) {
9196
pull(effectiveBuilderImage, processInheritIODisabled);
9297
}
9398
}
99+
94100
}
95101

96102
private void pull(String effectiveBuilderImage, boolean processInheritIODisabled) {

core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ public static void run(Application application, Class<? extends QuarkusApplicati
164164
stateLock.unlock();
165165
}
166166
}
167-
} catch (Exception e) {
168-
Throwable rootCause = ExceptionUtil.getRootCause(e);
167+
} catch (Throwable t) {
168+
Throwable rootCause = ExceptionUtil.getRootCause(t);
169169
if (exitCodeHandler == null) {
170170
Logger applicationLogger = Logger.getLogger(Application.class);
171171
if (rootCause instanceof QuarkusBindException qbe) {
@@ -198,7 +198,7 @@ public static void run(Application application, Class<? extends QuarkusApplicati
198198
&& !StringUtil.isNullOrEmpty(rootCause.getMessage())) {
199199
System.err.println(rootCause.getMessage());
200200
} else {
201-
applicationLogger.errorv(e, "Failed to start application");
201+
applicationLogger.errorv(t, "Failed to start application");
202202
ensureConsoleLogsDrained();
203203
}
204204
}
@@ -214,7 +214,7 @@ public static void run(Application application, Class<? extends QuarkusApplicati
214214
? ((PreventFurtherStepsException) rootCause).getExitCode()
215215
: 1;
216216
currentApplication = null;
217-
(exitCodeHandler == null ? defaultExitCodeHandler : exitCodeHandler).accept(exceptionExitCode, e);
217+
(exitCodeHandler == null ? defaultExitCodeHandler : exitCodeHandler).accept(exceptionExitCode, t);
218218
return;
219219
} finally {
220220
try {

devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java

Lines changed: 60 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.nio.file.Path;
88
import java.util.HashMap;
99
import java.util.HashSet;
10+
import java.util.List;
1011
import java.util.Map;
1112
import java.util.Optional;
1213
import java.util.Set;
@@ -348,43 +349,36 @@ public boolean isSatisfiedBy(Task t) {
348349

349350
project.afterEvaluate(this::afterEvaluate);
350351

351-
tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile.class,
352-
compileJava -> {
353-
compileJava.mustRunAfter(quarkusGenerateCode);
354-
compileJava.mustRunAfter(quarkusGenerateCodeDev);
355-
});
356-
tasks.named(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME, JavaCompile.class,
357-
compileTestJava -> {
358-
compileTestJava.dependsOn(quarkusGenerateCode);
359-
compileTestJava.dependsOn(quarkusGenerateCodeTests);
360-
if (project.getGradle().getStartParameter().getTaskNames().contains(QUARKUS_DEV_TASK_NAME)) {
361-
compileTestJava.getOptions().setFailOnError(false);
362-
}
363-
});
364-
365352
TaskProvider<Task> classesTask = tasks.named(JavaPlugin.CLASSES_TASK_NAME);
366353
TaskProvider<Task> resourcesTask = tasks.named(JavaPlugin.PROCESS_RESOURCES_TASK_NAME);
367354
TaskProvider<Task> testClassesTask = tasks.named(JavaPlugin.TEST_CLASSES_TASK_NAME);
368355
TaskProvider<Task> testResourcesTask = tasks.named(JavaPlugin.PROCESS_TEST_RESOURCES_TASK_NAME);
369356

357+
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
358+
SourceSet mainSourceSet = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME);
359+
SourceSet testSourceSet = sourceSets.getByName(SourceSet.TEST_SOURCE_SET_NAME);
360+
370361
quarkusGenerateCode.configure(task -> {
371362
Configuration config = project.getConfigurations().getByName(
372363
ApplicationDeploymentClasspathBuilder.getBaseRuntimeConfigName(LaunchMode.NORMAL));
373364
task.dependsOn(resourcesTask, config);
374365
task.setCompileClasspath(config);
366+
task.setSourcesDirectories(getSourcesParents(mainSourceSet));
375367
});
376368
quarkusGenerateCodeDev.configure(task -> {
377369
Configuration config = project.getConfigurations().getByName(
378370
ApplicationDeploymentClasspathBuilder
379371
.getBaseRuntimeConfigName(LaunchMode.DEVELOPMENT));
380372
task.dependsOn(resourcesTask, config);
381373
task.setCompileClasspath(config);
374+
task.setSourcesDirectories(getSourcesParents(mainSourceSet));
382375
});
383376
quarkusGenerateCodeTests.configure(task -> {
384377
Configuration config = project.getConfigurations().getByName(
385378
ApplicationDeploymentClasspathBuilder.getBaseRuntimeConfigName(LaunchMode.TEST));
386379
task.dependsOn(resourcesTask, config);
387380
task.setCompileClasspath(config);
381+
task.setSourcesDirectories(getSourcesParents(testSourceSet));
388382
});
389383

390384
quarkusDev.configure(task -> {
@@ -403,18 +397,6 @@ public boolean isSatisfiedBy(Task t) {
403397
quarkusBuildCacheableAppParts.configure(
404398
task -> task.dependsOn(classesTask, resourcesTask, tasks.named(JavaPlugin.JAR_TASK_NAME)));
405399

406-
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
407-
408-
SourceSet mainSourceSet = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME);
409-
SourceSet testSourceSet = sourceSets.getByName(SourceSet.TEST_SOURCE_SET_NAME);
410-
411-
mainSourceSet.getJava().srcDirs(quarkusGenerateCode, quarkusGenerateCodeDev);
412-
testSourceSet.getJava().srcDirs(quarkusGenerateCodeTests);
413-
414-
quarkusGenerateCode.configure(task -> task.setSourcesDirectories(getSourcesParents(mainSourceSet)));
415-
quarkusGenerateCodeDev.configure(task -> task.setSourcesDirectories(getSourcesParents(mainSourceSet)));
416-
quarkusGenerateCodeTests.configure(task -> task.setSourcesDirectories(getSourcesParents(testSourceSet)));
417-
418400
SourceSet intTestSourceSet = sourceSets.getByName(INTEGRATION_TEST_SOURCE_SET_NAME);
419401
intTestSourceSet.setCompileClasspath(
420402
intTestSourceSet.getCompileClasspath()
@@ -487,32 +469,69 @@ public boolean isSatisfiedBy(Task t) {
487469
// quarkusBuild is expected to run after the project has passed the tests
488470
quarkusBuildCacheableAppParts.configure(task -> task.shouldRunAfter(tasks.withType(Test.class)));
489471

490-
SourceSet generatedSourceSet = sourceSets.getByName(QuarkusGenerateCode.QUARKUS_GENERATED_SOURCES);
491-
SourceSet generatedTestSourceSet = sourceSets.getByName(QuarkusGenerateCode.QUARKUS_TEST_GENERATED_SOURCES);
492-
493-
project.afterEvaluate(project1 -> {
494-
// Register the quarkus-generated-code
495-
for (String provider : quarkusExt.getCodeGenerationProviders().get()) {
496-
497-
mainSourceSet.getJava().srcDir(
498-
new File(generatedSourceSet.getJava().getClassesDirectory().get().getAsFile(), provider));
499-
testSourceSet.getJava().srcDir(
500-
new File(generatedTestSourceSet.getJava().getClassesDirectory().get().getAsFile(),
501-
provider));
502-
}
503-
});
472+
tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile.class,
473+
compileJava -> {
474+
// quarkusGenerateCode is a dependency
475+
compileJava.dependsOn(quarkusGenerateCode);
476+
// quarkusGenerateCodeDev must run before compileJava in case quarkusDev is the target
477+
compileJava.mustRunAfter(quarkusGenerateCodeDev);
478+
// add the code gen sources
479+
addCodeGenSourceDirs(compileJava,
480+
sourceSets.getByName(QuarkusGenerateCode.QUARKUS_GENERATED_SOURCES), quarkusExt);
481+
});
482+
tasks.named(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME, JavaCompile.class,
483+
compileTestJava -> {
484+
compileTestJava.dependsOn(quarkusGenerateCode);
485+
compileTestJava.dependsOn(quarkusGenerateCodeTests);
486+
if (project.getGradle().getStartParameter().getTaskNames().contains(QUARKUS_DEV_TASK_NAME)) {
487+
compileTestJava.getOptions().setFailOnError(false);
488+
}
489+
// add the code gen test sources
490+
addCodeGenSourceDirs(compileTestJava,
491+
sourceSets.getByName(QuarkusGenerateCode.QUARKUS_TEST_GENERATED_SOURCES), quarkusExt);
492+
});
504493
});
505494

506495
project.getPlugins().withId("org.jetbrains.kotlin.jvm", plugin -> {
507496
quarkusDev.configure(task -> task.shouldPropagateJavaCompilerArgs(false));
508497
tasks.named("compileKotlin", task -> {
509498
task.mustRunAfter(quarkusGenerateCode);
510499
task.mustRunAfter(quarkusGenerateCodeDev);
500+
addCodeGenSourceDirs(task, project.getExtensions().getByType(SourceSetContainer.class)
501+
.getByName(QuarkusGenerateCode.QUARKUS_GENERATED_SOURCES), quarkusExt);
502+
});
503+
tasks.named("compileTestKotlin", task -> {
504+
task.dependsOn(quarkusGenerateCodeTests);
505+
addCodeGenSourceDirs(task, project.getExtensions().getByType(SourceSetContainer.class)
506+
.getByName(QuarkusGenerateCode.QUARKUS_TEST_GENERATED_SOURCES), quarkusExt);
511507
});
512-
tasks.named("compileTestKotlin", task -> task.dependsOn(quarkusGenerateCodeTests));
513508
});
514509
}
515510

511+
private static void addCodeGenSourceDirs(JavaCompile compileJava, SourceSet generatedSourceSet,
512+
QuarkusPluginExtension quarkusExt) {
513+
final File baseDir = generatedSourceSet.getJava().getClassesDirectory().get().getAsFile();
514+
for (String provider : quarkusExt.getCodeGenerationProviders().get()) {
515+
compileJava.source(new File(baseDir, provider));
516+
}
517+
}
518+
519+
private static void addCodeGenSourceDirs(Task compileKotlin, SourceSet generatedSourceSet,
520+
QuarkusPluginExtension quarkusExt) {
521+
final File baseDir = generatedSourceSet.getJava().getClassesDirectory().get().getAsFile();
522+
final List<String> codeGenProviders = quarkusExt.getCodeGenerationProviders().get();
523+
final Object[] codeGenDirs = new Object[codeGenProviders.size()];
524+
for (int i = 0; i < codeGenDirs.length; ++i) {
525+
codeGenDirs[i] = new File(baseDir, codeGenProviders.get(i));
526+
}
527+
try {
528+
var sourcesMethod = compileKotlin.getClass().getMethod("source", Object[].class);
529+
sourcesMethod.invoke(compileKotlin, new Object[] { codeGenDirs });
530+
} catch (Exception e) {
531+
throw new RuntimeException(e);
532+
}
533+
}
534+
516535
private ApplicationDeploymentClasspathBuilder getDeploymentClasspathBuilder(Project project, LaunchMode mode) {
517536
return new ApplicationDeploymentClasspathBuilder(project, mode, taskDependencyFactory);
518537
}

devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/EffectiveConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.quarkus.gradle.tasks;
22

3+
import static io.smallrye.config.ConfigMappings.ConfigClass.configClass;
34
import static java.util.Collections.emptyMap;
45
import static java.util.Collections.emptySet;
56
import static java.util.Collections.unmodifiableMap;
@@ -140,6 +141,8 @@ public Map<String, String> get() {
140141
properties.put(propertyName, configValue.getValue());
141142
}
142143
}
144+
configClass(PackageConfig.class).getProperties().keySet().forEach(properties::remove);
145+
configClass(NativeConfig.class).getProperties().keySet().forEach(properties::remove);
143146
return unmodifiableMap(properties);
144147
}
145148
});

0 commit comments

Comments
 (0)