4
4
(:require
5
5
[clojure.edn :as edn]
6
6
[clojure.java.io :as io]
7
- [clojure.java.javadoc :as javadoc]
8
7
[orchard.classpath :as cp]
9
- [orchard.java :as java]
10
8
[orchard.cljs.analysis :as cljs-ana]
11
9
[orchard.cljs.meta :as cljs-meta]
10
+ [orchard.java :as java]
12
11
[orchard.meta :as m]
13
- [orchard.misc :as u]))
12
+ [orchard.misc :as u]
13
+ [orchard.resource :as resource]))
14
14
15
15
(defn normalize-ns-meta
16
16
" Normalize cljs namespace metadata to look like a clj."
@@ -199,22 +199,6 @@ resolved (real) namespace and name here"}
199
199
[class member]
200
200
(java/member-info class member))
201
201
202
- (defn- resource-full-path [relative-path]
203
- (io/resource relative-path (cp/boot-aware-classloader )))
204
-
205
- (defn resource-path
206
- " If it's a resource, return a tuple of the relative path and the full resource path."
207
- [x]
208
- (or (if-let [full (resource-full-path x)]
209
- [x full])
210
- (if-let [[_ relative] (re-find #".*jar!/(.*)" x)]
211
- (if-let [full (resource-full-path relative)]
212
- [relative full]))
213
- ; ; handles load-file on jar resources from a cider buffer
214
- (if-let [[_ relative] (re-find #".*jar:(.*)" x)]
215
- (if-let [full (resource-full-path relative)]
216
- [relative full]))))
217
-
218
202
(defn file-path
219
203
" For a file path, return a URL to the file if it exists and does not
220
204
represent a form evaluated at the REPL."
@@ -227,7 +211,7 @@ resolved (real) namespace and name here"}
227
211
228
212
(defn file-info
229
213
[path]
230
- (let [[resource-relative resource-full] (resource-path path)]
214
+ (let [[resource-relative resource-full] (resource/resource -path-tuple path)]
231
215
(merge {:file (or (file-path path) resource-full path)}
232
216
; ; Classpath-relative path if possible
233
217
(if resource-relative
@@ -238,25 +222,4 @@ resolved (real) namespace and name here"}
238
222
resources on the classpath; then use online javadoc content for core API
239
223
classes. If no source is available, return the relative path as is."
240
224
[^String path]
241
- {:javadoc
242
- (or (resource-full-path path)
243
- ; ; [bug#308] `*remote-javadocs*` is outdated WRT Java
244
- ; ; 8, so we try our own thing first.
245
- (when (re-find #"^(java|javax|jdk|org.omg|org.w3c.dom|org.xml.sax)/" path)
246
- (apply str [" https://docs.oracle.com"
247
- (if (>= u/java-api-version 11 ) " /en/java/javase/" " /javase/" )
248
- u/java-api-version
249
- " /docs/api/"
250
- path]))
251
- ; ; If that didn't work, _then_ we fallback on `*remote-javadocs*`.
252
- (some (let [classname (.replaceAll path " /" " ." )]
253
- (fn [[prefix url]]
254
- (when (.startsWith classname prefix)
255
- (str url path))))
256
- @javadoc/*remote-javadocs*)
257
- path)})
258
-
259
- ; ; TODO: Seems those were hardcoded here accidentally - we should
260
- ; ; probably provide a simple API to register remote JavaDocs.
261
- (javadoc/add-remote-javadoc " com.amazonaws." " http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/" )
262
- (javadoc/add-remote-javadoc " org.apache.kafka." " https://kafka.apache.org/090/javadoc/index.html?" )
225
+ {:javadoc (java/resolve-javadoc-path path)})
0 commit comments