clj-on-windows

For those interested in making clj on Windows https://dev.clojure.org/jira/browse/TDEPS-67. Also see https://github.com/littleli/scoop-clojure.
littleli 2020-09-25T19:25:39.003Z

Clojure v1.10.1.697 (stable) landed at scoop bucket.

1
seancorfield 2020-09-25T19:26:02.003600Z

That was fast!

alexmiller 2020-09-25T19:27:29.003800Z

nice!

alexmiller 2020-09-25T19:27:54.004300Z

I actually tested this one about 100x more on windows than I have previously so hoping I didn't miss something

alexmiller 2020-09-25T19:28:18.005Z

(thank you AWS workspaces...)

borkdude 2020-09-25T19:30:02.005300Z

Looks like I've got some work to do for deps.clj :)

alexmiller 2020-09-25T19:32:13.005800Z

yeah, feel free to ping me if questions. there are a lot of changes

alexmiller 2020-09-25T19:32:27.006100Z

I actually meant to ping you prior and I forgot :)

borkdude 2020-09-25T19:33:09.006800Z

I think I'll just diff the bash script I based the port on against the newest and then just start porting those. I think it's just a few command line options and then bump tools jar, done

alexmiller 2020-09-25T19:34:52.007700Z

the command parsing changed a bit and the interface into the clojure bits has also drifted a bit (although I ended up putting a lot of stuff back for -R and -C - removing those had slimmed it down)

alexmiller 2020-09-25T19:35:04.008100Z

also, there is a new exec.jar that gets included in the classpath for -X

alexmiller 2020-09-25T19:35:31.008400Z

so that changes the install

borkdude 2020-09-25T19:36:54.008700Z

Thanks for the heads up.

borkdude 2020-09-25T19:40:20.009100Z

👀

alexmiller 2020-09-25T19:54:20.009500Z

yeah

alexmiller 2020-09-25T19:54:57.009800Z

it's not as bad as it looks :)

borkdude 2020-09-25T20:18:16.010600Z

I thought something changed about -A, but this still works:

$ cat ~/.clojure/deps.edn | grep depot
           :depot {:extra-deps {olical/depot {:mvn/version "RELEASE"}}
                   :main-opts ["-m" "depot.outdated.main"]}
clj -A:depot
Is there a blog article that lays out the breaking changes?

alexmiller 2020-09-25T20:18:39.010900Z

there aren't many now

alexmiller 2020-09-25T20:19:24.011800Z

-T, -O, -Sresolve-tags were all removed, so those are breaking changes

alexmiller 2020-09-25T20:19:45.012400Z

-R and -C both still do exactly what they did before (but warn)

borkdude 2020-09-25T20:20:00.013Z

nice!

alexmiller 2020-09-25T20:20:28.013400Z

-A is still the same but will warn if you supply :main-opts

borkdude 2020-09-25T20:20:58.014400Z

I didn't see a warning with clj -A:depot though, or did you mean command line args?

alexmiller 2020-09-25T20:21:14.014800Z

no, I meant an alias that has :main-opts

borkdude 2020-09-25T20:21:42.015500Z

ah, hmm. old clojure on the path somewhere I guess..

$ clojure -Sdescribe
{:version "1.10.1.561"

borkdude 2020-09-25T20:22:16.016Z

:s

borkdude@MBP2019 ~/Dropbox/dev/clojure/deps.clj (1.10.1.697*) $ brew uninstall clojure
Uninstalling /usr/local/Cellar/clojure/1.10.1.697... (10 files, 18.7MB)
borkdude@MBP2019 ~/Dropbox/dev/clojure/deps.clj (1.10.1.697*) $ which clojure
/usr/local/bin/clojure

alexmiller 2020-09-25T20:22:24.016200Z

-M does more than it used to (takes all args) so that could potentially surprise someone expecting to use it only for the :main-opts and not use the other parts of an alias

alexmiller 2020-09-25T20:23:06.017Z

if you've installed an @ release of clojure, you might need to explicitly uninstall those

seancorfield 2020-09-25T20:23:21.017600Z

What is the "official" way to pull in deps from an alias that includes :main-opts but start a REPL instead of running the :main-opts? Is that still -R?

alexmiller 2020-09-25T20:23:51.018100Z

you can do it with -R, but I would suggest just not doing this at all

alexmiller 2020-09-25T20:24:09.018400Z

break it into two aliases

seancorfield 2020-09-25T20:26:59.021200Z

It's very common to see recommendations for :test as an alias to include both :extra-paths ["test"] and :extra-deps <some test tool> :main-opts ["-m" "<run the tool>"] and it used to be that you could just use -R to pull in the test dependencies but start a REPL. Doing that now tells you -R is deprecated and to use -A for a REPL -- but if you use -A you don't get a REPL, it runs any :main-opts -- so I think that's going to confuse people.

seancorfield 2020-09-25T20:27:57.022Z

Hmm, I guess you needed -C there as well?

seancorfield 2020-09-25T20:30:34.023100Z

Yeah, that would need -C:test -R:test ... OK, I'll just crawl back into my hole ...

seancorfield 2020-09-25T20:32:59.024100Z

(I still think -R should have been expanded so it could be the REPL option but I know Rich doesn't agree so this will be the last time I mention it 🙂 )

alexmiller 2020-09-25T20:33:41.024300Z

"very common" == where?

seancorfield 2020-09-25T20:36:13.024900Z

Cognitect's test-runner -- which is where everyone else will copy it from: https://github.com/cognitect-labs/test-runner#usage

seancorfield 2020-09-25T20:37:06.025500Z

See also the :test alias here https://github.com/Olical/cljs-test-runner#usage

alexmiller 2020-09-25T20:37:08.025700Z

on my list of things to update :)

alexmiller 2020-09-25T20:38:13.026300Z

my impression of cljs-test-runner is that it's saying to use -A for main opts so that's not a case of above

alexmiller 2020-09-25T20:38:32.026600Z

you'll get the warning, it says to use -M, and that's what you want

borkdude 2020-09-25T20:42:12.028600Z

so tl;dr how can you pull :test alias deps? that's a pretty common thing for me to do (e.g. before hopping on a train)

seancorfield 2020-09-25T20:42:41.029100Z

I guess it finds tests to run by searching the filesystem (which I think Cognitect's test-runner does too). But both of those conflict with the :test alias in the system deps.edn which is where folks would normally get their :extra-paths ["test"] from so I guess it's really a bigger problem...

alexmiller 2020-09-25T20:43:12.029900Z

-P can be used with all other exec options to download deps, make classpath, but not execute (-P = prepare)

seancorfield 2020-09-25T20:43:15.030Z

Both of those runners should really use a different alias than :test I think.

alexmiller 2020-09-25T20:43:37.030200Z

why is that a conflict?

seancorfield 2020-09-25T20:45:15.031900Z

Well, the cljs-test-runner :test alias hides the system alias so that's probably a bad idea (since you can't start a REPL with your test folder on the path without doing something else).

alexmiller 2020-09-25T20:46:01.033Z

I don't understand why this is a problem

seancorfield 2020-09-25T20:46:25.033400Z

And the same goes for the Cognitect test-runner really: although it does have :extra-paths to pull in your test code, again you can't start a REPL with your test folder on the path -- unless you duplicate that path into a separate alias.

seancorfield 2020-09-25T20:47:03.033900Z

The conflict is between running the tool using :test and starting a REPL using :test.

seancorfield 2020-09-25T20:47:28.034600Z

(as you said: the solution is to separate the runner from the classpath/deps needed to run a REPL with tests)

alexmiller 2020-09-25T20:47:34.034700Z

those seem like two things

alexmiller 2020-09-25T20:47:39.034900Z

and you should have two aliases

seancorfield 2020-09-25T20:48:09.035800Z

Yes, we agree on that. I'm just saying that the two most common test runners for the CLI both do the wrong thing in their usage instructions.

borkdude 2020-09-25T20:48:10.035900Z

e.g. :clj/tests for running, :test for extra paths and extra deps?

alexmiller 2020-09-25T20:48:26.036300Z

well I can change one of those two things real easily :)

seancorfield 2020-09-25T20:48:47.037100Z

The separation has always been "best practice" but it has never mattered really until now.

alexmiller 2020-09-25T20:48:48.037200Z

personally, I'd rather have a :repl or :dev or something

alexmiller 2020-09-25T20:49:30.038300Z

I'd be pretty happy to just remove the built-in :test alias too

seancorfield 2020-09-25T20:50:10.039100Z

I think this also highlights the lack of composability of aliases -- because if you split stuff into multiple aliases you either have to duplicate stuff in deps.edn under multiple aliases or you have to specify multiple aliases on the command-line to combine those separate things.

alexmiller 2020-09-25T20:50:31.039500Z

I'm ok with both of those answers :)

alexmiller 2020-09-25T20:51:05.040500Z

but I wouldn't rule out some other way to combine things later

seancorfield 2020-09-25T20:51:35.041400Z

I've been doing -A:test:runner for ages by this point so I "don't care" -- and I got to that point simply because of these "issues" -- but some folks have been very vocal about wanting to just have a single alias that combines other aliases so... ¯\(ツ)/¯

borkdude 2020-09-25T20:51:54.041700Z

an alias can also be an arbitrary piece of data now right? can that be used to avoid duplication?

alexmiller 2020-09-25T20:52:07.041900Z

not currently

seancorfield 2020-09-25T20:52:23.042600Z

"data" != "another alias that is resolved"

alexmiller 2020-09-25T20:52:30.042800Z

that is, the clj aliases do not do that work right now

alexmiller 2020-09-25T20:52:43.043200Z

but they possibly could so that is something I'm thinking about

seancorfield 2020-09-25T20:53:41.044200Z

:aliases {:test {:compose [:test-deps :run-tests]} :test-deps {...} :run-tests {...}}

alexmiller 2020-09-25T20:54:38.044700Z

that's a lot heavier weight than what I'm thinking about :)

alexmiller 2020-09-25T20:55:56.046100Z

:aliases {:test #{#alias :test-deps #alias :run-tests} ...} 

seancorfield 2020-09-25T20:56:27.047Z

(I just noticed we're in #clj-on-windows and this probably should all be in #tools-deps 🙂 )

alexmiller 2020-09-25T20:56:34.047300Z

this is far from baked

borkdude 2020-09-25T20:56:50.047900Z

hm, reader tags... doesn't that go against: other tools should know as little as possible?

alexmiller 2020-09-25T20:57:10.048700Z

"this is far from baked"

seancorfield 2020-09-25T20:57:21.048900Z

Nice. Glad to know it's under consideration at this point. But you'd want to combine aliases in a specific order, right? (and sets are unordered)

alexmiller 2020-09-25T20:57:35.049200Z

"this is far from baked"

alexmiller 2020-09-25T20:58:06.050300Z

my point is, there are options

seancorfield 2020-09-25T20:58:09.050400Z

Hahaha... be careful... someone will make an alexmiller bot that just responds with that for any question! :rolling_on_the_floor_laughing:

borkdude 2020-09-25T21:01:06.052200Z

what's the use of having :run-tests standalone, since it will need the deps to run?

seancorfield 2020-09-25T21:01:38.052700Z

It would be the only alias that needs the test runner as a dependency.

seancorfield 2020-09-25T21:02:26.053700Z

Both "run a REPL with test code" and "run tests" need something that adds "test" to the path and any dependencies your tests themselves need (such as test.check, expectations...)

seancorfield 2020-09-25T21:05:08.056200Z

That's why I have :test (for the REPL stuff) and :runner (for the test runner dependency and :main-opts). But then I have to say -M:test:runner to run tests (which I'm OK with) but some people want to just say -M:run-tests have it combine the aliases under the hood, or at least have the :run-tests alias pull in the contents of the :test alias and then add the test runner stuff to it. Am I making sense @borkdude?

borkdude 2020-09-25T21:05:52.056500Z

This conversation reminds me of this tweet https://twitter.com/pjstadig/status/1138540715867365376

borkdude 2020-09-25T21:06:42.057500Z

yeah, it makes sense what you said

seancorfield 2020-09-25T21:06:59.057900Z

Yeah, it's all about where the composition is: inside the tool or on the surface. Leiningen composed "everything" inside, CLI makes you compose "everything" on the surface.

seancorfield 2020-09-25T21:07:28.058500Z

I can't tell whether Paul's tweet is praising CLI or criticizing it (text can be a horrible medium for intent).

borkdude 2020-09-25T21:08:15.059Z

some people wrap all these clojure invocations into little bash or Makefiles anyway

borkdude 2020-09-25T21:08:20.059200Z

so maybe it's not all that important from an ergonomic standpoint

seancorfield 2020-09-25T21:09:27.060100Z

We have a build shell script for that. But mostly it's for running a sequence of CLI commands across a sequence of directories (because: monorepo).

seancorfield 2020-09-25T21:09:53.060400Z

(it does have some composition shortcuts as well)

seancorfield 2020-09-25T21:10:24.060800Z

Anyways, I should stop shaving this yak and go back to working on HoneySQL 2.0...

alexmiller 2020-09-25T21:15:46.061Z

if only there was a snowflake maker

borkdude 2020-09-25T21:17:15.061300Z

:-D

borkdude 2020-09-25T21:17:38.061600Z

I'll have a stab at deps.clj this weekend. Thanks Alex for all the good work you do.

alexmiller 2020-09-25T21:17:55.061800Z

same to you all :)