Skip to content

Commit

Permalink
Merge pull request #29982 from gsmet/2.15.1-backports-1
Browse files Browse the repository at this point in the history
2.15.1 backports 1
  • Loading branch information
gsmet authored Dec 21, 2022
2 parents 9442d6f + 7b71598 commit ff1c280
Show file tree
Hide file tree
Showing 152 changed files with 2,310 additions and 450 deletions.
12 changes: 6 additions & 6 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<smallrye-context-propagation.version>1.2.2</smallrye-context-propagation.version>
<smallrye-reactive-streams-operators.version>1.0.13</smallrye-reactive-streams-operators.version>
<smallrye-reactive-types-converter.version>2.7.0</smallrye-reactive-types-converter.version>
<smallrye-mutiny-vertx-binding.version>2.28.0</smallrye-mutiny-vertx-binding.version>
<smallrye-mutiny-vertx-binding.version>2.29.0</smallrye-mutiny-vertx-binding.version>
<smallrye-reactive-messaging.version>3.22.0</smallrye-reactive-messaging.version>
<smallrye-stork.version>1.3.3</smallrye-stork.version>
<jakarta.activation.version>1.2.1</jakarta.activation.version>
Expand Down Expand Up @@ -110,7 +110,7 @@
<wildfly-client-config.version>1.0.1.Final</wildfly-client-config.version>
<wildfly-elytron.version>1.20.1.Final</wildfly-elytron.version>
<jboss-threads.version>3.4.3.Final</jboss-threads.version>
<vertx.version>4.3.5</vertx.version>
<vertx.version>4.3.6</vertx.version>

<httpclient.version>4.5.13</httpclient.version>
<httpcore.version>4.4.15</httpcore.version>
Expand All @@ -131,10 +131,10 @@
<junit.jupiter.version>5.9.1</junit.jupiter.version>
<junit-pioneer.version>1.5.0</junit-pioneer.version>
<testng.version>6.14.2</testng.version>
<infinispan.version>14.0.2.Final</infinispan.version>
<infinispan.version>14.0.3.Final</infinispan.version>
<infinispan.protostream.version>4.5.0.Final</infinispan.protostream.version>
<caffeine.version>3.1.1</caffeine.version>
<netty.version>4.1.85.Final</netty.version>
<netty.version>4.1.86.Final</netty.version>
<brotli4j.version>1.8.0</brotli4j.version>
<reactive-streams.version>1.0.3</reactive-streams.version>
<jboss-logging.version>3.5.0.Final</jboss-logging.version>
Expand All @@ -153,7 +153,7 @@
<kotlin.coroutine.version>1.6.4</kotlin.coroutine.version>
<kotlin-serialization.version>1.4.1</kotlin-serialization.version>
<kubernetes-client.version>6.2.0</kubernetes-client.version> <!-- Please check with Java Operator SDK team before updating -->
<dekorate.version>3.1.2</dekorate.version> <!-- Please check with Java Operator SDK team before updating -->
<dekorate.version>3.1.3</dekorate.version> <!-- Please check with Java Operator SDK team before updating -->
<maven-invoker.version>3.2.0</maven-invoker.version>
<awaitility.version>4.2.0</awaitility.version>
<jboss-logmanager.version>1.0.11</jboss-logmanager.version>
Expand All @@ -162,7 +162,7 @@
<liquibase.version>4.17.2</liquibase.version>
<snakeyaml.version>1.33</snakeyaml.version>
<osgi.version>6.0.0</osgi.version>
<mongo-client.version>4.8.0</mongo-client.version>
<mongo-client.version>4.8.1</mongo-client.version>
<mongo-crypt.version>1.6.1</mongo-crypt.version>
<proton-j.version>0.34.0</proton-j.version>
<javaparser.version>3.24.2</javaparser.version>
Expand Down
2 changes: 1 addition & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<!-- These properties are needed in order for them to be resolvable by the generated projects -->
<!-- Quarkus uses jboss-parent and it comes with 3.8.1-jboss-1, we don't want that in the templates -->
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<compiler-plugin.version>3.10.1</compiler-plugin.version>
<kotlin.version>1.7.21</kotlin.version>
<dokka.version>1.7.20</dokka.version>
<scala.version>2.13.8</scala.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,14 @@ protected List<String> getContainerRuntimeBuildArgs() {
volumeOutputPath = FileUtil.translateToVolumePath(volumeOutputPath);
}

String selinuxBindOption = ":z";
if (SystemUtils.IS_OS_MAC
&& ContainerRuntimeUtil.detectContainerRuntime() == ContainerRuntimeUtil.ContainerRuntime.PODMAN) {
selinuxBindOption = "";
}

Collections.addAll(containerRuntimeArgs, "-v",
volumeOutputPath + ":" + NativeImageBuildStep.CONTAINER_BUILD_VOLUME_PATH + ":z");
volumeOutputPath + ":" + NativeImageBuildStep.CONTAINER_BUILD_VOLUME_PATH + selinuxBindOption);
return containerRuntimeArgs;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.quarkus.deployment.steps;

import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;

final class KotlinUtil {

private static final DotName KOTLIN_METADATA_ANNOTATION = DotName.createSimple("kotlin.Metadata");

private KotlinUtil() {
}

static boolean isKotlinClass(ClassInfo classInfo) {
return classInfo.hasDeclaredAnnotation(KOTLIN_METADATA_ANNOTATION);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.quarkus.deployment.steps;

import static io.quarkus.deployment.steps.KotlinUtil.isKotlinClass;
import static io.quarkus.gizmo.MethodDescriptor.ofConstructor;
import static io.quarkus.gizmo.MethodDescriptor.ofMethod;

Expand All @@ -17,6 +18,7 @@

import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationValue;
import org.jboss.jandex.ArrayType;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.jandex.MethodInfo;
Expand Down Expand Up @@ -341,12 +343,13 @@ public MainClassBuildItem mainClassBuildStep(BuildProducer<GeneratedClassBuildIt
if (nameValue != null) {
name = nameValue.asString();
}
ClassInfo classInfo = i.target().asClass();
if (quarkusMainAnnotations.containsKey(name)) {
throw new RuntimeException(
"More than one @QuarkusMain method found with name '" + name + "': "
+ i.target().asClass().name() + " and " + quarkusMainAnnotations.get(name));
+ classInfo.name() + " and " + quarkusMainAnnotations.get(name));
}
quarkusMainAnnotations.put(name, i.target().asClass().name().toString());
quarkusMainAnnotations.put(name, sanitizeMainClassName(classInfo));
}

if (packageConfig.mainClass.isPresent()) {
Expand Down Expand Up @@ -410,6 +413,19 @@ public MainClassBuildItem mainClassBuildStep(BuildProducer<GeneratedClassBuildIt
return new MainClassBuildItem(mainClassName);
}

private static String sanitizeMainClassName(ClassInfo mainClass) {
String className = mainClass.name().toString();
if (isKotlinClass(mainClass)) {
MethodInfo mainMethod = mainClass.method("main",
ArrayType.create(Type.create(DotName.createSimple(String.class.getName()), Type.Kind.CLASS), 1));
if (mainMethod == null) {
className += "Kt";
}

}
return className;
}

private void generateMainForQuarkusApplication(String quarkusApplicationClassName,
BuildProducer<GeneratedClassBuildItem> generatedClass) {
ClassCreator file = new ClassCreator(new GeneratedClassGizmoAdaptor(generatedClass, true), MAIN_CLASS, null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.quarkus.deployment.steps;

import static io.quarkus.deployment.steps.KotlinUtil.isKotlinClass;

import java.io.IOException;
import java.lang.reflect.Modifier;
import java.util.HashSet;
Expand Down Expand Up @@ -34,8 +36,6 @@ public class RegisterForReflectionBuildStep {

private static final Logger log = Logger.getLogger(RegisterForReflectionBuildStep.class);

private static final DotName KOTLIN_METADATA_ANNOTATION = DotName.createSimple("kotlin.Metadata");

@BuildStep
public void build(CombinedIndexBuildItem combinedIndexBuildItem, Capabilities capabilities,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
Expand Down Expand Up @@ -98,10 +98,6 @@ public void build(CombinedIndexBuildItem combinedIndexBuildItem, Capabilities ca
}
}

private static boolean isKotlinClass(ClassInfo classInfo) {
return classInfo.hasDeclaredAnnotation(KOTLIN_METADATA_ANNOTATION);
}

/**
* BFS Recursive Method to register a class and it's inner classes for Reflection.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.quarkus.runtime;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;

@ConfigRoot(name = "debug", phase = ConfigPhase.RUN_TIME)
public class DebugRuntimeConfig {

/**
* If set to {@code true}, Quarkus prints the wall-clock time each build step took to complete.
* This is useful as a first step in debugging slow startup times.
*/
@ConfigItem(defaultValue = "false")
boolean printStartupTimes;
}
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/building-my-first-extension.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Your extension is a multi-module project. So let's start by checking out the par
<module>runtime</module>
</modules>
<properties>
<compiler-plugin.version>3.8.1</compiler-plugin.version><!--2-->
<compiler-plugin.version>3.10.1</compiler-plugin.version><!--2-->
<failsafe-plugin.version>${surefire-plugin.version}</failsafe-plugin.version>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -876,7 +876,7 @@ $ mvn clean compile quarkus:dev
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ greeting-app ---
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ greeting-app ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- quarkus-maven-plugin:{quarkus-version}:dev (default-cli) @ greeting-app ---
Expand Down
19 changes: 11 additions & 8 deletions docs/src/main/asciidoc/building-native-image.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ Adding `<argLine>--enable-preview</argLine>` to its `configuration` section is o

=== Excluding tests when running as a native executable

When running tests this way, the only things that actually run natively are you application endpoints, which
When running tests this way, the only things that actually run natively are your application endpoints, which
you can only test via HTTP calls. Your test code does not actually run natively, so if you are testing code
that does not call your HTTP endpoints, it's probably not a good idea to run them as part of native tests.

Expand Down Expand Up @@ -484,7 +484,7 @@ Then, if you didn't delete the generated native executable, you can build the do

[source,bash]
----
docker build -f src/main/docker/Dockerfile.native -t quarkus-quickstart/getting-started .
docker build -f src/main/docker/Dockerfile.native-micro -t quarkus-quickstart/getting-started .
----

And finally, run it with:
Expand Down Expand Up @@ -653,7 +653,7 @@ Just add your application on top of this image, and you will get a tiny containe

Distroless images should not be used in production without rigorous testing.

=== Using a scratch base image
=== Build a container image from scratch

IMPORTANT: Scratch image support is experimental.

Expand All @@ -671,9 +671,9 @@ COPY --chown=quarkus:quarkus mvnw /code/mvnw
COPY --chown=quarkus:quarkus .mvn /code/.mvn
COPY --chown=quarkus:quarkus pom.xml /code/
RUN mkdir /musl && \
curl -L -o musl.tar.gz https://more.musl.cc/10.2.1/x86_64-linux-musl/x86_64-linux-musl-native.tgz && \
curl -L -o musl.tar.gz https://more.musl.cc/11.2.1/x86_64-linux-musl/x86_64-linux-musl-native.tgz && \
tar -xvzf musl.tar.gz -C /musl --strip-components 1 && \
curl -L -o zlib.tar.gz https://zlib.net/zlib-1.2.12.tar.gz && \
curl -L -o zlib.tar.gz https://www.zlib.net/zlib-1.2.13.tar.gz && \
mkdir zlib && tar -xvzf zlib.tar.gz -C zlib --strip-components 1 && \
cd zlib && ./configure --static --prefix=/musl && \
make && make install && \
Expand All @@ -683,17 +683,20 @@ USER quarkus
WORKDIR /code
RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline
COPY src /code/src
RUN ./mvnw package -Pnative -Dquarkus.native.additional-build-args="--static","--libc=musl"
RUN ./mvnw package -Pnative -DskipTests -Dquarkus.native.additional-build-args="--static","--libc=musl"
## Stage 2 : create the docker final image
## Stage 2 : create the final image
FROM scratch
COPY --from=build /code/target/*-runner /application
EXPOSE 8080
ENTRYPOINT [ "/application" ]
----

Scratch images should not be used in production without rigorous testing.

=== Native executable compression
NOTE: The versions of musl and zlib may need to be updated to meet the native-image executable requirements (and UPX if you use native image compression).

=== Compress native images

Quarkus can compress the produced native executable using UPX.
More details on xref:./upx.adoc[UPX Compression documentation].
Expand Down
Loading

0 comments on commit ff1c280

Please sign in to comment.