Skip to content

Commit

Permalink
Merge pull request #39198 from gsmet/3.8.2-backports-1
Browse files Browse the repository at this point in the history
3.8.2 backports 1
  • Loading branch information
gsmet committed Mar 6, 2024
2 parents 3a4e21d + b47f807 commit 16c11df
Show file tree
Hide file tree
Showing 68 changed files with 810 additions and 243 deletions.
18 changes: 9 additions & 9 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<opentelemetry.version>1.32.0</opentelemetry.version>
<opentelemetry-alpha.version>1.32.0-alpha</opentelemetry-alpha.version>
<opentelemetry-semconv.version>1.21.0-alpha</opentelemetry-semconv.version> <!-- keep in sync with opentelemetry-java-instrumentation in the alpha bom-->
<quarkus-http.version>5.1.0.Final</quarkus-http.version>
<quarkus-http.version>5.2.0.Final</quarkus-http.version>
<micrometer.version>1.12.2</micrometer.version><!-- keep in sync with hdrhistogram -->
<hdrhistogram.version>2.1.12</hdrhistogram.version><!-- keep in sync with micrometer -->
<google-auth.version>0.22.0</google-auth.version>
Expand All @@ -61,8 +61,8 @@
<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.9.0</smallrye-mutiny-vertx-binding.version>
<smallrye-reactive-messaging.version>4.16.2</smallrye-reactive-messaging.version>
<smallrye-mutiny-vertx-binding.version>3.10.0</smallrye-mutiny-vertx-binding.version>
<smallrye-reactive-messaging.version>4.18.0</smallrye-reactive-messaging.version>
<smallrye-stork.version>2.5.0</smallrye-stork.version>
<jakarta.activation.version>2.1.2</jakarta.activation.version>
<jakarta.annotation-api.version>2.1.1</jakarta.annotation-api.version>
Expand Down Expand Up @@ -108,7 +108,7 @@
<!-- When updating, align hibernate-search.version-for-documentation in docs/pom.xml -->
<hibernate-search.version>7.0.0.Final</hibernate-search.version>
<narayana.version>7.0.0.Final</narayana.version>
<agroal.version>2.1</agroal.version>
<agroal.version>2.3</agroal.version>
<jboss-transaction-spi.version>8.0.0.Final</jboss-transaction-spi.version>
<elasticsearch-opensource-components.version>8.11.4</elasticsearch-opensource-components.version>
<rxjava.version>2.2.21</rxjava.version>
Expand All @@ -121,7 +121,7 @@
<wildfly-client-config.version>1.0.1.Final</wildfly-client-config.version>
<wildfly-elytron.version>2.2.3.Final</wildfly-elytron.version>
<jboss-threads.version>3.5.1.Final</jboss-threads.version>
<vertx.version>4.5.3</vertx.version>
<vertx.version>4.5.4</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,10 +141,10 @@
<hamcrest.version>2.2</hamcrest.version><!-- The version needs to be compatible with both REST Assured and Awaitility -->
<junit.jupiter.version>5.10.1</junit.jupiter.version>
<junit-pioneer.version>1.5.0</junit-pioneer.version>
<infinispan.version>14.0.24.Final</infinispan.version>
<infinispan.version>14.0.25.Final</infinispan.version>
<infinispan.protostream.version>4.6.5.Final</infinispan.protostream.version>
<caffeine.version>3.1.5</caffeine.version>
<netty.version>4.1.106.Final</netty.version>
<netty.version>4.1.107.Final</netty.version>
<brotli4j.version>1.14.0</brotli4j.version>
<reactive-streams.version>1.0.4</reactive-streams.version>
<jboss-logging.version>3.5.3.Final</jboss-logging.version>
Expand Down Expand Up @@ -207,8 +207,8 @@
<avro.version>1.11.3</avro.version>
<apicurio-registry.version>2.5.8.Final</apicurio-registry.version>
<apicurio-common-rest-client.version>0.1.18.Final</apicurio-common-rest-client.version> <!-- must be the version Apicurio Registry uses -->
<testcontainers.version>1.19.4</testcontainers.version> <!-- Make sure to also update docker-java.version to match its needs -->
<docker-java.version>3.3.4</docker-java.version> <!-- must be the version Testcontainers use -->
<testcontainers.version>1.19.6</testcontainers.version> <!-- Make sure to also update docker-java.version to match its needs -->
<docker-java.version>3.3.5</docker-java.version> <!-- must be the version Testcontainers use -->
<!-- Check the compatibility matrix (https://github.com/opensearch-project/opensearch-testcontainers) before upgrading: -->
<opensearch-testcontainers.version>2.0.0</opensearch-testcontainers.version>
<com.dajudge.kindcontainer>1.4.4</com.dajudge.kindcontainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -926,9 +926,11 @@ private void copyDependency(Set<ArtifactKey> parentFirstArtifacts, OutputTargetB
}
}
if (removedFromThisArchive.isEmpty()) {
Files.copy(resolvedDep, targetPath, StandardCopyOption.REPLACE_EXISTING);
Files.copy(resolvedDep, targetPath, StandardCopyOption.REPLACE_EXISTING,
StandardCopyOption.COPY_ATTRIBUTES);
} else {
//we have removed classes, we need to handle them correctly
// we copy jars for which we remove entries to the same directory
// which seems a bit odd to me
filterZipFile(resolvedDep, targetPath, removedFromThisArchive);
}
}
Expand Down Expand Up @@ -1251,6 +1253,8 @@ private void filterZipFile(Path resolvedDep, Path targetPath, Set<String> transf
}
}
}
// let's make sure we keep the original timestamp
Files.setLastModifiedTime(targetPath, Files.getLastModifiedTime(resolvedDep));
}
} catch (IOException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand All @@ -15,7 +16,6 @@
import org.jboss.logging.Logger;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.pkg.NativeConfig;
import io.quarkus.deployment.pkg.builditem.ArtifactResultBuildItem;
import io.quarkus.deployment.pkg.builditem.NativeImageBuildItem;
Expand All @@ -34,7 +34,6 @@ public class UpxCompressionBuildStep {
*/
private static final String PATH = "PATH";

@BuildStep(onlyIf = NativeBuild.class)
public void compress(NativeConfig nativeConfig, NativeImageRunnerBuildItem nativeImageRunner,
NativeImageBuildItem image,
BuildProducer<UpxCompressedBuildItem> upxCompressedProducer,
Expand Down Expand Up @@ -70,11 +69,13 @@ public void compress(NativeConfig nativeConfig, NativeImageRunnerBuildItem nativ
}

private boolean runUpxFromHost(File upx, File executable, NativeConfig nativeConfig) {
String level = getCompressionLevel(nativeConfig.compression().level().getAsInt());
List<String> extraArgs = nativeConfig.compression().additionalArgs().orElse(Collections.emptyList());
List<String> args = Stream.concat(
Stream.concat(Stream.of(upx.getAbsolutePath(), level), extraArgs.stream()),
List<String> args = Stream.of(
Stream.of(upx.getAbsolutePath()),
nativeConfig.compression().level().stream().mapToObj(this::getCompressionLevel),
extraArgs.stream(),
Stream.of(executable.getAbsolutePath()))
.flatMap(Function.identity())
.collect(Collectors.toList());
log.infof("Executing %s", String.join(" ", args));
final ProcessBuilder processBuilder = new ProcessBuilder(args)
Expand Down Expand Up @@ -104,7 +105,6 @@ private boolean runUpxFromHost(File upx, File executable, NativeConfig nativeCon

private boolean runUpxInContainer(NativeImageBuildItem nativeImage, NativeConfig nativeConfig,
String effectiveBuilderImage) {
String level = getCompressionLevel(nativeConfig.compression().level().getAsInt());
List<String> extraArgs = nativeConfig.compression().additionalArgs().orElse(Collections.emptyList());

List<String> commandLine = new ArrayList<>();
Expand Down Expand Up @@ -140,7 +140,9 @@ private boolean runUpxInContainer(NativeImageBuildItem nativeImage, NativeConfig
volumeOutputPath + ":" + NativeImageBuildStep.CONTAINER_BUILD_VOLUME_PATH + ":z");

commandLine.add(effectiveBuilderImage);
commandLine.add(level);
if (nativeConfig.compression().level().isPresent()) {
commandLine.add(getCompressionLevel(nativeConfig.compression().level().getAsInt()));
}
commandLine.addAll(extraArgs);

commandLine.add(nativeImage.getPath().toFile().getName());
Expand Down
8 changes: 5 additions & 3 deletions devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public int run(String... args) throws Exception {
//When running tests the cli should not prompt for user input.
boolean interactiveMode = Arrays.stream(args).noneMatch(arg -> arg.equals("--cli-test"));
Optional<String> testDir = Arrays.stream(args).dropWhile(arg -> !arg.equals("--cli-test-dir")).skip(1).findFirst();
boolean noCommand = args.length == 0 || args[0].startsWith("-");
boolean helpCommand = Arrays.stream(args).anyMatch(arg -> arg.equals("--help"));
boolean pluginCommand = args.length >= 1 && (args[0].equals("plug") || args[0].equals("plugin"));

Expand All @@ -103,22 +104,23 @@ public int run(String... args) throws Exception {
// If the command already exists and is not a help command (that lists subcommands) or plugin command, then just execute
// without dealing with plugins.
// The reason that we check if its a plugin command is that plugin commands need PluginManager initialization.
if (existingCommand && !helpCommand && !pluginCommand) {
if (existingCommand && !noCommand && !helpCommand && !pluginCommand) {
return cmd.execute(args);
}
PluginCommandFactory pluginCommandFactory = new PluginCommandFactory(output);
PluginManager pluginManager = pluginManager(output, testDir, interactiveMode);
pluginManager.syncIfNeeded();
Map<String, Plugin> plugins = new HashMap<>(pluginManager.getInstalledPlugins());
pluginCommandFactory.populateCommands(cmd, plugins);
missingCommand.ifPresent(m -> {
missingCommand.filter(m -> !plugins.containsKey(m)).ifPresent(m -> {
try {
output.info("Command %s is not available, looking for available plugins ...", m);
Map<String, Plugin> installable = pluginManager.getInstallablePlugins();
if (installable.containsKey(m)) {
Plugin candidate = installable.get(m);
PluginListItem item = new PluginListItem(false, candidate);
PluginListTable table = new PluginListTable(List.of(item));
output.info("Command %s not installed but the following plugin is available:\n%s", m,
output.info("Plugin %s is available:\n%s", m,
table.getContent());
if (interactiveMode && Prompt.yesOrNo(true,
"Would you like to install it now?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void beforeTest(Test task) {
Map<String, Object> props = task.getSystemProperties();
ApplicationModel appModel = getApplicationModel(TEST);

SmallRyeConfig config = buildEffectiveConfiguration(appModel.getAppArtifact()).config();
SmallRyeConfig config = buildEffectiveConfiguration(appModel.getAppArtifact()).getConfig();
config.getOptionalValue(TEST.getProfileKey(), String.class)
.ifPresent(value -> props.put(TEST.getProfileKey(), value));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package io.quarkus.gradle.tasks;

import static io.quarkus.gradle.tasks.QuarkusGradleUtils.getSourceSet;
import static io.smallrye.common.expression.Expression.Flag.DOUBLE_COLON;
import static io.smallrye.common.expression.Expression.Flag.LENIENT_SYNTAX;
import static io.smallrye.common.expression.Expression.Flag.NO_SMART_BRACES;
import static io.smallrye.common.expression.Expression.Flag.NO_TRIM;
import static java.util.Collections.emptyList;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand All @@ -24,6 +29,7 @@

import io.quarkus.gradle.dsl.Manifest;
import io.quarkus.maven.dependency.ResolvedDependency;
import io.smallrye.common.expression.Expression;

/**
* This base class exists to hide internal properties, make those only available in the {@link io.quarkus.gradle.tasks}
Expand Down Expand Up @@ -138,7 +144,7 @@ private EffectiveConfig buildEffectiveConfiguration(Map<String, Object> properti
* @param appArtifact the application dependency to retrive the quarkus application name and version.
* @return a filtered view of the configuration only with <code>quarkus.</code> names.
*/
protected Map<String, String> buildSystemProperties(ResolvedDependency appArtifact) {
protected Map<String, String> buildSystemProperties(ResolvedDependency appArtifact, Map<String, String> quarkusProperties) {
Map<String, String> buildSystemProperties = new HashMap<>();
buildSystemProperties.putIfAbsent("quarkus.application.name", appArtifact.getArtifactId());
buildSystemProperties.putIfAbsent("quarkus.application.version", appArtifact.getVersion());
Expand All @@ -158,6 +164,33 @@ protected Map<String, String> buildSystemProperties(ResolvedDependency appArtifa
buildSystemProperties.put(entry.getKey(), entry.getValue().toString());
}
}

Set<String> quarkusValues = new HashSet<>();
quarkusValues.addAll(quarkusProperties.values());
quarkusValues.addAll(buildSystemProperties.values());

for (String value : quarkusValues) {
Expression expression = Expression.compile(value, LENIENT_SYNTAX, NO_TRIM, NO_SMART_BRACES, DOUBLE_COLON);
for (String reference : expression.getReferencedStrings()) {
String expanded = forcedPropertiesProperty.get().get(reference);
if (expanded != null) {
buildSystemProperties.put(reference, expanded);
continue;
}

expanded = quarkusBuildProperties.get().get(reference);
if (expanded != null) {
buildSystemProperties.put(reference, expanded);
continue;
}

expanded = (String) project.getProperties().get(reference);
if (expanded != null) {
buildSystemProperties.put(reference, expanded);
}
}
}

return buildSystemProperties;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
final class BaseConfig {
private final Manifest manifest;
private final PackageConfig packageConfig;
private final Map<String, String> configMap;
private final Map<String, String> values;

// Note: EffectiveConfig has all the code to load the configurations from all the sources.
BaseConfig(EffectiveConfig config) {
manifest = new Manifest();
packageConfig = new PackageConfig();

ConfigInstantiator.handleObject(packageConfig, config.config());
ConfigInstantiator.handleObject(packageConfig, config.getConfig());

// populate the Gradle Manifest object
manifest.attributes(packageConfig.manifest.attributes);
packageConfig.manifest.manifestSections.forEach((section, attribs) -> manifest.attributes(attribs, section));

configMap = config.configMap();
values = config.getValues();
}

PackageConfig packageConfig() {
Expand All @@ -53,7 +53,7 @@ Map<String, String> cachingRelevantProperties(List<String> propertyPatterns) {
List<Pattern> patterns = propertyPatterns.stream().map(s -> "^(" + s + ")$").map(Pattern::compile)
.collect(Collectors.toList());
Predicate<Map.Entry<String, ?>> keyPredicate = e -> patterns.stream().anyMatch(p -> p.matcher(e.getKey()).matches());
return configMap.entrySet().stream()
return values.entrySet().stream()
.filter(keyPredicate)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ public Deploy() {
@TaskAction
public void checkRequiredExtensions() {
ApplicationModel appModel = resolveAppModelForBuild();
Map<String, String> configMap = extension().buildEffectiveConfiguration(appModel.getAppArtifact()).configMap();
Properties sysProps = new Properties();
sysProps.putAll(configMap);
sysProps.putAll(extension().buildEffectiveConfiguration(appModel.getAppArtifact()).getValues());
try (CuratedApplication curatedApplication = QuarkusBootstrap.builder()
.setBaseClassLoader(getClass().getClassLoader())
.setExistingModel(appModel)
Expand Down
Loading

0 comments on commit 16c11df

Please sign in to comment.