forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gradle: pass system properties as a parameter to QuarkusWorker
- Loading branch information
1 parent
43b68c1
commit 2227695
Showing
25 changed files
with
391 additions
and
2 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
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
28 changes: 28 additions & 0 deletions
28
...adle/src/main/resources/system-props-as-build-time-config-source/application/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,28 @@ | ||
plugins{ | ||
id "java" | ||
id "io.quarkus" | ||
} | ||
|
||
|
||
|
||
group 'io.quarkus.test.application' | ||
version '1.0-SNAPSHOT' | ||
|
||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") | ||
implementation 'io.quarkus:quarkus-resteasy-reactive' | ||
implementation ('org.acme.extensions:example-extension') | ||
|
||
testImplementation 'io.quarkus:quarkus-junit5' | ||
testImplementation 'io.rest-assured:rest-assured' | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} |
2 changes: 2 additions & 0 deletions
2
...src/main/resources/system-props-as-build-time-config-source/application/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 |
20 changes: 20 additions & 0 deletions
20
...e/src/main/resources/system-props-as-build-time-config-source/application/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,20 @@ | ||
pluginManagement { | ||
repositories { | ||
mavenLocal { | ||
content { | ||
includeGroupByRegex 'io.quarkus.*' | ||
} | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
//noinspection GroovyAssignabilityCheck | ||
plugins { | ||
id 'io.quarkus' version "${quarkusPluginVersion}" | ||
} | ||
} | ||
|
||
includeBuild('../extensions/example-extension'){ | ||
|
||
} | ||
rootProject.name='application' |
20 changes: 20 additions & 0 deletions
20
...d-time-config-source/application/src/integrationTest/java/org/acme/ExampleResourceIT.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,20 @@ | ||
package org.acme; | ||
|
||
import io.quarkus.test.junit.QuarkusIntegrationTest; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.CoreMatchers.is; | ||
|
||
@QuarkusIntegrationTest | ||
public class ExampleResourceIT { | ||
|
||
@Test | ||
public void testHelloEndpoint() { | ||
given() | ||
.when().get("/hello") | ||
.then() | ||
.statusCode(200) | ||
.body(is("hello cheburashka")); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...d-time-config-source/application/src/main/java/org/acme/quarkus/sample/HelloResource.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,22 @@ | ||
package org.acme.quarkus.sample; | ||
|
||
import jakarta.inject.Inject; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
import org.acme.example.extension.runtime.ExampleBuildOptions; | ||
|
||
@Path("/hello") | ||
public class HelloResource { | ||
|
||
@Inject | ||
ExampleBuildOptions buildOptions; | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String hello() { | ||
return "hello " + buildOptions.name; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ources/system-props-as-build-time-config-source/extensions/example-extension/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,34 @@ | ||
plugins{ | ||
id 'java-library' | ||
id 'maven-publish' | ||
} | ||
subprojects {subProject-> | ||
apply plugin: 'java-library' | ||
apply plugin: 'maven-publish' | ||
|
||
group 'org.acme.extensions' | ||
version '1.0-SNAPSHOT' | ||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
groupId = 'org.acme.extensions' | ||
artifactId = subProject.name | ||
version = '1.0-SNAPSHOT' | ||
from components.java | ||
} | ||
} | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
groupId = 'org.acme.extensions' | ||
artifactId = rootProject.name | ||
version = '1.0-SNAPSHOT' | ||
from components.java | ||
} | ||
} | ||
} | ||
group 'org.acme.extensions' | ||
version '1.0-SNAPSHOT' |
23 changes: 23 additions & 0 deletions
23
...em-props-as-build-time-config-source/extensions/example-extension/deployment/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 'java-library' | ||
} | ||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation platform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") | ||
annotationProcessor "io.quarkus:quarkus-extension-processor:${quarkusPlatformVersion}" | ||
|
||
|
||
api project(':example-extension') // why: https://quarkus.io/guides/building-my-first-extension | ||
implementation 'io.quarkus:quarkus-arc-deployment' | ||
} | ||
|
||
java { | ||
// withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
14 changes: 14 additions & 0 deletions
14
...tension/deployment/src/main/java/org/acme/example/extension/deployment/ExampleConfig.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.example.extension.deployment; | ||
|
||
import io.quarkus.runtime.annotations.ConfigItem; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
|
||
@ConfigRoot | ||
public class ExampleConfig { | ||
|
||
/** | ||
* name | ||
*/ | ||
@ConfigItem(defaultValue = "none") | ||
String name; | ||
} |
30 changes: 30 additions & 0 deletions
30
...sion/deployment/src/main/java/org/acme/example/extension/deployment/ExampleProcessor.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,30 @@ | ||
package org.acme.example.extension.deployment; | ||
|
||
import jakarta.inject.Singleton; | ||
|
||
import org.acme.example.extension.runtime.ExampleBuildOptions; | ||
import org.acme.example.extension.runtime.ExampleRecorder; | ||
import io.quarkus.arc.deployment.SyntheticBeanBuildItem; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.annotations.ExecutionTime; | ||
import io.quarkus.deployment.annotations.Record; | ||
import io.quarkus.deployment.builditem.FeatureBuildItem; | ||
|
||
class ExampleProcessor { | ||
|
||
private static final String FEATURE = "example"; | ||
|
||
@BuildStep | ||
FeatureBuildItem feature() { | ||
return new FeatureBuildItem(FEATURE); | ||
} | ||
|
||
@BuildStep | ||
@Record(ExecutionTime.STATIC_INIT) | ||
SyntheticBeanBuildItem syntheticBean(ExampleRecorder recorder, ExampleConfig config) { | ||
return SyntheticBeanBuildItem.configure(ExampleBuildOptions.class) | ||
.scope(Singleton.class) | ||
.runtimeValue(recorder.buildOptions(config.name)) | ||
.done(); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...s/system-props-as-build-time-config-source/extensions/example-extension/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 |
20 changes: 20 additions & 0 deletions
20
...ystem-props-as-build-time-config-source/extensions/example-extension/runtime/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,20 @@ | ||
|
||
plugins { | ||
id 'io.quarkus.extension' | ||
} | ||
|
||
quarkusExtension { | ||
deploymentModule = 'example-extension-deployment' | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation platform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") | ||
annotationProcessor "io.quarkus:quarkus-extension-processor:${quarkusPlatformVersion}" | ||
implementation 'io.quarkus:quarkus-arc' | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
...tension/runtime/src/main/java/org/acme/example/extension/runtime/ExampleBuildOptions.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,10 @@ | ||
package org.acme.example.extension.runtime; | ||
|
||
public class ExampleBuildOptions { | ||
|
||
public final String name; | ||
|
||
public ExampleBuildOptions(String name) { | ||
this.name = name; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...e-extension/runtime/src/main/java/org/acme/example/extension/runtime/ExampleRecorder.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,13 @@ | ||
package org.acme.example.extension.runtime; | ||
|
||
import io.quarkus.runtime.RuntimeValue; | ||
import io.quarkus.runtime.annotations.Recorder; | ||
|
||
@Recorder | ||
public class ExampleRecorder { | ||
|
||
public RuntimeValue<ExampleBuildOptions> buildOptions(String name) { | ||
System.out.println("ExampleRecorder.buildOptions " + name); | ||
return new RuntimeValue<>(new ExampleBuildOptions(name)); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...nsions/example-extension/runtime/src/main/resources/META-INF/quarkus-extension.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 @@ | ||
deployment-artifact=org.acme.extensions\:example-extension-deployment\:1.0 |
12 changes: 12 additions & 0 deletions
12
...e/extensions/example-extension/runtime/src/main/resources/META-INF/quarkus-extension.yaml
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,12 @@ | ||
--- | ||
name: Quarkus Example Extension | ||
artifact: ${project.groupId}:${project.artifactId}:${project.version} | ||
metadata: | ||
config: | ||
- "quarkus.example.extension." | ||
keywords: | ||
- "logzio" | ||
- "logging" | ||
categories: | ||
- "logging" | ||
description: "Quarkus example extension" |
Oops, something went wrong.