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.
miridius 2019-04-03T11:39:22.019300Z

Hi all, I just installed and tried out CLJ for windows and wanted to give some constructive criticism: 1. The instructions don't work as written, permission errors are not solved by running Set-ExecutionPolicy RemoteSigned -Scope CurrentUser as that only allows locally created scripts to run -- not those from the internet. I solved it by running Set-ExecutionPolicy Unrestricted -Scope Process before running the install script (using a scope of Process means the settings will revert when you close the powershell window). 2. Having the clj and clojure commands only available from PowerShell is a fairly poor user experience imo. It means I can't run them from Cmder, git bash, cmd.exe itself, or any of the other shells on windows that I (and probably many people) actually use. I saw @seancorfield's suggestion to add a clj.cmd and clojure.cmd to the PATH which both simply run powershell clj, which is a good idea and I think if we're really gonna stick with a PS script then this should be done as part of the install. 3. Having to use PowerShell to do the install was a bit annoying, only a miner gripe of course but still not the best UX

alexmiller 2019-04-03T11:44:17.021200Z

Iā€™m not interested in adding python to the mix here

šŸ‘ 3
miridius 2019-04-03T11:45:26.021500Z

You'd rather maintain 2 separate tools?

miridius 2019-04-03T11:53:02.024500Z

The idea is that you'd replace both the bash and PS scripts with Python, so you'd be reducing the number of languages in the mix šŸ˜‰ And python is not the only option, for example there's also Node (perhaps written in cljs even), though I'm not sure you can compile Node scripts to standalone binaries. But yeah regardless, it's only a suggestion; it's just what I would do personally (and might still do for my own personal use :)).

seancorfield 2019-04-03T11:57:36.027100Z

@miridius it's very important that the installer can be run on any system with no dependencies (except the JVM). Does Windows ship with Python pre-installed?

miridius 2019-04-03T11:58:40.027200Z

No it does not, but you don't need it. You can build Python scripts into standalone binaries that include the Python runtime (and any other imports) so they will run with 0 dependencies

miridius 2019-04-03T11:59:02.027400Z

http://www.pyinstaller.org/

seancorfield 2019-04-03T12:03:23.027800Z

Interesting option.

2019-04-03T14:18:50.029500Z

Does pyinstaller create cmd files on Windows and sh for macOS and Linux?

miridius 2019-04-03T14:19:54.029700Z

No it makes binaries rather than scripts. So on Windows you get a .exe, on Linux it's just binary file without extension

2019-04-03T14:23:17.030800Z

Ah I see.

2019-04-03T14:42:44.036600Z

just managed to install clj on windows by: - manually downloading the clojure-tools zip (setting permissions on the install script didnt work for me, probably because I'm not admin) - manually creating one of the install locations. found by seeing output of $env:PSModulePath - unzipping the tools there - running clj, then editing the deps.edn in my home dir to point to private repositories yay, finally got it going! šŸ™‚ next step.. get cursive able to use this. Anyone have experience of clj+cursive on windows? FWIW, I configured Cursive to point to a .bat script, which just does CALL powershell clj %* - ie launches powershell and passes on any args. this appears to work when I run it on its own. on syncing a cursive project, cursive outputs: 'cannot execute: invalid token'.

šŸ¦œ 1
lincpa 2019-04-03T14:51:43.037100Z

Put Clojure-CLR, dependent DLLs and wget.exe and Clojure-CLR scripts in the same directory, which is a portable solution. CoreRT, like graalvm, can native compilation of the results of the Clojure-CLR compilation, Clojure's thing, solved with Clojure, it's a politically correct choice.:simple_smile:

mseddon 2019-04-03T23:50:53.037800Z

I think the point is that requiring an install of python and then clj tools is just a crap first impression. If I had to install Ruby to install X, that wouldn't particularly entice me to install X.