forked from getlantern/lantern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installerBuild.bash
executable file
·100 lines (79 loc) · 3.29 KB
/
installerBuild.bash
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env bash
CONSTANTS_FILE=src/main/java/org/lantern/LanternClientConstants.java
LOCAL_BUILD=false
if [[ $VERSION == "local" ]] || [[ $VERSION == "quick" ]];
then
export LOCAL_BUILD=true
fi
function die() {
echo $*
echo "Reverting constants file"
git checkout -- $CONSTANTS_FILE || die "Could not revert $CONSTANTS_FILE?"
# Make sure to move back to master, not tag
git checkout $oldbranch
exit 1
}
if [ $# -lt "1" ]
then
die "$0: Received $# args... version required"
fi
# First make sure we have everything we need to do the install
test -f ../secure/bns-osx-cert-developer-id-application.p12 || die "Need OSX signing certificate at ../secure/bns-osx-cert-developer-id-application.p12"
test -f ../secure/bns_cert.p12 || die "Need windows signing certificate at ../secure/bns_cert.p12"
javac -version 2>&1 | grep 1.7 && die "Cannot build with Java 7 due to bugs with generated class files and pac"
which install4jc || die "No install4jc on PATH -- ABORTING"
printenv | grep INSTALL4J_KEY || die "Must have INSTALL4J_KEY defined with the Install4J license key to use"
printenv | grep INSTALL4J_MAC_PASS || die "Must have OSX signing key password defined in INSTALL4J_MAC_PASS"
printenv | grep INSTALL4J_WIN_PASS || die "Must have windows signing key password defined in INSTALL4J_WIN_PASS"
test -f $CONSTANTS_FILE || die "No constants file at $CONSTANTS_FILE?? Exiting"
VERSION=$1
MVN_ARGS=$2
echo "*******MAVEN ARGS*******: $MVN_ARGS"
if [ "$LOCAL_BUILD" = true ];
then
echo "Building from local code, not performing git ops"
else
git pull || die "Could not git pull?"
git pull --tags || die "Could not git pull --tags?"
if [[ $VERSION == "HEAD" ]];
then
CHECKOUT=HEAD;
elif [[ $VERSION == "newest" ]];
then
CHECKOUT=newest;
else
CHECKOUT=lantern-$VERSION;
fi
oldbranch=`git rev-parse --abbrev-ref HEAD`
git checkout $CHECKOUT || die "Could not checkout branch at $CHECKOUT"
fi
if [[ $VERSION == "newest" ]];
then
# Exporting it so platform-specific scripts will get the right name.
export VERSION=$(./parseversionfrompom.py);
fi
if [[ $VERSION == "quick" ]];
then
echo "Skipping maven for quick build"
else
echo "Version is $VERSION"
mvn clean || die "Could not clean?"
mvn $MVN_ARGS -Drelease install -Dmaven.test.skip=true || die "Could not build?"
fi
echo "Reverting constants file"
git checkout -- $CONSTANTS_FILE || die "Could not revert version file?"
if [[ $VERSION == "HEAD" ]] || [[ $VERSION == "local" ]];
then
cp -f `ls -1t target/lantern-*-small.jar | head -1` install/common/lantern.jar || die "Could not copy jar?"
elif [[ $VERSION == "quick" ]];
then
cp -f `ls -1t target/lantern-*.jar | head -1` install/common/lantern.jar || die "Could not copy jar?"
else
cp -f target/lantern-$VERSION-small.jar install/common/lantern.jar || die "Could not copy jar from lantern-$VERSION-small.jar"
fi
./bin/searchForJava7ClassFiles.bash install/common/lantern.jar || die "Found java 7 class files in build!!"
test -f ./install/wrapper/InstallDownloader.class || die "Could not find InstallerDownloader class file?"
file ./install/wrapper/InstallDownloader.class | grep 51 && die "InstallerDownloader.class was compiled with java7"
install4jc -L $INSTALL4J_KEY || die "Could not update license information?"
echo "Moving back to $oldbranch"
git checkout $oldbranch