Skip to content

Commit

Permalink
KTOR-7501 Use target hierarchy DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
osipxd committed Sep 26, 2024
1 parent 2ab6575 commit f68b079
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 326 deletions.
6 changes: 2 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ doctor {
enableTestCaching = false
}

allprojects {
subprojects {
group = "io.ktor"
version = configuredVersion
extra["hostManager"] = HostManager()

setupTrainForSubproject()

val nonDefaultProjectStructure: List<String> by rootProject.extra
if (nonDefaultProjectStructure.contains(project.name)) return@allprojects
if (nonDefaultProjectStructure.contains(project.name)) return@subprojects

apply(plugin = "kotlin-multiplatform")
apply(plugin = "atomicfu-conventions")
Expand All @@ -138,9 +138,7 @@ allprojects {
if (!skipPublish.contains(project.name)) {
configurePublication()
}
}

subprojects {
configureCodestyle()
}

Expand Down
13 changes: 10 additions & 3 deletions buildSrc/src/main/kotlin/JsConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ import org.jetbrains.kotlin.gradle.targets.js.ir.*
import java.io.*

fun Project.configureJs() {
configureJsTasks()
val nodeJsEnabled = project.targetIsEnabled("js.nodeJs")
val browserEnabled = project.targetIsEnabled("js.browser")

kotlin {
js {
if (nodeJsEnabled) nodejs()
if (browserEnabled) browser()
}

sourceSets {
jsTest {
dependencies {
Expand All @@ -21,13 +27,14 @@ fun Project.configureJs() {
}
}

configureJsTasks(nodeJsEnabled)
configureJsTestTasks()
}

private fun Project.configureJsTasks() {
private fun Project.configureJsTasks(nodeJsEnabled: Boolean) {
kotlin {
js {
if (project.targetIsEnabled("js.nodeJs")) {
if (nodeJsEnabled) {
nodejs {
testTask {
useMocha {
Expand Down
Loading

0 comments on commit f68b079

Please sign in to comment.