Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 23 additions & 29 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
buildscript {
def androidDir = "${buildscript.sourceFile.getParent()}/../"
apply(from: "$androidDir/test-app-util.gradle")
apply(from: "$androidDir/dependencies.gradle")
}

plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-kapt")
}

// `react-native run-android` is hard-coded to look for the output APK at a very
// specific location. See
// https://github.com/react-native-community/cli/blob/6cf12b00c02aca6d4bc843446394331d71a9749e/packages/platform-android/src/commands/runAndroid/index.ts#L180
buildDir = "$rootDir/$name/build"

def reactNativeDir = findNodeModulesPath(rootDir, "react-native")

buildscript {
def androidDir = "${buildscript.sourceFile.getParent()}/../"
apply from: "$androidDir/test-app-util.gradle"
apply from: "$androidDir/dependencies.gradle"

repositories {
google()
mavenCentral()
}
}

repositories {
maven {
url("${reactNativeDir}/android")
url = uri("${reactNativeDir}/android")
}

google()
mavenCentral()
google()

// TODO: Remove these when they've been published to Maven Central.
// See https://github.com/microsoft/react-native-test-app/issues/305
Expand All @@ -38,19 +39,11 @@ repositories {

// https://github.com/AzureAD/microsoft-authentication-library-for-android#step-1-declare-dependency-on-msal
maven {
url 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1'
url = uri("https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1")
}
}

apply from: "$projectDir/../force-resolve-trove4j.gradle"

apply plugin: "com.android.application"
apply plugin: "kotlin-android"
apply plugin: "kotlin-kapt"

def testAppDir = file("$projectDir/../../")

apply from: file("${testAppDir}/test-app.gradle")
apply(from: "$projectDir/../../test-app.gradle")
applyTestAppModule(project)

project.ext.react = [
Expand Down Expand Up @@ -91,7 +84,7 @@ android {
def recommendedFlipperVersion = getFlipperRecommendedVersion(rootDir)
buildConfigField "String",
"ReactTestApp_recommendedFlipperVersion",
recommendedFlipperVersion ? "\"${recommendedFlipperVersion}\"" : '"0"'
recommendedFlipperVersion ? "\"${recommendedFlipperVersion}\"" : "\"0\""

resValue "string", "app_name", project.ext.react.appName

Expand All @@ -107,7 +100,7 @@ android {

sourceSets {
if (project.ext.react.enableFlipper) {
debug.java.srcDirs += 'src/flipper/java'
debug.java.srcDirs += "src/flipper/java"
}
}
}
Expand All @@ -129,14 +122,15 @@ dependencies {
}

if (buildReactNativeFromSource(rootDir)) {
implementation project(':ReactAndroid')
implementation project(":ReactAndroid")
} else {
implementation "com.facebook.react:react-native:+"
}

implementation libraries.kotlinStdlibJdk7
implementation libraries.kotlinStdlibJdk8
implementation libraries.kotlinReflect

implementation libraries.androidAppCompat
implementation libraries.androidCoreKotlinExtensions
implementation libraries.androidRecyclerView
Expand All @@ -155,13 +149,13 @@ dependencies {
if (project.ext.react.enableFlipper) {
def flipperVersion = project.ext.react.enableFlipper
debugImplementation("com.facebook.flipper:flipper:${flipperVersion}") {
exclude group: 'com.facebook.fbjni'
exclude(group: "com.facebook.fbjni")
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${flipperVersion}") {
exclude group: 'com.facebook.flipper'
exclude(group: "com.facebook.flipper")
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${flipperVersion}") {
exclude group: 'com.facebook.flipper'
exclude(group: "com.facebook.flipper")
}
}
}
18 changes: 6 additions & 12 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
buildscript { scriptHandler ->
def buildscriptDir = buildscript.sourceFile.getParent()
apply from: "$buildscriptDir/dependencies.gradle"
apply from: "$buildscriptDir/force-resolve-trove4j.gradle", to: scriptHandler
plugins {
apply(from: "${buildscript.sourceFile.getParent()}/dependencies.gradle")

repositories {
google()
mavenCentral()
}

dependencies {
classpath "com.android.tools.build:gradle:$androidPluginVersion"
}
id("com.android.application") version "${androidPluginVersion}" apply false
id("com.android.library") version "${androidPluginVersion}" apply false
id("kotlin-android") version "${kotlinVersion}" apply false
id("kotlin-kapt") version "${kotlinVersion}" apply false
}
12 changes: 10 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
rootProject.name='react-test-app'
include ':app', ':support'
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
google()
}
}

rootProject.name = "react-test-app"
include ":app", ":support"
15 changes: 6 additions & 9 deletions android/support/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
buildscript {
def androidDir = "${buildscript.sourceFile.getParent()}/../"
apply from: "$androidDir/dependencies.gradle"
plugins {
id("com.android.library")
}

repositories {
google()
mavenCentral()
google()
}

def androidDir = "${buildscript.sourceFile.getParent()}/../"
apply from: "$androidDir/force-resolve-trove4j.gradle"

apply plugin: "com.android.library"

android {
def androidDir = "${buildscript.sourceFile.getParent()}/../"
apply(from: "$androidDir/dependencies.gradle")

compileSdkVersion project.ext.compileSdkVersion
buildToolsVersion project.ext.buildToolsVersion

Expand Down
6 changes: 3 additions & 3 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
buildscript { scriptHandler ->
buildscript {
def androidTestAppDir = "../node_modules/react-native-test-app/android"
apply from: "$androidTestAppDir/dependencies.gradle"
apply(from: "${androidTestAppDir}/dependencies.gradle")

repositories {
google()
mavenCentral()
google()
}

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pluginManagement {
}
}

rootProject.name='example'
rootProject.name = "example"

apply from: file("../node_modules/react-native-test-app/test-app.gradle")
apply(from: "../node_modules/react-native-test-app/test-app.gradle")
applyTestAppSettings(settings)
11 changes: 5 additions & 6 deletions scripts/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,14 +408,13 @@ const getConfig = (() => {
android: {
files: {
"build.gradle": join(
"buildscript { scriptHandler ->",
"buildscript {",
` def androidTestAppDir = "${testAppRelPath}/android"`,
' apply from: "$androidTestAppDir/dependencies.gradle"',
' apply from: "$androidTestAppDir/force-resolve-trove4j.gradle", to: scriptHandler',
' apply(from: "${androidTestAppDir}/dependencies.gradle")',
"",
" repositories {",
" google()",
" mavenCentral()",
" google()",
" }",
"",
" dependencies {",
Expand Down Expand Up @@ -473,9 +472,9 @@ const getConfig = (() => {
" }",
"}",
"",
`rootProject.name='${name}'`,
`rootProject.name = "${name}"`,
"",
`apply from: file("${testAppRelPath}/test-app.gradle")`,
`apply(from: "${testAppRelPath}/test-app.gradle")`,
"applyTestAppSettings(settings)",
""
),
Expand Down
4 changes: 0 additions & 4 deletions test-app.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ def cliAndroidDir = findNodeModulesPath(rootDir, "@react-native-community/cli-pl
apply from: "$cliAndroidDir/native_modules.gradle"

ext.applyTestAppSettings = { DefaultSettings defaultSettings ->
buildscript { scriptHandler ->
apply from: "$scriptDir/android/force-resolve-trove4j.gradle", to: scriptHandler
}

applySettings(defaultSettings)
applyNativeModulesSettingsGradle(defaultSettings)
}
Expand Down
33 changes: 15 additions & 18 deletions test/configure/__snapshots__/gatherConfig.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,13 @@ Object {
".watchmanconfig": Object {
"source": "node_modules/react-native/template/_watchmanconfig",
},
"android/build.gradle": "buildscript { scriptHandler ->
"android/build.gradle": "buildscript {
def androidTestAppDir = \\"../../android\\"
apply from: \\"$androidTestAppDir/dependencies.gradle\\"
apply from: \\"$androidTestAppDir/force-resolve-trove4j.gradle\\", to: scriptHandler
apply(from: \\"\${androidTestAppDir}/dependencies.gradle\\")

repositories {
google()
mavenCentral()
google()
}

dependencies {
Expand Down Expand Up @@ -104,9 +103,9 @@ Object {
}
}

rootProject.name='Test'
rootProject.name = \\"Test\\"

apply from: file(\\"../../test-app.gradle\\")
apply(from: \\"../../test-app.gradle\\")
applyTestAppSettings(settings)
",
"babel.config.js": Object {
Expand Down Expand Up @@ -476,14 +475,13 @@ Object {
".watchmanconfig": Object {
"source": "node_modules/react-native/template/_watchmanconfig",
},
"android/build.gradle": "buildscript { scriptHandler ->
"android/build.gradle": "buildscript {
def androidTestAppDir = \\"../../android\\"
apply from: \\"$androidTestAppDir/dependencies.gradle\\"
apply from: \\"$androidTestAppDir/force-resolve-trove4j.gradle\\", to: scriptHandler
apply(from: \\"\${androidTestAppDir}/dependencies.gradle\\")

repositories {
google()
mavenCentral()
google()
}

dependencies {
Expand Down Expand Up @@ -515,9 +513,9 @@ Object {
}
}

rootProject.name='Test'
rootProject.name = \\"Test\\"

apply from: file(\\"../../test-app.gradle\\")
apply(from: \\"../../test-app.gradle\\")
applyTestAppSettings(settings)
",
"babel.config.js": Object {
Expand Down Expand Up @@ -643,14 +641,13 @@ Object {
".watchmanconfig": Object {
"source": "node_modules/react-native/template/_watchmanconfig",
},
"android/build.gradle": "buildscript { scriptHandler ->
"android/build.gradle": "buildscript {
def androidTestAppDir = \\"../../android\\"
apply from: \\"$androidTestAppDir/dependencies.gradle\\"
apply from: \\"$androidTestAppDir/force-resolve-trove4j.gradle\\", to: scriptHandler
apply(from: \\"\${androidTestAppDir}/dependencies.gradle\\")

repositories {
google()
mavenCentral()
google()
}

dependencies {
Expand Down Expand Up @@ -682,9 +679,9 @@ Object {
}
}

rootProject.name='Test'
rootProject.name = \\"Test\\"

apply from: file(\\"../../test-app.gradle\\")
apply(from: \\"../../test-app.gradle\\")
applyTestAppSettings(settings)
",
"babel.config.js": Object {
Expand Down