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.
ajoberstar 2019-03-07T01:24:45.039600Z

FYI, patches attached to the ticket. This was a pretty shotgun approach of just putting everything in one commit, but I can break it apart if needed. The main thing at this point would be to identify whether the change to a PowerShell module approach is problematic or not. https://dev.clojure.org/jira/browse/TDEPS-67

ajoberstar 2019-03-07T01:25:16.040300Z

I'll take a look at the issue @seancorfield posted now, and see if there are any other updates that need to be made from comparing the linux script.

1
ajoberstar 2019-03-07T03:00:01.041200Z

An update has been pushed out to master on my ClojureTools repo and a new patch provided on the ticket. Will probably have some time this weekend to do some additional testing.

seancorfield 2019-03-07T03:18:17.042500Z

Just for a laugh, I tried to run one of our test suites from work via the PS version... and it passed! So that's using CLJ_CONFIG, and a mixture of artifacts from Maven, Clojars, and GitHub. Very nice @ajoberstar!

seancorfield 2019-03-07T03:26:48.044300Z

And then I started REBL from PS, with a Socket REPL open, and from WSL was able to rlwrap telnet 127.0.0.1 50505 and happily submit forms and values to REBL over my socket connection 🙂

seancorfield 2019-03-07T03:27:56.045400Z

So that tests local deps as well (both REBL as a local JAR and our dev subproject as a relative local path). I'll continue to bash on it a bit more but that looks very promising.

alexmiller 2019-03-07T12:57:58.046Z

nice! I am swamped today but hopefully I can look at it tomorrow

alexmiller 2019-03-07T13:55:44.046300Z

I don't know what "The main thing at this point would be to identify whether the change to a PowerShell module approach is problematic or not." means so hard for me to assess.

alexmiller 2019-03-07T13:56:06.046500Z

what are the tradeoffs?

timgilbert 2019-03-07T17:00:18.047500Z

I don't know much about PowerShell modules, but I assume one issue is that you need to Import-Module ClojureTools prior to using clj?

timgilbert 2019-03-07T17:03:43.048700Z

Also it's installed in a slightly unusual (to me) place: C:\Users\tim\Documents\WindowsPowerShell\Modules. Presumably that could be handled by an installer though.

timgilbert 2019-03-07T17:07:26.049800Z

...and I assume this would only be available in PowerShell, not cmd.exe (which I think is fine, personally, but other people may have different opinions)

timgilbert 2019-03-07T17:12:04.051500Z

I'm also not sure if there are implications on IDE integration, like if clojure is a PowerShell module I'm not certain whether IntelliJ on Windows can invoke it in the same way that it might invoke a clojure.bat file.

seancorfield 2019-03-07T17:29:16.053200Z

@timgilbert The install location "depends". On my laptop, it was in one place. On my desktop, it was another. Also, I needed to change the default security setting on my desktop in order to run the import, but not on my laptop. Good question about Windows programs that want to shell out to run clojure!

timgilbert 2019-03-07T17:31:58.055300Z

From a quick perusal of StackOverflow, it looks like an editor could invoke powershell.exe args, possibly one could do something like powershell.exe Import-Module ClojureTools && clojure -A:foo ... (or whatever the PS syntax is for that)

alexmiller 2019-03-07T18:06:57.055800Z

might be worth getting input from @cfleming

ajoberstar 2019-03-07T18:57:09.060600Z

@timgilbert The install location just needs to be anywhere on your module path. The Documents one is the standard per-user directory. There are locations under Program Files for system wide install. If it's in the module path, no Import-Module is needed

ajoberstar 2019-03-07T19:02:21.061800Z

But yeah, the main drawback is use from command prompt has the extra hoop of calling PowerShell.exe.

ajoberstar 2019-03-07T19:03:55.064300Z

Install location is also transparent if using Install-Module to grab from the PowerShell Gallery. Though Chocolatey or any other installer could copy it to the system modules directory without much trouble.

👍 1
alexmiller 2019-03-07T19:04:50.064700Z

is this the kind of thing you could paper over with a .bat?

alexmiller 2019-03-07T19:05:18.064900Z

or is that just gross?

timgilbert 2019-03-07T19:11:24.065900Z

I'm no expert, but I don't see why a .bat file couldn't just invoke powershell.exe clojure @args or what have you

seancorfield 2019-03-07T20:56:40.069100Z

You get a bunch of weird flashy stuff showing up in the cmd window as PowerShell searches for the commands but, yeah, the following works in cmd and should work in .bat:

X:\workspace\wsmain\clojure\lowlevel>powershell.exe $env:CLJ_CONFIG='..\versions' ; clojure -A:defaults:test-deps:test:runner

Running tests in #{"test"}
...
Ran 37 tests containing 118 assertions.
0 failures, 0 errors.

X:\workspace\wsmain\clojure\lowlevel>

alexmiller 2019-03-07T21:02:56.069300Z

"weird flashy stuff"