This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-28
Channels
- # announcements (2)
- # aws (21)
- # babashka (4)
- # babashka-sci-dev (17)
- # beginners (3)
- # cider (16)
- # clj-kondo (61)
- # clojure (122)
- # clojure-europe (11)
- # clojure-spec (3)
- # clojurescript (2)
- # conjure (19)
- # helix (9)
- # hyperfiddle (2)
- # inf-clojure (18)
- # lsp (12)
- # off-topic (15)
- # react (2)
- # releases (1)
- # shadow-cljs (40)
- # spacemacs (4)
- # tools-deps (5)
- # vim (15)
How do I include non clj files from an external lib. Specifically the cognitect aws lib depends on service.edn files. I made an intermediate library that depends on com.cognitect.aws/redshift-data
If you depend on a lib, anything in it will be on the classpath and loadable as a resource
But not sure if that's what you're asking
(ns lambdaisland.classpath.watch-deps
"Watch deps.edn for changes"
(:require [clojure.java.classpath :as cp]
[clojure.string :as str]
[clojure.tools.deps.alpha :as deps]
[lambdaisland.classpath :as licp]
[nextjournal.beholder :as beholder]))
(def watcher (atom nil))
(defn- on-event [opts {:keys [type path]}]
(when (and (= :modify type)
;; On Mac the path will be absolute and include the watched dir,
;; e.g. `/Users/x/project/./deps.edn`
;; On other systems it seems to be relative, like `./deps.edn`
(str/ends-with? (str path) "./deps.edn"))
(println "✨ Reloading deps.edn ✨")
(let [new-paths (remove (set (map str (cp/system-classpath)))
(:classpath-roots (deps/create-basis opts)))]
(doseq [path new-paths]
(println "- " path))
(licp/install-priority-loader! new-paths))))
(defn start!
"Start a file system watcher to pick up changes in `deps.edn'
Options are passed on to tools.deps when creating the basis, you probably want
to at least put the `:aliases` you need in there.
(start! {:aliases [:dev :test]})
"
[opts]
(swap! watcher
(fn [w]
(when w
(println "Stopping existing `deps.edn' watcher")
(beholder/stop w))
(beholder/watch (partial on-event opts) "."))))
(defn stop!
"Stop a previously started watcher"
[opts]
(swap! watcher
(fn [w]
(when w
(beholder/stop w))
nil)))
(comment
(start! {:aliases [:dev]}))
there is something about how this tool works that made it so I ended up with the error
"could not find redshift-something.service.edn" on the classpath.
It worked when I started the program.
So I have libA depends on com.cognitect.aws/redshift-data
and programB depends on libA and ran into the error