nix: use symlinks for maven dependencies derivation
This should reduce the size of the derivation by >50%. Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
3ae5f87be3
commit
954e677f0c
|
@ -9,10 +9,9 @@ let
|
||||||
mavenSourceFiles =
|
mavenSourceFiles =
|
||||||
let
|
let
|
||||||
srcs = import ./maven-sources.nix { };
|
srcs = import ./maven-sources.nix { };
|
||||||
system = if stdenv.isDarwin then "osx" else "linux";
|
|
||||||
# Warning: This must be the same as gradlePluginVersion android/gradle.properties
|
# Warning: This must be the same as gradlePluginVersion android/gradle.properties
|
||||||
version = "3.5.3-5435860";
|
version = "3.5.3-5435860";
|
||||||
aapt2NativePkg = "https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/${version}/aapt2-${version}-${system}";
|
aapt2NativePkg = "https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/${version}/aapt2-${version}-linux";
|
||||||
in srcs // (if !stdenv.isLinux then { } else {
|
in srcs // (if !stdenv.isLinux then { } else {
|
||||||
# On Linux, we need to patch the interpreter in Java packages that contain native executables to use Nix's interpreter instead
|
# On Linux, we need to patch the interpreter in Java packages that contain native executables to use Nix's interpreter instead
|
||||||
"${aapt2NativePkg}" = srcs."${aapt2NativePkg}" // {
|
"${aapt2NativePkg}" = srcs."${aapt2NativePkg}" // {
|
||||||
|
|
|
@ -40,13 +40,13 @@ let
|
||||||
mkdir -p ${directory}
|
mkdir -p ${directory}
|
||||||
|
|
||||||
${optionalString (pom-download != "") ''
|
${optionalString (pom-download != "") ''
|
||||||
cp -f "${pom-download}" "${getPOM dep.path}"
|
ln -s "${pom-download}" "${getPOM dep.path}"
|
||||||
''}
|
''}
|
||||||
${optionalString (pom.sha1 != "") ''
|
${optionalString (pom.sha1 != "") ''
|
||||||
echo "${pom.sha1}" > "${getPOM dep.path}.sha1"
|
echo "${pom.sha1}" > "${getPOM dep.path}.sha1"
|
||||||
''}
|
''}
|
||||||
${optionalString (jar-download != "") ''
|
${optionalString (jar-download != "") ''
|
||||||
cp -f "${jar-download}" "${dep.path}.${dep.type}"
|
ln -s "${jar-download}" "${dep.path}.${dep.type}"
|
||||||
''}
|
''}
|
||||||
${optionalString (jar.sha1 != "") ''
|
${optionalString (jar.sha1 != "") ''
|
||||||
echo "${jar.sha1}" > "${dep.path}.${dep.type}.sha1"
|
echo "${jar.sha1}" > "${dep.path}.${dep.type}.sha1"
|
||||||
|
@ -54,6 +54,9 @@ let
|
||||||
|
|
||||||
${if dep.postCopy != "" then ''
|
${if dep.postCopy != "" then ''
|
||||||
depPath="$PWD/${dep.path}"
|
depPath="$PWD/${dep.path}"
|
||||||
|
# postCopy can't modify the jar if it's a symlink
|
||||||
|
rm "${dep.path}.${dep.type}"
|
||||||
|
cp "${jar-download}" "${dep.path}.${dep.type}"
|
||||||
${dep.postCopy}
|
${dep.postCopy}
|
||||||
unset depPath
|
unset depPath
|
||||||
'' else ""
|
'' else ""
|
||||||
|
|
Loading…
Reference in New Issue