-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: ikappaki <[email protected]>
- Loading branch information
Showing
12 changed files
with
107 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,7 @@ | |
/.clj-kondo/.cache | ||
/deps | ||
/deps.build_artifacts.txt | ||
|
||
# Emacs | ||
*~ | ||
\#*\# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,37 @@ | ||
{:paths ["resources"] | ||
{:paths ["resources" "bb"] | ||
|
||
:tasks | ||
{:requires [[babashka.deps :as deps] | ||
[babashka.process :as p]] | ||
[babashka.fs :as fs] | ||
[babashka.process :as p] | ||
[clojure.string :as str]] | ||
|
||
compile tasks/compile-native | ||
|
||
bump-version (load-file "script/bump_version.clj") | ||
changelog (load-file "script/changelog.clj") | ||
gen-script {:doc "Regen `./deps[.clj|.bat]` from `src/borkdude/deps.clj`." | ||
:task (load-file "script/gen_script.clj")} | ||
|
||
test {:doc "Run all tests." | ||
:task | ||
(doseq [args '[[-M:test] [-M -m borkdude.deps -M:test]]] | ||
(println :testing... 'clojure args) | ||
(-> (deps/clojure args) | ||
p/check) | ||
(println))}}} | ||
babashka-test {:doc "Run tests with bb calling to bb deps lib." | ||
:task (let [bb (str \" (.get (.command (.info (java.lang.ProcessHandle/current)))) \")] | ||
(p/shell {:extra-env {"DEPS_CLJ_TEST_ENV" "babashka"}} | ||
bb "-cp" (str/join fs/path-separator ["src" "test" "resources"]) | ||
"-e" "(require '[clojure.test :as t] '[borkdude.deps-test])" | ||
"-e" "(let [{:keys [:fail :error]} (t/run-tests 'borkdude.deps-test)] (System/exit (+ fail error)))"))} | ||
|
||
exe-test {:doc "Run tests with deps exec calling to deps exec." | ||
:task (p/shell {:extra-env {"DEPS_CLJ_TEST_ENV" "native"}} | ||
(if (fs/windows?) "./deps.exe" "./deps") "-M:test")} | ||
|
||
jvm-clj-test {:doc "Run tests with clojure calling to clojure deps lib." | ||
:task (-> (deps/clojure '[-M:test]) | ||
p/check)} | ||
jvm-deps-test {:doc "Run tests with clojure deps lib calling to clojure deps lib." | ||
:task (-> (deps/clojure '[-M -m borkdude.deps -M:test]) | ||
p/check)} | ||
jvm-test {:doc "Run both jvm-clj-test and jvm-deps-test." | ||
:task (doseq [task '[jvm-clj-test jvm-deps-test]] | ||
(println :running... task) | ||
(run task) | ||
(println))}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
(ns tasks | ||
(:require [babashka.fs :as fs] | ||
[babashka.process :as p])) | ||
|
||
(defn compile-native | ||
"Compile library to standalone jar and a native executable program. | ||
It requires both leiningen and graalvm to be installed. | ||
It expects to find the graalvm home path in the GRAALVM_HOME env | ||
var, while searches for leiningen first in cwd, and then, if not | ||
found, in PATH." | ||
[] | ||
(let [graalvm-home (or (System/getenv "GRAALVM_HOME") | ||
(throw (Exception. "Please set GRAALVM_HOME."))) | ||
java-home (str (fs/path graalvm-home "bin")) | ||
lein (let [lein (cond-> "./lein" (fs/windows?) (str ".bat"))] | ||
(str (or (if (fs/executable? lein) lein (fs/which "lein")) | ||
(throw (Exception. "Cannot find lein in the cwd or in PATH."))))) | ||
deps-clj-version (slurp "resources/DEPS_CLJ_VERSION")] | ||
(println "Building deps " deps-clj-version) | ||
(println :lein lein :graalvm-home graalvm-home :java-home java-home) | ||
(p/shell lein "deps.clj" "-Spath" "-Sdeps" "{:deps {borkdude/deps.clj {:mvn/version \"0.0.1\"}}}") | ||
(p/shell (str lein " with-profiles +native-image do clean, uberjar")) | ||
(let [native-image (str (fs/path graalvm-home "bin" | ||
(if (fs/windows?) "native-image.cmd" "native-image")))] | ||
(p/shell native-image "-jar" (format "target/deps.clj-%s-standalone.jar" deps-clj-version) | ||
"-H:Name=deps" | ||
"-H:+ReportExceptionStackTraces" | ||
"-J-Dclojure.spec.skip-macros=true" | ||
"-J-Dclojure.compiler.direct-linking=true" | ||
"-H:IncludeResources=DEPS_CLJ_VERSION" | ||
"--initialize-at-build-time" | ||
"-H:Log=registerResource:" | ||
"-H:EnableURLProtocols=http,https" | ||
"--enable-all-security-services" | ||
"--no-fallback" | ||
"--verbose" | ||
"--no-server" | ||
"-J-Xmx3g")) | ||
(p/shell lein "clean") | ||
(p/shell "./deps" "-Spath" "-Sdeps" "{:deps {borkdude/deps.clj {:mvn/version \"0.0.1\"}}}"))) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.