buildscript {
    apply(from: {
        def searchDir = rootDir.toPath()
        do {
            def p = searchDir.resolve("node_modules/react-native-test-app/android/dependencies.gradle")
            if (p.toFile().exists()) {
                return p.toRealPath().toString()
            }
        } while (searchDir = searchDir.getParent())
        throw new GradleException("Could not find `react-native-test-app`");
    }())

    repositories {
        mavenCentral()
        google()
    }

    dependencies {
        getReactNativeDependencies().each { dependency ->
            classpath(dependency)
        }
    }
}

allprojects {
    repositories {
        {
            def searchDir = rootDir.toPath()
            do {
                def p = searchDir.resolve("node_modules/react-native/android")
                if (p.toFile().exists()) {
                    maven {
                        url(p.toRealPath().toString())
                    }
                    break
                }
            } while (searchDir = searchDir.getParent())
            // As of 0.80, React Native is no longer installed from npm
        }()
        mavenCentral()
        google()
    }
}

rootProject.ext.set("react.compileSdkVersion", 35)
rootProject.ext.set("react.targetSdkVersion", 35)
