-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36800 from snazy/gradle-plugin-unavailable-services
Quarkus code-gen (Gradle): Fix behavior to filter unavailable services
- Loading branch information
Showing
12 changed files
with
130 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
integration-tests/gradle/src/main/resources/custom-config-sources/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
plugins { | ||
id 'java' | ||
id 'io.quarkus' | ||
} | ||
|
||
repositories { | ||
mavenLocal { | ||
content { | ||
includeGroupByRegex 'io.quarkus.*' | ||
} | ||
} | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") | ||
implementation "io.quarkus:quarkus-grpc" // Need a `CodeGenProvider` on the class path for this test! | ||
compileOnly "io.smallrye.config:smallrye-config-core" | ||
} | ||
|
||
compileJava { | ||
options.compilerArgs << '-parameters' | ||
} |
2 changes: 2 additions & 0 deletions
2
integration-tests/gradle/src/main/resources/custom-config-sources/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
quarkusPlatformArtifactId=quarkus-bom | ||
quarkusPlatformGroupId=io.quarkus |
15 changes: 15 additions & 0 deletions
15
integration-tests/gradle/src/main/resources/custom-config-sources/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
pluginManagement { | ||
repositories { | ||
mavenLocal { | ||
content { | ||
includeGroupByRegex 'io.quarkus.*' | ||
} | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
plugins { | ||
id 'io.quarkus' version "${quarkusPluginVersion}" | ||
} | ||
} | ||
rootProject.name='custom-config-sources' |
35 changes: 35 additions & 0 deletions
35
...src/main/resources/custom-config-sources/src/main/java/org/acme/InMemoryConfigSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.acme; | ||
|
||
import org.eclipse.microprofile.config.spi.ConfigSource; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
public class InMemoryConfigSource implements ConfigSource { | ||
private static final Map<String, String> configuration = new HashMap<>(); | ||
|
||
static { | ||
configuration.put("my.prop", "1234"); | ||
} | ||
|
||
@Override | ||
public int getOrdinal() { | ||
return 275; | ||
} | ||
|
||
@Override | ||
public Set<String> getPropertyNames() { | ||
return configuration.keySet(); | ||
} | ||
|
||
@Override | ||
public String getValue(final String propertyName) { | ||
return configuration.get(propertyName); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return InMemoryConfigSource.class.getSimpleName(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...rc/main/resources/custom-config-sources/src/main/java/org/acme/MyConfigSourceFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.acme; | ||
|
||
import io.smallrye.config.ConfigSourceContext; | ||
import io.smallrye.config.ConfigSourceFactory; | ||
import org.eclipse.microprofile.config.spi.ConfigSource; | ||
|
||
import java.util.List; | ||
|
||
public class MyConfigSourceFactory implements ConfigSourceFactory { | ||
@Override | ||
public Iterable<ConfigSource> getConfigSources(ConfigSourceContext context) { | ||
return List.of(new InMemoryConfigSource()); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...onfig-sources/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.acme.MyConfigSourceFactory |
1 change: 1 addition & 0 deletions
1
...ces/src/main/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.acme.InMemoryConfigSource |
1 change: 1 addition & 0 deletions
1
...gradle/src/main/resources/custom-config-sources/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Need an empty application.properties to trigger config loading mandatory for CustomConfigSourcesTest |
19 changes: 19 additions & 0 deletions
19
integration-tests/gradle/src/test/java/io/quarkus/gradle/CustomConfigSourcesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.quarkus.gradle; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class CustomConfigSourcesTest extends QuarkusGradleWrapperTestBase { | ||
|
||
@Test | ||
public void testCustomConfigSources() throws Exception { | ||
var projectDir = getProjectDir("custom-config-sources"); | ||
|
||
// The test is successful, if the build works, see https://github.com/quarkusio/quarkus/issues/36716 | ||
runGradleWrapper(projectDir, "clean", "build", "--no-build-cache"); | ||
|
||
var p = projectDir.toPath().resolve("build").resolve("quarkus-app").resolve("quarkus-run.jar"); | ||
assertThat(p).exists(); | ||
} | ||
} |