Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): migrate away from JCenter #278

Merged
merged 1 commit into from Apr 7, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,6 +8,7 @@
.watchman-*
.yarn-offline-mirror/
Pods/
android/**/build/
clang-format-diff.py
coverage/
dist/
Expand Down
18 changes: 16 additions & 2 deletions android/app/build.gradle
Expand Up @@ -15,7 +15,8 @@ buildscript {
apply from: "$androidDir/dependencies.gradle"

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

dependencies {
Expand All @@ -29,9 +30,22 @@ repositories {
}

google()
jcenter()
mavenCentral()

// TODO: Remove these when they've been published to Maven Central.
// See https://github.com/microsoft/react-native-test-app/issues/305
jcenter() {
content {
includeGroup("com.facebook.fbjni")
includeGroup("com.facebook.flipper")
includeGroup("com.facebook.fresco")
includeGroup("com.facebook.yoga")
}
}
arazabishov marked this conversation as resolved.
Show resolved Hide resolved
}

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

apply plugin: "com.android.application"
apply plugin: "kotlin-android"
apply plugin: "kotlin-kapt"
Expand Down
11 changes: 6 additions & 5 deletions android/build.gradle
@@ -1,12 +1,13 @@
buildscript {
buildscript { scriptHandler ->
def buildscriptDir = buildscript.sourceFile.getParent()
apply from: "$buildscriptDir/dependencies.gradle"
apply from: "$buildscriptDir/force-resolve-trove4j.gradle", to: scriptHandler

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

def buildscriptDir = buildscript.sourceFile.getParent()
apply from: "$buildscriptDir/dependencies.gradle"

dependencies {
classpath "com.android.tools.build:gradle:$androidPluginVersion"
}
Expand Down
13 changes: 13 additions & 0 deletions android/force-resolve-trove4j.gradle
@@ -0,0 +1,13 @@
configurations.all {
resolutionStrategy {
eachDependency {
// https://issuetracker.google.com/issues/109894262#comment9
if (requested.group == "org.jetbrains.trove4j" &&
requested.name == "trove4j" &&
requested.version == "20160824")
{
useTarget("org.jetbrains.intellij.deps:trove4j:1.0.20181211")
}
}
}
}
4 changes: 2 additions & 2 deletions android/react-native-build.gradle
Expand Up @@ -4,7 +4,7 @@ buildscript {

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

dependencies {
Expand All @@ -16,7 +16,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
configurations.all {
resolutionStrategy {
Expand Down
8 changes: 4 additions & 4 deletions android/support/build.gradle
@@ -1,12 +1,12 @@
repositories {
jcenter()
google()
mavenCentral()
}

apply plugin: "com.android.library"

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

apply plugin: "com.android.library"

android {
compileSdkVersion sdk.version
Expand Down
8 changes: 5 additions & 3 deletions example/android/build.gradle
@@ -1,9 +1,11 @@
buildscript {
apply from: file("../node_modules/react-native-test-app/android/dependencies.gradle")
buildscript { scriptHandler ->
def androidTestAppDir = "../node_modules/react-native-test-app/android"
apply from: "$androidTestAppDir/dependencies.gradle"
apply from: "$androidTestAppDir/force-resolve-trove4j.gradle", to: scriptHandler

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

dependencies {
Expand Down
8 changes: 5 additions & 3 deletions scripts/configure.js
Expand Up @@ -348,12 +348,14 @@ const getConfig = (() => {
android: {
files: {
"build.gradle": join(
"buildscript {",
` apply from: file("${testAppRelPath}/android/dependencies.gradle")`,
"buildscript { scriptHandler ->",
` def androidTestAppDir = "${testAppRelPath}/android"`,
' apply from: "$androidTestAppDir/dependencies.gradle"',
' apply from: "$androidTestAppDir/force-resolve-trove4j.gradle", to: scriptHandler',
"",
" repositories {",
" jcenter()",
" google()",
" mavenCentral()",
" }",
"",
" dependencies {",
Expand Down
24 changes: 15 additions & 9 deletions test/configure/__snapshots__/gatherConfig.test.js.snap
Expand Up @@ -54,12 +54,14 @@ Object {
".watchmanconfig": Object {
"source": "node_modules/react-native/template/_watchmanconfig",
},
"android/build.gradle": "buildscript {
apply from: file(\\"../../../android/dependencies.gradle\\")
"android/build.gradle": "buildscript { scriptHandler ->
def androidTestAppDir = \\"../../../android\\"
apply from: \\"$androidTestAppDir/dependencies.gradle\\"
apply from: \\"$androidTestAppDir/force-resolve-trove4j.gradle\\", to: scriptHandler

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

dependencies {
Expand Down Expand Up @@ -184,12 +186,14 @@ Object {
".watchmanconfig": Object {
"source": "node_modules/react-native/template/_watchmanconfig",
},
"android/build.gradle": "buildscript {
apply from: file(\\"../../../android/dependencies.gradle\\")
"android/build.gradle": "buildscript { scriptHandler ->
def androidTestAppDir = \\"../../../android\\"
apply from: \\"$androidTestAppDir/dependencies.gradle\\"
apply from: \\"$androidTestAppDir/force-resolve-trove4j.gradle\\", to: scriptHandler

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

dependencies {
Expand Down Expand Up @@ -287,12 +291,14 @@ Object {
".watchmanconfig": Object {
"source": "node_modules/react-native/template/_watchmanconfig",
},
"android/build.gradle": "buildscript {
apply from: file(\\"../../../android/dependencies.gradle\\")
"android/build.gradle": "buildscript { scriptHandler ->
def androidTestAppDir = \\"../../../android\\"
apply from: \\"$androidTestAppDir/dependencies.gradle\\"
apply from: \\"$androidTestAppDir/force-resolve-trove4j.gradle\\", to: scriptHandler

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

dependencies {
Expand Down