build: cleanup sourceSet handling to drop unused vals

This commit is contained in:
Harsh Shandilya 2021-09-30 02:30:42 +05:30
parent fde4e01697
commit 76c46b4229
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
3 changed files with 27 additions and 61 deletions

View file

@ -8,39 +8,23 @@ plugins {
} }
kotlin { kotlin {
android() { compilations.all { kotlinOptions.jvmTarget = "11" } } android { compilations.all { kotlinOptions.jvmTarget = "11" } }
jvm("desktop") { compilations.all { kotlinOptions.jvmTarget = "11" } } jvm("desktop") { compilations.all { kotlinOptions.jvmTarget = "11" } }
sourceSets { sourceSets["commonMain"].apply {
// Workaround for: dependencies {
// api(compose.runtime)
// The Kotlin source set androidAndroidTestRelease was configured but not added to any api(compose.foundation)
// Kotlin compilation. You can add a source set to a target's compilation by connecting it api(compose.material)
// with the compilation's default source set using 'dependsOn'. api(projects.database)
// See
// https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#connecting-source-sets
//
// This workaround includes `dependsOn(androidAndroidTestRelease)` in the `androidTest`
// sourceSet.
val androidAndroidTestRelease by getting
val commonMain by getting {
dependencies {
api(compose.runtime)
api(compose.foundation)
api(compose.material)
api(projects.database)
}
} }
val commonTest by getting }
val androidMain by getting { sourceSets["androidMain"].apply {
dependencies { dependencies {
implementation(libs.androidx.browser) implementation(libs.androidx.browser)
implementation(libs.coil.compose) implementation(libs.coil.compose)
}
} }
val androidTest by getting { dependsOn(androidAndroidTestRelease) }
val desktopMain by getting { dependencies { implementation(libs.kamel.image) } }
val desktopTest by getting
} }
sourceSets["desktopMain"].apply { dependencies { implementation(libs.kamel.image) } }
} }
tasks.withType<KotlinCompile> { tasks.withType<KotlinCompile> {

View file

@ -13,28 +13,12 @@ kotlin {
kotlinOptions.freeCompilerArgs + listOf("-Xopt-in=kotlin.RequiresOptIn") kotlinOptions.freeCompilerArgs + listOf("-Xopt-in=kotlin.RequiresOptIn")
} }
} }
sourceSets { sourceSets["androidMain"].apply { dependencies { implementation(libs.sqldelight.androidDriver) } }
// Workaround for: sourceSets["desktopMain"].apply { dependencies { implementation(libs.sqldelight.jvmDriver) } }
// sourceSets["desktopTest"].apply {
// The Kotlin source set androidAndroidTestRelease was configured but not added to any dependencies {
// Kotlin compilation. You can add a source set to a target's compilation by connecting it implementation(libs.kotlin.coroutines.core)
// with the compilation's default source set using 'dependsOn'. implementation(kotlin("test-junit"))
// See
// https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#connecting-source-sets
//
// This workaround includes `dependsOn(androidAndroidTestRelease)` in the `androidTest`
// sourceSet.
val androidAndroidTestRelease by getting
val commonMain by getting
val commonTest by getting
val androidMain by getting { dependencies { implementation(libs.sqldelight.androidDriver) } }
val androidTest by getting { dependsOn(androidAndroidTestRelease) }
val desktopMain by getting { dependencies { implementation(libs.sqldelight.jvmDriver) } }
val desktopTest by getting {
dependencies {
implementation(libs.kotlin.coroutines.core)
implementation(kotlin("test-junit"))
}
} }
} }
} }

View file

@ -12,17 +12,15 @@ version = "1.0"
kotlin { kotlin {
jvm { compilations.all { kotlinOptions.jvmTarget = "11" } } jvm { compilations.all { kotlinOptions.jvmTarget = "11" } }
sourceSets { sourceSets["jvmMain"].apply {
val jvmMain by getting { dependencies {
dependencies { implementation(projects.api)
implementation(projects.common) implementation(projects.common)
implementation(libs.aurora.component) implementation(libs.aurora.component)
implementation(libs.aurora.skin) implementation(libs.aurora.skin)
implementation(libs.aurora.window) implementation(libs.aurora.window)
implementation(compose.desktop.currentOs) implementation(compose.desktop.currentOs)
}
} }
val jvmTest by getting
} }
} }