mirror of
https://github.com/ouchadam/small-talk.git
synced 2024-12-24 16:51:47 +01:00
170 lines
5.5 KiB
Groovy
170 lines
5.5 KiB
Groovy
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 Dependencies.google.firebaseCrashlyticsPlugin
|
|
}
|
|
}
|
|
|
|
def launchTask = getGradle()
|
|
.getStartParameter()
|
|
.getTaskRequests()
|
|
.toString()
|
|
.toLowerCase()
|
|
def isReleaseBuild = launchTask.contains("release")
|
|
ext.isDebugBuild = !isReleaseBuild
|
|
|
|
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',
|
|
]
|
|
}
|
|
}
|
|
}
|
|
|
|
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 = 32
|
|
|
|
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
|
|
}
|
|
}
|
|
|
|
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)
|
|
}
|
|
|
|
ext.applyAndroidLibraryModule = { project ->
|
|
applyLibraryPlugins(project)
|
|
applyCommonAndroidParameters(project)
|
|
applyLibraryModuleOptimisations(project)
|
|
}
|
|
|
|
ext.applyCrashlyticsIfRelease = { project ->
|
|
if (isReleaseBuild && !isFoss()) {
|
|
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.7'
|
|
dependencies.testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4'
|
|
|
|
dependencies.testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
|
|
dependencies.testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
|
|
}
|
|
|
|
ext.kotlinFixtures = { dependencies ->
|
|
dependencies.testFixturesImplementation 'io.mockk:mockk:1.12.7'
|
|
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")
|
|
}
|
|
|
|
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"))
|
|
}
|
|
}
|
|
|
|
|
|
if (launchTask.contains("codeCoverageReport".toLowerCase())) {
|
|
apply from: 'tools/coverage.gradle'
|
|
}
|