wiki:GeoGebraCAS/MathPiperUpdates
Last modified 10 months ago Last modified on 07/22/11 11:27:27

MathPiper Sources for GeoGebra

The following guide shows how to get the MathPiper sources for GeoGebra from the command line using SVN and Ant.

First Time Check Out

1) Make sure you have subversion and apache ant installed on your system and on the path.

2) Launch a shell and check out the whole MathPiper project from the subversion repository:

svn checkout http://mathpiper.googlecode.com/svn/trunk/ mathpiper

Manual Update

1) Open a shell and change into your workspace directory with the mathpiper folder you checked out before. Update MathPiper from the subversion repository:

svn update mathpiper

2) Change into the top level mathpiper directory. This directory contains the master build.xml file which is used to build all parts of the MathRider application.

3) Execute the *all target to create the build directory and build the whole MathRider application:

ant *all

Note: after the build is complete, MathPiperIDE can be launched by executing one of the launch scripts which is in mathpiper/build/mathrider.

4) Execute the geogebra_dist target to create a copy of the GeoGebra distribution of the MathPiper source code:

ant -Dtarget=geogebra_dist mathpiper_library

The MathPiper source for GeoGebra will then be placed into this directory:

mathpiper/build/library_apps/mathpiper/geogebra_dist/src

5) Now delete the org.mathpiper package and all subpackages in your GeoGebra project in Eclipse

6) Commit your changes to SVN. This removes mathpiper from the SVN repository which is important before proceeding.

7) Copy the new MathPiper sources from mathpiper/build/library_apps/mathpiper/geogebra_dist/src to your GeoGebra project directory in Eclipse

8) Refresh and compile your GeoGebra project in Eclipse

9) Commit your changes to SVN in Eclipse

Almost Automatic Update

The following script grabs the latest version of the MPReduce and the MathPiper SVN version, puts them in a temporary directory and then copies them into a geogebra-workspace. If any files were removed from the MathPiper/MPReduce trunk since the latest update, the script will notify the user to remove those files from geogebra as well (NOTE: this could be improved by using an additional switch from diff, so it doesn't also take into account files ADDED to the trunk of MP).

#!/bin/sh
#
# Updates MathPiper and MPReduce source code, and compiles the Reduce-Algebra package for MPReduce
# from the Algebra-Reduce source repository
# assumes geogebra, mathpiper, mpreduce and reduce have all been already checked out into the CWD.
# If they haven't, run:
#
# svn co http://www.geogebra.org/svn/trunk/geogebra geogebra
# svn co https://mathpiper.googlecode.com/svn/trunk/ mathpiper 
# svn co https://mathpiper.googlecode.com/svn/trunk/src/library_apps/mpreduce mpreduce-read-only
# svn co https://reduce-algebra.svn.sourceforge.net/svnroot/reduce-algebra/trunk/ reduce-trunk
#

#echo "Update MathPiper from SVN ..."
svn update mathpiper
cd mathpiper
ant *all
ant -Dtarget=geogebra_dist mathpiper_library
cd ..

#echo "Update MPReduce from SVN ..."
cd mpreduce-read-only
svn update
ant clean
ant compile
#ant minireduce.img
cd ..

# merge MathPiper and MPReduce sources in one directory
mkdir -p tmp_mp
cp -r mathpiper/build/library_apps/mathpiper/geogebra_dist/src/* tmp_mp
cp -r mpreduce-read-only/src/java/* tmp_mp
find tmp_mp -name ".svn" | xargs rm -r

# build minireduce image from the original reduce sources
svn update reduce-trunk
cp package.map reduce-trunk/jlisp
cd reduce-trunk/jlisp
make minireduce.img
cd ../..

# count any new/deleted files:
#	diff -q shows only if files were added/deleted/changed
#	the first grep filters out the svn directories and java class files
#	the 2nd grep finds files that exist in only one of the two directories.
# NOTE: this does not compare the edu/* directories that mathpiper allways comes with!
FILEDIFF=$(diff -qr geogebra/org/mathpiper tmp_mp/org/mathpiper | egrep -v -e \(.svn\|.class\)$ | grep -e ^Only | wc -l)
echo $FILEDIFF
if [ $FILEDIFF -gt 0 ]; then
	echo "There were new/deleted files, please deal with them manually:"
	echo $(diff -qr geogebra/org/mathpiper tmp_mp/org/mathpiper | egrep -v -e \(.svn\|.class\)$ | grep -e ^Only)
fi

# copy new MathPiper source files to geogebra project directory
cp -r tmp_mp/* geogebra/

# copying Reduce function image to geogebra
cp reduce-trunk/jlisp/minireduce.img geogebra/default.img

rm -rf tmp_mp

echo "Refresh and compile geogebra. Then commit changes to SVN."

Now go to Eclipse, refresh your geogebra project and commit your changes to SVN.

Raw Automatic Update

The following is a very crude way to update both MathPiper and MPReduce: it works by first removing the whole org/mathpiper tree from the SVN trunk, then copying over the current versions (making sure that there are no leftover .svn or *.class files). You can then start Eclipse and manually re-add those files to the SVN. Of course, this is quite a lengthy procedure, and it makes for quite big patch-files.

#!/bin/sh
#
# Updates MathPiper and MPReduce source code
# assumes geogebra, mathpiper and mpreduce have all 3 been already checked out into the CWD.
# If they haven't, run:
#
# svn checkout http://www.geogebra.org/svn/trunk/geogebra geogebra
# svn checkout https://mathpiper.googlecode.com/svn/trunk/ mathpiper 
# svn checkout https://mathpiper.googlecode.com/svn/trunk/src/library_apps/mpreduce mpreduce-read-only
#

echo "Update MathPiper from SVN ..."
svn update mathpiper
cd mathpiper
ant *all
ant -Dtarget=geogebra_dist mathpiper_library

# go to geogebra project in workspace
cd ../geogebra

# delete MathPiper directory from geogebra project
svn delete --force org/mathpiper
svn commit -m "deleted mathpiper"

# copy new MathPiper source files to geogebra project directory
cp -R ../mathpiper/build/library_apps/mathpiper/geogebra_dist/src/* ./
find org/mathpiper -name "*.class" -delete
echo "MathPiper sources updated in geogebra."

#=========================================

echo "Update MPReduce from SVN ..."
cd ../mpreduce-read-only
svn update
ant clean
ant compile
ant minireduce.img

# copying Reduce function image to geogebra
cp build/images/minireduce.img ../geogebra/default.img

# copy MPReduce java source files to geogebra
cp -r src/java/org ../geogebra

# remove mpreduce .svn directories
cd ../geogebra/org/mathpiper
find -name ".svn" | xargs rm -r


echo "Refresh and compile geogebra. Then commit changes to SVN."

Now go to Eclipse, refresh your geogebra project and commit your changes to SVN.