forked from nativelibs4java/BridJ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CheckPackages
executable file
·65 lines (61 loc) · 2.78 KB
/
CheckPackages
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
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
function failIfHas {
grep "$1" > /dev/null && ( echo "$2" ; exit 1 )
}
function fail {
echo "$@"
exit 1
}
for F in target/bridj*.jar ; do
if [[ ! $F =~ .*(javadoc|sources).* ]]; then
echo ""
echo $F
CONTENTS=`unzip -l $F`
echo "$CONTENTS" | grep org/bridj/BridJ.class > /dev/null || fail "Does not have BridJ"
ANDROID_CLASSES="DexFormat AndroidClassDefiner AndroidSupport"
if [[ $F =~ .*android.* ]]; then
for CLS in $ANDROID_CLASSES; do
echo "$CONTENTS" | grep $CLS.class > /dev/null || fail "Does not have class $CLS"
echo " Has class $CLS"
done
echo "$CONTENTS" | egrep "\.so|\.dll|\.dylib" && fail "Android jar should not have binaries"
else
for CLS in $ANDROID_CLASSES; do
echo "$CONTENTS" | grep $CLS.class > /dev/null && fail " Has class $CLS"
done
echo "$CONTENTS" | grep -i Android && fail " Has some android references"
echo "$CONTENTS" | egrep "\.so|\.dll|\.dylib" || exit 1
fi
if [[ $F =~ .*unix-only.* ]]; then
echo "$CONTENTS" | egrep "/(mfc|com)/" && fail " Has windows-only classes"
for FLAVOUR in linux_ sunos_ darwin_ ; do
echo "$CONTENTS" | grep $FLAVOUR || fail " Has no resource matching $FLAVOUR"
done
fi
if [[ $F =~ .*windows-only.* ]]; then
echo "$CONTENTS" | egrep "/mfc/" || fail " Has no MFC classes"
echo "$CONTENTS" | egrep "/com/" || fail " Has no COM classes"
echo "$CONTENTS" | egrep "linux_|sunos_|darwin_|ndroid" && fail " Has unix resources"
fi
if [[ $F =~ .*c-only.* ]]; then
echo "$CONTENTS" | egrep "/(cpp|objc)/" && fail " Has non-windows content"
fi
echo "$CONTENTS" | grep junit && fail " Has JUnit"
fi
done
echo ""
echo "Analyzing android zip"
CONTENTS=`unzip -l target/bridj-*-android.zip`
echo "$CONTENTS" | grep libs/ | grep '\.'
echo "$CONTENTS" | grep 'LICENSE.BridJ.txt' > /dev/null || fail "Does not have LICENSE"
echo "$CONTENTS" | grep 'README.BridJ.txt' > /dev/null || fail "Does not have README"
echo "$CONTENTS" | grep 'libs/bridj-.*-android.jar' > /dev/null || fail "Does not have BridJ JAR"
echo "$CONTENTS" | grep 'libs/bridj-.*-android.jar.properties' > /dev/null || fail "Does not have BridJ JAR properties"
echo "$CONTENTS" | grep 'libs/docs/bridj-.*-sources.jar' > /dev/null || fail "Does not have BridJ sources JAR"
echo "$CONTENTS" | grep 'libs/docs/bridj-.*-javadoc.jar' > /dev/null || fail "Does not have BridJ javadoc JAR"
for ABI in x86 armeabi; do
echo "$CONTENTS" | grep "libs/$ABI/libbridj.so" > /dev/null || fail "Does not have $ABI binary"
done
echo "
SUCCESS
"