As some additional context, here's the commit message from the patch.
I think you could wrap it with a bat
. That does bring back manipulating the PATH as part of the install. Which is common in installs, but I've liked the more structured approach PowerShell provides for making commands available. This could work either way though.
As primarily a VS Code user, I usually have a PowerShell terminal open in the VS Code window. For other editors I don't know enough to say if that will be as straightforward to use.
https://twitter.com/seancorfield/status/1103837703194337280 -- pls RT so we can get lots of responses π
Cursive doesnβt do any of this right now, it just invokes tools.deps.alpha directly. Reading this a bit, perhaps it should keep doing that π
But if invoking it requires prepending powershell.exe, thereβs no problem doing that for Cursive, at least, but it does open the door to possibly needing to support both powershell and cmd.exe (if I understand correctly, been a while)
Hey @ajoberstar and everyone! Chiming in to say I really appreciate the effort you're putting in. Thanks!
@ajoberstar ok, I merged everything over and did a release - available at https://download.clojure.org/install/clojure-tools-1.10.0.428.zip and https://download.clojure.org/install/win-install-1.10.0.428.ps1
let me know how it looks
@alexmiller I get
PS Y:\Downloads> .\win-install-1.10.0.428.ps1
Downloading Clojure tools
Invoke-WebRequest : The remote server returned an error: (403) Forbidden.
At Y:\Downloads\win-install-1.10.0.428.ps1:9 char:1
+ Invoke-WebRequest -Uri $ClojureToolsUrl -OutFile clojure-tools.zip
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
PS Y:\Downloads>
looks like didn't get version replacement in there, I can look at that
@seancorfield in that ps1 file, line 6, should that be " instead of ' to get variable interpolation?
can you try that?
I think that's correct, yeah. At least vscode hightlights the $Version
bit in blue when you change to double-quotes...
cool, rebuilding now
I'll try from a new release, just to get closest to the "real" experience.
https://download.clojure.org/install/win-install-1.10.0.431.ps1
I'm getting an SSL error from that one:
PS C:\Users\tim> C:\Users\tim\Downloads\win-install-1.10.0.431.ps1
Downloading Clojure tools
Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel.
At C:\Users\tim\Downloads\win-install-1.10.0.431.ps1:9 char:1
+ Invoke-WebRequest -Uri $ClojureToolsUrl -OutFile clojure-tools.zip
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Firefox lets me download https://download.clojure.org/install/clojure-tools-1.10.0.431.zip with no apparent issues though
Possibly it's this: https://stackoverflow.com/a/36266735/87990
oh should be http, not https
nah, both should work
https works, just the posh client is using TLS 1 or something
yeesh
Adding this line fixed that for me:
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
adding that in the script or outside?
Just above the Invoke-Request on line 10
In the script
Er, line 9
https://github.com/clojure/brew-install/commit/6cec80042e4c5b09c53649e5664786d5e2ed4cb3 ?
Yep
so what's the install process here that we would tell people? download the script and then... ?
https://download.clojure.org/install/win-install-1.10.0.434.ps1
Uh, download that, run it, and select an install location, then use clj
as normal
so the stuff at https://github.com/ajoberstar/ClojureTools is not necessary?
I'm still trying to verify that it's working correctly for me, seeing an odd error
whew, no even errors
Yeah, we're 50% there π
My local machine is in a weird state from working on https://github.com/ajoberstar/ClojureTools/pull/3 which is a workaround for a kind of gross Windows limitation
The stuff in https://github.com/ajoberstar/ClojureTools is the content of the zip file, isn't it? The installer just pops it in the proper directory
ah, right
seems like when I ran into this issue in the deep past (long enough ago that I was using windows daily), there was some way to start java with a classpath in a file, so we would just make the file (which actually happens to be exactly the file that's already in the .cpcache maybe)
Sort of, yeah. Java 9 can read arguments out of a file
you can set the CLASSPATH env var - is that same problem?
What my PR up there does as a proof of concept is to construct a jar which only has a manifest with a classpath in it, invoke java with -cp path/to/that/thing.jar
, then remove the generated jar
yeah, that's awful
For my use case the classpath is also too long for an environment variable πΏ
what does Maven do?
Good question, I'm not sure
can you change the line limit length?
also, the meta question - how is this still a problem 15 years after the last time it hurt me?
Maybe if they put me in charge of Windows 11
man, what a punishment that would be
Seriously. Although I must say that I'm warming up to Powershell, the syntax is awful but it winds up being more powerful than bash for some stuff
common "solution" seems to involve various ways to shorten the path of your maven repo
Yeah
I generally like powershell for being generally saner than bash (if also more verbose)
deeply unsatisfying
Yeah. My classpath is up to around 33K, which yes, I know that's not reasonable. Works fine in *nix though
you could symbolic link the files into a temp dir and include tmp/* :)
does windows have symbolic links?
I tried to install into C:\Program Files\WindowsPowerShell\Modules
which was offered as an option but it failed due to permissions -- but the script still said it was installed correctly π
well that's clear :)
is it the execution policy as described at https://github.com/ajoberstar/ClojureTools ?
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
?
Yeah, I got that too, the script should probably check for root / elevate permissions before it does that
Hmm, dunno
it's always good to download scripts from the internet that elevate permissions
wget | sudo sh
Success if I install it into my local modules location
PS Y:\Downloads> .\win-install-1.10.0.434.ps1
Downloading Clojure tools
WARNING: Clojure will install as a module in your PowerShell module path.
Possible install locations:
1) \\Mac\Home\Documents\WindowsPowerShell\Modules
2) C:\Program Files\WindowsPowerShell\Modules
3) C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
Enter number of preferred install location: 1
Cleaning up existing install
Installing PowerShell module
Removing download
Clojure now installed. Use "clj -h" for help.
PS Y:\Downloads>
PS Y:\Downloads> clj -Sdescribe
{:version "1.10.0.434"
woohoo
I want to be able to tell people to try this, but also I want to tell them something likely to work :)
PS X:\workspace\wsmain\clojure\lowlevel> $env:CLJ_CONFIG
PS X:\workspace\wsmain\clojure\lowlevel> $env:CLJ_CONFIG='..\versions'
PS X:\workspace\wsmain\clojure\lowlevel> $env:CLJ_CONFIG
..\versions
PS X:\workspace\wsmain\clojure\lowlevel> clj -A:defaults:test-deps:test:runner
Running tests in #{"test"}
...
From a clean install.As long as they use option 1 (home directory) I reckon it should work
why are there options then? :)
(And they don't hit the classpath limit)
So, yeah, with a few caveats, it works smoothly π
did you have to do the security thing?
One weird thing about option 1 is it puts a folder into Documents
, which is slightly irritating
I did not (but it's possible it was in effect from last time?). I only had to do that on one machine -- the other machine defaulted to allowing it...
Possibly it would be better to instruct users to run as admin and choose 2 or 3
I don't think I had to mess with that setting but I might have already fiddled with it to get other OSS stuff working. I can check tonight on a different machine
dumped some stuff here, please update https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Windows
I'm particularly not sure if I got all that info right from the chat here
does this all assume being in a powershell terminal? (and is that the right words to call that?)
feel free to just edit and fix
Everything looks good to me
I have installed clj on Windows without problems but when I do:
clojure -Sdeps '{:deps {friendly {:git/url "<https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18>" :sha "418bf66fd96851cc55398b55d5a8aff65692f565"}}}' -m friendly
I get this error:
Error while parsing option "--config-data {:deps {friendly {:git/url <https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18> :sha 418bf66fd96851cc55398b55d5a8aff65692f565}}}": java.lang.RuntimeException: Invalid token: <https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18>
somebody have some idea how can i fix this error?
Sounds like a quoting issue in the script. Want to file a bug on TDEPS JIRA?
looks like the script builds up the $ToolsArgs array and then drops it on the command line. probably want something to do the equivalent of unquote splice
yeah should be @ToolsArgs I think
Say @alexmiller, I've been playing around more with the classpath thing on Windows and figured out how to get it working with absolute paths to the local jars (in the maven repository). One thing that occured to me is that you could think of the "pathing jar" as just a differently-formatted version of what's currently in ~/.cpcache/<hash>.cp
, so that maybe from the Clojure side we could construct a ~/.cpcache/<hash>.jar
at the same time as the .cp
file, and then the PS script could check for that and use it it it's present. What do you think about that approach? I can try to work up a patch if it seems reasonable
Also maybe I'll open a ticket for this stuff so it doesn't wash away in the Slack history
that sounds better - I'd make a ticket for it in TDEPS
@ivangalbans updated build at https://download.clojure.org/install/win-install-1.10.0.436.ps1
thanks @alexmiller, I will try this
@alexmiller i'm getting this error now with win-install-1.10.0.436.ps1
.
Invoke-WebRequest : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
At C:\Users\ivan\Downloads\win-install-1.10.0.436.ps1:10 char:1
+ Invoke-WebRequest -Uri $ClojureToolsUrl -OutFile clojure-tools.zip
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Invoke-WebRequest], IOException
+ FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
It installed cleanly for me -- but only the window in which I ran the installer saw the new version. How do I tell PS to refresh/reload/whatever a module that has already been imported?
well the line that is failing is before that - that's the download
do you still have a clojure-tools.zip sitting there?
like is it barfing on writing over an existing file?
well actually I guess the error is on reading from the network. maybe just try it again?
hi, i tried to run https://download.clojure.org/install/win-install-1.10.0.436.ps1 and i got this error after i select the path
New-Object : Exception calling ".ctor" with "3" argument(s): "End of Central Directory record could not be found."
At
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:934
char:23
+ ... ipArchive = New-Object -TypeName System.IO.Compression.ZipArchive -Ar ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
any ideas?
that doesn't seem to be in the clojure script ?
i just did .\win-install-1.10.0.436.ps1
in my powershell
:thinking_face:
maybe a powershell version thing? what version do you have?
$PSVersionTable.PSVersion
was tested with PowerShell Core 6
build 17763 revision 316
Major Minor Build Revision
----- ----- ----- --------
5 1 17763 316
so, 5.1. maybe the script is using something new in 6. just guessing
How old is build 17763? I'm on 18343 (but I am on fast ring insider builds).
looks like it's coming from the zip expansion
possibly a corrupt downloaded zip file?
I will retract what I said above on versioning, doesn't seem like that's the issue
If it fails and you still have the clojure-tools.zip file there, try opening it and see if it works
i don't have the file
I'm running on
Major Minor Build Revision
----- ----- ----- --------
5 1 17134 590
...and things are hunky-dory for me.@raydelalonsobaryolo did you try it more than once?
I tried again, and it works, thanks
when i run this clojure -Sdeps '{:deps {friendly {:git/url "<https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18>" :sha "418bf66fd96851cc55398b55d5a8aff65692f565"}}}' -m friendly
, i get this error
Error while parsing option "--config-data {:deps {friendly {:git/url <https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18> :sha 418bf66fd96851cc55398b55d5a8aff65692f565}}}": java.lang.RuntimeException: Invalid token: <https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18>
prob best to file a jira ticket so we can track it, not going to be able to solve it right now
I think @ivangalbans may have filed that one earlier today?
I think he's using the version after the fix
"fix" I should say
https://clojurians.slack.com/archives/CFN4QDHPS/p1552078805115500
I made the change I thought would help that in 1.10.0.436
Oh. I'm with you. So it still needs a JIRA ticket then.
I'll go file one, to save anyone else...
thx
https://dev.clojure.org/jira/browse/TDEPS-121 @ivangalbans @raydelalonsobaryolo
Looks like the wiki captures all of the main points but I can add some clarification about the install locations tomorrow. They're all generated from the users existing modulepath, and this can differ between Windows PS and PS Core (and different again on Linux PS Core). So figured we'd just display all options in your path instead of trying to hardcode one. Should probably get a better message in the prompt about the need for an elevated PowerShell for some locations. Thanks everyone for helping test!