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

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

Extra detail given in comment

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