forked from getlantern/lantern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installerBuild.bash
executable file
·76 lines (61 loc) · 2.49 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
#!/usr/bin/env bash
CONSTANTS_FILE=src/main/java/org/lantern/LanternConstants.java
function die() {
echo $*
echo "Reverting version file"
git checkout -- $CONSTANTS_FILE || die "Could not revert version file?"
exit 1
}
if [ $# -lt "1" ]
then
die "$0: Received $# args... version required"
fi
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"
VERSION=$1
INTERNAL_VERSION=$1-`git rev-parse HEAD | cut -c1-10`
MVN_ARGS=$2
echo "*******MAVEN ARGS*******: $MVN_ARGS"
perl -pi -e "s/lantern_version_tok/$INTERNAL_VERSION/g" $CONSTANTS_FILE
if [ $# -gt "2" ]
then
RELEASE=$3;
else
RELEASE=true;
fi
BUILD_TIME=`date +%s`
perl -pi -e "s/build_time_tok/$BUILD_TIME/g" $CONSTANTS_FILE
# The build script in Lantern EC2 instances sets this in the environment.
if test -z $FALLBACK_SERVER_HOST; then
FALLBACK_SERVER_HOST="75.101.134.244";
fi
perl -pi -e "s/fallback_server_host_tok/$FALLBACK_SERVER_HOST/g" $CONSTANTS_FILE || die "Could not set fallback server host"
# The build script in Lantern EC2 instances sets this in the environment.
if test -z $FALLBACK_SERVER_PORT; then
FALLBACK_SERVER_PORT="7777";
fi
perl -pi -e "s/fallback_server_port_tok/$FALLBACK_SERVER_PORT/g" $CONSTANTS_FILE || die "Could not set fallback server port";
GE_API_KEY=`cat lantern_getexceptional.txt`
if [ ! -n "$GE_API_KEY" ]
then
die "No API key!!"
fi
perl -pi -e "s/ExceptionalUtils.NO_OP_KEY/\"$GE_API_KEY\"/g" $CONSTANTS_FILE
curBranch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
git pull origin $curBranch || die '"git pull origin" failed?'
mvn clean || die "Could not clean?"
mvn $MVN_ARGS install -Dmaven.test.skip=true || die "Could not build?"
echo "Reverting version file"
git checkout -- $CONSTANTS_FILE || die "Could not revert version file?"
cp target/lantern*SNAPSHOT.jar install/common/lantern.jar || die "Could not copy jar?"
if [ $RELEASE = true ]
then
echo "Tagging...";
git tag -f -a v$VERSION -m "Version $INTERNAL_VERSION release with MVN_ARGS $MVN_ARGS";
echo "Pushing tags...";
git push --tags || die "Could not push tags!!";
echo "Finished push...";
fi
install4jc -L $INSTALL4J_KEY || die "Could not update license information?"