Skip to content

Commit

Permalink
Merge pull request quarkusio#42088 from gsmet/3.13.0-backports-2
Browse files Browse the repository at this point in the history
[3.13] 3.13.0 backports 2
  • Loading branch information
gsmet authored Jul 24, 2024
2 parents 46ac790 + ee5856d commit 5f35abd
Show file tree
Hide file tree
Showing 34 changed files with 1,089 additions and 397 deletions.
4 changes: 2 additions & 2 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@
<shrinkwrap.version>1.2.6</shrinkwrap.version>
<hamcrest.version>2.2</hamcrest.version><!-- The version needs to be compatible with both REST Assured and Awaitility -->
<junit.jupiter.version>5.10.3</junit.jupiter.version>
<infinispan.version>15.0.5.Final</infinispan.version>
<infinispan.protostream.version>5.0.5.Final</infinispan.protostream.version>
<infinispan.version>15.0.6.Final</infinispan.version>
<infinispan.protostream.version>5.0.7.Final</infinispan.protostream.version>
<caffeine.version>3.1.5</caffeine.version>
<netty.version>4.1.111.Final</netty.version>
<brotli4j.version>1.16.0</brotli4j.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import org.jboss.jandex.IndexView;

import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.maven.dependency.ArtifactKey;
import io.quarkus.maven.dependency.ResolvedDependency;
Expand Down Expand Up @@ -71,6 +72,12 @@ public interface ApplicationArchive {
*/
PathCollection getResolvedPaths();

/**
* @deprecated in favor of {@link #getKey()}
* @return the artifact key or null if not available
*/
AppArtifactKey getArtifactKey();

/**
*
* @return the artifact key or null if not available
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import org.jboss.jandex.IndexView;

import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.builder.item.MultiBuildItem;
import io.quarkus.maven.dependency.ArtifactKey;
Expand Down Expand Up @@ -61,6 +62,21 @@ public PathCollection getResolvedPaths() {
return PathList.from(openTree.getOriginalTree().getRoots());
}

@Override
@Deprecated
/**
* @deprecated in favor of {@link #getKey()}
* @return archive key
*/
public AppArtifactKey getArtifactKey() {
if (resolvedDependency == null) {
return null;
}
ArtifactKey artifactKey = resolvedDependency.getKey();
return new AppArtifactKey(artifactKey.getGroupId(), artifactKey.getArtifactId(), artifactKey.getClassifier(),
artifactKey.getType());
}

@Override
public ArtifactKey getKey() {
return resolvedDependency != null ? resolvedDependency.getKey() : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,19 @@ private List<ConfigDocItem> recursivelyFindConfigItems(Element element, String r
configDocKey.setJavaDocSiteLink(getJavaDocSiteLink(type));
ConfigDocItem configDocItem = new ConfigDocItem();
configDocItem.setConfigDocKey(configDocKey);

// If there is already a config item with the same key it comes from a super type, and we need to override it
ConfigDocItem parent = null;
for (ConfigDocItem docItem : configDocItems) {
if (docItem.getConfigDocKey() != null && docItem.getConfigDocKey().getKey().equals(configDocKey.getKey())) {
parent = docItem;
break;
}
}
// We may want to merge the metadata, but let's keep this simple for now
if (parent != null) {
configDocItems.remove(parent);
}
configDocItems.add(configDocItem);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.File;
import java.nio.charset.Charset;
import java.time.format.DateTimeFormatter;
import java.util.Optional;
import java.util.logging.Level;

Expand Down Expand Up @@ -84,6 +85,8 @@ public static class RotationConfig {
* The file handler rotation file suffix.
* When used, the file will be rotated based on its suffix.
* <p>
* The suffix must be in a date-time format that is understood by {@link DateTimeFormatter}.
* <p>
* Example fileSuffix: .yyyy-MM-dd
* <p>
* Note: If the suffix ends with .zip or .gz, the rotation file will also be compressed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public void close() throws IOException {
})) {
return scanner.nextLine();
} catch (Exception e) {
getLogger().warn("Failed to collect user input for analytics", e);
getLogger().debug("Failed to collect user input for analytics", e);
return "";
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.Set;

Expand All @@ -37,13 +36,14 @@
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;

import io.quarkus.bootstrap.BootstrapConstants;
import io.quarkus.bootstrap.model.AppArtifactCoords;
import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.bootstrap.model.ApplicationModelBuilder;
import io.quarkus.devtools.project.extensions.ScmInfoProvider;
import io.quarkus.extension.gradle.QuarkusExtensionConfiguration;
import io.quarkus.extension.gradle.dsl.Capability;
import io.quarkus.extension.gradle.dsl.RemovedResource;
import io.quarkus.fs.util.ZipUtils;
import io.quarkus.maven.dependency.ArtifactCoords;
import io.quarkus.maven.dependency.ArtifactKey;
import io.quarkus.maven.dependency.GACT;

Expand Down Expand Up @@ -113,9 +113,9 @@ private void generateQuarkusExtensionProperties(Path metaInfDir) {
if (conditionalDependencies != null && !conditionalDependencies.isEmpty()) {
final StringBuilder buf = new StringBuilder();
int i = 0;
buf.append(ArtifactCoords.fromString(conditionalDependencies.get(i++)));
buf.append(AppArtifactCoords.fromString(conditionalDependencies.get(i++)).toString());
while (i < conditionalDependencies.size()) {
buf.append(' ').append(ArtifactCoords.fromString(conditionalDependencies.get(i++)));
buf.append(' ').append(AppArtifactCoords.fromString(conditionalDependencies.get(i++)).toString());
}
props.setProperty(BootstrapConstants.CONDITIONAL_DEPENDENCIES, buf.toString());
}
Expand Down Expand Up @@ -315,7 +315,7 @@ private void computeArtifactCoords(ObjectNode extObject) {
}
}
if (artifactNode == null || groupId == null || artifactId == null || version == null) {
final ArtifactCoords coords = ArtifactCoords.of(
final AppArtifactCoords coords = new AppArtifactCoords(
groupId == null ? projectInfo.get("group") : groupId,
artifactId == null ? projectInfo.get("name") : artifactId,
null,
Expand Down Expand Up @@ -363,7 +363,7 @@ private void computeQuarkusExtensions(ObjectNode extObject) {
ObjectNode metadataNode = getMetadataNode(extObject);
Set<ResolvedArtifact> extensions = new HashSet<>();
for (ResolvedArtifact resolvedArtifact : getClasspath().getResolvedConfiguration().getResolvedArtifacts()) {
if (Objects.equals(resolvedArtifact.getExtension(), "jar")) {
if (resolvedArtifact.getExtension().equals("jar")) {
Path p = resolvedArtifact.getFile().toPath();
if (Files.isDirectory(p) && isExtension(p)) {
extensions.add(resolvedArtifact);
Expand All @@ -382,7 +382,7 @@ private void computeQuarkusExtensions(ObjectNode extObject) {
for (ResolvedArtifact extension : extensions) {
ModuleVersionIdentifier id = extension.getModuleVersion().getId();
extensionArray
.add(ArtifactKey.of(id.getGroup(), id.getName(), extension.getClassifier(), extension.getExtension())
.add(new AppArtifactKey(id.getGroup(), id.getName(), extension.getClassifier(), extension.getExtension())
.toGacString());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.TaskAction;

import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.extension.gradle.QuarkusExtensionConfiguration;
import io.quarkus.gradle.tooling.dependency.ArtifactExtensionDependency;
import io.quarkus.gradle.tooling.dependency.DependencyUtils;
import io.quarkus.gradle.tooling.dependency.ExtensionDependency;
import io.quarkus.gradle.tooling.dependency.ProjectExtensionDependency;
import io.quarkus.maven.dependency.ArtifactKey;

public class ValidateExtensionTask extends DefaultTask {

Expand Down Expand Up @@ -59,12 +59,12 @@ public void setDeploymentModuleClasspath(Configuration deploymentModuleClasspath
public void validateExtension() {
Set<ResolvedArtifact> runtimeArtifacts = getRuntimeModuleClasspath().getResolvedConfiguration().getResolvedArtifacts();

List<ArtifactKey> deploymentModuleKeys = collectRuntimeExtensionsDeploymentKeys(runtimeArtifacts);
List<ArtifactKey> invalidRuntimeArtifacts = findExtensionInConfiguration(runtimeArtifacts, deploymentModuleKeys);
List<AppArtifactKey> deploymentModuleKeys = collectRuntimeExtensionsDeploymentKeys(runtimeArtifacts);
List<AppArtifactKey> invalidRuntimeArtifacts = findExtensionInConfiguration(runtimeArtifacts, deploymentModuleKeys);

Set<ResolvedArtifact> deploymentArtifacts = getDeploymentModuleClasspath().getResolvedConfiguration()
.getResolvedArtifacts();
List<ArtifactKey> existingDeploymentModuleKeys = findExtensionInConfiguration(deploymentArtifacts,
List<AppArtifactKey> existingDeploymentModuleKeys = findExtensionInConfiguration(deploymentArtifacts,
deploymentModuleKeys);
deploymentModuleKeys.removeAll(existingDeploymentModuleKeys);

Expand All @@ -81,60 +81,64 @@ public void validateExtension() {
}
}

private List<ArtifactKey> collectRuntimeExtensionsDeploymentKeys(Set<ResolvedArtifact> runtimeArtifacts) {
List<ArtifactKey> runtimeExtensions = new ArrayList<>();
private List<AppArtifactKey> collectRuntimeExtensionsDeploymentKeys(Set<ResolvedArtifact> runtimeArtifacts) {
List<AppArtifactKey> runtimeExtensions = new ArrayList<>();
for (ResolvedArtifact resolvedArtifact : runtimeArtifacts) {
ExtensionDependency<?> extension = DependencyUtils.getExtensionInfoOrNull(getProject(), resolvedArtifact);
if (extension != null) {
if (extension instanceof ProjectExtensionDependency ped) {
if (extension instanceof ProjectExtensionDependency) {
final ProjectExtensionDependency ped = (ProjectExtensionDependency) extension;

runtimeExtensions
.add(ArtifactKey.ga(ped.getDeploymentModule().getGroup().toString(),
.add(new AppArtifactKey(ped.getDeploymentModule().getGroup().toString(),
ped.getDeploymentModule().getName()));
} else if (extension instanceof ArtifactExtensionDependency aed) {
runtimeExtensions.add(ArtifactKey.ga(aed.getDeploymentModule().getGroupId(),
} else if (extension instanceof ArtifactExtensionDependency) {
final ArtifactExtensionDependency aed = (ArtifactExtensionDependency) extension;

runtimeExtensions.add(new AppArtifactKey(aed.getDeploymentModule().getGroupId(),
aed.getDeploymentModule().getArtifactId()));
}
}
}
return runtimeExtensions;
}

private List<ArtifactKey> findExtensionInConfiguration(Set<ResolvedArtifact> deploymentArtifacts,
List<ArtifactKey> extensions) {
List<ArtifactKey> foundExtensions = new ArrayList<>();
private List<AppArtifactKey> findExtensionInConfiguration(Set<ResolvedArtifact> deploymentArtifacts,
List<AppArtifactKey> extensions) {
List<AppArtifactKey> foundExtensions = new ArrayList<>();

for (ResolvedArtifact deploymentArtifact : deploymentArtifacts) {
ArtifactKey key = toArtifactKey(deploymentArtifact.getModuleVersion());
AppArtifactKey key = toAppArtifactKey(deploymentArtifact.getModuleVersion());
if (extensions.contains(key)) {
foundExtensions.add(key);
}
}
return foundExtensions;
}

private void printValidationErrors(List<ArtifactKey> invalidRuntimeArtifacts,
List<ArtifactKey> missingDeploymentArtifacts) {
private void printValidationErrors(List<AppArtifactKey> invalidRuntimeArtifacts,
List<AppArtifactKey> missingDeploymentArtifacts) {
Logger log = getLogger();
log.error("Quarkus Extension Dependency Verification Error");

if (!invalidRuntimeArtifacts.isEmpty()) {
log.error("The following deployment artifact(s) appear on the runtime classpath: ");
for (ArtifactKey invalidRuntimeArtifact : invalidRuntimeArtifacts) {
for (AppArtifactKey invalidRuntimeArtifact : invalidRuntimeArtifacts) {
log.error("- " + invalidRuntimeArtifact);
}
}

if (!missingDeploymentArtifacts.isEmpty()) {
log.error("The following deployment artifact(s) were found to be missing in the deployment module: ");
for (ArtifactKey missingDeploymentArtifact : missingDeploymentArtifacts) {
for (AppArtifactKey missingDeploymentArtifact : missingDeploymentArtifacts) {
log.error("- " + missingDeploymentArtifact);
}
}

throw new GradleException("Quarkus Extension Dependency Verification Error. See logs below");
}

private static ArtifactKey toArtifactKey(ResolvedModuleVersion artifactId) {
return ArtifactKey.ga(artifactId.getId().getGroup(), artifactId.getId().getName());
private static AppArtifactKey toAppArtifactKey(ResolvedModuleVersion artifactId) {
return new AppArtifactKey(artifactId.getId().getGroup(), artifactId.getId().getName());
}
}
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 @@ -444,7 +444,7 @@ public void close() throws IOException {
})) {
return scanner.nextLine();
} catch (Exception e) {
getLog().warn("Failed to collect user input for analytics", e);
getLog().debug("Failed to collect user input for analytics", e);
return "";
}
});
Expand Down
2 changes: 2 additions & 0 deletions docs/src/main/asciidoc/mailer-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ quarkus.mailer.start-tls=REQUIRED
quarkus.mailer.trust-all=true
----

IMPORTANT: To use `START_TLS`, make sure you set `tls` to `false` and `start-tls` to `REQUIRED` or `OPTIONAL`.

=== Configuring SSL/TLS

To establish a TLS connection, you need to configure a _named_ configuration using the xref:./tls-registry-reference.adoc[TLS registry]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,15 @@ private static void copyAsciidoc(Path sourceFile, Path targetFile, Set<String> d
lineNumber++;

if (!documentTitleFound && line.startsWith("= ")) {
// anything in the buffer needs to be appended
// we don't need to rewrite it as before the title we can only have the preamble
// and we don't want to change anything in the preamble
// if at some point we want to adjust the preamble, make sure to do it in a separate method and not reuse rewriteContent
if (currentBuffer.length() > 0) {
rewrittenGuide.append(currentBuffer);
currentBuffer.setLength(0);
}

// this is the document title
rewrittenGuide.append(line.replace(PROJECT_NAME_ATTRIBUTE, RED_HAT_BUILD_OF_QUARKUS) + "\n");
documentTitleFound = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,10 @@ private JibContainerBuilder createContainerBuilderFromFastJar(String baseJvmImag
entrypoint = List.of(RUN_JAVA_PATH);
envVars.put("JAVA_APP_JAR", workDirInContainer + "/" + JarResultBuildStep.QUARKUS_RUN_JAR);
envVars.put("JAVA_APP_DIR", workDirInContainer.toString());
envVars.put("JAVA_OPTS_APPEND", String.join(" ", determineEffectiveJvmArguments(jibConfig, appCDSResult)));
envVars.put("JAVA_OPTS_APPEND",
String.join(" ", determineEffectiveJvmArguments(jibConfig, appCDSResult, isMutableJar)));
} else {
List<String> effectiveJvmArguments = determineEffectiveJvmArguments(jibConfig, appCDSResult);
List<String> effectiveJvmArguments = determineEffectiveJvmArguments(jibConfig, appCDSResult, isMutableJar);
List<String> argsList = new ArrayList<>(3 + effectiveJvmArguments.size());
argsList.add("java");
argsList.addAll(effectiveJvmArguments);
Expand Down Expand Up @@ -693,7 +694,8 @@ private void mayInheritEntrypoint(JibContainerBuilder jibContainerBuilder, List<
}

private List<String> determineEffectiveJvmArguments(ContainerImageJibConfig jibConfig,
Optional<AppCDSResultBuildItem> appCDSResult) {
Optional<AppCDSResultBuildItem> appCDSResult,
boolean isMutableJar) {
List<String> effectiveJvmArguments = new ArrayList<>(jibConfig.jvmArguments);
jibConfig.jvmAdditionalArguments.ifPresent(effectiveJvmArguments::addAll);
if (appCDSResult.isPresent()) {
Expand All @@ -708,6 +710,10 @@ private List<String> determineEffectiveJvmArguments(ContainerImageJibConfig jibC
effectiveJvmArguments.add("-XX:SharedArchiveFile=" + appCDSResult.get().getAppCDS().getFileName().toString());
}
}
if (isMutableJar) {
// see https://github.com/quarkusio/quarkus/issues/41797
effectiveJvmArguments.add("-Dquarkus.package.output-directory=${PWD}");
}
return effectiveJvmArguments;
}

Expand Down Expand Up @@ -746,7 +752,7 @@ private JibContainerBuilder createContainerBuilderFromLegacyJar(String baseJvmIm
// when there is no custom entry point, we just set everything up for a regular java run
if (!jibConfig.jvmEntrypoint.isPresent()) {
javaContainerBuilder
.addJvmFlags(determineEffectiveJvmArguments(jibConfig, Optional.empty()))
.addJvmFlags(determineEffectiveJvmArguments(jibConfig, Optional.empty(), false))
.setMainClass(mainClassBuildItem.getClassName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,5 +313,10 @@ public String getReplicaSetUrl(String databaseName) {
return super.getReplicaSetUrl(databaseName);
}
}

@Override
public String getHost() {
return useSharedNetwork ? hostName : super.getHost();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
import java.util.Optional;
import java.util.OptionalInt;

import io.quarkus.runtime.annotations.ConfigGroup;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;

@ConfigGroup
public interface OtlpExporterConfig {
String DEFAULT_GRPC_BASE_URI = "http://localhost:4317/";
String DEFAULT_HTTP_BASE_URI = "http://localhost:4318/";
Expand Down
Loading

0 comments on commit 5f35abd

Please sign in to comment.