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.
Markus Gustavsson 2019-06-28T08:14:45.205100Z

What is the reasoning behind making the clj/clojure tool a PowerShell script instead of just a native application? It does not look like it does much so it should not be that much work to write it in C and that would integrate very much better with the system.

Markus Gustavsson 2019-06-28T08:15:46.205800Z

Did you not want to have to compile the program before providing it to users?

carkh 2019-06-28T13:37:13.206800Z

We've been having a bit of a debate on the subject recently =)

carkh 2019-06-28T13:37:43.207500Z

in the meantime, here is a tool that alleviates the poweshell induced troubles :

carkh 2019-06-28T13:37:44.207700Z

https://github.com/frericksm/clj-windows

carkh 2019-06-28T13:39:53.208500Z

Also sean advocates biting the bullet and launch your process with powershell, then maybe connect to it "remotely" from your editor

alexmiller 2019-06-28T13:41:29.209800Z

so far people have suggested that we rewrite it in python, ruby, javascript, bat, c, etc. it was written in powershell b/c that was a pretty close port from the original in bash, and there are a lot of benefits from maintaining two similar things.

carkh 2019-06-28T13:42:26.210400Z

@alexmiller you're aware of the troubles we're all having with it though ?

alexmiller 2019-06-28T13:43:01.211100Z

yes

carkh 2019-06-28T13:43:31.211800Z

i think that the language really does not matter

alexmiller 2019-06-28T13:43:59.212300Z

but creating a path that can be sustainably maintained is a critical dimension in the decision matrix

alexmiller 2019-06-28T13:45:00.213200Z

afaik, no one has actually spent the time to write down the issues, or the dimensions on which to compare things, or the options

alexmiller 2019-06-28T13:45:20.213700Z

without that, we just have a bag of ideas, not a means to make decisions

carkh 2019-06-28T13:45:30.214Z

i think they did !

alexmiller 2019-06-28T13:45:34.214300Z

where?

carkh 2019-06-28T13:45:50.214800Z

there is a jira thing about the quoting issues

alexmiller 2019-06-28T13:45:57.215100Z

that's one thing

carkh 2019-06-28T13:46:18.215800Z

then there is tooling not being able to call into powershell, and you ahve it all

alexmiller 2019-06-28T13:46:39.216100Z

the language really does matter, because ultimately, I'm the one that is going to be maintaining feature parity across these versions over time

carkh 2019-06-28T13:47:01.216400Z

you did the powershell script ?

alexmiller 2019-06-28T13:47:20.216800Z

some of it, yes, with help from others

carkh 2019-06-28T13:48:14.217900Z

here is my thoughts on that, powershell is really a wrapper for .net, all the services for powershell are available in .net, and .net is available on every windows computer

carkh 2019-06-28T13:48:35.218500Z

so any .net executable would allow for self-contained, always working solution

carkh 2019-06-28T13:49:39.219500Z

there is a plethora of languages to chose from there

carkh 2019-06-28T13:49:51.219900Z

even a clojrue !

alexmiller 2019-06-28T13:50:49.220800Z

one of the ideas of how clj is written is that there is essentially a clojure program to compute classpaths, and then it launches the clojure program you want to run. caching is used to avoid the first step if possible.

alexmiller 2019-06-28T13:51:18.221200Z

so, a key part of this idea is avoiding the first jvm launch if possible

carkh 2019-06-28T13:52:35.222400Z

right we're trying to avoid the "clojrue startup is slow" induced by lein

alexmiller 2019-06-28T13:52:41.222500Z

I don't know the tradeoffs (from a perf pov) in writing the actual tool itself in different languages

alexmiller 2019-06-28T13:53:07.223100Z

I do know that powershell seemed to be approximately similar to the use of bash in the *nix version of the tool

carkh 2019-06-28T13:53:45.223600Z

any startup time lost by starting .net would also be lost starting a powershell

alexmiller 2019-06-28T13:54:31.224200Z

I don't have any intuition about the truth of that assertion

carkh 2019-06-28T13:54:37.224400Z

but true enough, a c# solution wouldn't look anything like a bash script

carkh 2019-06-28T13:55:49.224900Z

well a commandlet (what the clj and clojure commands are) are .net programs

carkh 2019-06-28T13:56:08.225100Z

or classes really

alexmiller 2019-06-28T13:59:05.225800Z

here's what I need to move things forward:

alexmiller 2019-06-28T13:59:27.226300Z

1) a list of current issues (these could be tickets, could be other things)

alexmiller 2019-06-28T13:59:37.226600Z

2) a table with implementation options

alexmiller 2019-06-28T13:59:53.227Z

3) and dimensions along which to compare those implementations

alexmiller 2019-06-28T14:00:11.227400Z

4) cells in the table that evaluate each option on that dimension

alexmiller 2019-06-28T14:00:44.227900Z

For example, one option is powershell, another might be an implementation in C#

alexmiller 2019-06-28T14:01:45.229200Z

dimensions would be things like building, installation, maintenance, performance/ability to avoid the jvm startup, etc

alexmiller 2019-06-28T14:02:43.230200Z

I don't have time to make that table, nor the windows developer experience to adequately perform the evaluation

carkh 2019-06-28T14:03:09.230600Z

I'll take a copy of your requirements and get back to you during the next week

alexmiller 2019-06-28T14:04:44.231700Z

I'm open to this being a thing maintained primarily by the community too (although I think there are a lot of good reasons for us to build and release it)

carkh 2019-06-28T14:05:39.233500Z

makes sense that cognitect keeps the helm of course

lread 2019-06-28T14:07:32.234800Z

@carkh, for completeness, an option for the matrix would be stick with bash and have windows users use Git Bash.

carkh 2019-06-28T14:08:22.235300Z

@lee while i think that works and is perfectly fine, that's not self-contained

carkh 2019-06-28T14:09:10.236800Z

you have to think, newbie programmer deciding to try clojure being ready to go in 5 minutes

lread 2019-06-28T14:09:14.236900Z

agreed, but if you are building a matrix of options, good to include rationales of rejected options.

carkh 2019-06-28T14:09:23.237100Z

indeed

alexmiller 2019-06-28T14:09:36.237400Z

yes, please include

alexmiller 2019-06-28T14:10:03.237800Z

newbie programmer trying clojure is one dimension

alexmiller 2019-06-28T14:10:13.238Z

professional clojure programmer is another

alexmiller 2019-06-28T14:10:51.238300Z

they may not need the same answer

alexmiller 2019-06-28T14:12:25.240500Z

just as an aside, we go through this process of making tables of options and dimensions for pretty much every decision we do in Clojure (or Datomic)

lread 2019-06-28T14:12:44.240600Z

On my mind because I just fleshed out Git Bash support for cljs compiler scripts - it was not difficult

alexmiller 2019-06-28T14:13:13.241200Z

nothing has yet been rejected - the whole point of this is to give us a tool to make decisions

carkh 2019-06-28T14:13:25.241500Z

@alexmiller good process if not so hot on the velocity side of things =)

alexmiller 2019-06-28T14:13:44.241800Z

I have not found charging in the wrong direction to be good for velocity

carkh 2019-06-28T14:13:54.242Z

true enough

lread 2019-06-28T14:14:18.242500Z

a little up front thinking saves lots of time

lread 2019-06-28T14:18:17.242700Z

good point!

lread 2019-06-28T14:27:03.245800Z

@carkh, another option which should be included is reimplement launcher in scripting language of each supported shell: bash (including Git Bash), Command, PowerShell

lread 2019-06-28T14:28:14.246600Z

It’s nice to have an active Windows developer looking at this!

carkh 2019-06-28T14:34:28.247100Z

i'll add the option, though i think command batch processing is pretty bad at that

carkh 2019-06-28T14:35:32.248800Z

though back in the days, full featured installers were made with .bat files =)

lread 2019-06-28T14:35:33.249Z

probably right but worth including to weigh against other options and test assumptions

carkh 2019-06-28T14:36:44.250Z

oh god, slack prevents me from editing my messages, and all the typos are left for everyone to see !

😭 1
lread 2019-06-28T14:37:39.250800Z

I’m excellent at typos!

lread 2019-06-28T14:37:57.251100Z

I think your edit went through

carkh 2019-06-28T14:38:19.251400Z

pfiuh, i feel better now, thanks =)

1
carkh 2019-06-28T14:41:04.252Z

@lee with your git bash option, you're using the unix shell script ?

lread 2019-06-28T14:41:13.252200Z

yep

carkh 2019-06-28T14:41:35.252500Z

did it work out of the box ?

lread 2019-06-28T14:42:26.252800Z

included with https://gitforwindows.org/

carkh 2019-06-28T14:42:44.253600Z

i mean, the clojure shell script

lread 2019-06-28T14:43:39.254800Z

Ah.. that I have not tried. My work was on cljs compiler scripts which were written without git bash in mind.

lread 2019-06-28T14:44:00.255400Z

Really only minor tweaks were required.

carkh 2019-06-28T14:44:24.255600Z

ok

lread 2019-06-28T14:46:29.255800Z

https://clojure.atlassian.net/browse/CLJS-3098

carkh 2019-06-28T14:52:16.256300Z

that's so out of my realm...

lread 2019-06-28T15:05:54.258800Z

sorry, just trying to give you and idea of changes necessary to get bash scripts working under Git Bash… it wasn’t overwhelming, it mostly just came down to converting java classpath to windows path syntax

carkh 2019-06-28T15:07:44.259900Z

hey no worries ! interesting stuff

alexmiller 2019-06-28T15:25:20.260800Z

tools.deps uses the platform-aware calls inside the jdk when generating the classpath to use, but depending on your env under git bash, not sure what you'll get

alexmiller 2019-06-28T15:26:37.261600Z

the classpath to run tools.deps itself contains only the uberjar, so there are no separators used