From 42c02c244bc70ce3ccdd496166f03030d84baf7d Mon Sep 17 00:00:00 2001 From: RoB Murdock Date: Sat, 15 Jul 2023 23:19:55 -0400 Subject: [PATCH] more build refactoring --- libraries/action/build.gradle.kts | 41 ++++++------ libraries/logging/build.gradle.kts | 2 - libraries/model/build.gradle.kts | 2 - .../repository/compound/build.gradle.kts | 1 - libraries/repository/core/build.gradle.kts | 51 +++++---------- libraries/repository/dynamo/build.gradle.kts | 14 ++--- libraries/repository/memory/build.gradle.kts | 62 ++++++------------- .../repository/validation/build.gradle.kts | 43 +++++-------- server/action/build.gradle.kts | 3 - server/build.gradle.kts | 6 +- 10 files changed, 82 insertions(+), 143 deletions(-) diff --git a/libraries/action/build.gradle.kts b/libraries/action/build.gradle.kts index 44dc2ec6f4..550a083791 100644 --- a/libraries/action/build.gradle.kts +++ b/libraries/action/build.gradle.kts @@ -18,26 +18,6 @@ kotlin { sourceSets.named("jvmMain") { kotlin.srcDir("build/generated/ksp/jvm/jvmMain/kotlin") } - -} - -tasks { - named("jvmTest", Test::class) { - systemProperty("junit.jupiter.extensions.autodetection.enabled", "true") - useJUnitPlatform() - } - "formatKotlinJsMain" { - dependsOn("kspKotlinJs") - } - "formatKotlinJsTest" { - dependsOn("kspTestKotlinJs") - } - "lintKotlinJsMain" { - dependsOn("kspKotlinJs") - } - "lintKotlinJsTest" { - dependsOn("kspTestKotlinJs") - } } dependencies { @@ -66,4 +46,23 @@ dependencies { "jvmTestImplementation"("org.slf4j:slf4j-simple") "jvmTestImplementation"("org.junit.jupiter:junit-jupiter-api") "jvmTestImplementation"("org.junit.jupiter:junit-jupiter-engine") -} \ No newline at end of file +} + +tasks { + named("jvmTest") { + systemProperty("junit.jupiter.extensions.autodetection.enabled", "true") + useJUnitPlatform() + } + "formatKotlinJsMain" { + dependsOn("kspKotlinJs") + } + "formatKotlinJsTest" { + dependsOn("kspTestKotlinJs") + } + "lintKotlinJsMain" { + dependsOn("kspKotlinJs") + } + "lintKotlinJsTest" { + dependsOn("kspTestKotlinJs") + } +} diff --git a/libraries/logging/build.gradle.kts b/libraries/logging/build.gradle.kts index b0bcefa676..cad82cdac7 100644 --- a/libraries/logging/build.gradle.kts +++ b/libraries/logging/build.gradle.kts @@ -2,14 +2,12 @@ plugins { kotlin("plugin.serialization") id("com.zegreatrob.coupling.plugins.mp") } - kotlin { targets { jvm() js { nodejs() } } } - dependencies { commonMainImplementation("org.jetbrains.kotlin:kotlin-stdlib-common") commonMainImplementation("io.github.microutils:kotlin-logging") diff --git a/libraries/model/build.gradle.kts b/libraries/model/build.gradle.kts index c2f15dc79c..a836c687f1 100644 --- a/libraries/model/build.gradle.kts +++ b/libraries/model/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("com.zegreatrob.coupling.plugins.mp") } - kotlin { targets { jvm() @@ -11,7 +10,6 @@ kotlin { } } } - dependencies { commonMainApi(enforcedPlatform(project(":libraries:dependency-bom"))) commonMainApi(kotlin("stdlib")) diff --git a/libraries/repository/compound/build.gradle.kts b/libraries/repository/compound/build.gradle.kts index 90e24fa9c6..19df3425f3 100644 --- a/libraries/repository/compound/build.gradle.kts +++ b/libraries/repository/compound/build.gradle.kts @@ -7,7 +7,6 @@ kotlin { js { nodejs() } } } - dependencies { commonMainApi(project(":libraries:model")) commonMainApi(project(":libraries:repository:core")) diff --git a/libraries/repository/core/build.gradle.kts b/libraries/repository/core/build.gradle.kts index d6d25f2afe..a0bd59c7b7 100644 --- a/libraries/repository/core/build.gradle.kts +++ b/libraries/repository/core/build.gradle.kts @@ -9,39 +9,22 @@ kotlin { useCommonJs() } } +} +dependencies { + commonMainApi(project(":libraries:model")) + commonMainApi("org.jetbrains.kotlinx:kotlinx-coroutines-core") - sourceSets { - getByName("commonMain") { - dependencies { - api(project(":libraries:model")) - api("org.jetbrains.kotlinx:kotlinx-coroutines-core") - } - } - getByName("commonTest") { - dependencies { - implementation(project(":libraries:test-logging")) - implementation("com.zegreatrob.testmints:standard") - implementation("com.zegreatrob.testmints:minassert") - implementation("org.jetbrains.kotlin:kotlin-test") - } - } - getByName("jvmMain") { - dependencies { - api(kotlin("reflect")) - api("org.jetbrains.kotlinx:kotlinx-coroutines-core") - } - } - getByName("jvmTest") { - dependencies { - implementation(kotlin("reflect")) - implementation("org.junit.jupiter:junit-jupiter-api") - implementation("org.junit.jupiter:junit-jupiter-engine") - } - } - getByName("jsMain") { - dependencies { - api("org.jetbrains.kotlin:kotlin-stdlib-js") - } - } - } + commonTestImplementation(project(":libraries:test-logging")) + commonTestImplementation("com.zegreatrob.testmints:standard") + commonTestImplementation("com.zegreatrob.testmints:minassert") + commonTestImplementation("org.jetbrains.kotlin:kotlin-test") + + "jvmMainApi"(kotlin("reflect")) + "jvmMainApi"("org.jetbrains.kotlinx:kotlinx-coroutines-core") + + "jvmTestImplementation"(kotlin("reflect")) + "jvmTestImplementation"("org.junit.jupiter:junit-jupiter-api") + "jvmTestImplementation"("org.junit.jupiter:junit-jupiter-engine") + + "jsMainApi"("org.jetbrains.kotlin:kotlin-stdlib-js") } diff --git a/libraries/repository/dynamo/build.gradle.kts b/libraries/repository/dynamo/build.gradle.kts index 1eed4899ad..f3328c2bab 100644 --- a/libraries/repository/dynamo/build.gradle.kts +++ b/libraries/repository/dynamo/build.gradle.kts @@ -18,13 +18,6 @@ kotlin { } } -tasks { - named("jsNodeTest", KotlinJsTest::class) { - dependsOn("composeUp") - environment("LOCAL_DYNAMO", "true") - } -} - dockerCompose { tcpPortsToIgnoreWhenWaiting.set(listOf(5555)) setProjectName("Coupling-root") @@ -55,3 +48,10 @@ dependencies { jsTestImplementation("org.jetbrains.kotlin:kotlin-test-annotations-common") jsTestImplementation("org.jetbrains.kotlin:kotlin-test-js") } + +tasks { + named("jsNodeTest", KotlinJsTest::class) { + dependsOn("composeUp") + environment("LOCAL_DYNAMO", "true") + } +} diff --git a/libraries/repository/memory/build.gradle.kts b/libraries/repository/memory/build.gradle.kts index a8457ca12a..4158b20048 100644 --- a/libraries/repository/memory/build.gradle.kts +++ b/libraries/repository/memory/build.gradle.kts @@ -9,47 +9,25 @@ kotlin { useCommonJs() } } +} - sourceSets { - getByName("commonMain") { - dependencies { - implementation(project(":libraries:model")) - implementation(project(":libraries:repository:core")) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core") - implementation("com.benasher44:uuid") - } - } - getByName("commonTest") { - dependencies { - implementation(project(":libraries:test-logging")) - implementation(project(":libraries:repository:validation")) - implementation("com.zegreatrob.testmints:standard") - implementation("com.zegreatrob.testmints:minassert") - implementation("org.jetbrains.kotlin:kotlin-test") - } - } - getByName("jvmMain") { - dependencies { - api(kotlin("reflect")) - } - } - getByName("jvmTest") { - dependencies { - implementation(kotlin("reflect")) - implementation("org.junit.jupiter:junit-jupiter-api") - implementation("org.junit.jupiter:junit-jupiter-engine") - } - } +dependencies { + commonMainImplementation(project(":libraries:model")) + commonMainImplementation(project(":libraries:repository:core")) + commonMainImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core") + commonMainImplementation("com.benasher44:uuid") - getByName("jsMain") { - dependencies { - api("org.jetbrains.kotlin:kotlin-stdlib-js") - } - } - getByName("jsTest") { - dependencies { - implementation("com.zegreatrob.testmints:async") - } - } - } -} + commonTestImplementation(project(":libraries:test-logging")) + commonTestImplementation(project(":libraries:repository:validation")) + commonTestImplementation("com.zegreatrob.testmints:standard") + commonTestImplementation("com.zegreatrob.testmints:minassert") + commonTestImplementation("org.jetbrains.kotlin:kotlin-test") + + "jvmMainApi"(kotlin("reflect")) + + "jvmTestImplementation"(kotlin("reflect")) + "jvmTestImplementation"("org.junit.jupiter:junit-jupiter-api") + "jvmTestImplementation"("org.junit.jupiter:junit-jupiter-engine") + + "jsTestImplementation"("com.zegreatrob.testmints:async") +} \ No newline at end of file diff --git a/libraries/repository/validation/build.gradle.kts b/libraries/repository/validation/build.gradle.kts index e12c42b44e..5f7271f4f9 100644 --- a/libraries/repository/validation/build.gradle.kts +++ b/libraries/repository/validation/build.gradle.kts @@ -9,33 +9,20 @@ kotlin { useCommonJs() } } +} - sourceSets { - getByName("commonMain") { - dependencies { - api(project(":libraries:repository:core")) - api(project(":libraries:test-logging")) - api(project(":libraries:stub-model")) - api("org.jetbrains.kotlinx:kotlinx-datetime") - api("org.jetbrains.kotlinx:kotlinx-coroutines-core") - api("org.jetbrains.kotlin:kotlin-test") - api("com.zegreatrob.testmints:standard") - api("com.zegreatrob.testmints:async") - api("com.zegreatrob.testmints:minassert") - } - } +dependencies { + commonMainApi(project(":libraries:repository:core")) + commonMainApi(project(":libraries:test-logging")) + commonMainApi(project(":libraries:stub-model")) + commonMainApi("org.jetbrains.kotlinx:kotlinx-datetime") + commonMainApi("org.jetbrains.kotlinx:kotlinx-coroutines-core") + commonMainApi("org.jetbrains.kotlin:kotlin-test") + commonMainApi("com.zegreatrob.testmints:standard") + commonMainApi("com.zegreatrob.testmints:async") + commonMainApi("com.zegreatrob.testmints:minassert") - getByName("jvmMain") { - dependencies { - api(kotlin("reflect")) - implementation(kotlin("reflect")) - implementation("org.jetbrains.kotlin:kotlin-test-junit") - } - } - getByName("jsMain") { - dependencies { - api("org.jetbrains.kotlin:kotlin-stdlib-js") - } - } - } -} + "jvmMainApi"(kotlin("reflect")) + "jvmMainImplementation"(kotlin("reflect")) + "jvmMainImplementation"("org.jetbrains.kotlin:kotlin-test-junit") +} \ No newline at end of file diff --git a/server/action/build.gradle.kts b/server/action/build.gradle.kts index 1f3295c7b4..e02b6282c9 100644 --- a/server/action/build.gradle.kts +++ b/server/action/build.gradle.kts @@ -1,6 +1,3 @@ -import org.jmailen.gradle.kotlinter.tasks.FormatTask -import org.jmailen.gradle.kotlinter.tasks.LintTask - plugins { id("com.zegreatrob.coupling.plugins.mp") id("com.zegreatrob.testmints.action-mint") diff --git a/server/build.gradle.kts b/server/build.gradle.kts index 07d872892c..319ab7901b 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -217,13 +217,13 @@ tasks { stage ) } - register("serverlessBuild", NodeExec::class) { + register("serverlessBuild") { configureBuild("prod") } - register("serverlessBuildSandbox", NodeExec::class) { + register("serverlessBuildSandbox") { configureBuild("sandbox") } - register("serverlessBuildPrerelease", NodeExec::class) { + register("serverlessBuildPrerelease") { configureBuild("prerelease") } }