diff --git a/example/android/build.gradle b/example/android/build.gradle index d8bcc3aeb..6b403e9d7 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -24,19 +24,19 @@ buildscript { allprojects { repositories { - maven { - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm - url({ - def searchDir = rootDir.toPath() - do { - def p = searchDir.resolve("node_modules/react-native/android") - if (p.toFile().exists()) { - return p.toRealPath().toString() + { + def searchDir = rootDir.toPath() + do { + def p = searchDir.resolve("node_modules/react-native/android") + if (p.toFile().exists()) { + maven { + url(p.toRealPath().toString()) } - } while (searchDir = searchDir.getParent()) - throw new GradleException("Could not find `react-native`"); - }()) - } + break + } + } while (searchDir = searchDir.getParent()) + // As of 0.80, React Native is no longer installed from npm + }() mavenCentral() google() } diff --git a/scripts/template.mjs b/scripts/template.mjs index 854307922..5700733d1 100644 --- a/scripts/template.mjs +++ b/scripts/template.mjs @@ -75,19 +75,19 @@ export function buildGradle() { // https://github.com/facebook/react-native/commit/51a48d2e2c64a18012692b063368e369cd8ff797 "allprojects {", " repositories {", - " maven {", - " // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm", - " url({", - " def searchDir = rootDir.toPath()", - " do {", - ' def p = searchDir.resolve("node_modules/react-native/android")', - " if (p.toFile().exists()) {", - " return p.toRealPath().toString()", + " {", + " def searchDir = rootDir.toPath()", + " do {", + ' def p = searchDir.resolve("node_modules/react-native/android")', + " if (p.toFile().exists()) {", + " maven {", + " url(p.toRealPath().toString())", " }", - " } while (searchDir = searchDir.getParent())", - ' throw new GradleException("Could not find `react-native`");', - " }())", - " }", + " break", + " }", + " } while (searchDir = searchDir.getParent())", + " // As of 0.80, React Native is no longer installed from npm", + " }()", " mavenCentral()", " google()", " }", diff --git a/test/configure/gatherConfig.test.ts b/test/configure/gatherConfig.test.ts index 1ac7a484c..1f136e74d 100644 --- a/test/configure/gatherConfig.test.ts +++ b/test/configure/gatherConfig.test.ts @@ -79,19 +79,19 @@ describe("gatherConfig()", () => { "", "allprojects {", " repositories {", - " maven {", - " // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm", - " url({", - " def searchDir = rootDir.toPath()", - " do {", - ' def p = searchDir.resolve("node_modules/react-native/android")', - " if (p.toFile().exists()) {", - " return p.toRealPath().toString()", + " {", + " def searchDir = rootDir.toPath()", + " do {", + ' def p = searchDir.resolve("node_modules/react-native/android")', + " if (p.toFile().exists()) {", + " maven {", + " url(p.toRealPath().toString())", " }", - " } while (searchDir = searchDir.getParent())", - ' throw new GradleException("Could not find `react-native`");', - " }())", - " }", + " break", + " }", + " } while (searchDir = searchDir.getParent())", + " // As of 0.80, React Native is no longer installed from npm", + " }()", " mavenCentral()", " google()", " }", @@ -427,19 +427,19 @@ describe("gatherConfig()", () => { "", "allprojects {", " repositories {", - " maven {", - " // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm", - " url({", - " def searchDir = rootDir.toPath()", - " do {", - ' def p = searchDir.resolve("node_modules/react-native/android")', - " if (p.toFile().exists()) {", - " return p.toRealPath().toString()", + " {", + " def searchDir = rootDir.toPath()", + " do {", + ' def p = searchDir.resolve("node_modules/react-native/android")', + " if (p.toFile().exists()) {", + " maven {", + " url(p.toRealPath().toString())", " }", - " } while (searchDir = searchDir.getParent())", - ' throw new GradleException("Could not find `react-native`");', - " }())", - " }", + " break", + " }", + " } while (searchDir = searchDir.getParent())", + " // As of 0.80, React Native is no longer installed from npm", + " }()", " mavenCentral()", " google()", " }",