Skip to content

Commit

Permalink
bump deps and add few type hints
Browse files Browse the repository at this point in the history
finally gets rid of most Java9 reflection warnings
  • Loading branch information
thheller committed Apr 28, 2018
1 parent 5b93cfe commit ebc3ad8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
12 changes: 5 additions & 7 deletions project.clj
Expand Up @@ -30,12 +30,12 @@
[org.clojure/data.json "0.2.6"]

[org.clojure/tools.logging "0.4.0"]
[org.clojure/tools.cli "0.3.5"]
[org.clojure/tools.cli "0.3.7"]
[org.clojure/tools.nrepl "0.2.13"]
[org.clojure/tools.reader "1.3.0-alpha3"]

[com.cognitect/transit-clj "0.8.300"]
[com.cognitect/transit-cljs "0.8.243"]
[com.cognitect/transit-clj "0.8.309"]
[com.cognitect/transit-cljs "0.8.256"]

[org.clojure/core.async "0.4.474"]

Expand All @@ -49,17 +49,15 @@
[thheller/shadow-util "0.7.0"]
[thheller/shadow-client "1.3.2"]

[io.undertow/undertow-core "2.0.1.Final"]
;; tools.deps won't include runtime deps properly
[org.jboss.xnio/xnio-nio "3.3.8.Final"]
[io.undertow/undertow-core "2.0.4.Final"]

[hiccup "1.0.5"]
[ring/ring-core "1.6.3"
:exclusions
;; used by cookie middleware which we don't use
[clj-time]]

[expound "0.5.0"]
[expound "0.6.0"]
[fipp "0.6.12"]

;; experimental
Expand Down
30 changes: 16 additions & 14 deletions src/main/shadow/build/classpath.clj
Expand Up @@ -22,11 +22,13 @@
(java.net URL)
(java.util.zip ZipException)
(shadow.build.closure ErrorCollector JsInspector)
[java.nio.file Paths]
[java.nio.file Paths Path]
[com.google.javascript.jscomp CompilerOptions$LanguageMode CompilerOptions SourceFile]
[com.google.javascript.jscomp.deps ModuleNames]
[javax.xml.parsers DocumentBuilderFactory]
))
[org.w3c.dom Node Element]))

(set! *warn-on-reflection* true)

(def CACHE-TIMESTAMP (util/resource-last-modified "shadow/build/classpath.clj"))

Expand Down Expand Up @@ -230,7 +232,7 @@
false
)))

(defn process-deps-cljs [cp source-path resources]
(defn process-deps-cljs [cp ^File source-path resources]
{:pre [(sequential? resources)
(util/file? source-path)]}

Expand Down Expand Up @@ -360,7 +362,7 @@
:externs extern-rcs}
))))

(defn pom-info-for-jar [file]
(defn pom-info-for-jar [^File file]
(when (.isFile file)
(let [pom-file (io/file
(.getParentFile file)
Expand All @@ -383,7 +385,7 @@
info {}]
(if (>= x (.getLength child-nodes))
info
(let [node (.item child-nodes x)]
(let [^Element node (.item child-nodes x)]
(recur
(inc x)
(case (.getNodeName node)
Expand Down Expand Up @@ -441,7 +443,7 @@
(doseq [x (get-classpath)]
(prn (pom-info-for-jar x))))

(defn find-jar-resources* [cp file]
(defn find-jar-resources* [cp ^File file]
(try
(let [jar-path
(.getCanonicalPath file)
Expand Down Expand Up @@ -539,7 +541,7 @@
(inspect-resources cp)))

(defn find-jar-resources
[{:keys [manifest-cache-dir] :as cp} jar-file]
[{:keys [manifest-cache-dir] :as cp} ^File jar-file]
(let [manifest-name
(str (.lastModified jar-file) "-" (.getName jar-file) ".manifest")

Expand Down Expand Up @@ -570,7 +572,7 @@
(cache/write-file mfile (assoc jar-contents ::CACHE-TIMESTAMP CACHE-TIMESTAMP))
jar-contents))))

(defn make-fs-resource [file name]
(defn make-fs-resource [^File file name]
(let [last-mod
(if (.exists file)
(.lastModified file)
Expand Down Expand Up @@ -606,7 +608,7 @@
(->> (find-fs-resources* cp root)
(process-root-contents cp root)))

(defn find-resources [cp file]
(defn find-resources [cp ^File file]
(if (util/is-jar? (.getName file))
(find-jar-resources cp file)
(find-fs-resources cp file)))
Expand All @@ -621,7 +623,7 @@
(let [{:keys [classpath-excludes]} @index-ref]
(->> (get-classpath)
(remove #(should-exclude-classpath classpath-excludes %))
(map #(.getCanonicalFile %))
(map #(.getCanonicalFile ^File %))
(into []))))

(defn index-rc-remove [index resource-name]
Expand Down Expand Up @@ -798,7 +800,7 @@
(let [dir-contents (find-resources index path)]
(index-path-merge index path dir-contents)))

(defn index-file-add [index source-path file]
(defn index-file-add [index ^File source-path ^File file]
(let [abs-file
(.getAbsoluteFile file)

Expand All @@ -823,7 +825,7 @@
(index-rc-merge index rc)
))))

(defn index-file-remove [index source-path file]
(defn index-file-remove [index source-path ^File file]
(let [abs-file (.getAbsoluteFile file)
resource-name (get-in index [:file->name abs-file])]
(if-not resource-name
Expand Down Expand Up @@ -935,7 +937,7 @@

(defn find-resource-by-file
"returns nil if file is not registered on the classpath"
[{:keys [index-ref] :as cp} file]
[{:keys [index-ref] :as cp} ^File file]
{:pre [(service? cp)
(util/is-file-instance? file)]}

Expand Down Expand Up @@ -1005,7 +1007,7 @@
)))

;; relative require "./foo.js" from another rc
([cp {:keys [resource-name] :as require-from} require]
([cp {:keys [resource-name] :as require-from} ^String require]
(when-not require-from
(throw (ex-info "relative requires only allowed in files" {:require require})))

Expand Down

0 comments on commit ebc3ad8

Please sign in to comment.