diff --git a/.editorconfig b/.editorconfig index 9cbbec2..7472642 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,5 +12,5 @@ trim_trailing_whitespace = true spaces_around_operators = true [*.json] -indent_size = 0 -indent_style = tab +indent_size = 1 +indent_style = space diff --git a/.github/workflows/native-image.yml b/.github/workflows/native-image.yml new file mode 100644 index 0000000..dd980f3 --- /dev/null +++ b/.github/workflows/native-image.yml @@ -0,0 +1,39 @@ +name: avaje-config native image + +on: + workflow_dispatch: + schedule: + - cron: '40 0 1 1 6' + +jobs: + build: + runs-on: ${{ matrix.os }} + permissions: + contents: read + packages: write + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + - uses: graalvm/setup-graalvm@v1 + with: + java-version: '21' + distribution: 'graalvm' + cache: 'maven' + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Versions + run: | + echo "GRAALVM_HOME: $GRAALVM_HOME" + echo "JAVA_HOME: $JAVA_HOME" + java --version + native-image --version + - name: Build with Maven + run: | + mvn clean install -DskipTests + cd tests/test-native-image + mvn clean package -Pnative + ./target/test-native diff --git a/avaje-config/src/main/resources/META-INF/native-image/io.avaje.config.avaje-config/resource-config.json b/avaje-config/src/main/resources/META-INF/native-image/io.avaje.config.avaje-config/resource-config.json index f82473b..a08b14e 100644 --- a/avaje-config/src/main/resources/META-INF/native-image/io.avaje.config.avaje-config/resource-config.json +++ b/avaje-config/src/main/resources/META-INF/native-image/io.avaje.config.avaje-config/resource-config.json @@ -1,13 +1,13 @@ { - "resources": [ - { - "pattern": "application.properties" - }, - { - "pattern": "application.yaml" - }, - { - "pattern": "application.yml" - } - ] + "resources": [ + { + "pattern": "application.properties" + }, + { + "pattern": "application.yaml" + }, + { + "pattern": "application.yml" + } + ] } diff --git a/pom.xml b/pom.xml index af859bc..96e9445 100644 --- a/pom.xml +++ b/pom.xml @@ -4,18 +4,31 @@ org.avaje java11-oss - 3.10 + 3.12 + io.avaje - avaje-config-reactor + tests-config-reactor 1 pom - avaje config reactor avaje-config + + + + + + + + + + + + + diff --git a/tests/pom.xml b/tests/pom.xml new file mode 100644 index 0000000..4fd2adb --- /dev/null +++ b/tests/pom.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + + org.avaje + java11-oss + 3.12 + + + + tests + pom + + + test-native-image + + + diff --git a/tests/test-native-image/pom.xml b/tests/test-native-image/pom.xml new file mode 100644 index 0000000..1b67342 --- /dev/null +++ b/tests/test-native-image/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + + org.example + test-native + 1.0-SNAPSHOT + + + 21 + UTF-8 + 0.9.27 + org.example.Main + + + + + io.avaje + avaje-config + 3.9-SNAPSHOT + + + + + + native + + + + org.graalvm.buildtools + native-maven-plugin + ${version.plugin.nativeimage} + + + build-native + + build + + package + + + --no-fallback + --allow-incomplete-classpath + + + + + + + + + + + diff --git a/tests/test-native-image/src/main/java/org/example/Main.java b/tests/test-native-image/src/main/java/org/example/Main.java new file mode 100644 index 0000000..5f1d31c --- /dev/null +++ b/tests/test-native-image/src/main/java/org/example/Main.java @@ -0,0 +1,11 @@ +package org.example; + +import io.avaje.config.Config; + +public class Main { + + public static void main(String[] args) { + String val = Config.get("hello.world", "not-set"); + System.out.println("Hello - " + val); + } +} diff --git a/tests/test-native-image/src/main/resources/application.properties b/tests/test-native-image/src/main/resources/application.properties new file mode 100644 index 0000000..942827f --- /dev/null +++ b/tests/test-native-image/src/main/resources/application.properties @@ -0,0 +1 @@ +hello.world=Rob