Skip to content

Commit cf5fccc

Browse files
author
dnolen
committed
CLJS-865: remove cljs.js-deps/goog-resource hack
deps.js and base.js has been dropped from Closure 3rd party JAR for some time now
1 parent 31494aa commit cf5fccc

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/clj/cljs/closure.clj

+3-3
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ should contain the source for the given namespace name."
537537
(when (seq unprovided)
538538
(ana/warning :unprovided @env/*compiler* {:unprovided (sort unprovided)}))
539539
(cons
540-
(javascript-file nil (deps/goog-resource "goog/base.js") ["goog"] nil)
540+
(javascript-file nil (io/resource "goog/base.js") ["goog"] nil)
541541
(deps/dependency-order
542542
(concat
543543
(map
@@ -1140,8 +1140,8 @@ should contain the source for the given namespace name."
11401140
(write-javascript {} "goog.provide('demo');\nalert('hello');\n")
11411141
;; write something from a jar file to disk
11421142
(source-on-disk {}
1143-
{:url (deps/goog-resource "goog/base.js")
1144-
:source (with-open [reader (io/reader (deps/goog-resource "goog/base.js"))]
1143+
{:url (io/resource "goog/base.js")
1144+
:source (with-open [reader (io/reader (io/resource "goog/base.js"))]
11451145
(slurp reader))})
11461146
;; doesn't write a file that is already on disk
11471147
(source-on-disk {} {:url (io/resource "cljs/core.cljs")})

src/clj/cljs/js_deps.clj

+11-10
Original file line numberDiff line numberDiff line change
@@ -244,23 +244,24 @@ JavaScript library containing provide/require 'declarations'."
244244
(library-dependencies {:foreign-libs [{:file "cljs/nodejs_externs.js"
245245
:provides ["my.example"]}]}))
246246

247-
(defn goog-resource
248-
"Helper to disambiguate Google Closure Library resources from Google
249-
Closure Library Third Party resoures."
250-
[path]
251-
(first
252-
(filter
253-
(fn [res]
254-
(re-find #"(\/google-closure-library-0.0*|\/google-closure-library\/)" (.getPath ^URL res)))
255-
(enumeration-seq (.getResources (.getContextClassLoader (Thread/currentThread)) path)))))
247+
;; NO LONGER NEEDED, deps.js and base.js now removed from build
248+
;(defn goog-resource
249+
; "Helper to disambiguate Google Closure Library resources from Google
250+
; Closure Library Third Party resoures."
251+
; [path]
252+
; (first
253+
; (filter
254+
; (fn [res]
255+
; (re-find #"(\/google-closure-library-0.0*|\/google-closure-library\/)" (.getPath ^URL res)))
256+
; (enumeration-seq (.getResources (.getContextClassLoader (Thread/currentThread)) path)))))
256257

257258
(defn goog-dependencies*
258259
"Create an index of Google dependencies by namespace and file name."
259260
[]
260261
(letfn [(parse-list [s] (when (> (count s) 0)
261262
(-> (.substring ^String s 1 (dec (count s)))
262263
(string/split #"'\s*,\s*'"))))]
263-
(with-open [reader (io/reader (goog-resource "goog/deps.js"))]
264+
(with-open [reader (io/reader (io/resource "goog/deps.js"))]
264265
(->> (line-seq reader)
265266
(map #(re-matches #"^goog\.addDependency\(['\"](.*)['\"],\s*\[(.*)\],\s*\[(.*)\]\);.*" %))
266267
(remove nil?)

0 commit comments

Comments
 (0)