-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransform.sh
53 lines (41 loc) · 1000 Bytes
/
transform.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#set -v
if [ $# -eq 0 ]; then
echo Target directory argument required
fi
if [ ! -f kanzi.zip ]; then
echo java source zip 'kanzi.zip' required in current directory
fi
echo Transforming java files under $1 for Android
if [ ! -d $1 ]; then
mkdir $1
fi
if [ ! -d $1/android ]; then
mkdir $1/android
else
rm -rf $1/android
fi
echo Extract source files
unzip -q kanzi.zip -d $1/android
# Delete incompatible files
echo Delete incompatible files
for f in `find $1/android -name "*.java" -exec grep -l "java.awt" {} \;`;
do
rm -f $f
done
for f in `find $1/android -name "*.java" -exec grep -l "javax.swing" {} \;`;
do
rm -f $f
done
for f in `find $1/android -name "*.java" -exec grep -l "concurrent.ForkJoin" {} \;`;
do
rm -f $f
done
for f in `find $1/android -name "*.java" -exec grep -l "java.lang.management" {} \;`;
do
rm -f $f
done
# Replace packages
echo Replace packages
find $1/android -name "*.java" -exec ./replacepackage.sh {} \;
echo Done !