smalltalk-matrix/build.gradle

170 lines
5.5 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
2022-07-11 20:13:55 +02:00
classpath Dependencies.google.firebaseCrashlyticsPlugin
2022-02-24 22:55:56 +01:00
}
}
def launchTask = getGradle()
.getStartParameter()
.getTaskRequests()
.toString()
.toLowerCase()
def isReleaseBuild = launchTask.contains("release")
ext.isDebugBuild = !isReleaseBuild
2022-02-24 22:55:56 +01:00
subprojects {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = [
'-opt-in=kotlin.contracts.ExperimentalContracts',
'-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi',
2022-02-24 22:55:56 +01:00
]
}
}
}
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 = 33
2022-03-06 16:24:19 +01:00
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
}
}
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
def android = project.android
android.buildFeatures.compose = true
android.composeOptions {
kotlinCompilerExtensionVersion = Dependencies.google.kotlinCompilerExtensionVersion
}
}
ext.applyAndroidComposeLibraryModule = { project ->
applyAndroidLibraryModule(project)
applyCompose(project)
2022-02-24 22:55:56 +01:00
}
ext.applyAndroidLibraryModule = { project ->
applyLibraryPlugins(project)
applyCommonAndroidParameters(project)
applyLibraryModuleOptimisations(project)
}
ext.applyCrashlyticsIfRelease = { project ->
if (isReleaseBuild && !isFoss()) {
2022-02-24 22:55:56 +01:00
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.13.2'
dependencies.testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4'
2022-02-24 22:55:56 +01:00
dependencies.testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
dependencies.testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
2022-02-24 22:55:56 +01:00
}
ext.kotlinFixtures = { dependencies ->
dependencies.testFixturesImplementation 'io.mockk:mockk:1.13.1'
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")
}
ext.isFoss = {
return rootProject.hasProperty("foss")
}
ext.firebase = { dependencies, name ->
if (isFoss()) {
dependencies.implementation(project(":domains:firebase:$name-noop"))
} else {
dependencies.implementation(project(":domains:firebase:$name"))
}
}
2022-02-24 22:55:56 +01:00
if (launchTask.contains("codeCoverageReport".toLowerCase())) {
apply from: 'tools/coverage.gradle'
}