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.
carkh 2019-07-22T06:27:46.056800Z

https://github.com/cark/clojure-win-cli-wrap

carkh 2019-07-22T06:28:51.057700Z

if anyone feels adventurous, i need some real world use ...

carkh 2019-07-22T06:29:09.058100Z

"works on my computer", but how about yours ?

carkh 2019-07-22T06:32:16.059800Z

I tried to get away with light parsing, but i'm ready to go deeper if necessary

carkh 2019-07-22T06:33:54.060200Z

There is a pre-compiled release too https://github.com/cark/clojure-win-cli-wrap/releases

2019-07-22T07:52:14.061Z

@carkh got nim installed and compiled with some success -- simple tests such as clj.exe -Spath and clj.exe -r seem to work

2019-07-22T08:12:26.061900Z

hmm...actually, i had the unofficial clj windows installed -- it worked with that, but when i uninstalled that and installed the official clj on windows, the wrapper appears to hang

2019-07-22T08:20:29.062600Z

ah, may be it was the installation location -- i reinstalled the official clj on windows with a different choice, and now am having more luck

carkh 2019-07-22T08:43:05.062800Z

oh

carkh 2019-07-22T08:43:09.063Z

thanks for trying

carkh 2019-07-22T08:43:51.064Z

actually i discovered that by calling the cmdlet directly, and if you have the exe in the path, it would call the exe rather than the cmdlet

carkh 2019-07-22T08:44:33.064900Z

we have a good fortune though, the clojure and clj commands are only aliases to Invoke-Clojure

carkh 2019-07-22T08:44:50.065300Z

long story short, this hanging bug is fixed and pushed

carkh 2019-07-22T08:46:04.066100Z

the strange thing is that that bug was not apparent with the exe in the same directory, only when it is in the path

carkh 2019-07-22T08:46:30.066700Z

why woudl powershell give precedence to path commands over cmdlets is anybody's guess

2019-07-22T11:04:21.067100Z

pulled and rebuilt -- seems to be working

carkh 2019-07-22T17:38:45.067400Z

@sogaiu thanks !

johnjelinek 2019-07-22T19:03:32.068600Z

from a command prompt, I get this:

>powershell "clj -Sdeps '{:deps {nrepl {:mvn/version """0.6.0"""}}}' -m nrepl.cmdline"

Error while parsing option "--config-data {:deps {nrepl {:mvn/version 0.6.0}}}": java.lang.NumberFormatException: Invalid number: 0.6.0

johnjelinek 2019-07-22T19:03:53.068700Z

what's the right quote parsing magic to get this to work from command prompt?

johnjelinek 2019-07-22T19:17:10.068900Z

attempt 2:

>powershell clj -Sdeps "{:deps {nrepl {:mvn/version ^"0.6.0^"}}}" -m nrepl.cmdline
Unknown option: "-i"
Unknown option: "-n"
Unknown option: "-p"
Unknown option: "-u"
Unknown option: "-t"
Unknown option: "-F"
Unknown option: "-o"
Unknown option: "-r"
Unknown option: "-m"
Unknown option: "-a"
Unknown option: "-t"
Unknown option: "-o"
Unknown option: "-u"
Unknown option: "-t"
Unknown option: "-p"
Unknown option: "-u"
Unknown option: "-t"
Unknown option: "-F"
Unknown option: "-o"
Unknown option: "-r"
Unknown option: "-m"
Unknown option: "-a"
Unknown option: "-t"

carkh 2019-07-22T19:37:45.070700Z

you could : the official way is start from powershell itself, tripple double quotes your version numbers... the unofficial way : start from cmd, use https://github.com/frericksm/clj-windows

carkh 2019-07-22T19:38:13.071Z

starting from cmd and invoking clojure in powershell is hard

seancorfield 2019-07-22T19:48:48.071600Z

I think the simple answer is: don't do that -- use Powershell instead of cmd.

carkh 2019-07-22T19:49:12.072Z

that's if you can... I'll never give up on this =)

carkh 2019-07-22T19:49:43.072400Z

@seancorfield have a look at this wrapper i'm exploring

carkh 2019-07-22T19:49:54.072800Z

nice neat command lines just like on linux

seancorfield 2019-07-22T19:51:18.074100Z

I'm not interested and you know that. I'm going to use the official clj and I'm going to use PS when I'm on Windows.

seancorfield 2019-07-22T19:51:46.075Z

I want to help Clojure/core make the official PS client better -- and that's what this channel is for.

carkh 2019-07-22T19:51:48.075100Z

but you're advertising it as the only way, it isn't and makes several uses impossible

carkh 2019-07-22T19:52:26.076100Z

anyways that exploratory project makes use of the ps tools

seancorfield 2019-07-22T19:52:33.076200Z

I'm not "advertising" it. I'm using the official client and discussing issues in the "official" channel for that official client.

carkh 2019-07-22T19:52:43.076600Z

so am i

seancorfield 2019-07-22T19:53:03.077100Z

Coming in here and telling people to use a different, unofficial tool is not appropriate for this channel.

carkh 2019-07-22T19:53:23.077400Z

that's why i'm trying to make it work with the official tool

carkh 2019-07-22T19:53:39.077700Z

sometimes you're on windows, and have to use cmd

carkh 2019-07-22T19:53:46.077900Z

there is no way around it

carkh 2019-07-22T19:54:12.078300Z

i would gladly dump it in favor of ps if it was possible at all

carkh 2019-07-22T19:58:13.078900Z

anyways too bad, i really was looking forward to your feedback as a knowledgable cli user

seancorfield 2019-07-22T20:02:35.079900Z

When you say "that exploratory project", which one are you referring to? That frericks project is not a wrapper for the official tooling.

carkh 2019-07-22T20:02:54.080100Z

https://github.com/cark/clojure-win-cli-wrap

carkh 2019-07-22T20:03:01.080400Z

i posted it this morning

carkh 2019-07-22T20:03:17.081Z

just calls powershell with a twist

seancorfield 2019-07-22T20:03:22.081100Z

I didn't see that (and I was not responding to that).

carkh 2019-07-22T20:04:54.082400Z

light parsing/rebuilding of the command line, makes use of the poweshell tools, encodes the command line to base64 and makes use of powershell's encodedcommand feature to avoid further escaping issues

carkh 2019-07-22T20:05:06.082700Z

probably not good enough but a first step

carkh 2019-07-22T20:06:41.083200Z

I also want to make a proper installer, but only if there is any traction

carkh 2019-07-22T20:07:18.083900Z

then dump it all on cognitect =)

seancorfield 2019-07-22T20:08:59.085500Z

Interesting approach. I know @alexmiller has pushed back on bringing other languages into the mix, as far as officially supported tools are concerned, but that isn't very much code and as you note could be written in any language -- with the target being a small, self-contained .exe.

carkh 2019-07-22T20:09:36.086600Z

yes i don't care about language, i'm just not comfortable enough to go with c

seancorfield 2019-07-22T20:09:48.086900Z

I wonder whether it could be written in Clojure and a Graalvm binary produced? Maybe @borkdude might have some thoughts, given his work on clj-kondo?

carkh 2019-07-22T20:10:32.087700Z

reading though the graalvm channel, it looks like there are still issues with dll missing

carkh 2019-07-22T20:10:42.087900Z

So not totally self-contained

carkh 2019-07-22T20:12:43.089400Z

i also wrote the tables comparing different solutions as requested by Alex Miller, but wasn't comfortable showing that yet, but he's been busy and couldn't have a look at it yet, so here it goes: https://github.com/cark/clojure-windows-cli-issues

borkdude 2019-07-22T20:16:02.090Z

yes, Windows is the platform I can't really target succesfully with graalvm yet...

borkdude 2019-07-22T20:16:31.090300Z

in theory it should work, but there are some issues

borkdude 2019-07-22T20:43:31.091500Z

also this one: https://github.com/oracle/graal/issues/1407

carkh 2019-07-22T20:44:05.092100Z

@borkdude how does the command line work with graalvm executables ? can you pass it a naked command line to be parsed by your main ? That is can it be used as a clj replacement ?

carkh 2019-07-22T20:44:24.092400Z

or is it more like a java command line

borkdude 2019-07-22T20:45:00.092900Z

you just write a (defn -main [& args]) and you receive the arguments as strings

carkh 2019-07-22T20:45:19.093200Z

no access to the full command line then ?

carkh 2019-07-22T20:45:24.093500Z

i mean unparsed

borkdude 2019-07-22T20:45:34.093700Z

I'm not not sure what you mean

carkh 2019-07-22T20:46:18.094600Z

see how you receive a seq of args as your main parameters ? that means there is at least some parsing to separate the args

carkh 2019-07-22T20:47:20.095500Z

in the exploratory wrapper i posted, i sidestep that by just parsing the full command line myself, in order to avoid some of those pesky escaping issues

borkdude 2019-07-22T20:49:05.097200Z

@carkh I have a script\compile.bat in clj-kondo, so if you're using Windows, just clone the repo and try it out I'd say

carkh 2019-07-22T20:49:29.097500Z

i might just do that =)

borkdude 2019-07-22T20:50:06.097800Z

@carkh Here's the full instructions for Windows: https://github.com/borkdude/clj-kondo/blob/master/doc/build.md#windows

carkh 2019-07-22T20:51:05.098200Z

thanks

borkdude 2019-07-22T20:52:08.098700Z

this is a bit simpler CLI built with GraalVM: https://github.com/borkdude/jet but I don't have a Windows build script for that yet. should be easy to port from clj-kondo

borkdude 2019-07-22T20:54:05.099400Z

It's good to have some people look at this who are really using Windows and know it more than I do

carkh 2019-07-22T20:57:46.100600Z

i'm merely a user

borkdude 2019-07-22T21:06:58.101300Z

Windows support for GraalVM is probably a bit early days. I'm hoping it will catch on in a few months

carkh 2019-07-22T21:07:20.101600Z

yes looks like it

lread 2019-07-22T21:21:14.103100Z

@carkh you’ve clearly put some real effort in here! 👍

carkh 2019-07-22T21:23:05.103300Z

bit shy about showing it though =)

lread 2019-07-22T21:55:54.105200Z

feedback is usually friendly and constructive from this community so I don’t think you have too much to worry about