Move build.clj to src/
This commit is contained in:
parent
629903b801
commit
5250191dc1
|
@ -16,8 +16,10 @@ let
|
|||
|
||||
'';
|
||||
|
||||
pthru = o: builtins.trace o o;
|
||||
|
||||
java-compile = ns:
|
||||
''java -cp .:${classpath} clojure.main -e "(compile ${ns})"'';
|
||||
''java -cp .:${./src}:${classpath} clojure.main -e "(compile ${ns})"'';
|
||||
head-or-null = lst: if (lst == [ ]) then null else head lst;
|
||||
matches-ext = ext: filename: type:
|
||||
(builtins.match ".+[.]${ext}$" filename) != null;
|
||||
|
@ -29,8 +31,7 @@ let
|
|||
(ext-files "clj"
|
||||
"${build-tools-src}/src/main/clojure/clojure/tools/build/tasks"));
|
||||
task-namespaces = map (ns: "'clojure.tools.build.tasks.${ns}") tasks;
|
||||
all-namespaces = [ "'clojure.tools.build.api" ] ++ task-namespaces;
|
||||
compile-code = concatStringsSep " " (map (ns: "(compile ns)") all-namespaces);
|
||||
all-namespaces = task-namespaces ++ [ "'clojure.tools.build.api" ];
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
name = full-name;
|
||||
|
@ -42,6 +43,7 @@ in stdenv.mkDerivation {
|
|||
HOME=.
|
||||
${concatStringsSep "\n" (map extract-jar dep-jars)}
|
||||
${concatStringsSep "\n" (map java-compile all-namespaces)}
|
||||
${java-compile "'build"}
|
||||
jar cmf ${manifest} ./out.jar -C . cljs cognitect com javax mozilla plugin.xml about.html clojure cognitect_aws_http.edn data_readers.cljc licenses org
|
||||
'';
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
inherit (gitignore.lib) gitignoreSource;
|
||||
};
|
||||
in {
|
||||
packages."${system}" = { inherit build-tools-jar; };
|
||||
defaultPackage."${system}" = self.packages."${system}".build-tools-jar;
|
||||
lib = {
|
||||
mkClojureLib = pkgs.callPackage ./mkClojureLib.nix {
|
||||
inherit build-tools-jar;
|
||||
inherit (to-edn.lib) toEDN;
|
||||
};
|
||||
mkClojureLib =
|
||||
pkgs.callPackage ./mkClojureLib.nix { inherit (to-edn.lib) toEDN; };
|
||||
};
|
||||
devShell."${system}" =
|
||||
pkgs.mkShell { buildInputs = with pkgs; [ clojure clj2nix ]; };
|
||||
|
|
|
@ -1,25 +1,20 @@
|
|||
{ lib, stdenv, callPackage, clojure, jre, build-tools-jar, writeTextDir
|
||||
, writeShellScript, toEDN }:
|
||||
{ src, name, group, version, clj-deps, src-paths }:
|
||||
{ lib, stdenv, callPackage, clojure, jre, writeTextDir, writeShellScript, toEDN
|
||||
}:
|
||||
{ src, name, group, version, clj-deps, src-paths, build-tools-jar, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
|
||||
pthru = o: builtins.trace o o;
|
||||
|
||||
build-tools-edn = pthru (toEDN {
|
||||
build-tools-deps = writeTextDir "deps.edn" (toEDN {
|
||||
aliases.build = {
|
||||
ns-build = "'build";
|
||||
replace-deps."'io.github.clojure/tools.build"."local/root" =
|
||||
ns-default = "'build";
|
||||
extra-deps."'io.github.clojure/tools.build"."local/root" =
|
||||
"${build-tools-jar}";
|
||||
};
|
||||
});
|
||||
|
||||
build-tools-deps = writeTextDir "deps.edn" (pthru build-tools-edn);
|
||||
|
||||
classpath = clj-deps.makeClasspaths { };
|
||||
|
||||
full-name = "${group}-${name}-${version}-standalone.jar";
|
||||
full-name = "${name}-${version}-standalone.jar";
|
||||
|
||||
target = "$TEMP/target";
|
||||
|
||||
|
@ -28,27 +23,26 @@ let
|
|||
mkdir -p $HOME
|
||||
mkdir -p ${target}
|
||||
|
||||
clojure \
|
||||
-Scp .:${build-tools-jar}:${classpath} \
|
||||
-Sdeps ${builtins.trace build-tools-deps build-tools-deps} \
|
||||
-X:build \
|
||||
clojure \
|
||||
-Scp .:${build-tools-jar}:${classpath} \
|
||||
-Sdeps ${build-tools-deps} \
|
||||
-X:build \
|
||||
lib-uberjar \
|
||||
:project ${group}/${name} \
|
||||
:version ${version} \
|
||||
:srcs ${concatStringsSep "," src-paths} \
|
||||
:target ${target}
|
||||
:project ${group}/${name} \
|
||||
:version ${version} \
|
||||
:src-dirs ${concatStringsSep "," src-paths} \
|
||||
:target ${target}
|
||||
'';
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
name = name;
|
||||
name = full-name;
|
||||
|
||||
src = src;
|
||||
|
||||
nativeBuildInputs = [ clojure jre ];
|
||||
buildInputs = (map (x: x.paths) clj-deps.packages);
|
||||
|
||||
buildPhase = let script-call = "${build-script}";
|
||||
in builtins.trace script-call script-call;
|
||||
buildPhase = builtins.trace "${build-script}" "${build-script}";
|
||||
|
||||
installPhase = ''
|
||||
mv ${target}/${name}-${version}-standalone.jar $out
|
||||
|
|
Loading…
Reference in New Issue