buildscript { apply from: "dependencies.gradle" repositories { Dependencies._repositories.call(it) } dependencies { classpath Dependencies.google.androidGradlePlugin classpath Dependencies.mavenCentral.kotlinGradlePlugin classpath Dependencies.mavenCentral.sqldelightGradlePlugin classpath Dependencies.mavenCentral.kotlinSerializationGradlePlugin classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1' } } def launchTask = getGradle() .getStartParameter() .getTaskRequests() .toString() .toLowerCase() subprojects { tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { kotlinOptions { jvmTarget = "1.8" freeCompilerArgs = [ '-Xopt-in=kotlin.contracts.ExperimentalContracts', '-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi', ] } } } task clean(type: Delete) { delete rootProject.buildDir } ext.applyMatrixServiceModule = { project -> project.apply plugin: 'kotlin' project.apply plugin: 'org.jetbrains.kotlin.plugin.serialization' def dependencies = project.dependencies dependencies.api project.project(":matrix:matrix") dependencies.api project.project(":matrix:common") dependencies.implementation project.project(":matrix:matrix-http") dependencies.implementation Dependencies.mavenCentral.kotlinSerializationJson } ext.applyLibraryPlugins = { project -> project.apply plugin: 'com.android.library' project.apply plugin: 'kotlin-android' } ext.androidSdkVersion = 31 ext.applyCommonAndroidParameters = { project -> def android = project.android android.compileSdk androidSdkVersion android.compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 incremental = true } android.defaultConfig { minSdkVersion 24 targetSdkVersion androidSdkVersion } android.buildFeatures.compose = true android.composeOptions { kotlinCompilerExtensionVersion = Dependencies.google.kotlinCompilerExtensionVersion } } ext.applyLibraryModuleOptimisations = { project -> project.android { variantFilter { variant -> if (variant.name == "debug") { variant.ignore = true } } buildFeatures { buildConfig = false dataBinding = false aidl = false renderScript = false resValues = false shaders = false viewBinding = false } } } ext.applyCompose = { project -> def dependencies = project.dependencies dependencies.implementation Dependencies.google.androidxComposeUi dependencies.implementation Dependencies.google.androidxComposeFoundation dependencies.implementation Dependencies.google.androidxComposeMaterial dependencies.implementation Dependencies.google.androidxComposeIconsExtended dependencies.implementation Dependencies.google.androidxActivityCompose } ext.applyAndroidLibraryModule = { project -> applyLibraryPlugins(project) applyCommonAndroidParameters(project) applyLibraryModuleOptimisations(project) applyCompose(project) } ext.applyCrashlyticsIfRelease = { project -> def isReleaseBuild = launchTask.contains("release") if (isReleaseBuild) { project.apply plugin: 'com.google.firebase.crashlytics' project.afterEvaluate { project.tasks.withType(com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask).configureEach { it.googleServicesResourceRoot.set(project.file("src/release/res/")) } } } } ext.kotlinTest = { dependencies -> dependencies.testImplementation Dependencies.mavenCentral.kluent dependencies.testImplementation Dependencies.mavenCentral.kotlinTest dependencies.testImplementation "org.jetbrains.kotlin:kotlin-test-junit:1.6.10" dependencies.testImplementation 'io.mockk:mockk:1.12.4' dependencies.testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.2' dependencies.testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' dependencies.testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' } ext.kotlinFixtures = { dependencies -> dependencies.testFixturesImplementation 'io.mockk:mockk:1.12.4' dependencies.testFixturesImplementation Dependencies.mavenCentral.kluent dependencies.testFixturesImplementation Dependencies.mavenCentral.kotlinCoroutinesCore } ext.androidImportFixturesWorkaround = { project, fixtures -> project.dependencies.testImplementation(project.dependencies.testFixtures(fixtures)) project.dependencies.testImplementation fixtures.files("build/libs/${fixtures.name}-test-fixtures.jar") project.dependencies.testImplementation fixtures.files("build/libs/${fixtures.name}.jar") } if (launchTask.contains("codeCoverageReport".toLowerCase())) { apply from: 'tools/coverage.gradle' }