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

Last change on this file since 25605 was 25605, checked in by davidb, 12 years ago

Restructuring scripts to prepare all files needed on the sd-card locally, before pushing across to device

  • Property svn:executable set to *
File size: 3.1 KB
Line 
1#!/bin/bash
2
3if [ "x$PREPARE_SDCARD_GSDL3HOME" = "x" ] ; then
4 echo "Environment variable PREPARE_SDCARD_GSDL3HOME undefined"
5 exit -1
6fi
7
8
9JARS="axis.jar commons-lang3-3.0-beta.jar cp.jar \
10 gsdl3.jar gutil.jar \
11 jdbm.jar js.jar serializer.jar \
12 xercesImpl.jar xml-apis.jar"
13
14# LuceneWrapper.jar and xalan.jar used to be in the list,
15# but are now in modified-jars. See README.txt in that
16# directory for details
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@^/.\+/war/@/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=$PREPARE_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 --verbose --dex --core-library --positions=lines --output=$OUTPUT_DEX $INPUT_DIR
105##dx.bat --dex --core-library --positions=lines --output=$OUTPUT_DEX $INPUT_DIR
106
107if [ $? != 0 ] ; then
108 echo "Error(s) encountered when running 'dx'"
109 exit
110fi
111
112#---
113# Zip up I-Jetty classes directory and put it in lib
114#---
115
116echo "#---"
117if [ -d lib ] ; then
118 echo "# Regenerating directory: lib"
119 /bin/rm -rf lib
120else
121 echo "# Generating directory: lib"
122fi
123echo "#---"
124mkdir lib
125
126echo "#---"
127echo "Zipping up I-Jetty 'classes' and storing in 'lib'"
128echo "#---"
129(cd classes && zip -r ../lib/classes.zip . && cd ..)
130
131
132echo ""
133echo "####"
134echo "# Run ./DEX-TO-SDCARD.sh to install the latest DEX files on the device"
135echo "####"
136echo ""
Note: See TracBrowser for help on using the repository browser.