Skip to content

Commit

Permalink
Merge pull request #40206 from gsmet/3.10.0-backports-1
Browse files Browse the repository at this point in the history
[3.10] 3.10.0 backports 1
  • Loading branch information
gsmet committed Apr 23, 2024
2 parents 0bfcab2 + bbc9b9a commit aa799f8
Show file tree
Hide file tree
Showing 33 changed files with 391 additions and 212 deletions.
6 changes: 3 additions & 3 deletions .github/native-tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@
"os-name": "ubuntu-latest"
},
{
"category": "Windows - RESTEasy Jackson",
"timeout": 25,
"test-modules": "resteasy-jackson",
"category": "Windows support",
"timeout": 50,
"test-modules": "resteasy-jackson, qute",
"os-name": "windows-latest"
},
{
Expand Down
6 changes: 3 additions & 3 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<properties>
<angus-activation.version>2.0.2</angus-activation.version>
<bouncycastle.version>1.77</bouncycastle.version>
<bouncycastle.version>1.78.1</bouncycastle.version>
<bouncycastle.fips.version>1.0.2.4</bouncycastle.fips.version>
<bouncycastle.tls.fips.version>1.0.18</bouncycastle.tls.fips.version>
<expressly.version>5.0.0</expressly.version>
Expand Down Expand Up @@ -57,12 +57,12 @@
<smallrye-open-api.version>3.10.0</smallrye-open-api.version>
<smallrye-graphql.version>2.8.2</smallrye-graphql.version>
<smallrye-fault-tolerance.version>6.3.0</smallrye-fault-tolerance.version>
<smallrye-jwt.version>4.5.0</smallrye-jwt.version>
<smallrye-jwt.version>4.5.1</smallrye-jwt.version>
<smallrye-context-propagation.version>2.1.0</smallrye-context-propagation.version>
<smallrye-reactive-streams-operators.version>1.0.13</smallrye-reactive-streams-operators.version>
<smallrye-reactive-types-converter.version>3.0.1</smallrye-reactive-types-converter.version>
<smallrye-mutiny-vertx-binding.version>3.12.0</smallrye-mutiny-vertx-binding.version>
<smallrye-reactive-messaging.version>4.20.0</smallrye-reactive-messaging.version>
<smallrye-reactive-messaging.version>4.21.0</smallrye-reactive-messaging.version>
<smallrye-stork.version>2.6.0</smallrye-stork.version>
<jakarta.activation.version>2.1.3</jakarta.activation.version>
<jakarta.annotation-api.version>2.1.1</jakarta.annotation-api.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
import io.quarkus.builder.item.MultiBuildItem;

/**
* A build item that indicates that a static resource should be included in the native image
* A build item that indicates that a static resource should be included in the native image.
* <p>
* A static resource is a file that is not processed by the build steps, but is included in the native image as-is.
* The resource path passed to the constructor is a {@code /}-separated path name (with the same semantics as the parameters
* passed to {@link java.lang.ClassLoader#getResources(String)}.
* <p>
* Related build items:
* <ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,7 @@ public String getValue(final String propertyName) {
builder.getSources().clear();
builder.getSourceProviders().clear();
builder.setAddDefaultSources(false)
.withInterceptors(ConfigCompatibility.FrontEnd.nonLoggingInstance(), ConfigCompatibility.BackEnd.instance())
.addDiscoveredCustomizers()
.withProfiles(config.getProfiles())
.withSources(sourceProperties);
Expand All @@ -1099,6 +1100,7 @@ public String getValue(final String propertyName) {
builder.getSources().clear();
builder.getSourceProviders().clear();
builder.setAddDefaultSources(false)
.withInterceptors(ConfigCompatibility.FrontEnd.nonLoggingInstance(), ConfigCompatibility.BackEnd.instance())
.addDiscoveredCustomizers()
.withSources(sourceProperties)
.withSources(new MapBackedConfigSource(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@ public static final class FrontEnd implements ConfigSourceInterceptor {
@Serial
private static final long serialVersionUID = -3438497970389074611L;

private static final FrontEnd instance = new FrontEnd();
private static final FrontEnd instance = new FrontEnd(true);
private static final FrontEnd nonLoggingInstance = new FrontEnd(false);

private FrontEnd() {
private final boolean logging;

private FrontEnd(final boolean logging) {
this.logging = logging;
}

public ConfigValue getValue(final ConfigSourceInterceptorContext context, final String name) {
Expand Down Expand Up @@ -155,11 +159,13 @@ public boolean hasNext() {
// get the replacement names
List<String> list = fn.apply(context, new NameIterator(next));
subIter = list.iterator();
// todo: print these warnings when mapping the configuration so they cannot appear more than once
if (list.isEmpty()) {
log.warnf("Configuration property '%s' has been deprecated and will be ignored", next);
} else {
log.warnf("Configuration property '%s' has been deprecated and replaced by: %s", next, list);
if (logging) {
// todo: print these warnings when mapping the configuration so they cannot appear more than once
if (list.isEmpty()) {
log.warnf("Configuration property '%s' has been deprecated and will be ignored", next);
} else {
log.warnf("Configuration property '%s' has been deprecated and replaced by: %s", next, list);
}
}
}
return true;
Expand All @@ -179,6 +185,10 @@ public String next() {
public static FrontEnd instance() {
return instance;
}

public static FrontEnd nonLoggingInstance() {
return nonLoggingInstance;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.regex.Pattern;

import io.quarkus.builder.Json;
import io.quarkus.builder.Json.JsonArrayBuilder;
Expand All @@ -16,7 +17,6 @@
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourcePatternsBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild;
import io.quarkus.util.GlobUtil;

public class NativeImageResourceConfigStep {

Expand All @@ -35,14 +35,13 @@ void generateResourceConfig(BuildProducer<GeneratedResourceBuildItem> resourceCo
for (NativeImageResourceBuildItem i : resources) {
for (String path : i.getResources()) {
JsonObjectBuilder pat = Json.object();
pat.put("pattern", GlobUtil.toRegexPattern(path));
pat.put("pattern", Pattern.quote(path));
includes.add(pat);
}
addListToJsonArray(includes, i.getResources());
}

for (ServiceProviderBuildItem i : serviceProviderBuildItems) {
includes.add(Json.object().put("pattern", GlobUtil.toRegexPattern(i.serviceDescriptorFile())));
includes.add(Json.object().put("pattern", Pattern.quote(i.serviceDescriptorFile())));
}

for (NativeImageResourcePatternsBuildItem resourcePatternsItem : resourcePatterns) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected Boolean initialValue() {

public BasicConsole(boolean color, boolean inputSupport, PrintStream printStream, Console console) {
this(color, inputSupport, (s) -> {
if (console != null) {
if (TerminalUtils.isTerminal(console)) {
console.writer().print(s);
console.writer().flush();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static boolean hasColorSupport() {
} else {
// on sane operating systems having a console is a good indicator
// you are attached to a TTY with colors.
return System.console() != null;
return TerminalUtils.isTerminal(System.console());
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.quarkus.dev.console;

import java.io.Console;
import java.util.logging.Level;
import java.util.logging.Logger;

public class TerminalUtils {

private static final Logger LOGGER = Logger.getLogger(TerminalUtils.class.getName());

public static boolean isTerminal(Console console) {
if (console == null) {
return false;
}

if (Runtime.version().feature() < 22) { // isTerminal was introduced in Java 22
return true;
}

try {
return (boolean) Console.class.getMethod("isTerminal").invoke(console);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failed to invoke System.console().isTerminal() via Reflection API", e);
return false;
}
}
}
2 changes: 1 addition & 1 deletion devtools/cli/distribution/jreleaser-maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ project:
- java
links:
homepage: https://quarkus.io
license: https://github.com/quarkusio/quarkus/blob/main/LICENSE.txt
license: https://github.com/quarkusio/quarkus/blob/main/LICENSE

release:
github:
Expand Down
2 changes: 1 addition & 1 deletion devtools/cli/distribution/jreleaser-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ project:
- java
links:
homepage: https://quarkus.io
license: https://github.com/quarkusio/quarkus/blob/main/LICENSE.txt
license: https://github.com/quarkusio/quarkus/blob/main/LICENSE

release:
github:
Expand Down
2 changes: 1 addition & 1 deletion devtools/cli/distribution/jreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ project:
- java
links:
homepage: https://quarkus.io
license: https://github.com/quarkusio/quarkus/blob/main/LICENSE.txt
license: https://github.com/quarkusio/quarkus/blob/main/LICENSE

release:
github:
Expand Down
3 changes: 2 additions & 1 deletion docs/src/main/asciidoc/config-yaml.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ quarkus:
----
quarkus:
datasource:
url: jdbc:postgresql://localhost:5432/quarkus_test
jdbc:
url: jdbc:postgresql://localhost:5432/quarkus_test
hibernate-orm:
database:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/deploying-to-openshift.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ You can trigger a build and deployment in a single step or build the container i

To trigger a build and deployment in a single step:

:build-additional-parameters: -Dquarkus.kubernetes.deploy=true
:build-additional-parameters: -Dquarkus.openshift.deploy=true
include::{includes}/devtools/build.adoc[]
:!build-additional-parameters:

Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/hibernate-orm-panache.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1242,8 +1242,8 @@ If you need to mock entity instance methods, such as `persist()` you can do it b

[source,java]
----
import io.quarkus.test.InjectMock;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectMock;
import org.hibernate.Session;
import org.hibernate.query.Query;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -1322,8 +1322,8 @@ You can write your mocking test like this:

[source,java]
----
import io.quarkus.test.InjectMock;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectMock;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/kafka.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ In this case the producer will use this method as generator to create an infinit
@Outgoing("prices-out") CompletionStage<Message<T>> generate();
----

=== Sending messages with @Emitter
=== Sending messages with Emitter

Sometimes, you need to have an imperative way of sending messages.

Expand Down
32 changes: 18 additions & 14 deletions docs/src/main/asciidoc/logging.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ The same flow can be applied with any of the <<logging-apis,supported logging AP
[source,java]
----
package com.example;
import org.jboss.logging.Logger;
public class MyService {
Expand Down Expand Up @@ -129,6 +130,8 @@ Once injected, you can use the `log` object to invoke logging methods.
.An example of two different types of logger injection:
[source, java]
----
package com.example;
import org.jboss.logging.Logger;
@ApplicationScoped
Expand Down Expand Up @@ -203,9 +206,8 @@ FINEST:: Increased debug output compared to `TRACE`, which might have a higher f

== Configure the log level, category, and format

JBoss Logging is built into Quarkus and provides link:https://quarkus.io/developer-joy/[unified configuration] for all <<logging-apis,supported logging APIs>>.

Configure the runtime logging in the `application.properties` file.
JBoss Logging, integrated into Quarkus, offers a unified configuration for all <<logging-apis,supported logging APIs>> through a single configuration file that sets up all available extensions.
To adjust runtime logging, modify the `application.properties` file.

.An example of how you can set the default log level to `INFO` logging and include Hibernate `DEBUG` logs:
[source, properties]
Expand Down Expand Up @@ -347,9 +349,9 @@ The logging format string supports the following symbols:
|%t|Thread name|Render the thread name.
|%t{id}|Thread ID|Render the thread ID.
|%z{<zone name>}|Time zone|Set the time zone of the output to `<zone name>`.
|%X{<MDC property name>}|Mapped Diagnostic Context Value|Renders the value from Mapped Diagnostic Context
|%X|Mapped Diagnostic Context Values|Renders all the values from Mapped Diagnostic Context in format {property.key=property.value}
|%x|Nested Diagnostics context values|Renders all the values from Nested Diagnostics Context in format {value1.value2}
|%X{<MDC property name>}|Mapped Diagnostic Context Value|Renders the value from Mapped Diagnostic Context.
|%X|Mapped Diagnostic Context Values|Renders all the values from Mapped Diagnostic Context in format `{property.key=property.value}`.
|%x|Nested Diagnostics context values|Renders all the values from Nested Diagnostics Context in format `{value1.value2}`.
|===


Expand All @@ -364,8 +366,8 @@ Changing the console log format is useful, for example, when the console output

The `quarkus-logging-json` extension may be employed to add support for the JSON logging format and its related configuration.

Add this extension to your build file as the following snippet illustrates:

. Add this extension to your build file as the following snippet illustrates:
+
[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"]
.pom.xml
----
Expand All @@ -374,20 +376,21 @@ Add this extension to your build file as the following snippet illustrates:
<artifactId>quarkus-logging-json</artifactId>
</dependency>
----

+
[source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"]
.build.gradle
----
implementation("io.quarkus:quarkus-logging-json")
----

+
By default, the presence of this extension replaces the output format configuration from the console configuration, and the format string and the color settings (if any) are ignored.
The other console configuration items, including those controlling asynchronous logging and the log level, will continue to be applied.

+
For some, it will make sense to use humanly readable (unstructured) logging in dev mode and JSON logging (structured) in production mode.
This can be achieved using different profiles, as shown in the following configuration.

.Disable JSON logging in application.properties for dev and test mode
+
. Disable JSON logging in application.properties for dev and test mode:
+
[source, properties]
----
%dev.quarkus.log.console.json=false
Expand Down Expand Up @@ -443,7 +446,6 @@ To log events to a file on the application's host, use the Quarkus file log hand
The file log handler is disabled by default, so you must first enable it.

The Quarkus file log handler supports log file rotation.
Log file rotation ensures effective log file management over time by maintaining a specified number of backup log files, while also keeping the primary log file up-to-date and manageable.

Log file rotation ensures effective log file management over time by maintaining a specified number of backup log files, while keeping the primary log file up-to-date and manageable.

Expand Down Expand Up @@ -514,6 +516,8 @@ To register a logging filter:
.An example of writing a filter:
[source,java]
----
package com.example;
import io.quarkus.logging.LoggingFilter;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/rest-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This command generates the Maven project with a REST endpoint and imports:
If you already have your Quarkus project configured, you can add the `rest-client-jackson` extension
to your project by running the following command in your project base directory:

:add-extension-extensions: rest-client-reactive-jackson
:add-extension-extensions: rest-client-jackson
include::{includes}/devtools/extension-add.adoc[]

This will add the following to your build file:
Expand Down Expand Up @@ -1768,8 +1768,8 @@ import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import io.quarkus.test.InjectMock;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectMock;
@QuarkusTest
public class InjectMockTest {
Expand Down

0 comments on commit aa799f8

Please sign in to comment.