This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-11
Channels
- # announcements (1)
- # asami (10)
- # aws (36)
- # babashka (1)
- # beginners (32)
- # biff (13)
- # calva (2)
- # cider (2)
- # clj-kondo (3)
- # cljs-dev (5)
- # clojure-poland (2)
- # clojured (5)
- # clojurescript (7)
- # core-logic (13)
- # core-matrix (2)
- # core-typed (1)
- # datomic (1)
- # fulcro (19)
- # gratitude (6)
- # meander (15)
- # minecraft (4)
- # pathom (3)
- # podcasts-discuss (2)
- # reagent (19)
- # releases (1)
- # shadow-cljs (69)
- # sql (3)
- # tools-deps (22)
- # vim (1)
I couldn't find whether this was discussed before, but it feels a bit odd that aliases cannot hint at their preferred call structure and that is a peculiarity the caller has to know about (i.e: -M
vs. -X
). I suppose this stems from the fact that there's only so much the large bash wrapper can figure out, right? Or let me rephrase: if there was a way for tools to hint at their preferred calling convention, would a clojure cli flag honoring that be considered?
Not sure I understand what the request is at the end
@U06V097TP The usual solution to this is to use a task manager thing like Makefile, or https://book.babashka.org/#tasks`bb.edn`
@U06V097TP An alias can contain both :main-opts
and :exec-fn
so its behavior depends on whether you use -X
or -M
. Generally tho', looking at the alias in deps.edn
tells you which usage it expects: :main-opts
implies -M
, :exec-fn
or :exec-args
or :ns-default
implies -X
. Given my first point, usage could not be inferred however.
If an alias contains :extra-deps
and :exec-fn
, you can still use it with -M
and it will bring in those deps but then expect you to provide main opts somewhere else, either via other aliases in combination or on the command-line.
Similarly, if an alias contains :extra-deps
and :main-opts
, you can still use it with -X
and it will bring in those deps but then expect you to provide exec opts somewhere else, either via other aliases in combination or on the command-line.
For a long time, my dot-clojure deps.edn
file had aliases with both :exec-fn
and :main-opts
so you could invoke certain tools with either -X
or -M
(and so you got to choose how to provide command-line arguments). And that's another reason why the tool can't decide for you: clojure -[X or M]:some-alias :arg '{:value 42}'
-- those arguments will be read as EDN and put into a hash map if you use -X
but they'll be treated as strings if you use -M
.
question - when I use create-basis
in tools.build to create a basis and pass it to pom
, it looks like that command adds org.clojure/clojure
to the pom. i THINK I don’t want to do this, but instead let the user specify their Clojure version — so
1. is that correct? and
2. what is the best way to prevent tools.build from adding this dep?
Clojure is defined as a dep in the root deps.edn. If you want to not include the root, you can pass :root nil
to create-basis
Whether you want to do that is hard for me to answer :)
You do need something to declare a dep on Clojure or you can't run Clojure programs
@U064X3EF3 I had been browsing and seen many library that didn’t declare the dep at all, which made me think folks have settled on providing clj and cljs scoped as "provided"
which is eminently reasonable (that is how it should be done ALWAYS for cljs I’d say). but an explicit Clojure dep makes sense too obviously, at the lowest version you can support
I think not specifying is a reasonable choice for libraries
but I understand the many reasons libs do specify one
the important thing is that ultimately some app is going to make the choice anyways
etaoin for example https://clojars.org/etaoin does not declare org.clojure/clojure as a dependency, but I don’t see an obvious spot where this is excluded: https://github.com/clj-commons/etaoin/blob/master/build.clj
Warning @sritchie09 that build.clj
is pretty new and has not been used for a real release yet!
As far as I understand it, I think the best practice is for a library to explicitly depend on the minimum Clojure version required for the lib.
https://clojars.org/rewrite-clj/versions/1.1.45.
An app writer will typically specify clojure as a dep overriding any library clojure deps.
@lee okay that makes sense! and in that case that is easy to manage