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-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;
|
head-or-null = lst: if (lst == [ ]) then null else head lst;
|
||||||
matches-ext = ext: filename: type:
|
matches-ext = ext: filename: type:
|
||||||
(builtins.match ".+[.]${ext}$" filename) != null;
|
(builtins.match ".+[.]${ext}$" filename) != null;
|
||||||
|
@ -29,8 +31,7 @@ let
|
||||||
(ext-files "clj"
|
(ext-files "clj"
|
||||||
"${build-tools-src}/src/main/clojure/clojure/tools/build/tasks"));
|
"${build-tools-src}/src/main/clojure/clojure/tools/build/tasks"));
|
||||||
task-namespaces = map (ns: "'clojure.tools.build.tasks.${ns}") tasks;
|
task-namespaces = map (ns: "'clojure.tools.build.tasks.${ns}") tasks;
|
||||||
all-namespaces = [ "'clojure.tools.build.api" ] ++ task-namespaces;
|
all-namespaces = task-namespaces ++ [ "'clojure.tools.build.api" ];
|
||||||
compile-code = concatStringsSep " " (map (ns: "(compile ns)") all-namespaces);
|
|
||||||
|
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = full-name;
|
name = full-name;
|
||||||
|
@ -42,6 +43,7 @@ in stdenv.mkDerivation {
|
||||||
HOME=.
|
HOME=.
|
||||||
${concatStringsSep "\n" (map extract-jar dep-jars)}
|
${concatStringsSep "\n" (map extract-jar dep-jars)}
|
||||||
${concatStringsSep "\n" (map java-compile all-namespaces)}
|
${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
|
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;
|
inherit (gitignore.lib) gitignoreSource;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
packages."${system}" = { inherit build-tools-jar; };
|
||||||
|
defaultPackage."${system}" = self.packages."${system}".build-tools-jar;
|
||||||
lib = {
|
lib = {
|
||||||
mkClojureLib = pkgs.callPackage ./mkClojureLib.nix {
|
mkClojureLib =
|
||||||
inherit build-tools-jar;
|
pkgs.callPackage ./mkClojureLib.nix { inherit (to-edn.lib) toEDN; };
|
||||||
inherit (to-edn.lib) toEDN;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
devShell."${system}" =
|
devShell."${system}" =
|
||||||
pkgs.mkShell { buildInputs = with pkgs; [ clojure clj2nix ]; };
|
pkgs.mkShell { buildInputs = with pkgs; [ clojure clj2nix ]; };
|
||||||
|
|
|
@ -1,25 +1,20 @@
|
||||||
{ lib, stdenv, callPackage, clojure, jre, build-tools-jar, writeTextDir
|
{ lib, stdenv, callPackage, clojure, jre, writeTextDir, writeShellScript, toEDN
|
||||||
, writeShellScript, toEDN }:
|
}:
|
||||||
{ src, name, group, version, clj-deps, src-paths }:
|
{ src, name, group, version, clj-deps, src-paths, build-tools-jar, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
|
build-tools-deps = writeTextDir "deps.edn" (toEDN {
|
||||||
pthru = o: builtins.trace o o;
|
|
||||||
|
|
||||||
build-tools-edn = pthru (toEDN {
|
|
||||||
aliases.build = {
|
aliases.build = {
|
||||||
ns-build = "'build";
|
ns-default = "'build";
|
||||||
replace-deps."'io.github.clojure/tools.build"."local/root" =
|
extra-deps."'io.github.clojure/tools.build"."local/root" =
|
||||||
"${build-tools-jar}";
|
"${build-tools-jar}";
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
build-tools-deps = writeTextDir "deps.edn" (pthru build-tools-edn);
|
|
||||||
|
|
||||||
classpath = clj-deps.makeClasspaths { };
|
classpath = clj-deps.makeClasspaths { };
|
||||||
|
|
||||||
full-name = "${group}-${name}-${version}-standalone.jar";
|
full-name = "${name}-${version}-standalone.jar";
|
||||||
|
|
||||||
target = "$TEMP/target";
|
target = "$TEMP/target";
|
||||||
|
|
||||||
|
@ -28,27 +23,26 @@ let
|
||||||
mkdir -p $HOME
|
mkdir -p $HOME
|
||||||
mkdir -p ${target}
|
mkdir -p ${target}
|
||||||
|
|
||||||
clojure \
|
clojure \
|
||||||
-Scp .:${build-tools-jar}:${classpath} \
|
-Scp .:${build-tools-jar}:${classpath} \
|
||||||
-Sdeps ${builtins.trace build-tools-deps build-tools-deps} \
|
-Sdeps ${build-tools-deps} \
|
||||||
-X:build \
|
-X:build \
|
||||||
lib-uberjar \
|
lib-uberjar \
|
||||||
:project ${group}/${name} \
|
:project ${group}/${name} \
|
||||||
:version ${version} \
|
:version ${version} \
|
||||||
:srcs ${concatStringsSep "," src-paths} \
|
:src-dirs ${concatStringsSep "," src-paths} \
|
||||||
:target ${target}
|
:target ${target}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = name;
|
name = full-name;
|
||||||
|
|
||||||
src = src;
|
src = src;
|
||||||
|
|
||||||
nativeBuildInputs = [ clojure jre ];
|
nativeBuildInputs = [ clojure jre ];
|
||||||
buildInputs = (map (x: x.paths) clj-deps.packages);
|
buildInputs = (map (x: x.paths) clj-deps.packages);
|
||||||
|
|
||||||
buildPhase = let script-call = "${build-script}";
|
buildPhase = builtins.trace "${build-script}" "${build-script}";
|
||||||
in builtins.trace script-call script-call;
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mv ${target}/${name}-${version}-standalone.jar $out
|
mv ${target}/${name}-${version}-standalone.jar $out
|
||||||
|
|
Loading…
Reference in New Issue