Skip to content

Commit

Permalink
Merge pull request quarkusio#42038 from gsmet/3.13.0-backports-1
Browse files Browse the repository at this point in the history
[3.13] 3.13.0 backports 1
  • Loading branch information
gsmet authored Jul 23, 2024
2 parents 731c915 + c4c97b1 commit 46ac790
Show file tree
Hide file tree
Showing 71 changed files with 2,153 additions and 293 deletions.
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<extension>
<groupId>com.gradle</groupId>
<artifactId>develocity-maven-extension</artifactId>
<version>1.21.5</version>
<version>1.21.6</version>
</extension>
<extension>
<groupId>com.gradle</groupId>
Expand Down
4 changes: 2 additions & 2 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<smallrye-context-propagation.version>2.1.2</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.13.2</smallrye-mutiny-vertx-binding.version>
<smallrye-mutiny-vertx-binding.version>3.14.0</smallrye-mutiny-vertx-binding.version>
<smallrye-reactive-messaging.version>4.23.0</smallrye-reactive-messaging.version>
<smallrye-stork.version>2.6.0</smallrye-stork.version>
<jakarta.activation.version>2.1.3</jakarta.activation.version>
Expand Down Expand Up @@ -94,7 +94,7 @@
<gizmo.version>1.8.0</gizmo.version>
<jackson-bom.version>2.17.2</jackson-bom.version>
<commons-logging-jboss-logging.version>1.0.0.Final</commons-logging-jboss-logging.version>
<commons-lang3.version>3.14.0</commons-lang3.version>
<commons-lang3.version>3.15.0</commons-lang3.version>
<commons-codec.version>1.17.1</commons-codec.version>
<classmate.version>1.7.0</classmate.version>
<!-- See root POM for hibernate-orm.version, hibernate-reactive.version, hibernate-validator.version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ public final class NativeImageBuildItem extends SimpleBuildItem {

private final Path path;
private final GraalVMVersion graalVMVersion;
private final boolean reused;

public NativeImageBuildItem(Path path, GraalVMVersion graalVMVersion) {
public NativeImageBuildItem(Path path, GraalVMVersion graalVMVersion, boolean reused) {
this.path = path;
this.graalVMVersion = graalVMVersion;
this.reused = reused;
}

public Path getPath() {
Expand All @@ -24,6 +26,10 @@ public GraalVMVersion getGraalVMInfo() {
return graalVMVersion;
}

public boolean isReused() {
return reused;
}

public static class GraalVMVersion {
private final String fullVersion;
private final String version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, LocalesBuildTimeCon
if (nativeConfig.reuseExisting()) {
if (Files.exists(finalExecutablePath)) {
return new NativeImageBuildItem(finalExecutablePath,
NativeImageBuildItem.GraalVMVersion.unknown());
NativeImageBuildItem.GraalVMVersion.unknown(),
true);
}
}

Expand Down Expand Up @@ -297,7 +298,8 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, LocalesBuildTimeCon
new NativeImageBuildItem.GraalVMVersion(graalVMVersion.fullVersion,
graalVMVersion.getVersionAsString(),
graalVMVersion.javaVersion.feature(),
graalVMVersion.distribution.name()));
graalVMVersion.distribution.name()),
false);
} catch (ImageGenerationFailureException e) {
throw e;
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@ public void compress(NativeConfig nativeConfig, NativeImageRunnerBuildItem nativ
NativeImageBuildItem image,
BuildProducer<UpxCompressedBuildItem> upxCompressedProducer,
BuildProducer<ArtifactResultBuildItem> artifactResultProducer) {

if (nativeConfig.compression().level().isEmpty()) {
log.debug("UPX compression disabled");
return;
}
if (image.isReused()) {
log.debug("Native executable reused: skipping compression");
return;
}

String effectiveBuilderImage = nativeConfig.builderImage().getEffectiveImage();
Optional<File> upxPathFromSystem = getUpxFromSystem();
Expand All @@ -53,16 +58,16 @@ public void compress(NativeConfig nativeConfig, NativeImageRunnerBuildItem nativ
throw new IllegalStateException("Unable to compress the native executable");
}
} else if (nativeConfig.remoteContainerBuild()) {
log.errorf("Compression of native executables is not yet implemented for remote container builds.");
log.error("Compression of native executables is not yet implemented for remote container builds.");
throw new IllegalStateException(
"Unable to compress the native executable: Compression of native executables is not yet supported for remote container builds");
} else if (nativeImageRunner.isContainerBuild()) {
log.infof("Running UPX from a container using the builder image: " + effectiveBuilderImage);
log.info("Running UPX from a container using the builder image: " + effectiveBuilderImage);
if (!runUpxInContainer(image, nativeConfig, effectiveBuilderImage)) {
throw new IllegalStateException("Unable to compress the native executable");
}
} else {
log.errorf("Unable to compress the native executable. Either install `upx` from https://upx.github.io/" +
log.error("Unable to compress the native executable. Either install `upx` from https://upx.github.io/" +
" on your machine, or enable in-container build using `-Dquarkus.native.container-build=true`.");
throw new IllegalStateException("Unable to compress the native executable: `upx` not available");
}
Expand Down Expand Up @@ -90,12 +95,12 @@ private boolean runUpxFromHost(File upx, File executable, NativeConfig nativeCon
ProcessUtil.streamOutputToSysOut(process);
final int exitCode = process.waitFor();
if (exitCode != 0) {
log.errorf("Command: " + String.join(" ", args) + " failed with exit code " + exitCode);
log.error("Command: " + String.join(" ", args) + " failed with exit code " + exitCode);
return false;
}
return true;
} catch (Exception e) {
log.errorf("Command: " + String.join(" ", args) + " failed", e);
log.error("Command: " + String.join(" ", args) + " failed", e);
return false;
} finally {
if (process != null) {
Expand Down Expand Up @@ -169,7 +174,7 @@ private boolean runUpxInContainer(NativeImageBuildItem nativeImage, NativeConfig
}
return true;
} catch (Exception e) {
log.errorf("Command: " + String.join(" ", commandLine) + " failed", e);
log.error("Command: " + String.join(" ", commandLine) + " failed", e);
return false;
} finally {
if (process != null) {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/javascript/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if(tables){
const collapsibleSpan = decoration.children.item(1);
const descDiv = td.firstElementChild.querySelector(".description");
const collapsibleHandler = makeCollapsibleHandler(descDiv, td, row, collapsibleSpan, iconDecoration);
row.addEventListener('click', collapsibleHandler);
decoration.addEventListener('click', collapsibleHandler);
}
}

Expand Down
12 changes: 6 additions & 6 deletions docs/src/main/asciidoc/qute.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ Clone the Git repository: `git clone {quickstarts-clone-url}`, or download an {q
The solution is located in the `qute-quickstart` link:{quickstarts-tree-url}/qute-quickstart[directory].

[[serving-templates]]
== Serving Qute templates via http
== Serving Qute templates via HTTP

If you want to serve your templates via http:
If you want to serve your templates via HTTP:

1. The Qute Web extension allows you to directly serve via http templates located in `src/main/resource/templates/pub/`. In that case you don't need any Java code to "plug" the template, for example, the template `src/main/resource/templates/pub/foo.html` will be served from the paths `/foo` and `/foo.html` by default.
1. The Qute Web extension allows you to directly serve via HTTP templates located in `src/main/resources/templates/pub/`. In that case you don't need any Java code to "plug" the template, for example, the template `src/main/resources/templates/pub/foo.html` will be served from the paths `/foo` and `/foo.html` by default.
2. For finer control, you can combine it with Quarkus REST to control how your template will be served. All files located in the `src/main/resources/templates` directory and its subdirectories are registered as templates and can be injected in a REST resource.

[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"]
Expand All @@ -49,7 +49,7 @@ If you want to serve your templates via http:
implementation("io.quarkiverse.qute.web:quarkus-qute-web")
----

NOTE: The Qute Web extension while using the quarkiverse group-id, it is still part of the Quarkus platform.
NOTE: The Qute Web extension, while hosted in the Quarkiverse, is part of the Quarkus Platform and its version is defined in the Quarkus Platform BOM.

[[hello-qute-web]]
=== Serving Hello World with Qute
Expand All @@ -63,9 +63,9 @@ Let's start with a Hello World template:
----
<1> `{http:param('name', 'Quarkus')}` is an expression that is evaluated when the template is rendered (Quarkus is the default value).

NOTE: Templates located in the `pub` directory are served via HTTP. Automatically, no controllers needed. For example, the template src/main/resource/templates/pub/foo.html will be served from the paths /foo and /foo.html by default.
NOTE: Templates located in the `pub` directory are served via HTTP. This behavior is built-in, no controllers are needed. For example, the template `src/main/resources/templates/pub/foo.html` will be served from the paths `/foo` and `/foo.html` by default.

If your application is running, you can open your browser and hit: http://localhost:8080/hello?name=Martin
If your application is running, you can open your browser and hit: http://localhost:8080/hello?name=Martin

For more information about Qute Web options, see the https://docs.quarkiverse.io/quarkus-qute-web/dev/index.html[Qute Web guide].

Expand Down
4 changes: 1 addition & 3 deletions docs/src/main/asciidoc/stylesheet/config.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ table.configuration-reference.tableblock .description-collapsed {
table.configuration-reference.tableblock .description-decoration {
height: 10px;
margin: 0px;
padding: 0px;
padding: 0px 0px .75rem 0px;
text-align: center;

cursor: pointer;
}

Expand All @@ -100,7 +99,6 @@ table.configuration-reference.tableblock a.link-collapsible i.fa {
}

table.configuration-reference.tableblock tr.row-collapsible td {
cursor: pointer;
}

table.configuration-reference.tableblock td.tableblock > .content > :last-child {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

import org.eclipse.microprofile.config.ConfigProvider;
Expand Down Expand Up @@ -48,13 +46,9 @@ public class DevServicesDatasourceProcessor {
private static final Logger log = Logger.getLogger(DevServicesDatasourceProcessor.class);
private static final int DOCKER_PS_ID_LENGTH = 12;

// list of devservices properties we should not check for restart
// see issue #30390
private static final Set<String> EXCLUDED_PROPERTIES = Set.of("quarkus.datasource.devservices.enabled");

static volatile List<RunningDevService> databases;

static volatile Map<String, String> cachedProperties;
static volatile Map<String, Object> cachedProperties;

static volatile boolean first = true;

Expand All @@ -77,24 +71,9 @@ DevServicesDatasourceResultBuildItem launchDatabases(
//if not and the DB's have already started we just return
if (databases != null) {
boolean restartRequired = false;
if (!restartRequired) {
for (Map.Entry<String, String> entry : cachedProperties.entrySet()) {
if (!Objects.equals(entry.getValue(),
trim(ConfigProvider.getConfig().getOptionalValue(entry.getKey(), String.class).orElse(null)))) {
restartRequired = true;
break;
}
}
}
if (!restartRequired) {
//devservices properties may have been added
for (var name : ConfigProvider.getConfig().getPropertyNames()) {
if (name.startsWith("quarkus.datasource.") && name.contains(".devservices.")
&& !cachedProperties.containsKey(name) && !EXCLUDED_PROPERTIES.contains(name)) {
restartRequired = true;
break;
}
}
Map<String, Object> newDatasourceConfigs = buildMapFromBuildConfig(dataSourcesBuildTimeConfig);
if (!newDatasourceConfigs.equals(cachedProperties)) {
restartRequired = true;
}
if (!restartRequired) {
for (RunningDevService database : databases) {
Expand Down Expand Up @@ -172,18 +151,44 @@ public void run() {
closeBuildItem.addCloseTask(closeTask, true);
}
databases = runningDevServices;
cachedProperties = propertiesMap;
cachedProperties = buildMapFromBuildConfig(dataSourcesBuildTimeConfig);
for (RunningDevService database : databases) {
devServicesResultBuildItemBuildProducer.produce(database.toBuildItem());
}
return new DevServicesDatasourceResultBuildItem(results);
}

private String trim(String optional) {
if (optional == null) {
return null;
/**
* Returns a map of properties that can trigger a datasource dev service restart if modified.
* It builds this map from the datasource build time config.
*/
private static Map<String, Object> buildMapFromBuildConfig(DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig) {
Map<String, Object> res = new HashMap<>();
for (var datasource : dataSourcesBuildTimeConfig.dataSources().entrySet()) {
String name = datasource.getKey();
DataSourceBuildTimeConfig config = datasource.getValue();
res.put(name + ".db-kind", config.dbKind());
res.put(name + ".db-version", config.dbVersion());
res.put(name + ".devservices.command", config.devservices().command());
res.put(name + ".devservices.container-env", config.devservices().containerEnv());
res.put(name + ".devservices.container-properties.", config.devservices().containerProperties());
res.put(name + ".devservices.db-name", config.devservices().dbName());
res.put(name + ".devservices.image-name", config.devservices().imageName());
res.put(name + ".devservices.init-script-path", config.devservices().initScriptPath());
res.put(name + ".devservices.password", config.devservices().password());
res.put(name + ".devservices.port", config.devservices().port());
res.put(name + ".devservices.properties", config.devservices().properties());
res.put(name + ".devservices.reuse", config.devservices().reuse());
res.put(name + ".devservices.username", config.devservices().username());
res.put(name + ".devservices.volumes", config.devservices().volumes());
Optional<String> username = ConfigUtils.getFirstOptionalValue(
DataSourceUtil.dataSourcePropertyKeys(name, "username"), String.class);
res.put(name + ".username", username);
Optional<String> password = ConfigUtils.getFirstOptionalValue(
DataSourceUtil.dataSourcePropertyKeys(name, "password"), String.class);
res.put(name + ".password", password);
}
return optional.trim();
return res;
}

private RunningDevService startDevDb(
Expand Down Expand Up @@ -248,7 +253,7 @@ private RunningDevService startDevDb(
}
}

if (devDbProvider.isDockerRequired() && !dockerStatusBuildItem.isDockerAvailable()) {
if (devDbProvider.isDockerRequired() && !dockerStatusBuildItem.isContainerRuntimeAvailable()) {
String message = "Please configure the datasource URL for " + dataSourcePrettyName
+ " or ensure the Docker daemon is up and running.";
if (launchMode == LaunchMode.TEST) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private List<DevServiceDescriptionBuildItem> buildServiceDescriptions(

private Map<String, Container> fetchContainerInfos(DockerStatusBuildItem dockerStatusBuildItem,
Set<String> containerIds) {
if (containerIds.isEmpty() || !dockerStatusBuildItem.isDockerAvailable()) {
if (containerIds.isEmpty() || !dockerStatusBuildItem.isContainerRuntimeAvailable()) {
return Collections.emptyMap();
}
return DockerClientFactory.lazyClient().listContainersCmd()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private DevServicesResultBuildItem.RunningDevService startElasticsearch(
}
}

if (!dockerStatusBuildItem.isDockerAvailable()) {
if (!dockerStatusBuildItem.isContainerRuntimeAvailable()) {
log.warnf("Docker isn't working, please configure the Elasticsearch hosts property (%s).",
displayProperties(buildItemConfig.hostsConfigProperties));
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private RunningDevService startContainer(String clientName, DockerStatusBuildIte
return null;
}

if (!dockerStatusBuildItem.isDockerAvailable()) {
if (!dockerStatusBuildItem.isContainerRuntimeAvailable()) {
log.warn(
"Please configure 'quarkus.infinispan-client.hosts' or 'quarkus.infinispan-client.uri' or get a working Docker instance");
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private RunningDevService startKafka(DockerStatusBuildItem dockerStatusBuildItem
return null;
}

if (!dockerStatusBuildItem.isDockerAvailable()) {
if (!dockerStatusBuildItem.isContainerRuntimeAvailable()) {
log.warn(
"Docker isn't working, please configure the Kafka bootstrap servers property (kafka.bootstrap.servers).");
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private RunningDevService startKubernetes(DockerStatusBuildItem dockerStatusBuil
}
}

if (!dockerStatusBuildItem.isDockerAvailable()) {
if (!dockerStatusBuildItem.isContainerRuntimeAvailable()) {
log.warn(
"Docker isn't working, please configure the Kubernetes client.");
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private RunningDevService startMongo(DockerStatusBuildItem dockerStatusBuildItem
return null;
}

if (!dockerStatusBuildItem.isDockerAvailable()) {
if (!dockerStatusBuildItem.isContainerRuntimeAvailable()) {
log.warn("Please configure datasource URL for "
+ (isDefault(connectionName) ? "default datasource" : connectionName)
+ " or get a working docker instance");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void startContainers(LaunchModeBuildItem launchMode,
return;
}

if (!dockerStatusBuildItem.isDockerAvailable()) {
if (!dockerStatusBuildItem.isContainerRuntimeAvailable()) {
log.warn("Please get a working Docker instance");
return;
}
Expand Down
Loading

0 comments on commit 46ac790

Please sign in to comment.