Browse Source

support for android test release builds, fixed #1154

Daniel Zlotin 7 years ago
parent
commit
0786940ef8
4 changed files with 31 additions and 2 deletions
  1. 1
    1
      package.json
  2. 19
    0
      playground/android/app/build.gradle
  3. 10
    0
      scripts/install-android.js
  4. 1
    1
      scripts/test.e2e.android.js

+ 1
- 1
package.json View File

@@ -27,7 +27,7 @@
27 27
   "scripts": {
28 28
     "build": ":",
29 29
     "xcode": "open playground/ios/playground.xcodeproj",
30
-    "install-android": "cd playground/android && ./gradlew installDebug",
30
+    "install-android": "node ./scripts/install-android.js",
31 31
     "uninstall-android": "cd playground/android && ./gradlew uninstallAll",
32 32
     "clean": "node ./scripts/clean.js",
33 33
     "start": "node ./scripts/start.js",

+ 19
- 0
playground/android/app/build.gradle View File

@@ -1,4 +1,10 @@
1 1
 apply plugin: "com.android.application"
2
+
3
+project.ext.react = [
4
+        root     : "../../../",
5
+        entryFile: "playground/index.android.js"
6
+]
7
+
2 8
 apply from: "../../../node_modules/react-native/react.gradle"
3 9
 
4 10
 android {
@@ -12,6 +18,19 @@ android {
12 18
         versionCode 1
13 19
         versionName "1.0"
14 20
     }
21
+    signingConfigs {
22
+        release {
23
+            storeFile file('../playground.jks')
24
+            storePassword "playground"
25
+            keyAlias "playground"
26
+            keyPassword "playground"
27
+        }
28
+    }
29
+    buildTypes {
30
+        release {
31
+            signingConfig signingConfigs.release
32
+        }
33
+    }
15 34
 }
16 35
 
17 36
 dependencies {

+ 10
- 0
scripts/install-android.js View File

@@ -0,0 +1,10 @@
1
+const _ = require('lodash');
2
+const exec = require('shell-utils').exec;
3
+
4
+const release = _.includes(process.argv, 'release');
5
+
6
+run();
7
+
8
+function run() {
9
+  exec.execSync(`cd playground/android && ./gradlew ${release ? 'installRelease' : 'installDebug'}`);
10
+}

+ 1
- 1
scripts/test.e2e.android.js View File

@@ -10,7 +10,7 @@ function run() {
10 10
   }
11 11
 
12 12
   exec.execSync(`yarn run uninstall-android`);
13
-  exec.execSync(`yarn run install-android`);
13
+  exec.execSync(`yarn run install-android ${release ? '-- release' : ''}`);
14 14
   exec.execSync(`cd AndroidE2E && ./gradlew connectedDebugAndroidTest`);
15 15
 }
16 16