Skip to content

Commit

Permalink
fix(android): contain use of JCenter to 0.64 and older (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 authored Dec 17, 2021
1 parent d884ce7 commit a233d8b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
21 changes: 12 additions & 9 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ repositories {
mavenCentral()
google()

// 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)
}

0 comments on commit a233d8b

Please sign in to comment.