Skip to content

Commit 7e0c81e

Browse files
committed
Add android build script
1 parent 3d32e73 commit 7e0c81e

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525
"test": "jest",
2626
"typescript": "tsc --noEmit",
2727
"lint": "eslint \"**/*.{js,ts,tsx}\"",
28-
"prepare": "bob build",
28+
"prepare": "bob build && scripts/build-android.sh",
2929
"release": "release-it",
30-
"bootstrap": "yarn && cd example && yarn && cd ios && pod install"
30+
"bootstrap": "yarn && cd example && yarn && cd ios && pod install",
31+
"prepublish": "rm -rf android-backup && mv android android-backup && mv android-npm android",
32+
"postpublish": "mv android android-npm && mv android-backup android"
3133
},
3234
"keywords": [
3335
"react-native",

scripts/build-android.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
CWD="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
4+
5+
cd $CWD
6+
cd ..
7+
8+
echo 'Building Android in:'
9+
echo $PWD
10+
11+
cd android
12+
rm -rf build/
13+
14+
./gradlew clean
15+
./gradlew assembleDebug assembleRelease
16+
17+
rm -rf ../android-npm
18+
mkdir ../android-npm
19+
20+
shopt -s dotglob nullglob
21+
mv -v build/outputs/aar/* ../android-npm

0 commit comments

Comments
 (0)