-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_android_live.sh
executable file
·68 lines (57 loc) · 2.38 KB
/
build_android_live.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
RC="`cat rc.txt`"
MAJOR_VERSION="`cat major_version.txt`"
MINOR_VERSION="`cat minor_version.txt`"
BASE_DIR=/Users/aardvocate/src/XendBitV3/mobile/XendBit
RC=$((RC + 1))
#MAJOR_VERSION=$((MAJOR_VERSION + 1))
#MINOR_VERSION=$((MINOR_VERSION + 1))
VERSION="v$MAJOR_VERSION.$MINOR_VERSION-rc$RC"
cd $BASE_DIR
echo "$VERSION"
echo "$RC" > rc.txt
echo "$MINOR_VERSION" > minor_version.txt
echo "$MAJOR_VERSION" > major_version.txt
CONSTANTS_FILE="constants.ts"
BAK_FILE="$CONSTANTS_FILE.bak"
WORKING_FILE="$CONSTANTS_FILE.work"
cd $BASE_DIR/src/pages/utils/
#back up constants.ts
cp $CONSTANTS_FILE $BAK_FILE
#make a working copy as well
#tail -n +1 prints the whole file
#tail -n +2 prints all file expect the first line
#tail -n +3 prints all file expect the first 2 lines
tail -n +16 $CONSTANTS_FILE > $WORKING_FILE
#add the server base url and the first line of file
echo 'import { keystore } from "eth-lightwallet";
import { StorageService } from "./storageservice";
import { Console } from "./console";
import { Headers } from "@angular/http";
import { networks, Network } from "bitcoinjs-lib";
import { LocalProps } from "./localprops";
import { CoinsSender } from "./coinssender";
import { HDNode } from "bitcoinjs-lib";
import { mnemonicToSeed } from "bip39";
export class Constants {
static TOMCAT_URL = "https://lb.xendbit.net";' > /tmp/temp
echo "static APP_VERSION = \"$VERSION\"" >> /tmp/temp
echo "static ENABLE_GUEST = false;" >> /tmp/temp
echo "static NOTIFICATION_SOCKET_URL = \"ws://ethereum.xendbit.net:8080/notify/websocket\";" >> /tmp/temp
cat /tmp/temp | cat - $WORKING_FILE > temp && mv temp $WORKING_FILE
mv $WORKING_FILE $CONSTANTS_FILE
cd $BASE_DIR
ionic cordova build android --release
cd $BASE_DIR/platforms/android
./gradlew clean
./gradlew assemble
cd $BASE_DIR
jarsigner -storepass @bsolute -tsa http://timestamp.digicert.com -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore XendBit.keystore $BASE_DIR/platforms/android/build/outputs/apk/armv7/release/android-armv7-release-unsigned.apk XendBit
/Users/aardvocate/Library/Android/sdk/build-tools/24.0.2/zipalign -v 4 $BASE_DIR/platforms/android/build/outputs/apk/armv7/release/android-armv7-release-unsigned.apk XendBit.apk
mv XendBit.apk XendBit.$VERSION.apk
#reverse the process above
cd $BASE_DIR/src/pages/utils/
mv $BAK_FILE $CONSTANTS_FILE
cd $BASE_DIR
scp XendBit.$VERSION.apk [email protected]:/var/www/html/releases/
echo "Done"