|
| 1 | +// Jest Snapshot v1, https://goo.gl/fbAQLP |
| 2 | + |
| 3 | +exports[`App distribution Plugin Android Tests applies app distribution classpath to project build.gradle 1`] = ` |
| 4 | +"// Top-level build file where you can add configuration options common to all sub-projects/modules. |
| 5 | +
|
| 6 | +buildscript { |
| 7 | + ext { |
| 8 | + buildToolsVersion = "29.0.3" |
| 9 | + minSdkVersion = 21 |
| 10 | + compileSdkVersion = 30 |
| 11 | + targetSdkVersion = 30 |
| 12 | + } |
| 13 | + repositories { |
| 14 | + google() |
| 15 | + jcenter() |
| 16 | + } |
| 17 | + dependencies { |
| 18 | + classpath 'com.google.firebase:firebase-appdistribution-gradle:5.0.0' |
| 19 | + classpath("com.android.tools.build:gradle:4.1.0") |
| 20 | +
|
| 21 | + // NOTE: Do not place your application dependencies here; they belong |
| 22 | + // in the individual module build.gradle files |
| 23 | + } |
| 24 | +} |
| 25 | +
|
| 26 | +allprojects { |
| 27 | + repositories { |
| 28 | + mavenLocal() |
| 29 | + maven { |
| 30 | + // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm |
| 31 | + url("$rootDir/../node_modules/react-native/android") |
| 32 | + } |
| 33 | + maven { |
| 34 | + // Android JSC is installed from npm |
| 35 | + url("$rootDir/../node_modules/jsc-android/dist") |
| 36 | + } |
| 37 | +
|
| 38 | + google() |
| 39 | + jcenter() |
| 40 | + maven { url 'https://www.jitpack.io' } |
| 41 | + } |
| 42 | +} |
| 43 | +" |
| 44 | +`; |
| 45 | + |
| 46 | +exports[`App distribution Plugin Android Tests applies app distribution plugin to app/build.gradle 1`] = ` |
| 47 | +"/* Example build.gradle file from https://github.com/expo/expo/blob/6ab0274b5cb9a9c223e0d453787a522b438b4fcb/templates/expo-template-bare-minimum/android/app/build.gradle */ |
| 48 | +
|
| 49 | +apply plugin: "com.android.application" |
| 50 | +
|
| 51 | +import com.android.build.OutputFile |
| 52 | +
|
| 53 | +
|
| 54 | +project.ext.react = [ |
| 55 | + enableHermes: false |
| 56 | +] |
| 57 | +
|
| 58 | +apply from: '../../node_modules/react-native-unimodules/gradle.groovy' |
| 59 | +apply from: "../../node_modules/react-native/react.gradle" |
| 60 | +apply from: "../../node_modules/expo-constants/scripts/get-app-config-android.gradle" |
| 61 | +apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle" |
| 62 | +
|
| 63 | +def enableSeparateBuildPerCPUArchitecture = false |
| 64 | +
|
| 65 | +def enableProguardInReleaseBuilds = false |
| 66 | +
|
| 67 | +def jscFlavor = 'org.webkit:android-jsc:+' |
| 68 | +
|
| 69 | +def enableHermes = project.ext.react.get("enableHermes", false); |
| 70 | +
|
| 71 | +android { |
| 72 | + compileSdkVersion rootProject.ext.compileSdkVersion |
| 73 | +
|
| 74 | + compileOptions { |
| 75 | + sourceCompatibility JavaVersion.VERSION_1_8 |
| 76 | + targetCompatibility JavaVersion.VERSION_1_8 |
| 77 | + } |
| 78 | +
|
| 79 | + defaultConfig { |
| 80 | + applicationId "com.helloworld" |
| 81 | + minSdkVersion rootProject.ext.minSdkVersion |
| 82 | + targetSdkVersion rootProject.ext.targetSdkVersion |
| 83 | + versionCode 1 |
| 84 | + versionName "1.0" |
| 85 | + } |
| 86 | + splits { |
| 87 | + abi { |
| 88 | + reset() |
| 89 | + enable enableSeparateBuildPerCPUArchitecture |
| 90 | + universalApk false // If true, also generate a universal APK |
| 91 | + include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" |
| 92 | + } |
| 93 | + } |
| 94 | + signingConfigs { |
| 95 | + debug { |
| 96 | + storeFile file('debug.keystore') |
| 97 | + storePassword 'android' |
| 98 | + keyAlias 'androiddebugkey' |
| 99 | + keyPassword 'android' |
| 100 | + } |
| 101 | + } |
| 102 | + buildTypes { |
| 103 | + debug { |
| 104 | + signingConfig signingConfigs.debug |
| 105 | + } |
| 106 | + release { |
| 107 | + // Caution! In production, you need to generate your own keystore file. |
| 108 | + // see https://reactnative.dev/docs/signed-apk-android. |
| 109 | + signingConfig signingConfigs.debug |
| 110 | + minifyEnabled enableProguardInReleaseBuilds |
| 111 | + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" |
| 112 | + } |
| 113 | + } |
| 114 | +
|
| 115 | + // applicationVariants are e.g. debug, release |
| 116 | + applicationVariants.all { variant -> |
| 117 | + variant.outputs.each { output -> |
| 118 | + // For each separate APK per architecture, set a unique version code as described here: |
| 119 | + // https://developer.android.com/studio/build/configure-apk-splits.html |
| 120 | + def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] |
| 121 | + def abi = output.getFilter(OutputFile.ABI) |
| 122 | + if (abi != null) { // null for the universal-debug, universal-release variants |
| 123 | + output.versionCodeOverride = |
| 124 | + versionCodes.get(abi) * 1048576 + defaultConfig.versionCode |
| 125 | + } |
| 126 | +
|
| 127 | + } |
| 128 | + } |
| 129 | +} |
| 130 | +
|
| 131 | +dependencies { |
| 132 | + implementation fileTree(dir: "libs", include: ["*.jar"]) |
| 133 | + //noinspection GradleDynamicVersion |
| 134 | + implementation "com.facebook.react:react-native:+" // From node_modules |
| 135 | + implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" |
| 136 | + debugImplementation("com.facebook.flipper:flipper:\${FLIPPER_VERSION}") { |
| 137 | + exclude group:'com.facebook.fbjni' |
| 138 | + } |
| 139 | + debugImplementation("com.facebook.flipper:flipper-network-plugin:\${FLIPPER_VERSION}") { |
| 140 | + exclude group:'com.facebook.flipper' |
| 141 | + exclude group:'com.squareup.okhttp3', module:'okhttp' |
| 142 | + } |
| 143 | + debugImplementation("com.facebook.flipper:flipper-fresco-plugin:\${FLIPPER_VERSION}") { |
| 144 | + exclude group:'com.facebook.flipper' |
| 145 | + } |
| 146 | + addUnimodulesDependencies() |
| 147 | +
|
| 148 | + if (enableHermes) { |
| 149 | + def hermesPath = "../../node_modules/hermes-engine/android/"; |
| 150 | + debugImplementation files(hermesPath + "hermes-debug.aar") |
| 151 | + releaseImplementation files(hermesPath + "hermes-release.aar") |
| 152 | + } else { |
| 153 | + implementation jscFlavor |
| 154 | + } |
| 155 | +} |
| 156 | +
|
| 157 | +// Run this once to be able to run the application with BUCK |
| 158 | +// puts all compile dependencies into folder libs for BUCK to use |
| 159 | +task copyDownloadableDepsToLibs(type: Copy) { |
| 160 | + from configurations.compile |
| 161 | + into 'libs' |
| 162 | +} |
| 163 | +
|
| 164 | +apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) |
| 165 | +
|
| 166 | +apply plugin: 'com.google.firebase.appdistribution'" |
| 167 | +`; |
0 commit comments