Some checks are pending
Build Release and Upload to TestFlight (iOS) / build (push) Waiting to run
Build Release and Upload to TestFlight (iOS) / testflight-upload (push) Blocked by required conditions
BuildReleaseApk / buildReleaseApk (push) Waiting to run
BuildReleaseApk / browserstack (push) Blocked by required conditions
171 lines
6.5 KiB
Groovy
171 lines
6.5 KiB
Groovy
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
|
|
buildscript {
|
|
ext {
|
|
minSdkVersion = 24
|
|
buildToolsVersion = "36.0.0"
|
|
compileSdkVersion = 36
|
|
targetSdkVersion = 36
|
|
googlePlayServicesVersion = "16.+"
|
|
googlePlayServicesIidVersion = "16.0.1"
|
|
firebaseVersion = "21.1.0"
|
|
ndkVersion = "28.2.13676358"
|
|
kotlinVersion = '2.1.20'
|
|
}
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath("com.android.tools.build:gradle")
|
|
classpath("com.facebook.react:react-native-gradle-plugin")
|
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
|
|
classpath 'com.google.gms:google-services:4.4.4' // Google Services plugin
|
|
classpath("com.bugsnag:bugsnag-android-gradle-plugin:8.2.0")
|
|
}
|
|
}
|
|
|
|
// Gradle 9 removes jcenter(); add a shim that redirects any jcenter() call to mavenCentral()
|
|
def addJcenterShim = { repoContainer, logger ->
|
|
def mc = repoContainer.metaClass
|
|
if (!mc.respondsTo(repoContainer, 'jcenter')) {
|
|
mc.jcenter << { Closure config = null ->
|
|
def repo = repoContainer.mavenCentral()
|
|
if (config != null) {
|
|
config.delegate = repo
|
|
config.resolveStrategy = Closure.DELEGATE_FIRST
|
|
config.call(repo)
|
|
}
|
|
logger.lifecycle("Redirected jcenter() to mavenCentral()")
|
|
return repo
|
|
}
|
|
}
|
|
if (!mc.respondsTo(repoContainer, 'methodMissing')) {
|
|
mc.methodMissing = { String name, args ->
|
|
if (name == 'jcenter') {
|
|
def repo = repoContainer.mavenCentral()
|
|
logger.lifecycle("Redirected jcenter() (methodMissing) to mavenCentral()")
|
|
return repo
|
|
}
|
|
throw new MissingMethodException(name, repoContainer.class, args)
|
|
}
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
maven {
|
|
url("$rootDir/../node_modules/detox/Detox-android")
|
|
}
|
|
// react-native-background-fetch ships com.transistorsoft:tsbackgroundfetch
|
|
// as a bundled local Maven repo; the package's own build.gradle adds it
|
|
// for itself, but :app's runtime classpath resolution needs it visible
|
|
// at the root level too.
|
|
maven {
|
|
url("$rootDir/../node_modules/react-native-background-fetch/android/libs")
|
|
}
|
|
|
|
mavenCentral {
|
|
// We don't want to fetch react-native from Maven Central as there are
|
|
// older versions over there.
|
|
content {
|
|
excludeGroup "com.facebook.react"
|
|
}
|
|
}
|
|
google()
|
|
maven { url 'https://www.jitpack.io' }
|
|
}
|
|
}
|
|
|
|
// Apply jcenter shim very early for every project before its build.gradle is evaluated
|
|
gradle.beforeProject { project ->
|
|
addJcenterShim(project.repositories, project.logger)
|
|
if (project.buildscript != null) {
|
|
addJcenterShim(project.buildscript.repositories, project.logger)
|
|
}
|
|
}
|
|
|
|
// Apply to root as well
|
|
addJcenterShim(repositories, logger)
|
|
if (buildscript != null) {
|
|
addJcenterShim(buildscript.repositories, logger)
|
|
}
|
|
|
|
subprojects { project ->
|
|
// react-native-device-info's androidTest classpath pulls
|
|
// play-services-iid:16.0.1 -> play-services-base:16.0.1 -> support-v4:26.1.0,
|
|
// which collides with androidx.core:core:1.13.1 (Duplicate class
|
|
// android.support.v4.app.INotificationSideChannel). Exclude the pre-AndroidX
|
|
// support-* modules so the AndroidX equivalents in core win.
|
|
configurations.all {
|
|
exclude group: 'com.android.support', module: 'support-compat'
|
|
exclude group: 'com.android.support', module: 'support-annotations'
|
|
exclude group: 'com.android.support', module: 'support-core-utils'
|
|
}
|
|
|
|
// Remove and block any jcenter() repositories at both project and buildscript levels
|
|
def scrub = { repoContainer ->
|
|
repoContainer.all { repo ->
|
|
if (repo instanceof org.gradle.api.artifacts.repositories.MavenArtifactRepository &&
|
|
repo.url?.toString()?.contains('jcenter')) {
|
|
project.logger.lifecycle("Removing jcenter() from ${project.path}")
|
|
repoContainer.remove(repo)
|
|
}
|
|
}
|
|
repoContainer.whenObjectAdded { repo ->
|
|
if (repo instanceof org.gradle.api.artifacts.repositories.MavenArtifactRepository &&
|
|
repo.url?.toString()?.contains('jcenter')) {
|
|
project.logger.lifecycle("Blocking jcenter() from ${project.path}")
|
|
repoContainer.remove(repo)
|
|
repoContainer.mavenCentral()
|
|
}
|
|
}
|
|
}
|
|
|
|
scrub(project.repositories)
|
|
if (project.buildscript != null) {
|
|
scrub(project.buildscript.repositories)
|
|
}
|
|
|
|
afterEvaluate {proj ->
|
|
if (proj.hasProperty("android")) {
|
|
android {
|
|
buildToolsVersion "36.0.0"
|
|
compileSdkVersion 36
|
|
defaultConfig {
|
|
minSdkVersion 24
|
|
}
|
|
}
|
|
}
|
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
|
// FIXME: next line should be removed when https://github.com/wix/Detox/issues/4678 is fixed
|
|
kotlinOptions.freeCompilerArgs += ["-Xopt-in=kotlin.ExperimentalStdlibApi"]
|
|
if (proj.plugins.hasPlugin("com.android.application") || proj.plugins.hasPlugin("com.android.library")) {
|
|
kotlinOptions.jvmTarget = android.compileOptions.sourceCompatibility
|
|
} else {
|
|
kotlinOptions.jvmTarget = sourceCompatibility
|
|
}
|
|
}
|
|
|
|
if (proj.name == "react-native-reanimated" && proj.hasProperty("android")) {
|
|
// Wire Reanimated's generated codegen sources so WorkletsModule spec is visible under new architecture
|
|
proj.android.sourceSets.main.java.srcDir("${proj.buildDir}/generated/source/codegen/java")
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
// Final guard: fail fast if any jcenter repository slips through
|
|
gradle.projectsEvaluated {
|
|
allprojects { proj ->
|
|
def offenders = proj.repositories.findAll { repo ->
|
|
repo instanceof org.gradle.api.artifacts.repositories.MavenArtifactRepository &&
|
|
repo.url?.toString()?.contains('jcenter')
|
|
}
|
|
if (!offenders.isEmpty()) {
|
|
throw new GradleException("jcenter() detected in ${proj.path}; remove or replace with mavenCentral()");
|
|
}
|
|
}
|
|
}
|
|
|
|
apply plugin: "com.facebook.react.rootproject" |