Skip to content

Commit

Permalink
Merge branch 'main' into 2024-05-23-improve-reflective-registration-t…
Browse files Browse the repository at this point in the history
…racing
  • Loading branch information
zakkak authored Aug 1, 2024
2 parents be2e4ed + 3a5d393 commit 165fccf
Show file tree
Hide file tree
Showing 164 changed files with 3,764 additions and 2,352 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-actions-incremental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ jobs:
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.calculate-test-jobs.outputs.native_matrix) }}
runs-on: ${{matrix.os-name}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<extension>
<groupId>io.quarkus.develocity</groupId>
<artifactId>quarkus-project-develocity-extension</artifactId>
<version>1.1.3</version>
<version>1.1.4</version>
</extension>
</extensions>
25 changes: 10 additions & 15 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
<bouncycastle.tls.fips.version>1.0.19</bouncycastle.tls.fips.version>
<expressly.version>5.0.0</expressly.version>
<findbugs.version>3.0.2</findbugs.version>
<jandex.version>3.2.0</jandex.version>
<jandex.version>3.2.1</jandex.version>
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
<javax.inject.version>1</javax.inject.version>
<parsson.version>1.1.6</parsson.version>
<parsson.version>1.1.7</parsson.version>
<resteasy-microprofile.version>2.1.5.Final</resteasy-microprofile.version>
<resteasy-spring-web.version>3.1.3.Final</resteasy-spring-web.version>
<resteasy.version>6.2.9.Final</resteasy.version>
Expand Down Expand Up @@ -147,7 +147,7 @@
<!-- Scala is used by Kafka so we need to choose a compatible version -->
<scala.version>2.13.14</scala.version>
<aws-lambda-java.version>1.2.3</aws-lambda-java.version>
<aws-lambda-java-events.version>3.12.0</aws-lambda-java-events.version>
<aws-lambda-java-events.version>3.13.0</aws-lambda-java-events.version>
<aws-xray.version>2.17.0</aws-xray.version>
<cloudevents-api.version>3.0.0</cloudevents-api.version>
<azure-functions-java-library.version>3.1.0</azure-functions-java-library.version>
Expand All @@ -160,7 +160,7 @@
<maven-invoker.version>3.2.0</maven-invoker.version>
<awaitility.version>4.2.1</awaitility.version>
<jboss-logmanager.version>3.0.6.Final</jboss-logmanager.version>
<flyway.version>10.16.0</flyway.version>
<flyway.version>10.17.0</flyway.version>
<yasson.version>3.0.3</yasson.version>
<!-- liquibase-mongodb is not released everytime with liquibase anymore, but the two versions need to be compatible -->
<liquibase.version>4.27.0</liquibase.version>
Expand Down Expand Up @@ -198,7 +198,7 @@
<avro.version>1.11.3</avro.version>
<apicurio-registry.version>2.5.10.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.20.0</testcontainers.version> <!-- Make sure to also update docker-java.version to match its needs -->
<testcontainers.version>1.20.1</testcontainers.version> <!-- Make sure to also update docker-java.version to match its needs -->
<docker-java.version>3.4.0</docker-java.version> <!-- must be the version Testcontainers use: https://central.sonatype.com/artifact/org.testcontainers/testcontainers -->
<!-- Check the compatibility matrix (https://github.com/opensearch-project/opensearch-testcontainers) before upgrading: -->
<opensearch-testcontainers.version>2.0.2</opensearch-testcontainers.version>
Expand Down Expand Up @@ -6443,16 +6443,11 @@
<groupId>io.opentelemetry.semconv</groupId>
<artifactId>opentelemetry-semconv</artifactId>
<version>${opentelemetry-semconv.version}</version>
<exclusions>
<exclusion>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-bom</artifactId>
</exclusion>
<exclusion>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.opentelemetry.semconv</groupId>
<artifactId>opentelemetry-semconv-incubating</artifactId>
<version>${opentelemetry-semconv.version}</version>
</dependency>

<!-- JDK Flight Recorder -->
Expand Down
36 changes: 3 additions & 33 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<scala-plugin.version>${scala-maven-plugin.version}</scala-plugin.version>

<!-- Jandex versions -->
<jandex.version>3.2.0</jandex.version>
<jandex.version>3.2.1</jandex.version>
<jandex-gradle-plugin.version>1.0.0</jandex-gradle-plugin.version>

<asciidoctorj.version>2.5.13</asciidoctorj.version>
Expand Down Expand Up @@ -107,13 +107,13 @@
<wiremock-maven-plugin.version>7.3.0</wiremock-maven-plugin.version>

<!-- Artemis test dependencies -->
<artemis.version>2.35.0</artemis.version>
<artemis.version>2.36.0</artemis.version>

<!-- Code Coverage Properties-->
<jacoco.agent.argLine></jacoco.agent.argLine>

<asciidoctor-maven-plugin.version>2.0.0</asciidoctor-maven-plugin.version>
<docker-maven-plugin.version>0.44.0</docker-maven-plugin.version>
<docker-maven-plugin.version>0.45.0</docker-maven-plugin.version>
<maven-invoker-plugin.version>3.7.0</maven-invoker-plugin.version>

<!-- revapi API check -->
Expand Down Expand Up @@ -539,36 +539,6 @@
<artifactId>jandex-maven-plugin</artifactId>
<version>${jandex.version}</version>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<dependencies>
<dependency>
<artifactId>quarkus-ide-config</artifactId>
<groupId>io.quarkus</groupId>
<version>${project.version}</version>
</dependency>
</dependencies>
<configuration>
<!-- store outside of target to speed up formatting when mvn clean is used -->
<cachedir>.cache/formatter-maven-plugin-${formatter-maven-plugin.version}</cachedir>
<configFile>eclipse-format.xml</configFile>
<lineEnding>LF</lineEnding>
<skip>${format.skip}</skip>
</configuration>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<configuration>
<!-- store outside of target to speed up formatting when mvn clean is used -->
<cachedir>.cache/impsort-maven-plugin-${impsort-maven-plugin.version}</cachedir>
<groups>java.,javax.,jakarta.,org.,com.</groups>
<staticGroups>*</staticGroups>
<skip>${format.skip}</skip>
<removeUnused>true</removeUnused>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.quarkus.deployment.logging;

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.CompositeIndex;

import io.quarkus.builder.item.SimpleBuildItem;

/**
* Contains information to decorate the Log output. Can be used by extensions that output the log / stacktraces,
* for example the error page.
*
* Also see io.quarkus.runtime.logging.DecorateStackUtil to assist with the decoration
*/
public final class LoggingDecorateBuildItem extends SimpleBuildItem {
private final Path srcMainJava;
private final CompositeIndex knowClassesIndex;

public LoggingDecorateBuildItem(Path srcMainJava, CompositeIndex knowClassesIndex) {
this.srcMainJava = srcMainJava;
this.knowClassesIndex = knowClassesIndex;
}

public Path getSrcMainJava() {
return srcMainJava;
}

public CompositeIndex getKnowClassesIndex() {
return knowClassesIndex;
}

public List<String> getKnowClasses() {
List<String> knowClasses = new ArrayList<>();
Collection<ClassInfo> knownClasses = knowClassesIndex.getKnownClasses();
for (ClassInfo ci : knownClasses) {
knowClasses.add(ci.name().toString());
}
return knowClasses;
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.quarkus.deployment.logging;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
Expand Down Expand Up @@ -45,6 +47,8 @@

import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
import io.quarkus.bootstrap.logging.InitialConfigurator;
import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.workspace.WorkspaceModule;
import io.quarkus.deployment.ApplicationArchive;
import io.quarkus.deployment.GeneratedClassGizmoAdaptor;
import io.quarkus.deployment.IsNormal;
Expand Down Expand Up @@ -86,6 +90,8 @@
import io.quarkus.deployment.metrics.MetricsCapabilityBuildItem;
import io.quarkus.deployment.metrics.MetricsFactoryConsumerBuildItem;
import io.quarkus.deployment.pkg.builditem.BuildSystemTargetBuildItem;
import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem;
import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem;
import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild;
import io.quarkus.deployment.recording.RecorderContext;
import io.quarkus.deployment.util.JandexUtil;
Expand All @@ -102,11 +108,13 @@
import io.quarkus.gizmo.MethodDescriptor;
import io.quarkus.gizmo.ResultHandle;
import io.quarkus.logging.LoggingFilter;
import io.quarkus.runtime.LaunchMode;
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.configuration.ConfigInstantiator;
import io.quarkus.runtime.console.ConsoleRuntimeConfig;
import io.quarkus.runtime.logging.CategoryBuildTimeConfig;
import io.quarkus.runtime.logging.CleanupFilterConfig;
import io.quarkus.runtime.logging.DecorateStackUtil;
import io.quarkus.runtime.logging.DiscoveredLogComponents;
import io.quarkus.runtime.logging.InheritableLevel;
import io.quarkus.runtime.logging.LogBuildTimeConfig;
Expand Down Expand Up @@ -370,14 +378,25 @@ private DiscoveredLogComponents discoverLogComponents(IndexView index) {
void setupStackTraceFormatter(ApplicationArchivesBuildItem item, EffectiveIdeBuildItem ideSupport,
BuildSystemTargetBuildItem buildSystemTargetBuildItem,
List<ExceptionNotificationBuildItem> exceptionNotificationBuildItems,
CuratedApplicationShutdownBuildItem curatedApplicationShutdownBuildItem) {
CuratedApplicationShutdownBuildItem curatedApplicationShutdownBuildItem,
CurateOutcomeBuildItem curateOutcomeBuildItem,
OutputTargetBuildItem outputTargetBuildItem,
LaunchModeBuildItem launchMode,
LogBuildTimeConfig logBuildTimeConfig,
BuildProducer<LoggingDecorateBuildItem> loggingDecorateProducer) {
List<IndexView> indexList = new ArrayList<>();
for (ApplicationArchive i : item.getAllApplicationArchives()) {
if (i.getResolvedPaths().isSinglePath() && Files.isDirectory(i.getResolvedPaths().getSinglePath())) {
indexList.add(i.getIndex());
}
}
Path srcMainJava = getSourceRoot(curateOutcomeBuildItem.getApplicationModel(),
outputTargetBuildItem.getOutputDirectory());

CompositeIndex index = CompositeIndex.create(indexList);

loggingDecorateProducer.produce(new LoggingDecorateBuildItem(srcMainJava, index));

//awesome/horrible hack
//we know from the index which classes are part of the current application
//we add ANSI codes for bold and underline to their names to display them more prominently
Expand All @@ -393,6 +412,15 @@ public void accept(LogRecord logRecord, Consumer<LogRecord> logRecordConsumer) {
var elem = stackTrace[i];
if (index.getClassByName(DotName.createSimple(elem.getClassName())) != null) {
lastUserCode = stackTrace[i];

if (launchMode.getLaunchMode().equals(LaunchMode.DEVELOPMENT)
&& logBuildTimeConfig.decorateStacktraces) {
String decoratedString = DecorateStackUtil.getDecoratedString(srcMainJava, elem);
if (decoratedString != null) {
logRecord.setMessage(logRecord.getMessage() + "\n\n" + decoratedString + "\n\n");
}
}

stackTrace[i] = new StackTraceElement(elem.getClassLoaderName(), elem.getModuleName(),
elem.getModuleVersion(),
MessageFormat.UNDERLINE + MessageFormat.BOLD + elem.getClassName()
Expand Down Expand Up @@ -665,6 +693,24 @@ ConsoleCommandBuildItem logConsoleCommand() {
return new ConsoleCommandBuildItem(new LogCommand());
}

private Path getSourceRoot(ApplicationModel applicationModel, Path target) {
WorkspaceModule workspaceModule = applicationModel.getAppArtifact().getWorkspaceModule();
if (workspaceModule != null) {
return workspaceModule.getModuleDir().toPath().resolve(SRC_MAIN_JAVA);
}

if (target != null) {
var baseDir = target.getParent();
if (baseDir == null) {
baseDir = target;
}
return baseDir.resolve(SRC_MAIN_JAVA);
}
return Paths.get(SRC_MAIN_JAVA);
}

private static final String SRC_MAIN_JAVA = "src/main/java";

@GroupCommandDefinition(name = "log", description = "Logging Commands")
public static class LogCommand implements GroupCommand {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,15 @@ public void run() {
} finally {
stateLock.unlock();
}
if (currentApplication.isStarted()) {
//take a reliable reference before changing the application state:
final Application app = currentApplication;
if (app.isStarted()) {
// On CLI apps, SIGINT won't call io.quarkus.runtime.Application#stop(),
// making the awaitShutdown() below block the application termination process
// It should be a noop if called twice anyway
currentApplication.stop();
app.stop();
}
currentApplication.awaitShutdown();
app.awaitShutdown();
currentApplication = null;
System.out.flush();
System.err.flush();
Expand Down
Loading

0 comments on commit 165fccf

Please sign in to comment.