Browse Source

gradle fixes

Daniel Zlotin 7 years ago
parent
commit
a4c91c1eed

+ 27
- 38
android/app/build.gradle View File

@@ -1,30 +1,15 @@
1
-buildscript {
2
-    repositories {
3
-        jcenter()
4
-    }
5
-    dependencies {
6
-        classpath 'com.android.tools.build:gradle:2.1.3'
7
-    }
8
-}
9
-
10 1
 apply plugin: 'com.android.library'
11 2
 
12 3
 android {
13 4
     compileSdkVersion 23
14
-    buildToolsVersion "23.0.1"
5
+    buildToolsVersion "23.0.3"
15 6
 
16 7
     defaultConfig {
17 8
         minSdkVersion 16
18
-        targetSdkVersion 22
9
+        targetSdkVersion 23
19 10
         versionCode 1
20 11
         versionName "1.0"
21 12
     }
22
-    defaultPublishConfig 'release'
23
-    publishNonDefault true
24
-    productFlavors {
25
-        library {
26
-        }
27
-    }
28 13
     buildTypes {
29 14
         release {
30 15
             minifyEnabled false
@@ -36,39 +21,43 @@ android {
36 21
     lintOptions {
37 22
         abortOnError false
38 23
     }
39
-}
40 24
 
41
-repositories {
42
-    mavenLocal()
43
-    jcenter()
44
-    maven {
45
-        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
46
-        url "$rootDir/../node_modules/react-native/android"
47
-    }
48
-}
49
-
50
-allprojects { p ->
51
-    p.tasks.whenTaskAdded { task ->
52
-        if (task.name.toLowerCase().contains('lint')) {
53
-            task.enabled = false;
25
+    testOptions {
26
+        unitTests.all { t ->
27
+            reports {
28
+                html.enabled true
29
+            }
30
+            testLogging {
31
+                events "passed", "skipped", "failed", "standardOut", "standardError"
32
+            }
33
+            afterSuite { desc, result ->
34
+                if (!desc.parent) { // will match the outermost suite
35
+                    def output = "      ${result.resultType} (${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)     "
36
+                    def repeatLength = output.length()
37
+                    println '\n' + ('-' * repeatLength) + '\n' + output + '\n' + ('-' * repeatLength) + '\n'
38
+
39
+                    println "see report at file://${t.reports.html.destination}/index.html"
40
+                }
41
+            }
54 42
         }
55 43
     }
56 44
 }
57 45
 
58 46
 dependencies {
59 47
     compile fileTree(dir: "libs", include: ["*.jar"])
60
-    compile "com.aurelhubert:ahbottomnavigation:1.3.3"
48
+
61 49
     compile "com.android.support:appcompat-v7:23.3.0"
62 50
     compile 'com.android.support:design:23.3.0'
63
-    compile "com.facebook.react:react-native:+"  // From node_modules
51
+
52
+    // node_modules
53
+    compile "com.facebook.react:react-native:+"
54
+
55
+    // third party
56
+    compile "com.aurelhubert:ahbottomnavigation:1.3.3"
64 57
     compile 'com.balysv.materialmenu:material-menu-toolbar:1.5.4'
65 58
 
59
+    // tests
66 60
     testCompile "junit:junit:4.12"
67 61
     testCompile "org.robolectric:robolectric:3.1.1"
68 62
     testCompile 'org.assertj:assertj-core:3.5.2'
69 63
 }
70
-
71
-task unit(dependsOn: 'testLibraryDebugUnitTest') << {
72
-    println 'Finished running unit all tests'
73
-    println 'report at file://' + tasks.testLibraryDebugUnitTest.outputs.files.last().absolutePath + '/index.html'
74
-}

+ 1
- 1
android/app/src/test/java/com/reactnativenavigation/EnvironmentTest.java View File

@@ -10,6 +10,6 @@ import static org.assertj.core.api.Java6Assertions.assertThat;
10 10
 public class EnvironmentTest {
11 11
     @Test
12 12
     public void assertJ() {
13
-        assertThat(1 + 2).isEqualTo(3);
13
+        assertThat(1 + 2).isEqualTo(3).isGreaterThan(2).isLessThan(4).isNotNegative().isPositive().isNotZero();
14 14
     }
15 15
 }

+ 2
- 0
android/app/src/test/resources/robolectric.properties View File

@@ -0,0 +1,2 @@
1
+manifest: src/main/AndroidManifest.xml
2
+sdk: 23

+ 2
- 2
android/build.gradle View File

@@ -5,7 +5,7 @@ buildscript {
5 5
         jcenter()
6 6
     }
7 7
     dependencies {
8
-        classpath 'com.android.tools.build:gradle:1.3.1'
8
+        classpath 'com.android.tools.build:gradle:2.1.3'
9 9
 
10 10
         // NOTE: Do not place your application dependencies here; they belong
11 11
         // in the individual module build.gradle files
@@ -18,7 +18,7 @@ allprojects {
18 18
         jcenter()
19 19
         maven {
20 20
             // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
21
-            url "$projectDir/../../node_modules/react-native/android"
21
+            url "$rootDir/../node_modules/react-native/android"
22 22
         }
23 23
     }
24 24
 }

+ 1
- 0
android/settings.gradle View File

@@ -0,0 +1 @@
1
+include ':app'

+ 3
- 4
example-redux/android/app/build.gradle View File

@@ -84,12 +84,12 @@ def enableProguardInReleaseBuilds = false
84 84
 
85 85
 android {
86 86
     compileSdkVersion 23
87
-    buildToolsVersion "23.0.1"
87
+    buildToolsVersion "23.0.3"
88 88
 
89 89
     defaultConfig {
90 90
         applicationId "com.exampleredux"
91 91
         minSdkVersion 16
92
-        targetSdkVersion 22
92
+        targetSdkVersion 23
93 93
         versionCode 1
94 94
         versionName "1.0"
95 95
         ndk {
@@ -129,8 +129,7 @@ dependencies {
129 129
     compile fileTree(dir: "libs", include: ["*.jar"])
130 130
     compile "com.android.support:appcompat-v7:23.0.1"
131 131
     compile "com.facebook.react:react-native:+"  // From node_modules
132
-    debugCompile project(path: ':react-native-navigation', configuration: 'libraryDebug')
133
-    releaseCompile project(path: ':react-native-navigation', configuration: 'libraryRelease')
132
+    compile project(':react-native-navigation')
134 133
 }
135 134
 
136 135
 // Run this once to be able to run the application with BUCK

+ 2
- 3
example-redux/package.json View File

@@ -4,7 +4,7 @@
4 4
   "private": true,
5 5
   "scripts": {
6 6
     "start": "watchman watch-del-all && adb reverse tcp:8081 tcp:8081 && node node_modules/react-native/local-cli/cli.js start",
7
-    "install:android": "pushd android && ./gradlew installDebug && popd"
7
+    "install:android": "cd android && ./gradlew installDebug"
8 8
   },
9 9
   "dependencies": {
10 10
     "react-native-navigation": "file:../",
@@ -13,7 +13,6 @@
13 13
     "react-redux": "^4.0.6",
14 14
     "redux": "^3.0.5",
15 15
     "redux-thunk": "^1.0.3",
16
-    "seamless-immutable": "^5.0.1",
17
-    "babel-preset-react-native-stage-0": "*"
16
+    "seamless-immutable": "^5.0.1"
18 17
   }
19 18
 }

+ 6
- 6
package.json View File

@@ -4,25 +4,25 @@
4 4
   "description": "React Native Navigation - truly native navigation for iOS and Android",
5 5
   "license": "MIT",
6 6
   "nativePackage": true,
7
+  "author": "Tal Kol <talkol@gmail.com>",
7 8
   "publishConfig": {
8 9
     "registry": "https://registry.npmjs.org/"
9 10
   },
10
-  "repository": {
11
-    "type": "git",
12
-    "url": "https://github.com/wix/react-native-navigation.git"
13
-  },
14 11
   "bugs": {
15 12
     "url": "https://github.com/wix/react-native-navigation/issues"
16 13
   },
17 14
   "homepage": "https://github.com/wix/react-native-navigation",
18 15
   "readme": "https://github.com/wix/react-native-navigation#readme",
16
+  "repository": {
17
+    "type": "git",
18
+    "url": "https://github.com/wix/react-native-navigation.git"
19
+  },
19 20
   "main": "src/index.js",
20
-  "author": "Tal Kol <talkol@gmail.com>",
21 21
   "scripts": {
22 22
     "build": ":",
23 23
     "lint": "eslint src test",
24 24
     "pretest": "npm run lint",
25
-    "test": "cd android && ./gradlew test",
25
+    "test": "cd android && ./gradlew clean testDebugUnitTest",
26 26
     "release": "npm version prerelease && npm publish --tag next && npm view react-native-navigation dist-tags && git push"
27 27
   },
28 28
   "peerDependencies": {