Skip to content

Commit

Permalink
Merge pull request #22738 from gsmet/2.6.2-backports-1
Browse files Browse the repository at this point in the history
2.6.2 backports 1
  • Loading branch information
gsmet authored Jan 7, 2022
2 parents 5918592 + d583074 commit 10c72be
Show file tree
Hide file tree
Showing 106 changed files with 1,319 additions and 304 deletions.
10 changes: 5 additions & 5 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<smallrye-config.version>2.7.0</smallrye-config.version>
<smallrye-health.version>3.1.2</smallrye-health.version>
<smallrye-metrics.version>3.0.4</smallrye-metrics.version>
<smallrye-open-api.version>2.1.16</smallrye-open-api.version>
<smallrye-graphql.version>1.4.0</smallrye-graphql.version>
<smallrye-open-api.version>2.1.17</smallrye-open-api.version>
<smallrye-graphql.version>1.4.1</smallrye-graphql.version>
<smallrye-opentracing.version>2.0.1</smallrye-opentracing.version>
<smallrye-fault-tolerance.version>5.2.1</smallrye-fault-tolerance.version>
<smallrye-jwt.version>3.3.2</smallrye-jwt.version>
Expand Down Expand Up @@ -93,7 +93,7 @@
<hibernate-orm.version>5.6.1.Final</hibernate-orm.version>
<hibernate-reactive.version>1.1.0.Final</hibernate-reactive.version>
<hibernate-validator.version>6.2.1.Final</hibernate-validator.version>
<hibernate-search.version>6.0.7.Final</hibernate-search.version>
<hibernate-search.version>6.0.8.Final</hibernate-search.version>
<narayana.version>5.12.4.Final</narayana.version>
<jboss-transaction-api_1.2_spec.version>1.1.1.Final</jboss-transaction-api_1.2_spec.version>
<agroal.version>1.14</agroal.version>
Expand All @@ -102,7 +102,7 @@
<rxjava.version>2.2.21</rxjava.version>
<wildfly.openssl.version>1.0.6.Final</wildfly.openssl.version>
<jboss-logging-annotations.version>2.2.1.Final</jboss-logging-annotations.version>
<slf4j.version>1.7.30</slf4j.version>
<slf4j.version>1.7.32</slf4j.version>
<slf4j-jboss-logmanager.version>1.1.0.Final</slf4j-jboss-logmanager.version>
<wildfly-common.version>1.5.4.Final-format-001</wildfly-common.version>
<wildfly-client-config.version>1.0.1.Final</wildfly-client-config.version>
Expand Down Expand Up @@ -185,7 +185,7 @@
<gson.version>2.8.6</gson.version>
<webjars-locator-core.version>0.46</webjars-locator-core.version>
<log4j2-jboss-logmanager.version>1.1.1.Final</log4j2-jboss-logmanager.version>
<log4j2-api.version>2.17.0</log4j2-api.version>
<log4j2-api.version>2.17.1</log4j2-api.version>
<log4j-jboss-logmanager.version>1.2.2.Final</log4j-jboss-logmanager.version>
<avro.version>1.11.0</avro.version>
<apicurio-registry.version>2.1.3.Final</apicurio-registry.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 @@ -21,7 +21,7 @@
<!-- 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>
<kotlin.version>1.6.10</kotlin.version>
<dokka.version>1.6.0</dokka.version>
<dokka.version>1.6.10</dokka.version>
<scala.version>2.12.13</scala.version>
<scala-maven-plugin.version>4.5.4</scala-maven-plugin.version>
<!-- not pretty but this is used in the codestarts and we don't want to break compatibility -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.quarkus.deployment;

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

@ConfigRoot(name = ConfigItem.PARENT, phase = ConfigPhase.BUILD_TIME)
public class ConfigBuildTimeConfig {
/**
* <p>
* Set this to <code>true</code> to read configuration from system properties and environment variables only. This
* only applies to runtime.
* </p>
*/
@ConfigItem(name = "config.sources.system-only", defaultValue = "false")
public boolean systemOnly;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@
import java.util.List;
import java.util.OptionalInt;
import java.util.Set;
import java.util.function.BooleanSupplier;

import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
import org.eclipse.microprofile.config.spi.ConfigSource;
import org.eclipse.microprofile.config.spi.ConfigSourceProvider;
import org.eclipse.microprofile.config.spi.Converter;

import io.quarkus.deployment.ConfigBuildTimeConfig;
import io.quarkus.deployment.GeneratedClassGizmoAdaptor;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.GeneratedClassBuildItem;
import io.quarkus.deployment.builditem.LiveReloadBuildItem;
import io.quarkus.deployment.builditem.RunTimeConfigBuilderBuildItem;
import io.quarkus.deployment.builditem.RunTimeConfigurationSourceBuildItem;
import io.quarkus.deployment.builditem.StaticInitConfigBuilderBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.util.ServiceUtil;
Expand All @@ -25,6 +29,7 @@
import io.quarkus.gizmo.MethodCreator;
import io.quarkus.gizmo.MethodDescriptor;
import io.quarkus.gizmo.ResultHandle;
import io.quarkus.runtime.configuration.SystemOnlySourcesConfigBuilder;
import io.quarkus.runtime.graal.InetRunTime;
import io.smallrye.config.ConfigSourceInterceptor;
import io.smallrye.config.ConfigSourceInterceptorFactory;
Expand Down Expand Up @@ -97,4 +102,20 @@ void nativeServiceProviders(
RuntimeInitializedClassBuildItem runtimeInitializedClass() {
return new RuntimeInitializedClassBuildItem(InetRunTime.class.getName());
}

@BuildStep(onlyIf = SystemOnlySources.class)
void systemOnlySources(BuildProducer<StaticInitConfigBuilderBuildItem> staticInitConfigBuilder,
BuildProducer<RunTimeConfigBuilderBuildItem> runTimeConfigBuilder) {
staticInitConfigBuilder.produce(new StaticInitConfigBuilderBuildItem(SystemOnlySourcesConfigBuilder.class.getName()));
runTimeConfigBuilder.produce(new RunTimeConfigBuilderBuildItem(SystemOnlySourcesConfigBuilder.class.getName()));
}

private static class SystemOnlySources implements BooleanSupplier {
ConfigBuildTimeConfig configBuildTimeConfig;

@Override
public boolean getAsBoolean() {
return configBuildTimeConfig.systemOnly;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.quarkus.runtime.configuration;

import io.smallrye.config.SmallRyeConfigBuilder;

public class SystemOnlySourcesConfigBuilder implements ConfigBuilder {
@Override
public SmallRyeConfigBuilder configBuilder(final SmallRyeConfigBuilder builder) {
builder.getSourceProviders().clear();
return builder;
}

@Override
public int priority() {
return Integer.MAX_VALUE;
}
}
3 changes: 2 additions & 1 deletion devtools/cli/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ quarkus.native.resources.includes=quarkus.properties
quarkus.native.additional-build-args=--initialize-at-run-time=org.apache.maven.wagon.shared.http.AbstractHttpClientWagon
# Do not attempt to detect "unused removed beans" false positives during programmatic lookup
# at runtime to conserve some memory
quarkus.arc.detect-unused-false-positives=false
quarkus.arc.detect-unused-false-positives=false
quarkus.config.sources.system-only=true
2 changes: 1 addition & 1 deletion devtools/gradle/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.gradle.plugin-publish' version '0.18.0' apply false
id 'com.gradle.plugin-publish' version '0.19.0' apply false
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void execute(Task test) {
ConfigurationContainer configurations = project.getConfigurations();

// create a custom configuration for devmode
Configuration configuration = configurations.create(DEV_MODE_CONFIGURATION_NAME)
Configuration devModeConfiguration = configurations.create(DEV_MODE_CONFIGURATION_NAME)
.extendsFrom(configurations.findByName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME));

tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile.class,
Expand Down Expand Up @@ -197,12 +197,15 @@ public void execute(Task test) {
task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask,
quarkusGenerateCodeDev,
quarkusGenerateCodeTests);
task.setQuarkusDevConfiguration(configuration);
task.setQuarkusDevConfiguration(devModeConfiguration);
});
quarkusRemoteDev.configure(task -> task.dependsOn(classesTask, resourcesTask));
quarkusTest.configure(task -> task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask,
quarkusGenerateCode,
quarkusGenerateCodeTests));
quarkusTest.configure(task -> {
task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask,
quarkusGenerateCode,
quarkusGenerateCodeTests);
task.setQuarkusDevConfiguration(devModeConfiguration);
});
quarkusBuild.configure(
task -> task.dependsOn(classesTask, resourcesTask, tasks.named(JavaPlugin.JAR_TASK_NAME)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class QuarkusDev extends QuarkusTask {

public static final String IO_QUARKUS_DEVMODE_ARGS = "io.quarkus.devmode-args";
private Set<File> filesIncludedInClasspath = new HashSet<>();
private Configuration quarkusDevConfiguration;
protected Configuration quarkusDevConfiguration;

private File buildDir;

Expand Down
2 changes: 1 addition & 1 deletion devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
* <p>
* You can use this dev mode in a remote container environment with {@code remote-dev}.
*/
@Mojo(name = "dev", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, requiresDependencyResolution = ResolutionScope.TEST)
@Mojo(name = "dev", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true)
public class DevMojo extends AbstractMojo {

private static final String EXT_PROPERTIES_PATH = "META-INF/quarkus-extension.properties";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* The test mojo, that starts continuous testing outside of dev mode
*/
@Mojo(name = "test", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, requiresDependencyResolution = ResolutionScope.TEST)
@Mojo(name = "test", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true)
public class TestMojo extends DevMojo {
@Override
protected void modifyDevModeContext(MavenDevModeLauncher.Builder builder) {
Expand Down
8 changes: 4 additions & 4 deletions docs/src/main/asciidoc/cdi-integration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ NOTE: If no default scope is specified the `@Dependent` pseudo-scope is used.

=== _Reason 2_: Class Is Discovered but Has No Bean Defining Annotation

In Quarkus, the application is represented by a single bean archive with the https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#default_bean_discovery[bean discovery mode `annotated`, window="_blank"].
Therefore, bean classes that don't have a https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#bean_defining_annotations[bean defining annotation, window="_blank"] are ignored.
In Quarkus, the application is represented by a single bean archive with the https://jakarta.ee/specifications/cdi/2.0/cdi-spec-2.0.html#default_bean_discovery[bean discovery mode `annotated`, window="_blank"].
Therefore, bean classes that don't have a https://jakarta.ee/specifications/cdi/2.0/cdi-spec-2.0.html#bean_defining_annotations[bean defining annotation, window="_blank"] are ignored.
Bean defining annotations are declared on the class-level and include scopes, stereotypes and `@Interceptor`.

_Solution 1_: Use the `AutoAddScopeBuildItem`. This build item can be used to add a scope to a class that meets certain conditions.
Expand Down Expand Up @@ -160,7 +160,7 @@ _Solution_: Use the `AdditionalBeanBuildItem` as described in <<additional_bean_
== Use Case - I Need To Transform Metadata

In some cases, it's useful to be able to modify the metadata.
Quarkus provides a powerful alternative to https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#process_annotated_type[`javax.enterprise.inject.spi.ProcessAnnotatedType`, window="_blank"].
Quarkus provides a powerful alternative to https://jakarta.ee/specifications/cdi/2.0/cdi-spec-2.0.html#process_annotated_type[`javax.enterprise.inject.spi.ProcessAnnotatedType`, window="_blank"].
With an `AnnotationsTransformerBuildItem` it's possible to override the annotations that exist on bean classes.

For example, you might want to add an interceptor binding to a specific bean class.
Expand Down Expand Up @@ -251,7 +251,7 @@ void doSomethingWithNamedBeans(SynthesisFinishedBuildItem synthesisFinished, Bui
Sometimes it is practical to be able to register a _synthetic bean_.
Bean attributes of a synthetic bean are not derived from a Java class, method or field.
Instead, all the attributes are defined by an extension.
In regular CDI, this could be achieved using the https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#after_bean_discovery[`AfterBeanDiscovery.addBean()`, window="_blank"] methods.
In regular CDI, this could be achieved using the https://jakarta.ee/specifications/cdi/2.0/cdi-spec-2.0.html#after_bean_discovery[`AfterBeanDiscovery.addBean()`, window="_blank"] methods.

_Solution_: If you need to register a synthetic bean then use the `SyntheticBeanBuildItem`.

Expand Down
6 changes: 3 additions & 3 deletions docs/src/main/asciidoc/cdi-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include::./attributes.adoc[]
:sectnumlevels: 4
:toc:

Quarkus DI solution (also called ArC) is based on the http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html[Contexts and Dependency Injection for Java 2.0, window="_blank"] specification.
Quarkus DI solution (also called ArC) is based on the https://jakarta.ee/specifications/cdi/2.0/cdi-spec-2.0.html[Contexts and Dependency Injection for Java 2.0, window="_blank"] specification.
However, it is not a full CDI implementation verified by the TCK.
Only a subset of the CDI features is implemented - see also <<supported_features,the list of supported features>> and <<limitations,the list of limitations>>.
Expand All @@ -24,7 +24,7 @@ NOTE: Most of the existing CDI code should work just fine but there are some sma
Bean discovery in CDI is a complex process which involves legacy deployment structures and accessibility requirements of the underlying module architecture.
However, Quarkus is using a *simplified bean discovery*.
There is only single bean archive with the https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#default_bean_discovery[bean discovery mode `annotated`, window="_blank"] and no visibility boundaries.
There is only single bean archive with the https://jakarta.ee/specifications/cdi/2.0/cdi-spec-2.0.html#default_bean_discovery[bean discovery mode `annotated`, window="_blank"] and no visibility boundaries.
The bean archive is synthesized from:
Expand All @@ -34,7 +34,7 @@ The bean archive is synthesized from:
* dependencies referenced by `quarkus.index-dependency` in `application.properties`,
* and Quarkus integration code.
Bean classes that don't have a http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#bean_defining_annotations[bean defining annotation, window="_blank"] are not discovered.
Bean classes that don't have a https://jakarta.ee/specifications/cdi/2.0/cdi-spec-2.0.html#bean_defining_annotations[bean defining annotation, window="_blank"] are not discovered.
This behavior is defined by CDI.
But producer methods and fields and observer methods are discovered even if the declaring class is not annotated with a bean defining annotation (this behavior is different to what is defined in CDI).
In fact, the declaring bean classes are considered annotated with `@Dependent`.
Expand Down
Loading

0 comments on commit 10c72be

Please sign in to comment.