ClojureScript

Windows commandline scripts are missing

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Any Windows version

Description

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

  1. bootstrap.bat
    23/Jul/11 2:49 AM
    1.0 kB
    Benny Tsai
  2. repl.bat
    23/Jul/11 2:49 AM
    0.1 kB
    Benny Tsai
  3. repljs.bat
    23/Jul/11 2:49 AM
    0.2 kB
    Benny Tsai
  4. cljsc.bat
    23/Jul/11 2:50 AM
    0.6 kB
    Benny Tsai
  5. 0001-Add-commandline-scripts-for-windows.patch
    25/Jul/11 7:39 AM
    2 kB
    Marko Kocić

Activity

Hide
Benny Tsai added a comment - - edited

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.
Show
Benny Tsai added a comment - - edited 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.
Hide
Marko Kocić added a comment -

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.

Show
Marko Kocić added a comment - 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.
Hide
Brenton Ashworth added a comment -

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.

Show
Brenton Ashworth added a comment - 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.
Hide
Benny Tsai added a comment -

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".

Show
Benny Tsai added a comment - 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".
Hide
Benny Tsai added a comment -

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.

Show
Benny Tsai added a comment - 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.
Hide
Tim Visher added a comment -

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.

Show
Tim Visher added a comment - 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.
Hide
Phongphan Phuttha added a comment -

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.

Show
Phongphan Phuttha added a comment - 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.

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: