This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-21
Channels
- # announcements (1)
- # aws (18)
- # babashka (5)
- # beginners (72)
- # biff (2)
- # calva (38)
- # cider (2)
- # clj-commons (6)
- # clj-yaml (2)
- # clojars (7)
- # clojure (41)
- # clojure-austin (5)
- # clojure-europe (78)
- # clojure-nl (1)
- # clojure-norway (18)
- # clojure-uk (3)
- # clojurescript (13)
- # component (9)
- # cursive (37)
- # datahike (3)
- # datomic (7)
- # fulcro (7)
- # graphql (3)
- # holy-lambda (2)
- # honeysql (8)
- # introduce-yourself (1)
- # jobs (1)
- # kaocha (1)
- # leiningen (19)
- # lsp (104)
- # malli (5)
- # nbb (8)
- # off-topic (60)
- # polylith (22)
- # portal (2)
- # reagent (24)
- # reveal (1)
- # shadow-cljs (126)
- # test-check (11)
- # tools-build (39)
- # vim (23)
- # xtdb (10)
anyone using codox with tools.build? seems like it would need a way to inject the basis into it or just shell out from tools.build and run the deps.edn -X:codox alias. o/w it complains it can't find any of the project's namespaces on the classpath. anyone figured out anything better for that or similar libs?
You should be able to make a basis to do whatever you need?
I guess you’re trying to run it in the builds process?
Yeah, I tried calling codox/generate-docs
from my build.clj
. I hadn’t tried adding the paths to the build alias. I’ll give it a shot.
there's no magic here - you're just running a Clojure program with a classpath. If you need something additional on the classpath, just add it. :)
Yeah. I just would have thought it inherited the top-level paths if I didn’t override them in the alias
there's some extended info on this at https://clojure.org/guides/tools_build#_setup
"Tools executed with -T:an-alias
remove all project deps and paths, add "."
as a path, and include any other deps or paths as defined in :an-alias
."
In general, tool execution (-T) means "run a separate tool" and thus your project deps/paths are not included
gotcha. makes sense. thanks!
then it complains about not being able to find the top-level :deps
referenced in macros when codox tries to generate the docs
codox might just be a hard one to tool-ify w/o some modifications huh?
I’m not understanding that
You might need to add the :deps too
Yeah, me neither really. Just throwing macro expansion errors about not finding any libs I’m pulling in via top-level deps
As I said above, you don’t have your :deps when running a tool, unless you pull them in
Yeah I’ll just leave it as a process invocation for now
Maybe open an issue about accepting a basis in codox and see what they think
(Maybe I will, that is)
You could also give #C03EC4DD26S a "quick" try, it doesn't load the code but uses clj-kondo analysis (for better or worse!)
ah, cool. I'll check it out, thanks!
You could add the :paths to the build process alias but maybe you would want to shell out for isolation, not sure
Is accepting a tools.deps.alpha basis value the idiomatic way for libraries to work with tools.build programs? Or is there a better way to integrate? I've seen some that do accept that as an optional arg, but wondering if it's the best approach or not.
I think unhelpfully I will say it depends :)
for things that expect to be run in some classpath context, then probably no - you should define the context in which you're expecting to be run
I assume you mean something broader here than just "put everything you'll need into the build alias"?
makes me wonder if there'd be any benefit to a tools.build.api fn along the lines of clojure-command
or exec-alias
? perhaps there's not much to be gained beyond what you get with (b/process {:command-args ["clojure" "-X:foo" ...]})
we have a ticket for that already and eventually I'll get to it
oh, ok. great!
the issues outlined by Sean in the comments are tied up with other things and that's the main reason this doesn't exist yet
@U06FS3DLH We have a variant of the code from TBUILD-6 in our build.clj
at work and it's pretty nasty so I would say, for now, using the -M
style invocation for subprocesses is just so much easier.
I haven't looked at Codox but I get the impression it expects to be run in the project's context (classpath etc) rather than as a separate tool? Codox would need to accept args to specify deps.edn
files and aliases etc and then use t.d.a itself to build the basis and then walk all the code...
(which is why it's hard to run directly in-process in build.clj
right?)
yeah exactly
which works as Clojure dependency as well, although it doesn't really have a nice Clojure API:
(borkdude.deps/-main "-Sdeps" <deps-map>" "-M" "-e" ...)
for things that plan to shell out or manipulate basis information, then probably yes (or accept the same basis modifying parameters used throughout the :deps programs and pass those along to create-basis)