Skip to content

fix(android): contain use of JCenter to 0.64 and older #658

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

Merged
merged 1 commit into from
Dec 17, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ repositories {
google()
mavenCentral()

// TODO: Remove these when they've been published to Maven Central.
// See https://github.com/microsoft/react-native-test-app/issues/305
// noinspection JcenterRepositoryObsolete
jcenter() {
content {
includeGroup("com.facebook.fbjni")
includeGroup("com.facebook.flipper")
includeGroup("com.facebook.fresco")
includeGroup("com.facebook.yoga")
// TODO: Remove this block when we drop support for 0.64.
if (getReactNativeVersionNumber(rootDir) < 6500) {
// Artifacts for 0.65+ are published to Maven Central. If we're on an
// older version, we still need to use JCenter.
// noinspection JcenterRepositoryObsolete
jcenter() {
content {
includeGroup("com.facebook.fbjni")
includeGroup("com.facebook.flipper")
includeGroup("com.facebook.fresco")
includeGroup("com.facebook.yoga")
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions android/test-app-util.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,11 @@ ext.getFlipperVersion = { baseDir ->
// Use the recommended Flipper version
return recommendedFlipperVersion
}

ext.getReactNativeVersionNumber = { baseDir ->
def reactNativePath = findNodeModulesPath(baseDir, "react-native")
def packageJson = file("${reactNativePath}/package.json")
def manifest = new JsonSlurper().parseText(packageJson.text)
def (major, minor, patch) = manifest["version"].tokenize(".")
return (major as int) * 10000 + (minor as int) * 100 + (patch as int)
}