smalltalk-matrix/build.gradle

150 lines
5.0 KiB
Groovy
Raw Normal View History

2022-02-24 22:55:56 +01:00
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'
}
2022-03-06 16:24:19 +01:00
ext.androidSdkVersion = 31
2022-02-24 22:55:56 +01:00
ext.applyCommonAndroidParameters = { project ->
def android = project.android
2022-03-06 16:24:19 +01:00
android.compileSdk androidSdkVersion
2022-02-24 22:55:56 +01:00
android.compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
incremental = true
}
android.defaultConfig {
minSdkVersion 24
2022-03-06 16:24:19 +01:00
targetSdkVersion androidSdkVersion
2022-02-24 22:55:56 +01:00
}
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.1'
2022-02-24 22:55:56 +01:00
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'
2022-02-24 22:55:56 +01:00
dependencies.testFixturesImplementation Dependencies.mavenCentral.kluent
dependencies.testFixturesImplementation Dependencies.mavenCentral.kotlinCoroutinesCore
2022-02-24 22:55:56 +01:00
}
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")
}
2022-02-24 22:55:56 +01:00
if (launchTask.contains("codeCoverageReport".toLowerCase())) {
apply from: 'tools/coverage.gradle'
}