diff --git a/.github/workflows/clojure.yml b/.github/workflows/clojure.yml index 2971fc1..94e392a 100644 --- a/.github/workflows/clojure.yml +++ b/.github/workflows/clojure.yml @@ -14,11 +14,16 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 - - name: Tools setup + - name: SDK Tools setup uses: jdx/mise-action@v2 with: install: true cache: true + - name: Native Image setup + run: | + echo "JAVA_HOME=$(mise where java)" >> $GITHUB_ENV + echo "GRAALVM_HOME=$(mise where java)" >> $GITHUB_ENV + gu install native-image - name: Run tests run: make test - name: Run clj-kondo linter @@ -28,5 +33,4 @@ jobs: - name: Run build app run: | printenv - gu install native-image - bin/build-native + make build-native diff --git a/Makefile b/Makefile index 3f42a4f..7ce2f1f 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,24 @@ build: clojure -X:jar :sync-pom true :jar "build/hierarchy.jar" build-native: build - bin/build-native + mkdir -p build/graalvm-config + clojure -X:uberjar :sync-pom false :jar "build/hierarchy-test-app.jar" + java -agentlib:native-image-agent=config-output-dir=build/graalvm-config -jar "build/hierarchy-test-app.jar" hierarchy.main + native-image -jar "build/hierarchy-test-app.jar" \ + "-H:+ReportExceptionStackTraces" \ + "-H:+JNI" \ + "-H:EnableURLProtocols=http,https,jar" \ + "-J-Dclojure.spec.skip-macros=true" \ + "-J-Dclojure.compiler.direct-linking=true" \ + "--report-unsupported-elements-at-runtime" \ + "--verbose" \ + "--no-fallback" \ + "--no-server" \ + "--allow-incomplete-classpath" \ + "--trace-object-instantiation=java.lang.Thread" \ + "--features=clj_easy.graal_build_time.InitClojureClasses" \ + "-H:ConfigurationFileDirectories=build/graalvm-config" \ + "build/hierarchy-test-app" deploy: clean build clojure -X:deploy-maven