ソースを参照

Added Android test app.

Tom Underhill 5 年 前
コミット
a1da2c9271
共有34 個のファイルを変更した790 個の追加34 個の削除を含む
  1. 55
    0
      example/android/app/BUCK
  2. 190
    0
      example/android/app/build.gradle
  3. 19
    0
      example/android/app/build_defs.bzl
  4. バイナリ
      example/android/app/exampleAsyncStorage.keystore
  5. 17
    0
      example/android/app/proguard-rules.pro
  6. 25
    0
      example/android/app/scripts/CI.gradle
  7. 24
    0
      example/android/app/src/androidTest/java/com/webviewexample/DetoxTest.java
  8. 9
    0
      example/android/app/src/debug/AndroidManifest.xml
  9. 26
    0
      example/android/app/src/main/AndroidManifest.xml
  10. 15
    0
      example/android/app/src/main/java/com/webviewexample/MainActivity.java
  11. 47
    0
      example/android/app/src/main/java/com/webviewexample/MainApplication.java
  12. バイナリ
      example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
  13. バイナリ
      example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
  14. バイナリ
      example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
  15. バイナリ
      example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
  16. バイナリ
      example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
  17. バイナリ
      example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
  18. バイナリ
      example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  19. バイナリ
      example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
  20. バイナリ
      example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  21. バイナリ
      example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
  22. 3
    0
      example/android/app/src/main/res/values/strings.xml
  23. 8
    0
      example/android/app/src/main/res/values/styles.xml
  24. 38
    0
      example/android/build.gradle
  25. 27
    0
      example/android/gradle.properties
  26. バイナリ
      example/android/gradle/wrapper/gradle-wrapper.jar
  27. 6
    0
      example/android/gradle/wrapper/gradle-wrapper.properties
  28. 172
    0
      example/android/gradlew
  29. 84
    0
      example/android/gradlew.bat
  30. 8
    0
      example/android/keystores/BUCK
  31. 4
    0
      example/android/keystores/debug.keystore.properties
  32. 7
    0
      example/android/settings.gradle
  33. 4
    0
      package.json
  34. 2
    34
      yarn.lock

+ 55
- 0
example/android/app/BUCK ファイルの表示

@@ -0,0 +1,55 @@
1
+# To learn about Buck see [Docs](https://buckbuild.com/).
2
+# To run your application with Buck:
3
+# - install Buck
4
+# - `npm start` - to start the packager
5
+# - `cd android`
6
+# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7
+# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8
+# - `buck install -r android/app` - compile, install and run application
9
+#
10
+
11
+load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12
+
13
+lib_deps = []
14
+
15
+create_aar_targets(glob(["libs/*.aar"]))
16
+
17
+create_jar_targets(glob(["libs/*.jar"]))
18
+
19
+android_library(
20
+    name = "all-libs",
21
+    exported_deps = lib_deps,
22
+)
23
+
24
+android_library(
25
+    name = "app-code",
26
+    srcs = glob([
27
+        "src/main/java/**/*.java",
28
+    ]),
29
+    deps = [
30
+        ":all-libs",
31
+        ":build_config",
32
+        ":res",
33
+    ],
34
+)
35
+
36
+android_build_config(
37
+    name = "build_config",
38
+    package = "com.webviewexample",
39
+)
40
+
41
+android_resource(
42
+    name = "res",
43
+    package = "com.webviewexample",
44
+    res = "src/main/res",
45
+)
46
+
47
+android_binary(
48
+    name = "app",
49
+    keystore = "//android/keystores:debug",
50
+    manifest = "src/main/AndroidManifest.xml",
51
+    package_type = "debug",
52
+    deps = [
53
+        ":app-code",
54
+    ],
55
+)

+ 190
- 0
example/android/app/build.gradle ファイルの表示

@@ -0,0 +1,190 @@
1
+apply plugin: "com.android.application"
2
+
3
+import com.android.build.OutputFile
4
+
5
+/**
6
+ * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7
+ * and bundleReleaseJsAndAssets).
8
+ * These basically call `react-native bundle` with the correct arguments during the Android build
9
+ * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10
+ * bundle directly from the development server. Below you can see all the possible configurations
11
+ * and their defaults. If you decide to add a configuration block, make sure to add it before the
12
+ * `apply from: "../../node_modules/react-native/react.gradle"` line.
13
+ *
14
+ * project.ext.react = [
15
+ *   // the name of the generated asset file containing your JS bundle
16
+ *   bundleAssetName: "index.android.bundle",
17
+ *
18
+ *   // the entry file for bundle generation
19
+ *   entryFile: "index.android.js",
20
+ *
21
+ *   // whether to bundle JS and assets in debug mode
22
+ *   bundleInDebug: false,
23
+ *
24
+ *   // whether to bundle JS and assets in release mode
25
+ *   bundleInRelease: true,
26
+ *
27
+ *   // whether to bundle JS and assets in another build variant (if configured).
28
+ *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29
+ *   // The configuration property can be in the following formats
30
+ *   //         'bundleIn${productFlavor}${buildType}'
31
+ *   //         'bundleIn${buildType}'
32
+ *   // bundleInFreeDebug: true,
33
+ *   // bundleInPaidRelease: true,
34
+ *   // bundleInBeta: true,
35
+ *
36
+ *   // whether to disable dev mode in custom build variants (by default only disabled in release)
37
+ *   // for example: to disable dev mode in the staging build type (if configured)
38
+ *   devDisabledInStaging: true,
39
+ *   // The configuration property can be in the following formats
40
+ *   //         'devDisabledIn${productFlavor}${buildType}'
41
+ *   //         'devDisabledIn${buildType}'
42
+ *
43
+ *   // the root of your project, i.e. where "package.json" lives
44
+ *   root: "../../",
45
+ *
46
+ *   // where to put the JS bundle asset in debug mode
47
+ *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
48
+ *
49
+ *   // where to put the JS bundle asset in release mode
50
+ *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
51
+ *
52
+ *   // where to put drawable resources / React Native assets, e.g. the ones you use via
53
+ *   // require('./image.png')), in debug mode
54
+ *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
55
+ *
56
+ *   // where to put drawable resources / React Native assets, e.g. the ones you use via
57
+ *   // require('./image.png')), in release mode
58
+ *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
59
+ *
60
+ *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
61
+ *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
62
+ *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
63
+ *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
64
+ *   // for example, you might want to remove it from here.
65
+ *   inputExcludes: ["android/**", "ios/**"],
66
+ *
67
+ *   // override which node gets called and with what additional arguments
68
+ *   nodeExecutableAndArgs: ["node"],
69
+ *
70
+ *   // supply additional arguments to the packager
71
+ *   extraPackagerArgs: []
72
+ * ]
73
+ */
74
+
75
+
76
+project.ext.react = [
77
+        cliPath: "./node_modules/react-native/local-cli/cli.js",
78
+        enableHermes: false,
79
+        entryFile: "./example/index.js",
80
+        root: "../../../"
81
+]
82
+
83
+
84
+apply from: "./scripts/CI.gradle"
85
+apply from: "../../../node_modules/react-native/react.gradle"
86
+
87
+/**
88
+ * Set this to true to create two separate APKs instead of one:
89
+ *   - An APK that only works on ARM devices
90
+ *   - An APK that only works on x86 devices
91
+ * The advantage is the size of the APK is reduced by about 4MB.
92
+ * Upload all the APKs to the Play Store and people will download
93
+ * the correct one based on the CPU architecture of their device.
94
+ */
95
+def enableSeparateBuildPerCPUArchitecture = false
96
+
97
+/**
98
+ * Run Proguard to shrink the Java bytecode in release builds.
99
+ */
100
+def enableProguardInReleaseBuilds = false
101
+
102
+android {
103
+    compileSdkVersion rootProject.ext.compileSdkVersion
104
+
105
+    compileOptions {
106
+        sourceCompatibility JavaVersion.VERSION_1_8
107
+        targetCompatibility JavaVersion.VERSION_1_8
108
+    }
109
+
110
+    signingConfigs {
111
+        release {
112
+            storeFile file("exampleWebView.keystore")
113
+            keyAlias "webview"
114
+            keyPassword "webview"
115
+            storePassword "webview"
116
+        }
117
+    }
118
+
119
+    defaultConfig {
120
+        applicationId "com.webviewexample"
121
+        minSdkVersion rootProject.ext.minSdkVersion
122
+        targetSdkVersion rootProject.ext.targetSdkVersion
123
+        versionCode 1
124
+        versionName "1.0"
125
+        testBuildType System.getProperty('testBuildType', 'debug')
126
+        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
127
+    }
128
+    splits {
129
+        abi {
130
+            reset()
131
+            enable enableSeparateBuildPerCPUArchitecture
132
+            universalApk false  // If true, also generate a universal APK
133
+            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
134
+        }
135
+    }
136
+    buildTypes {
137
+        release {
138
+            minifyEnabled enableProguardInReleaseBuilds
139
+            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
140
+            proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
141
+            signingConfig signingConfigs.release
142
+            matchingFallbacks = ['release']
143
+        }
144
+    }
145
+    // applicationVariants are e.g. debug, release
146
+    applicationVariants.all { variant ->
147
+        variant.outputs.each { output ->
148
+            // For each separate APK per architecture, set a unique version code as described here:
149
+            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
150
+            def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
151
+            def abi = output.getFilter(OutputFile.ABI)
152
+            if (abi != null) {  // null for the universal-debug, universal-release variants
153
+                output.versionCodeOverride =
154
+                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
155
+            }
156
+        }
157
+    }
158
+}
159
+
160
+def jscFlavor = 'org.webkit:android-jsc:+'
161
+
162
+def enableHermes = project.ext.react.get("enableHermes", false);
163
+
164
+dependencies {
165
+    implementation project(':ReactNativeWebView')
166
+    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
167
+    implementation fileTree(dir: "libs", include: ["*.jar"])
168
+    implementation "com.facebook.react:react-native:+"  // From node_modules
169
+
170
+    // tests
171
+    androidTestImplementation ('com.wix:detox:+') { transitive = true }
172
+    androidTestImplementation 'junit:junit:4.12'
173
+
174
+    if (enableHermes) {
175
+        // For RN 0.60.x
176
+        def hermesPath = "${rootProject.projectDir}/../node_modules/hermesvm/android/"
177
+
178
+        debugImplementation files(hermesPath + "hermes-debug.aar")
179
+        releaseImplementation files(hermesPath + "hermes-release.aar")
180
+    } else {
181
+        implementation jscFlavor
182
+    }
183
+}
184
+
185
+// Run this once to be able to run the application with BUCK
186
+// puts all compile dependencies into folder libs for BUCK to use
187
+task copyDownloadableDepsToLibs(type: Copy) {
188
+    from configurations.compile
189
+    into 'libs'
190
+}

+ 19
- 0
example/android/app/build_defs.bzl ファイルの表示

@@ -0,0 +1,19 @@
1
+"""Helper definitions to glob .aar and .jar targets"""
2
+
3
+def create_aar_targets(aarfiles):
4
+    for aarfile in aarfiles:
5
+        name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6
+        lib_deps.append(":" + name)
7
+        android_prebuilt_aar(
8
+            name = name,
9
+            aar = aarfile,
10
+        )
11
+
12
+def create_jar_targets(jarfiles):
13
+    for jarfile in jarfiles:
14
+        name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15
+        lib_deps.append(":" + name)
16
+        prebuilt_jar(
17
+            name = name,
18
+            binary_jar = jarfile,
19
+        )

バイナリ
example/android/app/exampleAsyncStorage.keystore ファイルの表示


+ 17
- 0
example/android/app/proguard-rules.pro ファイルの表示

@@ -0,0 +1,17 @@
1
+# Add project specific ProGuard rules here.
2
+# By default, the flags in this file are appended to flags specified
3
+# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
+# You can edit the include path and order by changing the proguardFiles
5
+# directive in build.gradle.
6
+#
7
+# For more details, see
8
+#   http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+# Add any project specific keep options here:
11
+
12
+# If your project uses WebView with JS, uncomment the following
13
+# and specify the fully qualified class name to the JavaScript interface
14
+# class:
15
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
+#   public *;
17
+#}

+ 25
- 0
example/android/app/scripts/CI.gradle ファイルの表示

@@ -0,0 +1,25 @@
1
+// Fetch all dependencies upfront
2
+task fetchDependencies() {
3
+    description 'Download all dependencies to the Gradle cache'
4
+    group 'android'
5
+    doLast {
6
+        project.rootProject.allprojects.each { subProject ->
7
+            subProject.buildscript.configurations.each {config ->
8
+                if(config.canBeResolved) {
9
+                    config.files
10
+                }
11
+            }
12
+            subProject.configurations.each {config ->
13
+                if(config.canBeResolved) {
14
+                    // DefaultLenientConfiguration$ArtifactResolveException
15
+                    try {
16
+                        config.files
17
+                    } catch(e) {
18
+                        println e
19
+                    }
20
+
21
+                }
22
+            }
23
+        }
24
+    }
25
+}

+ 24
- 0
example/android/app/src/androidTest/java/com/webviewexample/DetoxTest.java ファイルの表示

@@ -0,0 +1,24 @@
1
+package com.webviewexample;
2
+
3
+import androidx.test.filters.LargeTest;
4
+import androidx.test.rule.ActivityTestRule;
5
+import androidx.test.runner.AndroidJUnit4;
6
+
7
+import com.wix.detox.Detox;
8
+
9
+import org.junit.Rule;
10
+import org.junit.Test;
11
+import org.junit.runner.RunWith;
12
+
13
+@RunWith(AndroidJUnit4.class)
14
+@LargeTest
15
+public class DetoxTest {
16
+
17
+    @Rule
18
+    public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false);
19
+
20
+    @Test
21
+    public void runDetoxTests() throws InterruptedException {
22
+        Detox.runTests(mActivityRule);
23
+    }
24
+}

+ 9
- 0
example/android/app/src/debug/AndroidManifest.xml ファイルの表示

@@ -0,0 +1,9 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+          xmlns:tools="http://schemas.android.com/tools">
4
+    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
5
+    <application
6
+    	android:usesCleartextTraffic="true"
7
+    	tools:targetApi="28"
8
+    	tools:ignore="GoogleAppIndexingWarning"/>
9
+</manifest>

+ 26
- 0
example/android/app/src/main/AndroidManifest.xml ファイルの表示

@@ -0,0 +1,26 @@
1
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+    package="com.webviewexample">
3
+
4
+    <uses-permission android:name="android.permission.INTERNET" />
5
+
6
+    <application
7
+      android:name=".MainApplication"
8
+      android:label="@string/app_name"
9
+      android:icon="@mipmap/ic_launcher"
10
+      android:roundIcon="@mipmap/ic_launcher_round"
11
+      android:allowBackup="false"
12
+      android:theme="@style/AppTheme">
13
+      <activity
14
+        android:name=".MainActivity"
15
+        android:label="@string/app_name"
16
+        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
17
+        android:windowSoftInputMode="adjustResize">
18
+        <intent-filter>
19
+            <action android:name="android.intent.action.MAIN" />
20
+            <category android:name="android.intent.category.LAUNCHER" />
21
+        </intent-filter>
22
+      </activity>
23
+      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
24
+    </application>
25
+
26
+</manifest>

+ 15
- 0
example/android/app/src/main/java/com/webviewexample/MainActivity.java ファイルの表示

@@ -0,0 +1,15 @@
1
+package com.webviewexample;
2
+
3
+import com.facebook.react.ReactActivity;
4
+
5
+public class MainActivity extends ReactActivity {
6
+
7
+    /**
8
+     * Returns the name of the main component registered from JavaScript.
9
+     * This is used to schedule rendering of the component.
10
+     */
11
+    @Override
12
+    protected String getMainComponentName() {
13
+        return "RNCWebViewExample";
14
+    }
15
+}

+ 47
- 0
example/android/app/src/main/java/com/webviewexample/MainApplication.java ファイルの表示

@@ -0,0 +1,47 @@
1
+package com.webviewexample;
2
+
3
+import android.app.Application;
4
+
5
+import com.facebook.react.ReactApplication;
6
+import com.facebook.react.ReactNativeHost;
7
+import com.facebook.react.ReactPackage;
8
+import com.facebook.react.shell.MainReactPackage;
9
+import com.facebook.soloader.SoLoader;
10
+import com.reactnativecommunity.webview.RNCWebViewPackage;
11
+
12
+import java.util.Arrays;
13
+import java.util.List;
14
+
15
+public class MainApplication extends Application implements ReactApplication {
16
+
17
+    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
18
+        @Override
19
+        public boolean getUseDeveloperSupport() {
20
+            return BuildConfig.DEBUG;
21
+        }
22
+
23
+        @Override
24
+        protected List<ReactPackage> getPackages() {
25
+            return Arrays.<ReactPackage>asList(
26
+                    new MainReactPackage(),
27
+                    new RNCWebViewPackage()
28
+            );
29
+        }
30
+
31
+        @Override
32
+        protected String getJSMainModuleName() {
33
+            return "example/index";
34
+        }
35
+    };
36
+
37
+    @Override
38
+    public ReactNativeHost getReactNativeHost() {
39
+        return mReactNativeHost;
40
+    }
41
+
42
+    @Override
43
+    public void onCreate() {
44
+        super.onCreate();
45
+        SoLoader.init(this, /* native exopackage */ false);
46
+    }
47
+}

バイナリ
example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png ファイルの表示


バイナリ
example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png ファイルの表示


バイナリ
example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png ファイルの表示


バイナリ
example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png ファイルの表示


バイナリ
example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png ファイルの表示


バイナリ
example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png ファイルの表示


バイナリ
example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png ファイルの表示


バイナリ
example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png ファイルの表示


バイナリ
example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png ファイルの表示


バイナリ
example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png ファイルの表示


+ 3
- 0
example/android/app/src/main/res/values/strings.xml ファイルの表示

@@ -0,0 +1,3 @@
1
+<resources>
2
+    <string name="app_name">WebViewExample</string>
3
+</resources>

+ 8
- 0
example/android/app/src/main/res/values/styles.xml ファイルの表示

@@ -0,0 +1,8 @@
1
+<resources>
2
+
3
+    <!-- Base application theme. -->
4
+    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
5
+        <!-- Customize your theme here. -->
6
+    </style>
7
+
8
+</resources>

+ 38
- 0
example/android/build.gradle ファイルの表示

@@ -0,0 +1,38 @@
1
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
+
3
+buildscript {
4
+    ext {
5
+        kotlinVersion = '1.3.10'
6
+        buildToolsVersion = "28.0.3"
7
+        minSdkVersion = 19
8
+        compileSdkVersion = 28
9
+        targetSdkVersion = 28
10
+        supportLibVersion = "28.0.0"
11
+        detoxKotlinVersion = kotlinVersion
12
+    }
13
+    repositories {
14
+        google()
15
+        jcenter()
16
+    }
17
+    dependencies {
18
+        classpath 'com.android.tools.build:gradle:3.4.1'
19
+        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
20
+    }
21
+}
22
+
23
+allprojects {
24
+    repositories {
25
+        mavenLocal()
26
+        google()
27
+        jcenter()
28
+        maven {
29
+            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
30
+            url "$rootDir/../../node_modules/react-native/android"
31
+            }
32
+        maven {
33
+            // Android JSC is installed from npm
34
+            url "$rootDir/../../node_modules/jsc-android/dist"
35
+        }
36
+        maven { url "$rootDir/../../node_modules/detox/Detox-android" }
37
+    }
38
+}

+ 27
- 0
example/android/gradle.properties ファイルの表示

@@ -0,0 +1,27 @@
1
+# Project-wide Gradle settings.
2
+
3
+# IDE (e.g. Android Studio) users:
4
+# Gradle settings configured through the IDE *will override*
5
+# any settings specified in this file.
6
+
7
+# For more details on how to configure your build environment visit
8
+# http://www.gradle.org/docs/current/userguide/build_environment.html
9
+
10
+# Specifies the JVM arguments used for the daemon process.
11
+# The setting is particularly useful for tweaking memory settings.
12
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
13
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14
+
15
+# When configured, Gradle will run in incubating parallel mode.
16
+# This option should only be used with decoupled projects. More details, visit
17
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18
+# org.gradle.parallel=true
19
+
20
+# This is an example of how you can change default DB size (6MB) to 10MB
21
+# WebView_db_size_in_MB=10
22
+
23
+# Enable dedicated thread pool executor
24
+WebView_dedicatedExecutor=true
25
+android.useAndroidX=true
26
+android.enableJetifier=true
27
+

バイナリ
example/android/gradle/wrapper/gradle-wrapper.jar ファイルの表示


+ 6
- 0
example/android/gradle/wrapper/gradle-wrapper.properties ファイルの表示

@@ -0,0 +1,6 @@
1
+distributionBase=GRADLE_USER_HOME
2
+distributionPath=wrapper/dists
3
+zipStoreBase=GRADLE_USER_HOME
4
+zipStorePath=wrapper/dists
5
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
6
+

+ 172
- 0
example/android/gradlew ファイルの表示

@@ -0,0 +1,172 @@
1
+#!/usr/bin/env sh
2
+
3
+##############################################################################
4
+##
5
+##  Gradle start up script for UN*X
6
+##
7
+##############################################################################
8
+
9
+# Attempt to set APP_HOME
10
+# Resolve links: $0 may be a link
11
+PRG="$0"
12
+# Need this for relative symlinks.
13
+while [ -h "$PRG" ] ; do
14
+    ls=`ls -ld "$PRG"`
15
+    link=`expr "$ls" : '.*-> \(.*\)$'`
16
+    if expr "$link" : '/.*' > /dev/null; then
17
+        PRG="$link"
18
+    else
19
+        PRG=`dirname "$PRG"`"/$link"
20
+    fi
21
+done
22
+SAVED="`pwd`"
23
+cd "`dirname \"$PRG\"`/" >/dev/null
24
+APP_HOME="`pwd -P`"
25
+cd "$SAVED" >/dev/null
26
+
27
+APP_NAME="Gradle"
28
+APP_BASE_NAME=`basename "$0"`
29
+
30
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31
+DEFAULT_JVM_OPTS=""
32
+
33
+# Use the maximum available, or set MAX_FD != -1 to use that value.
34
+MAX_FD="maximum"
35
+
36
+warn () {
37
+    echo "$*"
38
+}
39
+
40
+die () {
41
+    echo
42
+    echo "$*"
43
+    echo
44
+    exit 1
45
+}
46
+
47
+# OS specific support (must be 'true' or 'false').
48
+cygwin=false
49
+msys=false
50
+darwin=false
51
+nonstop=false
52
+case "`uname`" in
53
+  CYGWIN* )
54
+    cygwin=true
55
+    ;;
56
+  Darwin* )
57
+    darwin=true
58
+    ;;
59
+  MINGW* )
60
+    msys=true
61
+    ;;
62
+  NONSTOP* )
63
+    nonstop=true
64
+    ;;
65
+esac
66
+
67
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68
+
69
+# Determine the Java command to use to start the JVM.
70
+if [ -n "$JAVA_HOME" ] ; then
71
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72
+        # IBM's JDK on AIX uses strange locations for the executables
73
+        JAVACMD="$JAVA_HOME/jre/sh/java"
74
+    else
75
+        JAVACMD="$JAVA_HOME/bin/java"
76
+    fi
77
+    if [ ! -x "$JAVACMD" ] ; then
78
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79
+
80
+Please set the JAVA_HOME variable in your environment to match the
81
+location of your Java installation."
82
+    fi
83
+else
84
+    JAVACMD="java"
85
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86
+
87
+Please set the JAVA_HOME variable in your environment to match the
88
+location of your Java installation."
89
+fi
90
+
91
+# Increase the maximum file descriptors if we can.
92
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93
+    MAX_FD_LIMIT=`ulimit -H -n`
94
+    if [ $? -eq 0 ] ; then
95
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96
+            MAX_FD="$MAX_FD_LIMIT"
97
+        fi
98
+        ulimit -n $MAX_FD
99
+        if [ $? -ne 0 ] ; then
100
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
101
+        fi
102
+    else
103
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104
+    fi
105
+fi
106
+
107
+# For Darwin, add options to specify how the application appears in the dock
108
+if $darwin; then
109
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110
+fi
111
+
112
+# For Cygwin, switch paths to Windows format before running java
113
+if $cygwin ; then
114
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116
+    JAVACMD=`cygpath --unix "$JAVACMD"`
117
+
118
+    # We build the pattern for arguments to be converted via cygpath
119
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120
+    SEP=""
121
+    for dir in $ROOTDIRSRAW ; do
122
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
123
+        SEP="|"
124
+    done
125
+    OURCYGPATTERN="(^($ROOTDIRS))"
126
+    # Add a user-defined pattern to the cygpath arguments
127
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129
+    fi
130
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
131
+    i=0
132
+    for arg in "$@" ; do
133
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
135
+
136
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
137
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138
+        else
139
+            eval `echo args$i`="\"$arg\""
140
+        fi
141
+        i=$((i+1))
142
+    done
143
+    case $i in
144
+        (0) set -- ;;
145
+        (1) set -- "$args0" ;;
146
+        (2) set -- "$args0" "$args1" ;;
147
+        (3) set -- "$args0" "$args1" "$args2" ;;
148
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154
+    esac
155
+fi
156
+
157
+# Escape application args
158
+save () {
159
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160
+    echo " "
161
+}
162
+APP_ARGS=$(save "$@")
163
+
164
+# Collect all arguments for the java command, following the shell quoting and substitution rules
165
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166
+
167
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169
+  cd "$(dirname "$0")"
170
+fi
171
+
172
+exec "$JAVACMD" "$@"

+ 84
- 0
example/android/gradlew.bat ファイルの表示

@@ -0,0 +1,84 @@
1
+@if "%DEBUG%" == "" @echo off
2
+@rem ##########################################################################
3
+@rem
4
+@rem  Gradle startup script for Windows
5
+@rem
6
+@rem ##########################################################################
7
+
8
+@rem Set local scope for the variables with windows NT shell
9
+if "%OS%"=="Windows_NT" setlocal
10
+
11
+set DIRNAME=%~dp0
12
+if "%DIRNAME%" == "" set DIRNAME=.
13
+set APP_BASE_NAME=%~n0
14
+set APP_HOME=%DIRNAME%
15
+
16
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17
+set DEFAULT_JVM_OPTS=
18
+
19
+@rem Find java.exe
20
+if defined JAVA_HOME goto findJavaFromJavaHome
21
+
22
+set JAVA_EXE=java.exe
23
+%JAVA_EXE% -version >NUL 2>&1
24
+if "%ERRORLEVEL%" == "0" goto init
25
+
26
+echo.
27
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
+echo.
29
+echo Please set the JAVA_HOME variable in your environment to match the
30
+echo location of your Java installation.
31
+
32
+goto fail
33
+
34
+:findJavaFromJavaHome
35
+set JAVA_HOME=%JAVA_HOME:"=%
36
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
+
38
+if exist "%JAVA_EXE%" goto init
39
+
40
+echo.
41
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
+echo.
43
+echo Please set the JAVA_HOME variable in your environment to match the
44
+echo location of your Java installation.
45
+
46
+goto fail
47
+
48
+:init
49
+@rem Get command-line arguments, handling Windows variants
50
+
51
+if not "%OS%" == "Windows_NT" goto win9xME_args
52
+
53
+:win9xME_args
54
+@rem Slurp the command line arguments.
55
+set CMD_LINE_ARGS=
56
+set _SKIP=2
57
+
58
+:win9xME_args_slurp
59
+if "x%~1" == "x" goto execute
60
+
61
+set CMD_LINE_ARGS=%*
62
+
63
+:execute
64
+@rem Setup the command line
65
+
66
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67
+
68
+@rem Execute Gradle
69
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70
+
71
+:end
72
+@rem End local scope for the variables with windows NT shell
73
+if "%ERRORLEVEL%"=="0" goto mainEnd
74
+
75
+:fail
76
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77
+rem the _cmd.exe /c_ return code!
78
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79
+exit /b 1
80
+
81
+:mainEnd
82
+if "%OS%"=="Windows_NT" endlocal
83
+
84
+:omega

+ 8
- 0
example/android/keystores/BUCK ファイルの表示

@@ -0,0 +1,8 @@
1
+keystore(
2
+    name = "debug",
3
+    properties = "debug.keystore.properties",
4
+    store = "debug.keystore",
5
+    visibility = [
6
+        "PUBLIC",
7
+    ],
8
+)

+ 4
- 0
example/android/keystores/debug.keystore.properties ファイルの表示

@@ -0,0 +1,4 @@
1
+key.store=debug.keystore
2
+key.alias=androiddebugkey
3
+key.store.password=android
4
+key.alias.password=android

+ 7
- 0
example/android/settings.gradle ファイルの表示

@@ -0,0 +1,7 @@
1
+rootProject.name = 'WebViewExample'
2
+
3
+include ':app'
4
+include ':ReactNativeWebView'
5
+
6
+
7
+project(':ReactNativeWebView').projectDir = new File(rootProject.projectDir, '../../android')

+ 4
- 0
package.json ファイルの表示

@@ -12,6 +12,10 @@
12 12
   "homepage": "https://github.com/react-native-community/react-native-webview#readme",
13 13
   "scripts": {
14 14
     "start": "node node_modules/react-native/local-cli/cli.js start",
15
+    "start:android": "react-native run-android --root example/",
16
+    "start:ios": "react-native run-ios --project-path example/ios --scheme RNCWebViewExample",
17
+    "build:e2e:ios": "detox build -c ios",
18
+    "build:e2e:android": "detox build -c android",
15 19
     "ci": "CI=true && yarn lint && yarn test",
16 20
     "ci:publish": "yarn semantic-release",
17 21
     "lint": "yarn tsc --noEmit && yarn eslint ./src --ext .ts,.tsx",

+ 2
- 34
yarn.lock ファイルの表示

@@ -2752,7 +2752,7 @@ debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:
2752 2752
   dependencies:
2753 2753
     ms "^2.1.1"
2754 2754
 
2755
-debuglog@*, debuglog@^1.0.1:
2755
+debuglog@^1.0.1:
2756 2756
   version "1.0.1"
2757 2757
   resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
2758 2758
   integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
@@ -4285,7 +4285,7 @@ import-local@^2.0.0:
4285 4285
     pkg-dir "^3.0.0"
4286 4286
     resolve-cwd "^2.0.0"
4287 4287
 
4288
-imurmurhash@*, imurmurhash@^0.1.4:
4288
+imurmurhash@^0.1.4:
4289 4289
   version "0.1.4"
4290 4290
   resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
4291 4291
   integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
@@ -5566,11 +5566,6 @@ lockfile@^1.0.4:
5566 5566
   dependencies:
5567 5567
     signal-exit "^3.0.2"
5568 5568
 
5569
-lodash._baseindexof@*:
5570
-  version "3.1.0"
5571
-  resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
5572
-  integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=
5573
-
5574 5569
 lodash._baseuniq@~4.6.0:
5575 5570
   version "4.6.0"
5576 5571
   resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
@@ -5579,33 +5574,11 @@ lodash._baseuniq@~4.6.0:
5579 5574
     lodash._createset "~4.0.0"
5580 5575
     lodash._root "~3.0.0"
5581 5576
 
5582
-lodash._bindcallback@*:
5583
-  version "3.0.1"
5584
-  resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
5585
-  integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4=
5586
-
5587
-lodash._cacheindexof@*:
5588
-  version "3.0.2"
5589
-  resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
5590
-  integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=
5591
-
5592
-lodash._createcache@*:
5593
-  version "3.1.2"
5594
-  resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
5595
-  integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=
5596
-  dependencies:
5597
-    lodash._getnative "^3.0.0"
5598
-
5599 5577
 lodash._createset@~4.0.0:
5600 5578
   version "4.0.3"
5601 5579
   resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
5602 5580
   integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=
5603 5581
 
5604
-lodash._getnative@*, lodash._getnative@^3.0.0:
5605
-  version "3.9.1"
5606
-  resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
5607
-  integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=
5608
-
5609 5582
 lodash._root@~3.0.0:
5610 5583
   version "3.0.1"
5611 5584
   resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692"
@@ -5646,11 +5619,6 @@ lodash.isstring@^4.0.1:
5646 5619
   resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"
5647 5620
   integrity sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=
5648 5621
 
5649
-lodash.restparam@*:
5650
-  version "3.6.1"
5651
-  resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
5652
-  integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=
5653
-
5654 5622
 lodash.set@^4.3.2:
5655 5623
   version "4.3.2"
5656 5624
   resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"