Skip to content

Commit

Permalink
Merge pull request #44002 from gsmet/3.16.0-backports-1
Browse files Browse the repository at this point in the history
[3.16] 3.16.0 backports 1
  • Loading branch information
gsmet authored Oct 22, 2024
2 parents 29b0b6b + d0852f1 commit 20baabe
Show file tree
Hide file tree
Showing 68 changed files with 897 additions and 250 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci-actions-incremental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ jobs:
restore-keys: |
develocity-cache-Initial JDK 17 Build-${{ github.event.pull_request.number }}-
- name: Populate the cache
# only populate the cache if it's not a pull request as we only store the cache in this case
if: github.event_name != 'pull_request'
run: |
./mvnw -T2C $COMMON_MAVEN_ARGS dependency:go-offline
- name: Verify native-tests.json
Expand Down Expand Up @@ -936,16 +938,16 @@ jobs:
} else {
return branch
}
- name: Get Quarkus version
id: get-quarkus-version
run: |
echo "quarkus-version=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
- name: Compile Quickstarts
env:
CAPTURE_BUILD_SCAN: true
run: |
git clone --depth=1 -b ${{ steps.get-quickstarts-branch.outputs.result }} https://github.com/quarkusio/quarkus-quickstarts.git && cd quarkus-quickstarts
if [ "${{ steps.get-quickstarts-branch.outputs.result }}" != "development" ]; then
QUARKUS_VERSION_ARGS="-Dquarkus.platform.version=${{ steps.get-quickstarts-branch.outputs.result }}.999-SNAPSHOT"
else
QUARKUS_VERSION_ARGS=""
fi
QUARKUS_VERSION_ARGS="-Dquarkus.platform.version=${{ steps.get-quarkus-version.outputs.quarkus-version }}"
export LANG=en_US && ./mvnw -e -B -fae --settings .github/mvn-settings.xml clean verify -DskipTests -Dquarkus.platform.group-id=io.quarkus $QUARKUS_VERSION_ARGS
- name: Prepare build reports archive
if: always()
Expand Down
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
<db2-jdbc.version>11.5.8.0</db2-jdbc.version>
<shrinkwrap.version>1.2.6</shrinkwrap.version>
<hamcrest.version>2.2</hamcrest.version><!-- The version needs to be compatible with both REST Assured and Awaitility -->
<junit.jupiter.version>5.10.3</junit.jupiter.version>
<junit.jupiter.version>5.10.5</junit.jupiter.version>
<infinispan.version>15.0.10.Final</infinispan.version>
<infinispan.protostream.version>5.0.12.Final</infinispan.protostream.version>
<caffeine.version>3.1.5</caffeine.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public B preventnoverify(boolean preventnoverify) {
return (B) this;
}

@SuppressWarnings("unchecked")
public B forceC2(boolean force) {
forceC2 = force;
return (B) this;
}

@SuppressWarnings("unchecked")
public B jvmArgs(String jvmArgs) {
args.add(jvmArgs);
Expand Down Expand Up @@ -316,6 +322,7 @@ public R build() throws Exception {
private String targetJavaVersion;
private Set<Path> buildFiles = new HashSet<>(0);
private boolean deleteDevJar = true;
private boolean forceC2 = false;
private String baseName;
private Consumer<DevModeContext> entryPointCustomizer;
private String applicationArgs;
Expand All @@ -335,7 +342,7 @@ protected QuarkusDevModeLauncher() {
protected void prepare() throws Exception {
JBossVersion.disableVersionLogging();

if (!JavaVersionUtil.isGraalvmJdk()) {
if (!JavaVersionUtil.isGraalvmJdk() && !forceC2) {
// prevent C2 compiler for kicking in - makes startup a little faster
// it only makes sense in dev-mode but it is not available when GraalVM is used as the JDK
args.add("-XX:TieredStopAtLevel=1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.commons.lang3.SystemUtils;
import org.jboss.logging.Logger;

import io.quarkus.bootstrap.util.IoUtils;
Expand Down Expand Up @@ -53,6 +52,7 @@
import io.quarkus.runtime.graal.DisableLoggingFeature;
import io.quarkus.sbom.ApplicationComponent;
import io.quarkus.sbom.ApplicationManifestConfig;
import io.smallrye.common.os.OS;

public class NativeImageBuildStep {

Expand Down Expand Up @@ -210,7 +210,7 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, LocalesBuildTimeCon
String pie = "";

boolean isContainerBuild = nativeImageRunner.isContainerBuild();
if (!isContainerBuild && SystemUtils.IS_OS_LINUX) {
if (!isContainerBuild && OS.LINUX.isCurrent()) {
if (nativeConfig.pie().isPresent() && nativeConfig.pie().get()) {
pie = detectPIE();
} else {
Expand Down Expand Up @@ -332,7 +332,7 @@ private String getNativeImageName(OutputTargetBuildItem outputTargetBuildItem, P

private String getResultingExecutableName(String nativeImageName, boolean isContainerBuild) {
String resultingExecutableName = nativeImageName;
if (SystemUtils.IS_OS_WINDOWS && !isContainerBuild) {
if (OS.WINDOWS.isCurrent() && !isContainerBuild) {
//once image is generated it gets added .exe on Windows
resultingExecutableName = resultingExecutableName + ".exe";
}
Expand All @@ -354,7 +354,7 @@ public NativeImageRunnerBuildItem resolveNativeImageBuildRunner(NativeConfig nat
String executableName = getNativeImageExecutableName();
String errorMessage = "Cannot find the `" + executableName
+ "` in the GRAALVM_HOME, JAVA_HOME and System PATH.";
if (!SystemUtils.IS_OS_LINUX) {
if (!OS.LINUX.isCurrent()) {
// Delay the error: if we're just building native sources, we may not need the build runner at all.
return new NativeImageRunnerBuildItem(new NativeImageBuildRunnerError(errorMessage));
}
Expand Down Expand Up @@ -474,7 +474,7 @@ private static void copySourcesToSourceCache(OutputTargetBuildItem outputTargetB

private RuntimeException imageGenerationFailed(int exitValue, boolean isContainerBuild) {
if (exitValue == OOM_ERROR_VALUE) {
if (isContainerBuild && !SystemUtils.IS_OS_LINUX) {
if (isContainerBuild && !OS.LINUX.isCurrent()) {
return new ImageGenerationFailureException("Image generation failed. Exit code was " + exitValue
+ " which indicates an out of memory error. The most likely cause is Docker not being given enough memory. Also consider increasing the Xmx value for native image generation by setting the \""
+ QUARKUS_XMX_PROPERTY + "\" property");
Expand Down Expand Up @@ -554,7 +554,7 @@ private static NativeImageBuildLocalRunner getNativeImageBuildLocalRunner(Native
}

private static String getNativeImageExecutableName() {
return SystemUtils.IS_OS_WINDOWS ? "native-image.cmd" : "native-image";
return OS.WINDOWS.isCurrent() ? "native-image.cmd" : "native-image";
}

private static String detectNoPIE() {
Expand Down Expand Up @@ -932,13 +932,18 @@ public NativeImageInvokerInfo build() {
}

List<NativeConfig.MonitoringOption> monitoringOptions = new ArrayList<>();
monitoringOptions.add(NativeConfig.MonitoringOption.HEAPDUMP);
if (!OS.WINDOWS.isCurrent() || containerBuild) {
// --enable-monitoring=heapdump is not supported on Windows
monitoringOptions.add(NativeConfig.MonitoringOption.HEAPDUMP);
}
if (nativeConfig.monitoring().isPresent()) {
monitoringOptions.addAll(nativeConfig.monitoring().get());
}
nativeImageArgs.add("--enable-monitoring=" + monitoringOptions.stream()
.distinct()
.map(o -> o.name().toLowerCase(Locale.ROOT)).collect(Collectors.joining(",")));
if (!monitoringOptions.isEmpty()) {
nativeImageArgs.add("--enable-monitoring=" + monitoringOptions.stream()
.distinct()
.map(o -> o.name().toLowerCase(Locale.ROOT)).collect(Collectors.joining(",")));
}

if (nativeConfig.autoServiceLoaderRegistration()) {
addExperimentalVMOption(nativeImageArgs, "-H:+UseServiceLoaderFeature");
Expand Down
5 changes: 4 additions & 1 deletion devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public int run(String... args) throws Exception {
boolean noCommand = args.length == 0 || args[0].startsWith("-");
boolean helpCommand = Arrays.stream(args).anyMatch(arg -> arg.equals("--help"));
boolean pluginCommand = args.length >= 1 && (args[0].equals("plug") || args[0].equals("plugin"));
boolean pluginSyncCommand = pluginCommand && args.length >= 2 && args[1].equals("sync");

try {
Optional<String> missingCommand = checkMissingCommand(cmd, args);
Expand All @@ -117,7 +118,9 @@ public int run(String... args) throws Exception {
}
PluginCommandFactory pluginCommandFactory = new PluginCommandFactory(output);
PluginManager pluginManager = pluginManager(output, testDir, interactiveMode);
pluginManager.syncIfNeeded();
if (!pluginSyncCommand) { // Let`s not sync before the actual command
pluginManager.syncIfNeeded();
}
Map<String, Plugin> plugins = new HashMap<>(pluginManager.getInstalledPlugins());
pluginCommandFactory.populateCommands(cmd, plugins);
missingCommand.filter(m -> !plugins.containsKey(m)).ifPresent(m -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ private Optional<PluginCommand> createPluginCommand(Plugin plugin) {
return plugin.getLocation().map(l -> new JBangCommand(l, output));
case executable:
return plugin.getLocation().map(l -> new ShellCommand(plugin.getName(), Paths.get(l), output));
case extension:
if (PluginUtil.checkGACTV(plugin.getLocation()).isPresent()) {
return plugin.getLocation().flatMap(PluginUtil::checkGACTV).map(g -> new JBangCommand(toGAVC(g), output));
} else if (plugin.getLocation().filter(l -> l.endsWith(".jar")).isPresent()) {
return plugin.getLocation().map(l -> new JBangCommand(l, output));
}
default:
throw new IllegalStateException("Unknown plugin type!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public abstract class QuarkusDev extends QuarkusTask {
private final MapProperty<String, String> environmentVariables;

private final Property<Boolean> preventNoVerify;
private final Property<Boolean> forceC2;
private final Property<Boolean> shouldPropagateJavaCompilerArgs;
private final ListProperty<String> args;
private final ListProperty<String> jvmArgs;
Expand Down Expand Up @@ -128,6 +129,9 @@ public QuarkusDev(
preventNoVerify = objectFactory.property(Boolean.class);
preventNoVerify.convention(false);

forceC2 = objectFactory.property(Boolean.class);
forceC2.convention(false);

shouldPropagateJavaCompilerArgs = objectFactory.property(Boolean.class);
shouldPropagateJavaCompilerArgs.convention(true);

Expand Down Expand Up @@ -222,6 +226,11 @@ public boolean isPreventnoverify() {
return getPreventNoVerify().get();
}

@Input
public Property<Boolean> getForceC2() {
return forceC2;
}

/**
* @deprecated see {@link #getPreventNoVerify()}
*/
Expand Down Expand Up @@ -414,6 +423,7 @@ private QuarkusDevModeLauncher newLauncher(final AnalyticsService analyticsServi
}
GradleDevModeLauncher.Builder builder = GradleDevModeLauncher.builder(getLogger(), java)
.preventnoverify(getPreventNoVerify().getOrElse(false))
.forceC2(getForceC2().getOrElse(false))
.projectDir(projectDir)
.buildDir(buildDir)
.outputDir(buildDir)
Expand Down
2 changes: 1 addition & 1 deletion devtools/gradle/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugin-publish = "1.3.0"
kotlin = "2.0.21"
smallrye-config = "3.9.1"

junit5 = "5.11.1"
junit5 = "5.10.5"
assertj = "3.26.3"

[plugins]
Expand Down
10 changes: 10 additions & 0 deletions devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,15 @@ public class DevMojo extends AbstractMojo {
@Parameter(defaultValue = "${preventnoverify}")
private boolean preventnoverify = false;

/**
* This value is intended to be set to true when we want to require C2 compilation instead of preventing it from
* ever kicking in.
* Setting this will likely have a small negative effect on startup time and should only be done when it absolutely
* makes sense.
*/
@Parameter(defaultValue = "${forceC2}")
private boolean forceC2 = false;

/**
* Whether changes in the projects that appear to be dependencies of the project containing the application to be launched
* should trigger hot-reload. By default, they do.
Expand Down Expand Up @@ -1247,6 +1256,7 @@ private QuarkusDevModeLauncher newLauncher(String actualDebugPort, String bootst

final MavenDevModeLauncher.Builder builder = MavenDevModeLauncher.builder(java, getLog())
.preventnoverify(preventnoverify)
.forceC2(forceC2)
.buildDir(buildDir)
.outputDir(outputDirectory)
.suspend(suspend)
Expand Down
18 changes: 12 additions & 6 deletions docs/src/main/asciidoc/appcds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ This reference guide explains how to enable Application Class Data Sharing in yo
== What is Application Class Data Sharing (AppCDS)?

link:https://docs.oracle.com/en/java/javase/17/docs/specs/man/java.html#application-class-data-sharing[Application Class Data Sharing] is a JVM feature that helps reduce the startup time and memory footprint of a JVM application.
This is achieved by having the JVM create a pre-processed shared archived of classes that are loaded at startup time. As these classes
This is achieved by having the JVM create a pre-processed shared archived of classes that are loaded at startup time.
As these classes
are loaded every time the application starts, AppCDS is a conceptually simple way of improving the application startup time,
without the application itself having to be coded or configured in a specific way. How much of an improvement depends on many factors, such as the number of classes loaded, the underlying hardware etc.
without the application itself having to be coded or configured in a specific way.
How much of an improvement depends on many factors, such as the number of classes loaded, the underlying hardware etc.

== Vanilla AppCDS generation

The main downside of creating AppCDS manually for an application is that their generation requires launching the application with special flags and obtaining the archive in a step before the application is deployed to production.

NOTE: The exact process depends on the JVM version being used as newer JVM have incrementally made the process easier.

This fact makes the use of AppCDS difficult to use for real world deployments where a CI pipeline is responsible for building and deploying applications.
This fact makes AppCDS difficult to use for real world deployments where a CI pipeline is responsible for building and deploying applications.

== AppCDS in Quarkus

Expand Down Expand Up @@ -95,7 +97,11 @@ AppCDS has improved significantly in the latest JDK releases. This means that to

=== Usage in containers

When building container images using the `quarkus-container-image-jib` extension, Quarkus automatically takes care of all the steps needed to generate the archive
and make it usable at runtime in the container.
When building container images using the `quarkus-container-image-jib` extension, Quarkus automatically takes care of all the steps needed to generate the archive and make it usable at runtime in the container.

This way, by simply setting `quarkus.package.jar.appcds.enabled` to `true` the generated container can benefit from a slight reduction in startup time and memory usage.
This way, by simply setting `quarkus.package.jar.appcds.enabled` to `true`, containers using the generated image can benefit from a slight reduction in startup time and memory usage.

You may see that Quarkus starts a container to generate the AppCDS archive.
It does this to ensure that the Java version of the build align with that of the generated container image.
It is possible to opt out of this by setting `quarkus.package.jar.appcds.use-container` to `false`.
In that case, it is your responsibility to ensure that the Java version that will run the Quarkus application matches that of the machine building it.
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/building-native-image.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ Sample Dockerfile for building with Maven:
----
## Stage 1 : build with maven builder image with native capabilities
FROM quay.io/quarkus/ubi-quarkus-mandrel-builder-image:{mandrel-flavor} AS build
COPY --chown=quarkus:quarkus mvnw /code/mvnw
COPY --chown=quarkus:quarkus --chmod=0755 mvnw /code/mvnw
COPY --chown=quarkus:quarkus .mvn /code/.mvn
COPY --chown=quarkus:quarkus pom.xml /code/
USER quarkus
Expand Down
9 changes: 8 additions & 1 deletion docs/src/main/asciidoc/deploying-to-google-cloud.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,20 @@ WARNING: This only works when your application is running inside a Google Cloud

=== Using Cloud SQL with native executables

When generating native executables, you must also mark `jnr.ffi.provider.jffi.NativeFinalizer$SingletonHolder` as runtime initialized.
When generating native executables, you must mark `jnr.ffi.provider.jffi.NativeFinalizer$SingletonHolder` as runtime initialized.

[source,properties]
----
quarkus.native.additional-build-args=--initialize-at-run-time=jnr.ffi.provider.jffi.NativeFinalizer$SingletonHolder
----

Additionally, starting with `com.google.cloud.sql:postgres-socket-factory:1.17.0`, you must also mark `com.kenai.jffi.internal.Cleaner` as runtime initialized.

[source,properties]
----
quarkus.native.additional-build-args=--initialize-at-run-time=jnr.ffi.provider.jffi.NativeFinalizer$SingletonHolder\\,com.kenai.jffi.internal.Cleaner
----

== Going further

You can find a set of extensions to access various Google Cloud Services in the Quarkiverse (a GitHub organization for Quarkus extensions maintained by the community),
Expand Down
10 changes: 5 additions & 5 deletions docs/src/main/asciidoc/dev-ui.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -463,12 +463,12 @@ customElements.define('qwc-arc-beans', QwcArcBeans);

===== Qomponent

We also include all components from the [Qomponent](https://github.com/qomponent) library
We also include all components from the https://github.com/qomponent[Qomponent] library

- [Card](https://www.npmjs.com/package/@qomponent/qui-card)
- [Badge](https://www.npmjs.com/package/@qomponent/qui-badge)
- [Alert](https://www.npmjs.com/package/@qomponent/qui-alert)
- [Code block](https://www.npmjs.com/package/@qomponent/qui-code-block)
- https://www.npmjs.com/package/@qomponent/qui-card[Card]
- https://www.npmjs.com/package/@qomponent/qui-badge[Badge]
- https://www.npmjs.com/package/@qomponent/qui-alert[Alert]
- https://www.npmjs.com/package/@qomponent/qui-code-block[Code block]

====== Card

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/http-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ quarkus.tls.key-store.pem.0.key=server.key
quarkus.http.insecure-requests=disabled # Reject HTTP requests
----

So you a `p12` (PKCS12) key store, use the following configuration:
To use a `p12` (PKCS12) key store, apply the following configuration:

[source,properties]
----
Expand Down
Loading

0 comments on commit 20baabe

Please sign in to comment.