Skip to content

Commit

Permalink
Merge pull request quarkusio#24881 from gsmet/2.8.1-backports-1
Browse files Browse the repository at this point in the history
2.8.1 backports 1
  • Loading branch information
gsmet authored Apr 12, 2022
2 parents 68fd9d1 + 393de9c commit 4681627
Show file tree
Hide file tree
Showing 123 changed files with 2,253 additions and 500 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci-actions-incremental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,12 @@ jobs:
java-version: 11,
os-name: "ubuntu-latest"
}
- {
name: "11 mvn 3.8.5",
java-version: 11,
os-name: "ubuntu-latest",
mvn-version: 3.8.5
}
- {
name: "11 Windows",
java-version: 11,
Expand All @@ -382,6 +388,11 @@ jobs:
with:
distribution: temurin
java-version: ${{ matrix.java.java-version }}
- name: Switch Maven version
if: "matrix.java.mvn-version != ''"
run: |
echo 'distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/${{matrix.java.mvn-version}}/apache-maven-${{matrix.java.mvn-version}}-bin.zip' >> .mvn/wrapper/maven-wrapper.properties
./mvnw -version
- name: Build
# Important: keep -pl ... in sync with "Calculate run flags"!
run: ./mvnw $COMMON_MAVEN_ARGS $JVM_TEST_MAVEN_ARGS install -pl 'integration-tests/maven'
Expand Down
43 changes: 12 additions & 31 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<smallrye-jwt.version>3.3.3</smallrye-jwt.version>
<smallrye-context-propagation.version>1.2.2</smallrye-context-propagation.version>
<smallrye-reactive-streams-operators.version>1.0.13</smallrye-reactive-streams-operators.version>
<smallrye-reactive-types-converter.version>2.6.0</smallrye-reactive-types-converter.version>
<smallrye-reactive-types-converter.version>2.7.0</smallrye-reactive-types-converter.version>
<smallrye-mutiny-vertx-binding.version>2.19.0</smallrye-mutiny-vertx-binding.version>
<smallrye-reactive-messaging.version>3.15.0</smallrye-reactive-messaging.version>
<smallrye-stork.version>1.1.0</smallrye-stork.version>
Expand Down Expand Up @@ -133,7 +133,7 @@
<junit.jupiter.version>5.8.2</junit.jupiter.version>
<junit-pioneer.version>1.5.0</junit-pioneer.version>
<testng.version>6.14.2</testng.version>
<infinispan.version>13.0.6.Final</infinispan.version>
<infinispan.version>13.0.8.Final</infinispan.version>
<infinispan.protostream.version>4.4.1.Final</infinispan.protostream.version>
<caffeine.version>2.9.3</caffeine.version>
<netty.version>4.1.74.Final</netty.version>
Expand All @@ -154,10 +154,10 @@
<kotlin.coroutine.version>1.6.0</kotlin.coroutine.version>
<kotlin-serialization.version>1.3.2</kotlin-serialization.version>
<dekorate.version>2.9.0</dekorate.version>
<maven-invoker.version>3.0.1</maven-invoker.version>
<maven-invoker.version>3.1.0</maven-invoker.version>
<awaitility.version>4.2.0</awaitility.version>
<jboss-logmanager.version>1.0.9</jboss-logmanager.version>
<flyway.version>8.5.4</flyway.version>
<flyway.version>8.5.7</flyway.version>
<yasson.version>1.0.11</yasson.version>
<liquibase.version>4.9.0</liquibase.version>
<snakeyaml.version>1.30</snakeyaml.version>
Expand All @@ -167,9 +167,9 @@
<proton-j.version>0.33.10</proton-j.version>
<okhttp.version>3.14.9</okhttp.version>
<hibernate-quarkus-local-cache.version>0.1.0</hibernate-quarkus-local-cache.version>
<kubernetes-client.version>5.12.1</kubernetes-client.version>
<kubernetes-client.version>5.12.2</kubernetes-client.version>
<flapdoodle.mongo.version>3.3.0</flapdoodle.mongo.version>
<quarkus-spring-api.version>5.2.SP4</quarkus-spring-api.version>
<quarkus-spring-api.version>5.2.SP6</quarkus-spring-api.version>
<quarkus-spring-data-api.version>2.1.SP2</quarkus-spring-data-api.version>
<quarkus-spring-security-api.version>5.3.Final</quarkus-spring-security-api.version>
<quarkus-spring-boot-api.version>2.1.SP1</quarkus-spring-boot-api.version>
Expand Down Expand Up @@ -2090,16 +2090,6 @@
<artifactId>quarkus-resteasy-reactive</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-kotlin-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-kotlin-common-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-kotlin</artifactId>
Expand Down Expand Up @@ -5038,6 +5028,12 @@
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-invoker</artifactId>
<version>${maven-invoker.version}</version>
<exclusions>
<exclusion>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
Expand Down Expand Up @@ -5521,16 +5517,6 @@
<artifactId>quarkus-hibernate-search-orm-elasticsearch-aws-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-amazon-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-amazon-common-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-amazon-dynamodb</artifactId>
Expand Down Expand Up @@ -5691,11 +5677,6 @@
<artifactId>quarkus-vault</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vault-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vault-deployment</artifactId>
Expand Down
1 change: 1 addition & 0 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<mssql.image>mcr.microsoft.com/mssql/server:2019-CU15-ubuntu-20.04</mssql.image>
<mysql.image>docker.io/mysql:8.0</mysql.image>
<oracle.image>docker.io/gvenzl/oracle-xe:21-slim</oracle.image>
<mongo.image>docker.io/mongo:4.4.13</mongo.image>

<!-- Align various dependencies that are not really part of the bom-->
<junit4.version>4.13.2</junit4.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ public void run() {
ResultHandle bootstrapBuilder = null;
if (bootstrapConfigSetupNeeded()) {
bootstrapBuilder = readBootstrapConfig.invokeStaticMethod(CU_CONFIG_BUILDER_WITH_ADD_DISCOVERED_AND_BOOTSRAP,
readBootstrapConfig.load(false), readBootstrapConfig.load(true), readBootstrapConfig.load(false),
readBootstrapConfig.load(true), readBootstrapConfig.load(true), readBootstrapConfig.load(false),
readBootstrapConfig.load(launchMode));
}

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

import io.quarkus.bootstrap.app.RunningQuarkusApplication;

/**
* SPI that can be used by extensions that need to run code in various phases of dev mode
*/
public interface DevModeListener {

int DEFAULT_ORDER = 0;

void afterFirstStart(RunningQuarkusApplication application);

void beforeShutdown();

/**
* Determines the order with which the listeners are executed. Classes with a lower order are executed
* first during start (the order is reverse for shutdown)
*/
default int order() {
return DEFAULT_ORDER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
Expand Down Expand Up @@ -81,6 +82,7 @@ public class IsolatedDevModeMain implements BiConsumer<CuratedApplication, Map<S
private Thread shutdownThread;
private final FSWatchUtil fsWatchUtil = new FSWatchUtil();
private static volatile ConsoleStateManager.ConsoleContext consoleContext;
private final List<DevModeListener> listeners = new ArrayList<>();

private synchronized void firstStart(QuarkusClassLoader deploymentClassLoader, List<CodeGenData> codeGens) {

Expand Down Expand Up @@ -145,6 +147,20 @@ public void accept(String args) {
RuntimeUpdatesProcessor.INSTANCE.setConfiguredInstrumentationEnabled(
runner.getConfigValue("quarkus.live-reload.instrumentation", Boolean.class).orElse(false));
firstStartCompleted = true;

for (DevModeListener listener : ServiceLoader.load(DevModeListener.class)) {
listeners.add(listener);
}
listeners.sort(Comparator.comparingInt(DevModeListener::order));

for (DevModeListener listener : ServiceLoader.load(DevModeListener.class)) {
try {
listener.afterFirstStart(runner);
} catch (Exception e) {
log.warn("Unable to invoke 'afterFirstStart' of " + listener.getClass(), e);
}
}

} catch (Throwable t) {
Throwable rootCause = t;
while (rootCause.getCause() != null) {
Expand Down Expand Up @@ -331,6 +347,15 @@ public void close() {
//don't attempt to restart in the exit code handler
restarting = true;
fsWatchUtil.shutdown();

for (int i = listeners.size() - 1; i >= 0; i--) {
try {
listeners.get(i).beforeShutdown();
} catch (Exception e) {
log.warn("Unable to invoke 'beforeShutdown' of " + listeners.get(i).getClass(), e);
}
}

try {
stop();
if (RuntimeUpdatesProcessor.INSTANCE == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.AbstractMap;
import java.util.Enumeration;
import java.util.Map;
import java.util.Scanner;
import java.util.jar.JarFile;

import org.jboss.logging.Logger;

Expand Down Expand Up @@ -103,20 +101,22 @@ private Map.Entry<URL, Boolean> getBanner(BannerConfig config) throws IOExceptio
}
}

private boolean isQuarkusCoreBanner(URL url) throws IOException {
protected boolean isQuarkusCoreBanner(URL url) {
if (!"jar".equals(url.getProtocol())) {
return false;
}

String thisClassName = this.getClass().getName();
String jarPath = url.getPath().substring(0, url.getPath().lastIndexOf('!'));

// We determine whether the banner is the default by checking to see if the jar that contains it also
// contains this class. This way although somewhat complicated guarantees that any rename of artifacts
// won't affect the check
try (JarFile jarFile = new JarFile(Paths.get(new URI(jarPath)).toFile())) {
return jarFile.getJarEntry(thisClassName.replace('.', '/') + ".class") != null;
} catch (URISyntaxException e) {
try {
return ClassPathUtils.processAsPath(url, p -> {
// We determine whether the banner is the default by checking to see if the jar that contains it also
// contains this class. This way although somewhat complicated guarantees that any rename of artifacts
// won't affect the check
Path resolved = p.resolve("/" + thisClassName.replace('.', '/') + ".class");
return Files.exists(resolved);
});
} catch (UncheckedIOException ex) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package io.quarkus.deployment.pkg.steps;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

import org.junit.jupiter.api.Test;

import io.quarkus.deployment.steps.BannerProcessor;
import io.quarkus.fs.util.ZipUtils;

public class BannerProcessorTest {

class MyBannerProcessor extends BannerProcessor {
public boolean test(Path path) throws Exception {
return this.isQuarkusCoreBanner(path.toUri().toURL());
}
}

@Test
public void checkQuarkusCoreBannerOnFilesystemWithSpecialCharacters() throws Exception {
MyBannerProcessor processor = new MyBannerProcessor();

assertFalse(processor.test(Paths.get("tmp", "Descărcări", "test", "something!")));

final Path tmpDir = Files.createTempDirectory("Descărcări");
final Path zipPath = tmpDir.resolve("BannerProcessorTest.jar");

try {
try (FileSystem ignored = ZipUtils.newZip(zipPath)) {
}

try (FileSystem fs = ZipUtils.newFileSystem(zipPath)) {
assertFalse(processor.test(fs.getPath("/")));
}

try (final FileSystem fs = ZipUtils.newFileSystem(zipPath)) {
Path classFile = fs.getPath(MyBannerProcessor.class.getName().replace('.', '/') + ".class");
Files.createDirectories(classFile.getParent());
Files.write(classFile, "".getBytes(StandardCharsets.UTF_8));
}

try (FileSystem fs = ZipUtils.newFileSystem(zipPath)) {
assertTrue(processor.test(fs.getPath("/")));
}
} finally {
Files.deleteIfExists(zipPath);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,12 @@ public static SmallRyeConfigBuilder configBuilder(final boolean runTime, final b
if (launchMode.isDevOrTest() && (runTime || bootstrap)) {
builder.withSources(new RuntimeOverrideConfigSource(classLoader));
}
if (runTime) {
if (runTime || bootstrap) {
builder.addDefaultSources();
builder.withDefaultValue(UUID_KEY, UUID.randomUUID().toString());
builder.withSources(new DotEnvConfigSourceProvider());
builder.withSources(
new PropertiesConfigSource(loadRuntimeDefaultValues(), "Runtime Defaults", Integer.MIN_VALUE + 50));
} else {
List<ConfigSource> sources = new ArrayList<>();
sources.addAll(classPathSources(META_INF_MICROPROFILE_CONFIG_PROPERTIES, classLoader));
Expand All @@ -121,10 +123,6 @@ public static SmallRyeConfigBuilder configBuilder(final boolean runTime, final b
if (addDiscovered) {
builder.addDiscoveredSources();
}
if (runTime || bootstrap) {
Map<String, String> runtimeDefaults = loadRuntimeDefaultValues();
builder.withSources(new PropertiesConfigSource(runtimeDefaults, "Runtime Defaults", Integer.MIN_VALUE + 50));
}
return builder;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public static <T> Level getLogLevel(String categoryName, Map<String, T> categori
T categoryConfig = categories.get(categoryName);
if (categoryConfig != null) {
final InheritableLevel inheritableLevel = levelExtractor.apply(categoryConfig);
if (!inheritableLevel.isInherited()) {
if (inheritableLevel != null && !inheritableLevel.isInherited()) {
return inheritableLevel.getLevel();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.quarkus.cli.create;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import io.quarkus.cli.common.OutputOptionMixin;
import io.quarkus.devtools.project.BuildTool;
Expand All @@ -17,13 +17,13 @@ public class TargetLanguageGroup {

static class VersionCandidates extends ArrayList<String> {
VersionCandidates() {
super(List.copyOf(CreateProjectHelper.JAVA_VERSIONS_LTS));
super(CreateProjectHelper.JAVA_VERSIONS_LTS.stream().map(String::valueOf).collect(Collectors.toList()));
}
}

@CommandLine.Option(names = {
"--java" }, description = "Target Java version.\n Valid values: ${COMPLETION-CANDIDATES}", completionCandidates = VersionCandidates.class, defaultValue = CreateProjectHelper.DEFAULT_JAVA_VERSION)
String javaVersion = CreateProjectHelper.DEFAULT_JAVA_VERSION;
"--java" }, description = "Target Java version.\n Valid values: ${COMPLETION-CANDIDATES}", completionCandidates = VersionCandidates.class, defaultValue = CreateProjectHelper.DETECT_JAVA_RUNTIME_VERSION)
String javaVersion = CreateProjectHelper.DETECT_JAVA_RUNTIME_VERSION;

@CommandLine.Option(names = { "--kotlin" }, description = "Use Kotlin")
boolean kotlin = false;
Expand Down
Loading

0 comments on commit 4681627

Please sign in to comment.