tools-build

seancorfield 2023-05-29T19:27:39.764409Z

I'm working on a tools.build "cookbook" as part of my http://clojure-doc.org work. Is https://clojure-doc.org/articles/cookbooks/cli_build_projects/ useful content? Is the list of topics (about halfway down, currently) a good range of things? Are there more topics you'd like covered? Is the introductory section explaining -X and -T too long/in the wrong place? General feedback? (in a thread here, or via https://github.com/clojure-doc/clojure-doc.github.io/discussions/46 on the website -- or via DM if you don't feel comfortable providing feedback in public)

practicalli-johnny 2023-05-30T07:00:17.172619Z

Very useful information, thank you. I wonder if this is two articles, one to introduce aliases and one to introduce tools.build? Combining the two seems useful for those new to the Clojure CLI, although there is a lot to scan if only interested in writing a build.clj file. An alternative approach would be a separate article on Clojure CLI aliases, covering clojure.main and clojure.exec in more detail, e.g https://practical.li/clojure/clojure-cli/defining-aliases/ I actually split aliases and Clojure CLI exec options into a separate page to cover them in more detail too, e.g https://practical.li/clojure/clojure-cli/execution-options/ Then include a reference to the clojure.main section as background reading in the tools.build page, helping to keep that article focused on one topic, e.g https://practical.li/clojure/clojure-cli/projects/tools-build/ As aliases are intrinsic to the development workflow, I believe it would be useful to have a separate page on Clojure CLI aliases in clojure-doc at some point, as a follow on from the Clojure CLI introduction on clojure-doc.

❤️ 1
seancorfield 2023-05-30T19:29:26.493069Z

> I wonder if this is two articles, one to introduce aliases and one to introduce tools.build? It's not intended to be about aliases so much as the whole concept of running a Clojure function from the command-line: -X and -T are very different from -A and -M, but I can see that I may have emphasized aliases too much in that initial section (`:ns-default` is really the only important part, since that's typically used for -T:build). I could certainly link to your articles for more about aliases and simplify my -X/`-T` introduction. I'm trying to make sure http://clojure-doc.org doesn't unnecessarily duplicate other sites' material (I've managed to delete a lot of old material that is now present on http://clojure.org, and I'm already deferring to some of your articles in other areas).

seancorfield 2023-05-30T19:30:51.597079Z

(great feedback -- added to the tools.build cookbook issue on clojure-doc's GH)

salam 2023-05-29T21:17:48.726799Z

Thanks for putting this together, Sean! I find it very helpful as I don’t have any real-world experience using tools.build and am thinking of migrating to it a project with a myriad of Makefiles, shell scripts, and CLJ files. I’m only partway through the article but I think I found a potential issue with the intro to the -X option. Is the use of the -X option marked in the screenshot supposed to have those two aliases (`api` and foo) that specify the default namespace and the function to execute?

1
seancorfield 2023-05-29T21:22:16.127179Z

Good catch! It was meant to be this: Or you can specify a default function to run in an alias:

;; deps.edn
{
 :aliases
 {
  :api {:ns-default my-proj.api
        :exec-fn my-proj.api/foo}
 }}
Now -X:api on its own will run that foo function:
clojure -X:api :bar 42

👍 1
seancorfield 2023-05-29T21:23:43.055749Z

(fixed & pushed -- the site should update within a few minutes)

🙌 1