Skip to content

Commit 8a2ceb5

Browse files
committed
SDK-714 reuse iOS version update script to update android
1 parent 570a24d commit 8a2ceb5

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

android/build.gradle

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
import groovy.json.JsonSlurper
2-
31
apply plugin: 'com.android.library'
42

53
def getNpmVersion() {
6-
// This returns the app version instead of the plugin version. Will need to rework this in the future.
7-
// def inputFile = new File("../package.json")
8-
// def packageJson = new JsonSlurper().parseText(inputFile.text)
9-
// return packageJson["version"]
10-
11-
return "4.2.2"
4+
def pluginVersion = "4.2.2"
5+
return pluginVersion
126
}
137

148
repositories {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"scripts": {
1515
"lint": "eslint src test",
16-
"version": "./scripts/update-plugin-version-in-RNBranchConfig.sh",
16+
"version": "./scripts/update-plugin-version.sh",
1717
"test": "jest"
1818
},
1919
"babel": {

scripts/update-plugin-version-in-RNBranchConfig.sh renamed to scripts/update-plugin-version.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ set -e
66
# Attribution: https://medium.com/@andr3wjack/versioning-react-native-apps-407469707661
77

88
PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')
9+
10+
# update Android build.gradle
11+
sed -i '' -e "/pluginVersion/ {s/\".*\"/\"$PACKAGE_VERSION\"/; }" android/build.gradle
12+
13+
# update iOS RNBranchConfig.m
914
sed -i '' -e "/RNBNC_PLUGIN_VERSION/ {s/\".*\"/\"$PACKAGE_VERSION\"/; }" ios/RNBranchConfig.m
1015

1116
# this script runs runs AFTER bumping the package version, but BEFORE commit, so we need to git add.
1217
# More info: https://docs.npmjs.com/misc/scripts
13-
git add ./ios/RNBranchConfig.m
18+
git add ./android/build.gradle
19+
git add ./ios/RNBranchConfig.m

0 commit comments

Comments
 (0)