GB2 Building Tips for Windows

These are some notes and hints to get Gradebook 2 to build on Windows. Eventually these may be incorporated and improved in gradebook 2.

There were 2 major problems for building gradebook 2 on Windows, the patching needed (for 2.6) and the the deployGWT.sh script that runs. Both of these are shell scripts that run during the build process. They might work with cygwin, but cause problems with minimal (UnxUtils) or no unix utilities installed. You can work around this without installing a bunch of other stuff with these tips.

Pre-Reqs

Java 

Apache Ant (http://ant.apache.org/)

UnxUtils in Windows Path (Optional but useful, much easier than cygwin) - http://unxutils.sourceforge.net/

Patching

To get past the patching there were a few problems. Windows has no built in patch mechanism and the patch files have unix line endings, which the gnu patchtool will give an error on when it tries to process. TortoiseSVN seems like it works but I remember having some problems with automatic patching with this, even though patching with the GUI worked. The easiest way I'd found to patch is to use GNU patch with an ant file. Ant has macros for patch and removing the line endings so this works well. Since ant is java based and you need java to compile it anyway, this made sense to just require ant.

The other problem was that on Vista/Windows 7, there is an error with the only version of patch I could find where it would constantly pop up user account windows asking for permission to run as the command 'patch' is a special reserved command. You can recompile it with a manifest, or have a manifest file present in the directory telling windows to ignore this file. I have bundled all of these files at this link.

GradeBook 2 Patch XML and EXE

To run the files in this archive, download ant and configure it to work in your path. Place all 3 of these files in the gradebook 2 sakai/2-6-x directory.

Edit the file and make sure the property for your sakai directory is correct, then you can run

ant -f patch.xml windows

All of your files *should* be correctly patched.

Deploy GWT

When building gradebook 2, the 'war' task attempts to run deployGWTCode.sh. If you actually have 'sh' in your path, it will try to run this and it was failing for me anyway. (With UnxUtils) This is run from the exec-maven-plugin plugin. Ideally there would be a windows batch file that would run here, but you have to do this process manually.

 What it does:

  • Creates a file in 'war/version.js'
    • This file has one line, you should create this file before you do the build and add this variable.

var gb2_version="gradebook2/branches/1.2.0-a5";

  • Figures out if the 'war/gradebook' directory exists and/or is newer than the file gradebook.tar.gz
    • If there is no gradebook directory you need to uncompress the gradebook.tar.gz. Ideally this would be a .zip file to make it easier (infozip's unzip is very portable compared to tar/gz on windows). I just used7-zip to uncompress this. Might need to do it twice on the .gz and on the .tar. Note that UnxUtils has tar and gzip in it, so if you put this in your patch you can also do it the unix way.

tar zxvf gradebook.tar.gz

Finished

After all this is done, you should be able to (mvn install) and deploy gradebook2 as normal. Note, you'd have to do a full rebuild and deploy of the entire sakai source as other projects (such as gradebook) have also been modified.