-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
421 additions
and
144 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
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,7 @@ | ||
{:include ["bin/jank/**/**.clj" | ||
"bin/jank/bb.edn" | ||
|
||
"compiler+runtime/bin/jank/**/*.clj" | ||
"compiler+runtime/bin/jank/bb.edn" | ||
"compiler+runtime/src/jank/**/*.jank" | ||
"compiler+runtime/test/jank/**/*.jank"]} |
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,2 @@ | ||
{:paths ["../" | ||
"../../compiler+runtime/bin"]} |
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,73 @@ | ||
#!/usr/bin/env bb | ||
|
||
(ns jank.test-everything | ||
(:require | ||
[jank.util :as util] | ||
[jank.compiler+runtime.core])) | ||
|
||
(defn show-env [] | ||
(util/log-info "JANK_BUILD_TYPE: " (System/getenv "JANK_BUILD_TYPE")) | ||
(util/log-info "JANK_LINT: " (System/getenv "JANK_LINT")) | ||
(util/log-info "JANK_CODECOV: " (System/getenv "JANK_CODECOV")) | ||
(util/log-info "JANK_ANALYZE: " (System/getenv "JANK_ANALYZE")) | ||
(util/log-info "JANK_SANITIZE: " (System/getenv "JANK_SANITIZE"))) | ||
|
||
(def os->deps-cmd {"Linux" "sudo apt-get install -y curl git git-lfs zip build-essential entr libssl-dev libdouble-conversion-dev pkg-config ninja-build cmake zlib1g-dev libffi-dev libzip-dev libbz2-dev doctest-dev libboost-all-dev gcc g++ libgc-dev" | ||
|
||
"Mac OS X" "brew install curl git git-lfs zip entr openssl double-conversion pkg-config ninja python cmake gnupg zlib doctest boost libzip lbzip2 llvm@19"}) | ||
|
||
(defmulti install-deps | ||
(fn [] | ||
(System/getProperty "os.name"))) | ||
|
||
(defmethod install-deps "Linux" [] | ||
(let [apt? (try | ||
(util/quiet-shell {} "which apt-get") | ||
true | ||
(catch Exception _e | ||
false))] | ||
(if-not apt? | ||
(util/log-warning "Skipping dependency install, since we don't have apt-get") | ||
(do | ||
; Install deps required for running our tests. | ||
(util/quiet-shell {} "sudo apt-get install -y default-jdk software-properties-common lsb-release npm lcov leiningen") | ||
(util/quiet-shell {} "sudo npm install --global @chrisoakman/standard-clojure-style") | ||
|
||
; Install jank's build deps. | ||
(util/quiet-shell {} (os->deps-cmd "Linux")) | ||
|
||
; Install Clang/LLVM. | ||
(util/quiet-shell {} "curl -L -O https://apt.llvm.org/llvm.sh") | ||
(util/quiet-shell {} "chmod +x llvm.sh") | ||
(util/quiet-shell {} (str "sudo ./llvm.sh " util/llvm-version " all")) | ||
; The libc++abi headers conflict with the system headers: | ||
; https://github.com/llvm/llvm-project/issues/121300 | ||
(util/quiet-shell {} (str "sudo apt-get remove -y libc++abi-" util/llvm-version "-dev")) | ||
|
||
; Install the new Clojure CLI. | ||
(util/quiet-shell {} "curl -L -O https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh") | ||
(util/quiet-shell {} "chmod +x linux-install.sh") | ||
(util/quiet-shell {} "sudo ./linux-install.sh"))))) | ||
|
||
(defmethod install-deps "Mac OS X" [] | ||
(util/quiet-shell {:extra-env {"HOMEBREW_NO_AUTO_UPDATE" "1"}} | ||
(os->deps-cmd "Mac OS X"))) | ||
|
||
(defn -main [{:keys [install-deps? validate-formatting? compiler+runtime]}] | ||
(util/log-boundary "Environment") | ||
(show-env) | ||
|
||
(util/log-boundary "Install dependencies") | ||
(if-not install-deps? | ||
(util/log-info "Not enabled") | ||
(util/with-elapsed-time duration | ||
(install-deps) | ||
(util/log-info-with-time duration "Dependencies installed"))) | ||
|
||
(jank.compiler+runtime.core/-main {:validate-formatting? validate-formatting? | ||
:build? (:build? compiler+runtime)})) | ||
|
||
(when (= *file* (System/getProperty "babashka.file")) | ||
(-main {:install-deps? (parse-boolean (or (System/getenv "JANK_INSTALL_DEPS") "true")) | ||
:validate-formatting? (parse-boolean (or (System/getenv "JANK_LINT") "true")) | ||
:compiler+runtime {:build? (some? (System/getenv "JANK_BUILD_TYPE"))}})) |
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,74 @@ | ||
(ns jank.util | ||
(:require | ||
[clojure.string] | ||
[babashka.fs :as b.f] | ||
[babashka.process :as b.p])) | ||
|
||
(def llvm-version 19) | ||
|
||
(defn log [& args] | ||
(println (apply str args))) | ||
|
||
(defn log-boundary [title] | ||
(log "\n──────────────── " title " ────────────────")) | ||
|
||
(defn log-step [title] | ||
(log "\n──── " title " ────")) | ||
|
||
(defn log-info [& args] | ||
(println "🛈 " (apply str args))) | ||
|
||
(defn log-info-with-time [time-ms & args] | ||
; TODO: Time formatting. | ||
(println "🛈 " (apply str args) (str "(" time-ms " ms)"))) | ||
|
||
(defn log-warning [& args] | ||
(println "⚠ " (apply str args))) | ||
|
||
(defn log-error [& args] | ||
(println "❌ " (apply str args))) | ||
|
||
(defn log-error-with-time [time-ms & args] | ||
; TODO: Time formatting. | ||
(println "❌ " (apply str args) (str "(" time-ms " ms)"))) | ||
|
||
(defn quiet-shell [props cmd] | ||
(let [proc @(b.p/process | ||
(merge {:out :string | ||
:err :out} | ||
props) | ||
cmd)] | ||
(if-not (zero? (:exit proc)) | ||
(do | ||
(log-error "Failed to run command " cmd) | ||
(log (:out proc)) | ||
(System/exit 1)) | ||
proc))) | ||
|
||
(defmacro with-elapsed-time | ||
[time-sym expr-to-time expr-with-time-sym] | ||
`(let [start# (. System (nanoTime)) | ||
ret# ~expr-to-time | ||
~time-sym (long (/ (double (- (. System (nanoTime)) start#)) 1000000.0))] | ||
~expr-with-time-sym)) | ||
|
||
(defn extract-llvm-tool-format-version [tool] | ||
(let [res (b.p/shell {:out :string | ||
:err :string} | ||
(str tool " --version")) | ||
major-version (->> (clojure.string/replace (clojure.string/trim (:out res)) #"\n" " ") | ||
(re-matches #".*version (\d+).*") | ||
second)] | ||
major-version)) | ||
|
||
(defn find-llvm-tool [tool] | ||
(loop [names [(str tool "-" llvm-version) tool]] | ||
(if (empty? names) | ||
(do | ||
(log-error "Unable to find a suitable " tool " for LLVM " llvm-version) | ||
(System/exit 1)) | ||
(let [found (b.f/which (first names))] | ||
(if (and (some? found) (= (str llvm-version) | ||
(extract-llvm-tool-format-version found))) | ||
(clojure.string/trim (str found)) | ||
(recur (rest names))))))) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.