root/gs3-extensions/i-jetty/trunk/src/JAVA-TO-DEX.sh @ 23931

Revision 23931, 3.2 KB (checked in by davidb, 10 years ago)

Some fine-tuning of scripts, as the result of a fresh pass at setting up Greenstone-3 on an Android device

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