<< Back to previous view

[CLJS-24] Windows commandline scripts are missing Created: 21/Jul/11  Updated: 20/Mar/14  Resolved: 30/Jul/11

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Marko Kocić Assignee: Brenton Ashworth
Resolution: Completed Votes: 0
Labels: None
Environment:

Any Windows version


Attachments: Text File 0001-Add-commandline-scripts-for-windows.patch     File bootstrap.bat     File cljsc.bat     File repl.bat     File repljs.bat    

 Description   

Right now, all scripts in bin and scripts folders are sh scripts, and those not work under Windows.



 Comments   
Comment by Benny Tsai [ 23/Jul/11 2:48 AM ]

Hi all,

I put together the following Windows batch files and tested them on my machine. They allowed me to do almost everything in the Quick Start guide (didn't test the Node.js-related items, as I don't have Node.js installed). I've attached the batch files for your consideration.

bin\cljsc.bat
script\bootstrap.bat
script\repl.bat
script\repljs.bat

Some things of note:

  • The original bootstrap script used curl for downloading and unzip for unzipping. bootstrap.bat uses jar -xf for unzipping, but currently expects wget.exe in clojurescript\bin for downloading. I'm open to suggestions!
  • When calling cljsc.bat with an option map, the map needs to be enclosed in " instead of ' (as currently shown in the Quick Start guide).
  • Spaces in the path are bad. I think the problem lies with calls to (io/resource) in closure.clj and compiler.clj, which encodes paths like "C:\Documents and Settings\Benny\clojurescript\..." to "C:\Documents%20and%Settings\Benny\clojurescript\...", which can't be resolved. For now, I just put everything in C:\clojurescript\ to work around the issue.
Comment by Marko Kocić [ 25/Jul/11 7:39 AM ]

The following patch adds cljsc.bat, repl.bat and repljs.bat files.
Those files correctly infer CLOJURESCRIPT_HOME using script file name as a base.

Also, they use java 1.6 classpath feature that you don't have to list individual jar files anymore when setting up classpath.

Comment by Brenton Ashworth [ 30/Jul/11 9:47 AM ]

Benny and Marko,

Thank you for taking the time to report this issue and submit patches. We welcome patches from the community but you must follow the process outlined here:

http://clojure.org/contributing

We can only accept patches from those whose names appear in the list at the bottom of that page. It's simple to get on that list, you only have to sign a CA. After you have signed a CA, please send patches instead of plain files.

I have added batch files for cljsc, repl and repljs.

Creating a bootstrap batch file is a problem. I don't know that it can be done without depending on external programs. Since this only needs to be done once and the things which it does can be done manually, we may want to supply a wiki page for Windows users which describes how to get set up without using script/bootstrap.

Comment by Benny Tsai [ 30/Jul/11 10:25 AM ]

Hi Brenton,

First, thank you for working on this issue.

I'll sign and send the CA pronto. Mail delivery seems quite slow between Canada and the states, so it might take a while before it gets there. Ah well.

W.r.t. bootstrap external dependencies: Perhaps we could take a page from lein's approach, and create a Windows package that includes the required program(s)? AFAICT, the only program that would need to be included is wget.exe or something equivalent, since the unzipping can be done via "jar -xf".

Comment by Benny Tsai [ 30/Jul/11 10:41 AM ]

Also, I noticed that in the latest .bat files, CLASSPATH is being modified and overwritten. It might be better to create and use CLJSC_CP like the original sh scripts.

Comment by Tim Visher [ 22/Nov/13 10:23 AM ]

I just found this issue because I was trying to work on a FS bug.

For very simple things like the repl script and such I think it makes some sense to maintain separate sh and bat files, but for the bootstrap script, why not move to something like Ant?

All it's doing is fetching some files, unzipping them, jarring them up potentially, and cleaning up after itself, which Ant is perfectly capable of doing in a cross-platfrom way. Ant apparently even has svn support at this point.

See:

Get Task: http://ant.apache.org/manual/Tasks/get.html
Unzip Task: http://ant.apache.org/manual/Tasks/get.html
Jar Task: http://ant.apache.org/manual/Tasks/jar.html
svnant extension: http://subclipse.tigris.org/svnant/svn.html
Copy task: http://ant.apache.org/manual/Tasks/copy.html
Delete Task: http://ant.apache.org/manual/Tasks/delete.html

How would we feel about porting this to ant so we get cross-platform support for 'free' from one source.

I'm mainly asking this as a way to gauge interest, I think implementation would be trivial.

Comment by Phongphan Phuttha [ 20/Mar/14 11:10 AM ]

Sorry for adding more comments on completed ticket.

But for bootstrap.bat, it could be done without installing any third party tools by just using Windows Script Host.

I have created a proof of concept by forking current master and add bootstrap.bat with download and extracting tools written in VBScript here.

Generated at Tue Sep 30 09:03:45 CDT 2014 using JIRA 4.4#649-r158309.