File tree Expand file tree Collapse file tree 8 files changed +26
-24
lines changed Expand file tree Collapse file tree 8 files changed +26
-24
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bb
2
2
3
3
(ns ci-unit-tests
4
- (:require [helper.env :as env]
5
- [helper.fs :as fs]
4
+ (:require [helper.fs :as fs]
6
5
[helper.main :as main]
6
+ [helper.os :as os]
7
7
[helper.shell :as shell]
8
8
[lread.status-line :as status]))
9
9
33
33
(shell/command " bb test-shadow-cljs" ))
34
34
35
35
(defn cljs-bootstrap-tests []
36
- (if (some #{(env /get-os )} '(:mac :unix ))
36
+ (if (some #{(os /get-os )} '(:mac :unix ))
37
37
(shell/command " bb test-cljs --env planck --optimizations none" )
38
38
(status/line :warn " skipping planck tests, they can only be run on linux and macOS" )) )
39
39
Original file line number Diff line number Diff line change 1
1
(ns helper.env
2
2
(:require [clojure.edn :as edn]
3
- [clojure.string :as string]
4
3
[helper.shell :as shell]
5
4
[lread.status-line :as status]
6
5
[version-clj.core :as ver]))
7
6
8
- (defn get-os []
9
- (let [os-name (string/lower-case (System/getProperty " os.name" ))]
10
- (condp re-find os-name
11
- #"win" :win
12
- #"mac" :mac
13
- #"(nix|nux|aix)" :unix
14
- #"sunos" :solaris
15
- :unknown )))
16
-
17
7
(defn- assert-clojure-min-version
18
8
" Asserts minimum version of Clojure version"
19
9
[]
Original file line number Diff line number Diff line change 1
1
(ns helper.graal
2
2
(:require [clojure.java.io :as io]
3
3
[clojure.string :as string]
4
- [helper.env :as env]
5
4
[helper.fs :as fs]
5
+ [helper.os :as os]
6
6
[helper.shell :as shell]
7
7
[lread.status-line :as status]))
8
8
12
12
(fs/at-path (str (io/file (System/getenv " GRAALVM_HOME" ) " bin" )) prog-name)))
13
13
14
14
(defn find-native-image-prog []
15
- (find-graal-prog (if (= :win (env /get-os )) " native-image.cmd" " native-image" )))
15
+ (find-graal-prog (if (= :win (os /get-os )) " native-image.cmd" " native-image" )))
16
16
17
17
(defn find-gu-prog []
18
- (find-graal-prog (if (= :win (env /get-os )) " gu.cmd" " gu" )))
18
+ (find-graal-prog (if (= :win (os /get-os )) " gu.cmd" " gu" )))
19
19
20
20
(defn- assert-min-native-image-version [native-image-exe]
21
21
(let [min-major 21
Original file line number Diff line number Diff line change
1
+ (ns helper.os
2
+ (:require [clojure.string :as string]))
3
+
4
+ (defn get-os []
5
+ (let [os-name (string/lower-case (System/getProperty " os.name" ))]
6
+ (condp re-find os-name
7
+ #"win" :win
8
+ #"mac" :mac
9
+ #"(nix|nux|aix)" :unix
10
+ #"sunos" :solaris
11
+ :unknown )))
Original file line number Diff line number Diff line change 11
11
(with-out-str (pprint/pprint cmd))))})
12
12
13
13
(defn command
14
- " Thin wrapper on babashka.tasks/shell that on error, prints status error message and exits."
14
+ " Thin wrapper on babashka.tasks/shell that on error, prints status error message and exits.
15
+ Automatically converts calls to clojure on Windows to call with powershell"
15
16
[cmd & args]
16
17
(let [[opts cmd args] (if (map? cmd)
17
18
[cmd (first args) (rest args)]
Original file line number Diff line number Diff line change 2
2
3
3
(ns test-native
4
4
(:require [clojure.java.io :as io]
5
- [helper.env :as env]
6
5
[helper.fs :as fs]
7
6
[helper.graal :as graal]
8
7
[helper.main :as main]
8
+ [helper.os :as os]
9
9
[helper.shell :as shell]
10
10
[lread.status-line :as status]))
11
11
@@ -37,7 +37,7 @@ Options:
37
37
native-image-xmx " 6g"
38
38
target-path " target"
39
39
target-exe " rewrite-clj-test"
40
- full-target-exe (str target-path " /" target-exe (when (= :win (env /get-os )) " .exe" ))]
40
+ full-target-exe (str target-path " /" target-exe (when (= :win (os /get-os )) " .exe" ))]
41
41
(status/line :head " Creating native image for test" )
42
42
(status/line :detail " java -version" )
43
43
(shell/command " java -version" )
Original file line number Diff line number Diff line change 2
2
3
3
(ns test-native-sci
4
4
(:require [clojure.java.io :as io]
5
- [helper.env :as env]
6
5
[helper.graal :as graal]
7
6
[helper.main :as main]
7
+ [helper.os :as os]
8
8
[helper.shell :as shell]
9
9
[lread.status-line :as status]))
10
10
@@ -45,7 +45,7 @@ Options:
45
45
graal-reflection-fname " target/native-image/reflection.json"
46
46
target-path " target"
47
47
target-exe " sci-test-rewrite-clj"
48
- full-target-exe (str target-path " /" target-exe (when (= :win (env /get-os )) " .exe" ))]
48
+ full-target-exe (str target-path " /" target-exe (when (= :win (os /get-os )) " .exe" ))]
49
49
(status/line :head " Creating native image for testing via sci" )
50
50
(status/line :detail " java -version" )
51
51
(shell/command " java -version" )
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bb
2
2
3
3
(ns test-shadow-cljs
4
- (:require [helper.env :as env ]
5
- [helper.main :as main ]
4
+ (:require [helper.main :as main ]
5
+ [helper.os :as os ]
6
6
[helper.shell :as shell]
7
7
[lread.status-line :as status]))
8
8
12
12
(defn -main [& args]
13
13
(when (main/doc-arg-opt args)
14
14
(status/line :head " testing ClojureScript source with Shadow CLJS, node, optimizations: none" )
15
- (shell/command (if (= :win (env /get-os )) " npx.cmd" " npx" )
15
+ (shell/command (if (= :win (os /get-os )) " npx.cmd" " npx" )
16
16
" shadow-cljs" " compile" " test" )
17
17
(shell/command " node" compiled-tests))
18
18
nil )
You can’t perform that action at this time.
0 commit comments