Try reverting to 0.6.8 again

This commit is contained in:
niten 2022-06-01 13:59:31 -07:00
parent 330fab4269
commit 5cb0123393
5 changed files with 59 additions and 50 deletions

View File

@ -71,27 +71,29 @@ in stdenv.mkDerivation {
${concatStringsSep "\n" (map extract-jar dep-jars)}
${concatStringsSep "\n"
(map (java-compile tools-classpath) tools-namespaces)}
${java-compile "" "'build"}
${java-compile tools-classpath "'build"}
jar cmf ${manifest} ./out.jar -C . ${
concatStringsSep " " [
"build"
"cljs"
"cognitect"
"com"
"javax"
"mozilla"
"plugin.xml"
"META-INF"
"about.html"
"build.clj"
"classes"
"cljs"
"clojure"
"cognitect"
"cognitect_aws_http.edn"
"com"
"data_readers.cljc"
"javax"
"licenses"
"mozilla"
"org"
"plugin.xml"
]
}
cat /tmp/*.edn
[ $? -eq 0 ] || /tmp/*.edn
'';
in pthru "${build-script}";
in "${build-script}";
installPhase = ''
cp out.jar $out

View File

@ -89,16 +89,16 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1645296114,
"narHash": "sha256-y53N7TyIkXsjMpOG7RhvqJFGDacLs9HlyHeSTBioqYU=",
"lastModified": 1654005557,
"narHash": "sha256-J6elwUzPoco+r5qWPHhvS2EHVWomUtNcxzkfdAQOwEU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "530a53dcbc9437363471167a5e4762c5fcfa34a1",
"rev": "08950a6e29cf7bddee466592eb790a417550f7f9",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-21.05",
"ref": "nixos-22.05",
"type": "indirect"
}
},

View File

@ -2,11 +2,11 @@
description = "clojure/tools.build packaged for NixOS.";
inputs = {
nixpkgs.url = "nixpkgs/nixos-21.05";
nixpkgs.url = "nixpkgs/nixos-22.05";
utils.url = "github:numtide/flake-utils";
clj2nix.url = "github:hlolli/clj2nix";
build-tools-src = {
url = "github:clojure/tools.build?tag=v0.8.2";
url = "github:clojure/tools.build?tag=v0.6.8";
flake = false;
};
gitignore = {
@ -22,7 +22,7 @@
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages."${system}";
build-tools-jar = pkgs.callPackage ./build.tools.nix {
version = "0.8.2";
version = "0.6.8";
inherit build-tools-src;
inherit (gitignore.lib) gitignoreSource;
};

View File

@ -1,19 +1,21 @@
{ lib, stdenv, callPackage, clojure, jre, writeTextDir, writeShellScript, toEDN
{ lib, stdenv, callPackage, clojure, jre, writeText, writeShellScript, toEDN }:
{ src, name, group, version, deps-edn, clj-deps, src-paths, build-tools-jar, ...
}:
{ src, name, group, version, clj-deps, src-paths, build-tools-jar, ... }:
with lib;
let
build-tools-deps = writeTextDir "deps.edn" (toEDN {
build-tools-deps = toEDN {
aliases.build = {
ns-default = "'build";
extra-deps."'io.github.clojure/tools.build"."local/root" =
"${build-tools-jar}";
''\"${build-tools-jar}\"'';
};
});
};
classpath = clj-deps.makeClasspaths { };
build-deps = callPackage ./deps.nix { };
build-classpath = build-deps.makeClasspaths { };
full-name = "${name}-${version}-standalone.jar";
target = "$TEMP/target";
@ -24,25 +26,31 @@ let
mkdir -p ${target}
clojure \
-Scp .:${build-tools-jar}:${classpath} \
-Sdeps ${build-tools-deps} \
-Scp ${build-classpath}:${classpath}:${build-tools-jar}:. \
-Sdeps "${build-tools-deps}" \
-X:build \
lib-uberjar \
build/lib-uberjar \
:project ${group}/${name} \
:version ${version} \
:src-dirs ${concatStringsSep "," src-paths} \
:target ${target}
:target '"${target}"' \
:deps-edn '"${deps-edn}"'
[ $? -eq 0 ] || cat /tmp/*.edn
'';
pthru = o: builtins.trace o o;
in stdenv.mkDerivation {
name = full-name;
src = src;
nativeBuildInputs = [ clojure jre ];
buildInputs = (map (x: x.paths) clj-deps.packages);
buildInputs = (map (x: x.paths) clj-deps.packages)
++ (map (x: x.paths) build-deps.packages);
buildPhase = "${build-script}";
buildPhase = pthru "${build-script}";
installPhase = ''
mv ${target}/${name}-${version}-standalone.jar $out

View File

@ -1,15 +1,12 @@
(ns build
(:require [clojure.tools.build.api :as b]))
(:require [clojure.tools.build.api :as b]
[clojure.string :as str]))
(defn make-class-dir [target] (format "%s/classes" target))
(def basis (b/create-basis {:project "deps.edn"}))
(defonce timestamp
(.format (java.time.LocalDateTime/now)
java.time.format.DateTimeFormatter/BASIC_ISO_DATE))
(defn make-basis [deps] (b/create-basis {:project deps}))
(defonce default-target "./target")
(defonce default-srcs ["src"])
(defonce default-srcs "src")
(defn make-jar-filename [target project version]
(format "%s/%s-%s.jar"
@ -25,43 +22,45 @@
params)
(defn lib-jar
[{:keys [project version target srcs]
:or {version timestamp
target default-target
[{:keys [project version target srcs deps-edn]
:or {target default-target
srcs default-srcs}
:as params}]
(let [project-sym (symbol project)
target-jar (make-jar-filename target project version)
class-dir (make-class-dir target)]
class-dir (make-class-dir target)
basis (make-basis deps-edn)
src-dirs (str/split srcs #",")]
(clean params)
(b/copy-dir {:src-dirs srcs})
(b/copy-dir {:src-dirs src-dirs})
(b/compile-clj {:basis basis
:src-dirs srcs
:src-dirs src-dirs
:class-dir class-dir})
(b/write-pom {:class-dir class-dir
:lib project-sym
:version version
:basis basis
:src-dirs srcs})
:src-dirs src-dirs})
(b/jar {:class-dir class-dir
:jar-file target-jar})
(println (format "jar file created at: %s" target-jar)))
params)
(defn lib-uberjar
[{:keys [project version target srcs]
:or {version timestamp
target default-target
[{:keys [project version target srcs deps-edn]
:or {target default-target
srcs default-srcs}
:as params}]
(let [project-sym (symbol project)
target-uber (jar-filename target project version)
class-dir (make-class-dir target)]
target-uber (make-uber-filename target project version)
class-dir (make-class-dir target)
basis (make-basis deps-edn)
src-dirs (str/split srcs #",")]
(clean params)
(b/copy-dir {:src-dirs srcs
(b/copy-dir {:src-dirs src-dirs
:target-dir class-dir})
(b/compile-clj {:basis basis
:src-dirs srcs
:src-dirs src-dirs
:class-dir class-dir})
(b/uber {:class-dir class-dir
:uber-file target-uber