Skip to content

Commit

Permalink
Merge pull request #33556 from gsmet/3.1.0-backports-1
Browse files Browse the repository at this point in the history
3.1.0 backports 1
  • Loading branch information
gsmet authored May 24, 2023
2 parents 62e9725 + ba54a59 commit 501eca1
Show file tree
Hide file tree
Showing 87 changed files with 1,319 additions and 420 deletions.
10 changes: 5 additions & 5 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-parent</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-project</artifactId>
<version>999-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Expand All @@ -31,7 +31,7 @@
<parsson.version>1.1.1</parsson.version>
<resteasy-microprofile.version>2.1.1.Final</resteasy-microprofile.version>
<resteasy-spring-web.version>3.0.2.Final</resteasy-spring-web.version>
<resteasy.version>6.2.3.Final</resteasy.version>
<resteasy.version>6.2.4.Final</resteasy.version>
<opentracing.version>0.33.0</opentracing.version>
<opentracing-jdbc.version>0.2.4</opentracing-jdbc.version>
<opentracing-kafka.version>0.1.15</opentracing-kafka.version>
Expand Down Expand Up @@ -89,7 +89,7 @@
<jboss-metadata-web.version>16.0.0.Final</jboss-metadata-web.version>
<maven-toolchain.version>3.0-alpha-2</maven-toolchain.version>
<plexus-component-annotations.version>2.1.0</plexus-component-annotations.version>
<graal-sdk.version>22.3.0</graal-sdk.version>
<graal-sdk.version>22.3.2</graal-sdk.version>
<graal-svm.version>${graal-sdk.version}</graal-svm.version>
<gizmo.version>1.6.1.Final</gizmo.version>
<jackson-bom.version>2.15.0</jackson-bom.version>
Expand Down Expand Up @@ -119,7 +119,7 @@
<wildfly-client-config.version>1.0.1.Final</wildfly-client-config.version>
<wildfly-elytron.version>2.1.0.Final</wildfly-elytron.version>
<jboss-threads.version>3.5.0.Final</jboss-threads.version>
<vertx.version>4.4.1</vertx.version>
<vertx.version>4.4.2</vertx.version>
<httpclient.version>4.5.14</httpclient.version>
<httpcore.version>4.4.16</httpcore.version>
<httpasync.version>4.1.5</httpasync.version>
Expand All @@ -141,7 +141,7 @@
<infinispan.version>14.0.9.Final</infinispan.version>
<infinispan.protostream.version>4.6.2.Final</infinispan.protostream.version>
<caffeine.version>3.1.5</caffeine.version>
<netty.version>4.1.90.Final</netty.version>
<netty.version>4.1.92.Final</netty.version>
<brotli4j.version>1.11.0</brotli4j.version>
<reactive-streams.version>1.0.4</reactive-streams.version>
<jboss-logging.version>3.5.0.Final</jboss-logging.version>
Expand Down
2 changes: 1 addition & 1 deletion bom/test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-parent</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-project</artifactId>
<version>999-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
Expand Down
3 changes: 2 additions & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-parent</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-project</artifactId>
<version>999-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ public static final class Version implements Comparable<Version> {
static final Version UNVERSIONED = new Version("Undefined", "snapshot", Distribution.ORACLE);
static final Version VERSION_21_3 = new Version("GraalVM 21.3", "21.3", Distribution.ORACLE);
static final Version VERSION_21_3_0 = new Version("GraalVM 21.3.0", "21.3.0", Distribution.ORACLE);
public static final Version VERSION_22_3_2 = new Version("GraalVM 22.3.2", "22.3.2", Distribution.ORACLE);
public static final Version VERSION_22_3_0 = new Version("GraalVM 22.3.0", "22.3.0", Distribution.ORACLE);
public static final Version VERSION_22_2_0 = new Version("GraalVM 22.2.0", "22.2.0", Distribution.ORACLE);
public static final Version VERSION_23_0_0 = new Version("GraalVM 23.0.0", "23.0.0", Distribution.ORACLE);

public static final Version MINIMUM = VERSION_22_2_0;
public static final Version CURRENT = VERSION_22_3_0;
public static final Version CURRENT = VERSION_22_3_2;
public static final int UNDEFINED = -1;

final String fullVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,7 @@ private void copyJsonConfigFiles(ApplicationArchivesBuildItem applicationArchive
@Override
public void accept(Path jsonPath) {
try {
Files.createDirectories(thinJarDirectory);
Files.copy(jsonPath, thinJarDirectory.resolve(jsonPath.getFileName().toString()));
} catch (IOException e) {
throw new UncheckedIOException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ private String getResultingExecutableName(String nativeImageName, boolean isCont
/**
* Resolves the runner factory. Happens quite early, *before* the build.
*/
@BuildStep
@BuildStep(onlyIf = NativeBuild.class)
public NativeImageRunnerBuildItem resolveNativeImageBuildRunner(NativeConfig nativeConfig) {
boolean isExplicitContainerBuild = nativeConfig.containerBuild()
.orElse(nativeConfig.containerRuntime().isPresent() || nativeConfig.remoteContainerBuild());
Expand All @@ -353,6 +353,16 @@ public NativeImageRunnerBuildItem resolveNativeImageBuildRunner(NativeConfig nat
return new NativeImageRunnerBuildItem(new NativeImageBuildLocalContainerRunner(nativeConfig));
}

/**
* Creates a dummy runner for native-sources builds. This allows the creation of native-source jars without
* requiring podman/docker or a local native-image installation.
*/
@BuildStep(onlyIf = NativeSourcesBuild.class)
public NativeImageRunnerBuildItem dummyNativeImageBuildRunner(NativeConfig nativeConfig) {
boolean explicitContainerBuild = nativeConfig.isExplicitContainerBuild();
return new NativeImageRunnerBuildItem(new NoopNativeImageBuildRunner(explicitContainerBuild));
}

private void copyJarSourcesToLib(OutputTargetBuildItem outputTargetBuildItem,
CurateOutcomeBuildItem curateOutcomeBuildItem) {
Path targetDirectory = outputTargetBuildItem.getOutputDirectory()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.quarkus.deployment.pkg.steps;

import java.nio.file.Path;
import java.util.List;

public class NoopNativeImageBuildRunner extends NativeImageBuildRunner {

private static final String MESSAGE = "NoopNativeImageBuildRunner is not meant to be used to perform an actual build.";
private final boolean isContainer;

public NoopNativeImageBuildRunner(boolean isContainer) {
this.isContainer = isContainer;
}

@Override
public boolean isContainer() {
return isContainer;
}

@Override
protected String[] getGraalVMVersionCommand(List<String> args) {
throw new UnsupportedOperationException(MESSAGE);
}

@Override
protected String[] getBuildCommand(Path outputDir, List<String> args) {
throw new UnsupportedOperationException(MESSAGE);
}

@Override
protected void objcopy(Path outputDir, String... args) {
throw new UnsupportedOperationException(MESSAGE);
}
}
5 changes: 3 additions & 2 deletions docs/src/main/asciidoc/building-native-image.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -786,10 +786,11 @@ $ ./mvnw clean package -Dquarkus.package.type=native-sources -Dquarkus.native.co
cd target/native-sources
docker run \
-it \
--user $(id -ur):$(id -gr) \
--rm \
--v $(pwd):/work \# <1>
-v $(pwd):/work \# <1>
-w /work \# <2>
--entrypoint bin/sh \
--entrypoint /bin/sh \
$(cat native-builder.image) \# <3>
-c "native-image $(cat native-image.args) -J-Xmx4g"# <4>
----
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/getting-started-testing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ public class MockTestCase {
}
}
----
<1> `@InjectMock` results in a mock being and is available in test methods of the test class (other test classes are *not* affected by this)
<1> `@InjectMock` results in a Mockito mock being created, which is then available in test methods of the test class (other test classes are *not* affected by this)
<2> The `mockableBean1` is configured here for every test method of the class
<3> Since the `mockableBean2` mock has not been configured, it will return the default Mockito response.
<4> In this test the `mockableBean2` is configured, so it returns the configured response.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/grpc-service-consumption.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ include::{generated-dir}/config/quarkus-grpc-config-group-grpc-dev-mode-config.a

== Inject mock clients

In your `@QuarkuTest`, you can use `@InjectMock` to inject the Mutiny client of a gRPC service:
In your `@QuarkusTest`, you can use `@InjectMock` to inject the Mutiny client of a gRPC service:

[source, java]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ import jakarta.enterprise.context.ApplicationScoped;
import java.util.function.Supplier;
import io.smallrye.mutiny.Uni;
import io.quarkus.oidc.OidcRequestContext;
import io.quarkus.oidc.OidcTenantConfig;
import io.quarkus.oidc.TenantConfigResolver;
import io.vertx.ext.web.RoutingContext;
Expand All @@ -645,7 +646,7 @@ import io.vertx.ext.web.RoutingContext;
public class CustomTenantConfigResolver implements TenantConfigResolver {
@Override
public Uni<OidcTenantConfig> resolve(RoutingContext context, TenantConfigResolver.TenantConfigRequestContext requestContext) {
public Uni<OidcTenantConfig> resolve(RoutingContext context, OidcRequestContext<OidcTenantConfig> requestContext) {
String path = context.request().path();
String[] parts = path.split("/");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.jboss.jandex.AnnotationTarget;
import org.jboss.jandex.AnnotationValue;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.ClassType;
import org.jboss.jandex.DotName;
import org.jboss.jandex.FieldInfo;
import org.jboss.jandex.MethodInfo;
Expand Down Expand Up @@ -320,6 +321,7 @@ void registerConfigMappingsBean(
.configure(configClass.getConfigClass())
.types(configClass.getTypes().toArray(new Type[] {}))
.creator(ConfigMappingCreator.class)
.addInjectionPoint(ClassType.create(DotNames.INJECTION_POINT))
.param("type", configClass.getConfigClass())
.param("prefix", configClass.getPrefix());

Expand Down Expand Up @@ -367,6 +369,7 @@ void registerConfigPropertiesBean(
createStringValue("prefix", configClass.getPrefix())
}))
.creator(ConfigMappingCreator.class)
.addInjectionPoint(ClassType.create(DotNames.INJECTION_POINT))
.param("type", configClass.getConfigClass())
.param("prefix", configClass.getPrefix())));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { LitElement, html, css} from 'lit';
import { until } from 'lit/directives/until.js';
import { JsonRpc } from 'jsonrpc';
import '@vaadin/grid';
import { columnBodyRenderer } from '@vaadin/grid/lit.js';
Expand Down Expand Up @@ -54,12 +53,15 @@ export class QwcArcFiredEvents extends LitElement {
}

render() {
return html`${until(this._renderFiredEvents(), html`<span>Loading ArC fired event...</span>`)}`;
if(this._firedEvents){
return this._renderFiredEvents();
} else {
return html`<span>Loading ArC fired event...</span>`;
}
}

_renderFiredEvents(){
if(this._firedEvents){
return html`<div class="menubar">
return html`<div class="menubar">
<vaadin-button theme="small" @click=${() => this._refresh()} class="button">
<vaadin-icon icon="font-awesome-solid:rotate"></vaadin-icon> Refresh
</vaadin-button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { LitElement, html, css} from 'lit';
import { until } from 'lit/directives/until.js';
import { JsonRpc } from 'jsonrpc';
import { columnBodyRenderer } from '@vaadin/grid/lit.js';
import '@vaadin/grid';
Expand Down Expand Up @@ -50,12 +49,15 @@ export class QwcArcInvocationTrees extends LitElement {
}

render() {
return html`${until(this._renderInvocations(), html`<span>Loading ArC invocation trees...</span>`)}`;
if(this._invocations){
return this._renderInvocations();
} else {
return html`<span>Loading ArC invocation trees...</span>`;
}
}

_renderInvocations(){
if(this._invocations){
return html`<div class="menubar">
return html`<div class="menubar">
<vaadin-button theme="small" @click=${() => this._refresh()} class="button">
<vaadin-icon icon="font-awesome-solid:rotate"></vaadin-icon> Refresh
</vaadin-button>
Expand All @@ -76,7 +78,6 @@ export class QwcArcInvocationTrees extends LitElement {
resizable>
</vaadin-grid-column>
</vaadin-grid>`;
}
}

_invocationsRenderer(invocation) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package io.quarkus.arc.test.observer.injectionpoint;

import static org.junit.jupiter.api.Assertions.assertEquals;

import jakarta.enterprise.event.Observes;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.runtime.StartupEvent;
import io.quarkus.test.QuarkusUnitTest;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;

public class ObserverInjectingDependentSyntheticBeanWithMetadataTest {

@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.withApplicationRoot(root -> root.addClasses(MyConfig.class)).overrideConfigKey("my.config.value1", "42");

@Test
public void testInjection() {

}

@ConfigMapping(prefix = "my.config")
public interface MyConfig {

int value1();

@WithDefault("baz")
String value2();

}

public static class MyBean {

void onStart(@Observes StartupEvent event, MyConfig config) {
// A @Dependent synthetic bean is registered for MyConfig, and it attempts to obtain InjectionPoint in its create() method
assertEquals(42, config.value1());
assertEquals("baz", config.value2());
}

}

}
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
package io.quarkus.arc.runtime;

import java.lang.annotation.Annotation;
import java.util.Map;
import java.util.Optional;

import jakarta.enterprise.context.spi.CreationalContext;
import jakarta.enterprise.inject.spi.Annotated;
import jakarta.enterprise.inject.spi.InjectionPoint;

import org.eclipse.microprofile.config.ConfigProvider;
import org.eclipse.microprofile.config.inject.ConfigProperties;

import io.quarkus.arc.BeanCreator;
import io.quarkus.arc.impl.InjectionPointProvider;
import io.quarkus.arc.SyntheticCreationalContext;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.SmallRyeConfig;

public class ConfigMappingCreator implements BeanCreator<Object> {

@Override
public Object create(CreationalContext<Object> creationalContext, Map<String, Object> params) {
InjectionPoint injectionPoint = InjectionPointProvider.get();
public Object create(SyntheticCreationalContext<Object> context) {
InjectionPoint injectionPoint = context.getInjectedReference(InjectionPoint.class);
if (injectionPoint == null) {
throw new IllegalStateException("No current injection point found");
}

Class<?> interfaceType = (Class<?>) params.get("type");
String prefix = (String) params.get("prefix");
Class<?> interfaceType = (Class<?>) context.getParams().get("type");
String prefix = (String) context.getParams().get("prefix");

SmallRyeConfig config = (SmallRyeConfig) ConfigProvider.getConfig();
return config.getConfigMapping(interfaceType, getPrefixFromInjectionPoint(injectionPoint).orElse(prefix));
Expand Down
Loading

0 comments on commit 501eca1

Please sign in to comment.