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-01T00:50:30.007400Z

@seancorfield Can you run $env:PSModulePath from a PowerShell window and confirm that C:\Users\sean\Documents\WindowsPowerShell\Modules\ is in there? I got the same error you did intially but had cloned into the wrong dir. Yours doesn't look wrong, but maybe your module path is different.

seancorfield 2019-03-01T00:55:56.008200Z

PS C:\Users\sean> $env:PSModulePath                                                                                     \\Mac\Home\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
PS C:\Users\sean>
Interesting. I'm on a Parallels VM so it's shadowing my actual, local Documents folder... just a sec...

seancorfield 2019-03-01T00:58:04.008700Z

Ah, and I can't run modules from that mounted file system apparently:

PS C:\Users\sean\clojure\cool> Import-Module ClojureTools
Import-Module : File \\Mac\Home\Documents\WindowsPowerShell\Modules\ClojureTools\ClojureTools.psm1 cannot be loaded
because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ Import-Module ClojureTools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [Import-Module], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand
PS C:\Users\sean\clojure\cool>

ajoberstar 2019-03-01T00:58:47.009200Z

You'll want to run Set-ExecutionPolicy RemoteSigned -Scope CurrentUser. I'll add that to the README

seancorfield 2019-03-01T01:00:02.009500Z

Progress but

PS C:\Users\sean\clojure\cool> cat .\deps.edn
{}
PS C:\Users\sean\clojure\cool> clj
Error building classpath. Error reading edn. Map literal must contain an even number of forms (C:\Users\sean\clojure\cool\deps.edn)
Get-Content : Cannot find path 'C:\Users\sean\clojure\cool\.cpcache\E5871DE60E3205214DC08C277D9BF25A.cp' because it
does not exist.
At \\Mac\Home\Documents\WindowsPowerShell\Modules\ClojureTools\ClojureTools.psm1:290 char:11
+     $CP = Get-Content $CpFile
+           ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\sean\c...8C277D9BF25A.cp:String) [Get-Content], ItemNotFoundEx
   ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

seancorfield 2019-03-01T01:00:26.009900Z

sure looks like a valid deps.edn to me... 👀

ajoberstar 2019-03-01T01:00:29.010100Z

interestng

ajoberstar 2019-03-01T01:04:08.011Z

Just tested from Windows PowerShell and PowerShell Core. Both of my work with a deps.edn only containing {}. Maybe try clj -Sdescribe

seancorfield 2019-03-01T01:07:27.011500Z

If I remove that deps.edn, it runs and gives me the expected output.

ajoberstar 2019-03-01T01:07:36.011700Z

weird

seancorfield 2019-03-01T01:08:27.012200Z

If I cd off to another directory that contains a deps.edn, it works.

ajoberstar 2019-03-01T01:08:53.012700Z

so just the empty map one causes a problem?

seancorfield 2019-03-01T01:09:28.013Z

No, empty maps in other folders are fine.

ajoberstar 2019-03-01T01:09:50.013200Z

curiouser and curiouser

seancorfield 2019-03-01T01:10:29.013800Z

And when I copied in an empty deps.edn from somewhere else it worked. Must have been some bogus character in that file.

ajoberstar 2019-03-01T01:10:36.014100Z

How did you create it?

ajoberstar 2019-03-01T01:10:50.014700Z

If it was via PowerShell, it could have ended up in UTF-16

seancorfield 2019-03-01T01:10:59.014900Z

Ah, yes, via echo.

seancorfield 2019-03-01T01:11:05.015100Z

Like I would on Linux 🙂

ajoberstar 2019-03-01T01:11:13.015300Z

haha, right

ajoberstar 2019-03-01T01:11:20.015600Z

Luckily PowerShell core defaults to UTF-8

seancorfield 2019-03-01T01:14:04.016200Z

Copied in my dot-clojure file from Linux and all that seems to be working... cool...

seancorfield 2019-03-01T01:14:39.017Z

Now I guess I should install OpenJDK11 and test REBL running here 🙂

ajoberstar 2019-03-01T01:14:54.017300Z

Most of my tests were cribbed from your deps.edn example, so hopefully I caught some of your common ones. Didn't try REBL yet though.

seancorfield 2019-03-01T01:16:22.017900Z

clj -A:liquid works (and pops open a new window for editing) so that's pretty cool 🙂

👍 1
seancorfield 2019-03-01T01:22:05.018100Z

Success!

🎉 1
seancorfield 2019-03-01T01:27:17.018900Z

clj -A:new works to create a new project. So far, so good.

seancorfield 2019-03-01T03:49:11.019500Z

@ajoberstar I just went through the steps on my Windows 10 laptop (so it's native Windows, not a VM).

seancorfield 2019-03-01T03:49:41.020100Z

Import-Module seemed to go smoothly, but whenever I run clj or clojure, the PS window quits.

ajoberstar 2019-03-01T03:51:50.020700Z

Trying pulling down the latest commits. I noticed that the exits ported over from the bash were quitting PS, so changed them to returns.

seancorfield 2019-03-01T03:53:02.020900Z

'k ... just a sec ...

seancorfield 2019-03-01T03:53:48.021200Z

I have the very latest from Git

seancorfield 2019-03-01T03:53:55.021400Z

I literally just cloned it

seancorfield 2019-03-01T03:54:11.021800Z

But I did a git pull just to check -- already up to date

ajoberstar 2019-03-01T03:54:30.022100Z

OK, let me double check what I have out there on master

seancorfield 2019-03-01T03:54:53.022400Z

Updated a day ago it says 🙂

ajoberstar 2019-03-01T03:55:11.022800Z

hmm, is the latest commit c9a6a580ed1a22d58af833b4b9895aca97b0b755

ajoberstar 2019-03-01T03:55:17.023Z

Should be 3 hours ago

ajoberstar 2019-03-01T03:55:32.023400Z

It does look like I missed a couple exits, will get something pushed up for that

seancorfield 2019-03-01T03:55:45.023700Z

Oh, my bad. Yeah, 3 hours ago 🙂

ajoberstar 2019-03-01T03:56:26.024400Z

ok pushed

seancorfield 2019-03-01T03:56:42.024800Z

Ah, I don't have Java installed so that would cause the 'exit'.

seancorfield 2019-03-01T03:56:55.025200Z

If I git pull the repo, do I need to re-import the module?

ajoberstar 2019-03-01T03:57:14.025600Z

yeah, make sure you include -Force at the end too

seancorfield 2019-03-01T03:57:44.026Z

I didn't re-import but it just worked

PS C:\var\www> clj
Couldn't find 'java'. Please set JAVA_HOME.
PS C:\var\www>

seancorfield 2019-03-01T03:58:03.026500Z

I have Java on WSL on this machine but not natively on Windows. Doh!

ajoberstar 2019-03-01T03:59:02.027100Z

I don't fully understand when re-import is required, but it seems to be more often than not, so that's just been my habit.

ajoberstar 2019-03-01T03:59:36.027800Z

I definitely like having WSL around, but very much looking forward to not having to go there for clojure

ajoberstar 2019-03-01T04:01:30.029Z

Heads up that I probably won't get a chance to work on this again till mid-next week. But if anyone has additional feedback, please pass it along.

seancorfield 2019-03-01T04:01:34.029100Z

It'll be nice to have REBL running on Windows...

alexmiller 2019-03-01T04:21:19.029700Z

nice work @ajoberstar and @seancorfield thx as always, feel free to send me patches, even if partial

alexmiller 2019-03-01T04:21:40.030200Z

I can do builds and put them on our download cdn for people to try whenever

alexmiller 2019-03-01T04:21:45.030400Z

even if not "done"

seancorfield 2019-03-01T04:36:00.030800Z

Nice. REBL up and running natively on Windows, on OpenJDK11!

alexmiller 2019-03-01T04:45:28.031Z

!!

seancorfield 2019-03-01T04:55:35.031900Z

Now I'm working on clojure.java.jdbc in Atom with Chlorine connected to a Socket REPL server running inside REBL, and evaluating forms from the editor into REBL's inspector 🙂

seancorfield 2019-03-01T04:58:17.032Z

Side-by-side, ctrl-, i to "inspect" a form from Atom into REBL.

🦜 2
seancorfield 2019-03-01T04:58:46.032700Z

(excuse the narrow windows -- this is on a tiny laptop)

alexmiller 2019-03-01T05:02:51.032900Z

sweet!

seancorfield 2019-03-01T05:12:55.033800Z

@ajoberstar Am I right that it doesn't support the equivalent of CLJ_CONFIG=<path> clojure ... at the moment?

seancorfield 2019-03-01T05:14:47.035Z

It looks like you unconditionally set $ConfigDir to the user .clojure folder, without allowing it to be overridden. We rely on being able to override that for our work projects.

seancorfield 2019-03-01T05:15:21.035400Z

I can open an issue on your repo if you want, for tracking?