source: gs3-extensions/i-jetty/trunk/src/JAVA-TO-DEX.sh@ 23924

Last change on this file since 23924 was 23924, checked in by davidb, 10 years ago

Test added to direct user to configure their setup-android.bash if not already done so

File size: 3.0 KB
Line 
1#!/bin/bash
2
3if [ "x$SDCARD_WEBAPPS" = "x" ] ; then
4 echo "Environment variable SDCARD_WEBAPPS undefined"
5 echo " => No valid directory to install to on Android device"
6 echo " => Did you run setup.bash before the Android device was in disk mode?"
7 exit
8fi
9
10
11JARS="axis.jar commons-lang3-3.0-beta.jar cp.jar \
12 gsdl3.jar gutil.jar \
13 jdbm.jar js.jar serializer.jar \
14 xercesImpl.jar xml-apis.jar"
15
16# LuceneWrapper.jar and xalan.jar used to be in the list
17
18#---
19# Copy GS3 classes files to I-Jetty classes
20#---
21
22if [ -d classes ] ; then
23 echo "#---"
24 echo "# Regenerating directory: classes"
25 echo "#---"
26 /bin/rm -rf classes
27fi
28
29echo "#---"
30echo "# Copying Greenstone-3 classes to the I-Jetty extension"
31/bin/cp -rf "$GSDL3HOME/WEB-INF/classes" classes
32/bin/rm -rf classes/.svn
33
34echo "# Setting GSDL3HOME to match SD-Card on Android device"
35echo "#---"
36
37if [ "x$IJOS" = "xcygwin" ] ; then
38 SDCARD_GSDL3HOME_ONDEVICE=`echo $SDCARD_GSDL3HOME | sed 's@^/cygdrive/./@/sdcard/@'`
39else
40 echo "Need to change mapped location of Android device on host machine"
41 echo "But no support currently implemented for: $IJOS"
42 SDCARD_GSDL3HOME_ONDEVICE=$SDCARD_GSDL3HOME
43fi
44
45cat classes/global.properties \
46 | sed "s@^gsdl3\.home=.*@gsdl3.home=$SDCARD_GSDL3HOME_ONDEVICE@" \
47 | sed "s@^tomcat\.port=.*@tomcat.port=$IJETTY_PORT@" \
48 > classes/global.properties.android
49
50/bin/mv classes/global.properties.android classes/global.properties
51
52cat classes/log4j.properties \
53 | sed "s@^gsdl3\.home=.*@gsdl3.home=$SDCARD_GSDL3HOME_ONDEVICE@" \
54 > classes/log4j.properties.android
55
56/bin/mv classes/log4j.properties.android classes/log4j.properties
57
58
59#---
60# Copy selected GS3 Jar files to I-Jetty jars
61#---
62
63echo "#---"
64if [ -d jars ] ; then
65 echo "# Regenerating jars"
66 /bin/rm -rf jars
67else
68 echo "# Generating jars"
69fi
70echo "#---"
71mkdir jars
72
73for f in $JARS ; do
74 echo " Copying from Greenstone-3 to I-Jetty: $f"
75 /bin/cp "$GSDL3HOME/WEB-INF/lib/$f" jars/.
76done
77
78echo "Overriding existings Greenstone jars with ones that needed tweaking for Android"
79/bin/cp -v modified-jars/* jars/.
80
81
82echo "Topping up 'jars' with Android specific jars"
83/bin/cp -v extra-jars/* jars/.
84
85
86#---
87# Generate dex file in I-Jetty 'classes' directory
88#---
89
90
91# If need more memory, add
92# -JXmx1024M
93
94OUTPUT_DEX=$IJETTY_HOME/classes/classes.dex
95INPUT_DIR=$IJETTY_HOME/jars
96
97
98if [ "x$IJOS" = "xcygwin" ] ; then
99 OUTPUT_DEX=`cygpath -w $OUTPUT_DEX`
100 INPUT_DIR=`cygpath -w $INPUT_DIR`
101fi
102
103# add --verbose for more information
104dx.bat --dex --core-library --positions=lines --output=$OUTPUT_DEX $INPUT_DIR
105
106if [ $? != 0 ] ; then
107 echo "Error(s) encountered when running 'dx'"
108 exit
109fi
110
111#---
112# Zip up I-Jetty classes directory and put it in lib
113#---
114
115echo "#---"
116if [ -d lib ] ; then
117 echo "# Regenerating directory: lib"
118 /bin/rm -rf lib
119else
120 echo "# Generating directory: lib"
121fi
122echo "#---"
123mkdir lib
124
125echo "#---"
126echo "Zipping up I-Jetty 'classes' and storing in 'lib'"
127echo "#---"
128(cd classes && zip -r ../lib/classes.zip . && cd ..)
129
130
131echo ""
132echo "Run ./DEX-TO-SDCARD.sh to install the latest DEX files on the device"
133echo ""
Note: See TracBrowser for help on using the repository browser.