From e3df3ef4504a14cc1cd0ce726e20a3270746783a Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 7 Jun 2024 17:23:27 +0200 Subject: [PATCH] add native to build --- build.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/build.py b/build.py index 5aaa49c..b14f1e5 100644 --- a/build.py +++ b/build.py @@ -108,6 +108,39 @@ def package_uberjar(project): ) +@task +def package_native(project): + run( + "mkdir -p target/graalvm", + shell=True, + check=True, + ) + run( + "native-image " + + "--native-image-info " + + "--report-unsupported-elements-at-runtime " + + "--no-server " + + "--no-fallback " + + "--features=clj_easy.graal_build_time.InitClojureClasses " + + f"-jar target/uberjar/{project.name}-standalone.jar " + + "-H:IncludeResources=.*.yaml " + + "-H:Log=registerResource:verbose " + + f"-H:Name=target/graalvm/{project.name}", + shell=True, + check=True, + ) + run( + f"sha256sum target/graalvm/{project.name} > target/graalvm/{project.name}.sha256", + shell=True, + check=True, + ) + run( + f"sha512sum target/graalvm/{project.name} > target/graalvm/{project.name}.sha512", + shell=True, + check=True, + ) + + @task def upload_clj(project): run("lein deploy", shell=True, check=True) @@ -127,6 +160,22 @@ def lint(project): ) +@task +def inst(project): + package_uberjar(project) + package_native(project) + run( + f"sudo install -m=755 target/uberjar/{project.name}-standalone.jar /usr/local/bin/{project.name}-standalone.jar", + shell=True, + check=True, + ) + run( + f"sudo install -m=755 target/graalvm/{project.name} /usr/local/bin/{project.name}", + shell=True, + check=True, + ) + + @task def patch(project): linttest(project, "PATCH")