mirror of
https://github.com/status-im/status-react.git
synced 2025-01-10 02:56:07 +00:00
Jakub Sokołowski
d1442b306a
Clojure dependencies require only JARs to work. Downloading POMs is both a waste of time, space, and bandwidth. In addition POMs create edge cases that we would have to handle, an would rather avoid. For example, the `guice` package which shows up in the classpath includes a JAR named `guice-4.2.2-no_aop.jar`. The issue with that is that there is no corresponding POM in the directory: https://repo1.maven.org/maven2/com/google/inject/guice/4.2.2/ Either we have to make a special case for such packages, or we can just skip POMs entirely and avoid the mess. Signed-off-by: Jakub Sokołowski <jakub@status.im>
45 lines
1.2 KiB
Nix
45 lines
1.2 KiB
Nix
{ stdenv, lib, fetchurl, writeShellScriptBin }:
|
|
|
|
let
|
|
inherit (lib)
|
|
removeSuffix optionalString splitString concatMapStrings
|
|
attrByPath attrValues last makeOverridable importJSON;
|
|
|
|
# load dependencies
|
|
deps = importJSON ./deps.json;
|
|
|
|
script = writeShellScriptBin "create-local-maven-repo" (''
|
|
mkdir -p $out
|
|
cd $out
|
|
'' +
|
|
(concatMapStrings (dep:
|
|
let
|
|
url = "${dep.host}/${dep.path}";
|
|
jar = {
|
|
sha1 = attrByPath [ "jar" "sha1" ] "" dep;
|
|
sha256 = attrByPath [ "jar" "sha256" ] "" dep;
|
|
};
|
|
jarFile = optionalString (jar.sha256 != "") (
|
|
fetchurl { url = "${url}.jar"; inherit (jar) sha256; }
|
|
);
|
|
fileName = last (splitString "/" dep.path);
|
|
directory = removeSuffix fileName dep.path;
|
|
in
|
|
''
|
|
mkdir -p ${directory}
|
|
|
|
${optionalString (jarFile != "") ''
|
|
ln -s "${jarFile}" "${dep.path}.jar"
|
|
''}
|
|
${optionalString (jar.sha1 != "") ''
|
|
echo "${jar.sha1}" > "${dep.path}.jar.sha1"
|
|
''}
|
|
'')
|
|
deps));
|
|
|
|
in makeOverridable stdenv.mkDerivation {
|
|
name = "status-mobile-clojure-deps";
|
|
phases = [ "buildPhase" ];
|
|
buildPhase = "${script}/bin/create-local-maven-repo";
|
|
}
|