-
Notifications
You must be signed in to change notification settings - Fork 9
/
jdk.clj
30 lines (21 loc) · 845 Bytes
/
jdk.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(ns cider.enrich-classpath.jdk
(:require
[clojure.string :as string]))
(defn digits-str []
(->> "java.version" System/getProperty (re-seq #"\d+") (string/join)))
(defn jdk8? []
(boolean (re-find #"^1\.8\." (System/getProperty "java.version"))))
(def javac-tree "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED")
(def javac-code "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED")
(def javac-tree-opens (str "--add-opens=" javac-tree))
(def javac-code-opens (str "--add-opens=" javac-code))
(def javac-tree-like #{javac-tree javac-tree-opens})
(def javac-code-like #{javac-code javac-code-opens})
(defn maybe-add-opens [xs]
(cond-> xs
(and (not (jdk8?))
(not (some javac-tree-like xs)))
(conj javac-tree-opens)
(and (not (jdk8?))
(not (some javac-code-like xs)))
(conj javac-code-opens)))