This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-06
Channels
- # adventofcode (10)
- # ai (2)
- # aleph (2)
- # announcements (21)
- # beginners (25)
- # calva (7)
- # cider (19)
- # clj-kondo (28)
- # clj-on-windows (3)
- # cljdoc (6)
- # clojure (80)
- # clojure-dev (15)
- # clojure-europe (29)
- # clojure-italy (3)
- # clojure-nl (37)
- # clojure-uk (4)
- # clojurescript (3)
- # cloverage (1)
- # conjure (6)
- # core-async (2)
- # cursive (17)
- # datalevin (9)
- # datomic (7)
- # deps-new (23)
- # emacs (4)
- # figwheel-main (6)
- # fulcro (6)
- # honeysql (19)
- # improve-getting-started (4)
- # inf-clojure (2)
- # introduce-yourself (5)
- # jobs (1)
- # leiningen (6)
- # lsp (73)
- # malli (1)
- # nrepl (2)
- # off-topic (37)
- # polylith (9)
- # quil (2)
- # reitit (16)
- # releases (2)
- # remote-jobs (6)
- # rewrite-clj (38)
- # shadow-cljs (1)
- # tools-build (1)
I'm wondering, would it be an idea to have the templates as a jar? So that instead of having the templates cloned locally, it can fetch and apply? Or perhaps, the templates can also be a pointer to a repo to clone and apply?
You can't have templates in a JAR.
tools.build requires files on a file system, not resources on the classpath
What I'm thinking about is sharing. If I go to the trouble of defining a new template, then it would be nice if the deps-new
tool could find those templates for me via some mechanism and clone the repo
(for copying)
Right now, I have to do clj-template/clj-template {:local/root "/home/david/development/clojure/clj-template"}}
, but would be nice if I could tell deps-new where to clone that repo out locally, then to apply all the goodness that it does
Read the deps-new
source. It doesn't currently do anything with fetching dependencies, it doesn't unpack anything.
I don't want to deal with unpacking JARs and maintaining a "cache" tree and staleness and all the other complexity that goes with that.
By sticking to local or git deps, t.d.a and the CLI deal with all that for me.
This is the entire extent of dealing with the classpath at the moment:
(let [poss-dir (->file template-sym)
edn-file (str poss-dir "/template.edn")
paths (str/split (System/getProperty "java.class.path")
(re-pattern (System/getProperty "path.separator")))]
(some #(let [file (io/file (str % "/" edn-file))]
(when (.exists file)
[(.getCanonicalPath (io/file (str % "/" poss-dir)))
(.getCanonicalPath file)]))
paths)))
clj-template/clj-template {:git/url ""
:git/sha "96f0cde2d4b6eab8fb39d0b01cb1d37857660088"}}
Yeah, I said git deps work.
The README does mention all of this (including the no JAR stuff): The COORDINATES could be something like {:local/root "/path/to/cool-lib"} for a template that exists on the local filesystem, or it could be based on :git/url/:git/sha etc for a template that exists in a git repository. Note: because deps-new is based on tools.build and uses its file copying functions, the template must ultimately live on the filesystem, so :local/root and git-based coordinates are supported, but Maven/Clojars coordinates are not.