mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 07:53:19 +00:00
clj-kondo: refactor and reduce closure size
Use the new `native-image.properties` to simplify build: https://github.com/clj-kondo/clj-kondo/pull/1373 Also link to `graalvm11-ce.lib` to reduce closure size: Before: ``` $ nix path-info -S ./result -h /nix/store/bc46ki5sj5abbdfsighvvvlk03qnzrp5-clj-kondo-2021.09.25 1.9G ``` After: ``` $ nix path-info -S ./result -h /nix/store/6mzk1f3j2j7lzzg378jl1g86p4pkz43z-clj-kondo-2021.09.25 74.1M ```
This commit is contained in:
parent
e7b3740842
commit
bc40a84b55
@ -4,12 +4,6 @@ stdenv.mkDerivation rec {
|
||||
pname = "clj-kondo";
|
||||
version = "2021.09.25";
|
||||
|
||||
reflectionJson = fetchurl {
|
||||
name = "reflection.json";
|
||||
url = "https://raw.githubusercontent.com/clj-kondo/${pname}/v${version}/reflection.json";
|
||||
sha256 = "sha256-C4QYk5lLienCHKnWXXZPcKmsCTMtIIkXOkvCrZfyIhA=";
|
||||
};
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/clj-kondo/${pname}/releases/download/v${version}/${pname}-${version}-standalone.jar";
|
||||
sha256 = "sha256-kS6bwsYH/cbjJlIeiDAy6QsAw+D1uHp26d4NBLfStjg=";
|
||||
@ -20,21 +14,21 @@ stdenv.mkDerivation rec {
|
||||
buildInputs = [ graalvm11-ce ];
|
||||
|
||||
buildPhase = ''
|
||||
native-image \
|
||||
-jar ${src} \
|
||||
-H:Name=clj-kondo \
|
||||
${lib.optionalString stdenv.isDarwin ''-H:-CheckToolchain''} \
|
||||
-H:+ReportExceptionStackTraces \
|
||||
-J-Dclojure.spec.skip-macros=true \
|
||||
-J-Dclojure.compiler.direct-linking=true \
|
||||
"-H:IncludeResources=clj_kondo/impl/cache/built_in/.*" \
|
||||
-H:ReflectionConfigurationFiles=${reflectionJson} \
|
||||
--initialize-at-build-time \
|
||||
-H:Log=registerResource: \
|
||||
--verbose \
|
||||
--no-fallback \
|
||||
--no-server \
|
||||
"-J-Xmx3g"
|
||||
runHook preBuild
|
||||
|
||||
# https://github.com/clj-kondo/clj-kondo/blob/v2021.09.25/script/compile#L17-L21
|
||||
args=("-jar" "$src"
|
||||
"-H:CLibraryPath=${graalvm11-ce.lib}/lib"
|
||||
# Required to build babashka on darwin. Do not remove.
|
||||
"${lib.optionalString stdenv.isDarwin "-H:-CheckToolchain"}"
|
||||
"-H:+ReportExceptionStackTraces"
|
||||
"--verbose"
|
||||
"--no-fallback"
|
||||
"-J-Xmx3g")
|
||||
|
||||
native-image ''${args[@]}
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
@ -47,6 +41,6 @@ stdenv.mkDerivation rec {
|
||||
homepage = "https://github.com/clj-kondo/clj-kondo";
|
||||
license = licenses.epl10;
|
||||
platforms = graalvm11-ce.meta.platforms;
|
||||
maintainers = with maintainers; [ jlesquembre bandresen ];
|
||||
maintainers = with maintainers; [ jlesquembre bandresen thiagokokada ];
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user