Alexandre Brown
12/17/2021, 6:12 PMJavier
12/17/2021, 6:14 PMAlexandre Brown
12/17/2021, 6:14 PMMyUseCaseImpl.kt
to be able to implement the UseCaseInterface.kt
Javier
12/17/2021, 6:22 PMAlexandre Brown
12/17/2021, 6:23 PMBig Chungus
12/17/2021, 6:36 PMAlexandre Brown
12/17/2021, 6:42 PMBig Chungus
12/17/2021, 6:47 PMMyUseCaseImpl
import UseCaseInterface
Alexandre Brown
12/17/2021, 6:49 PMBig Chungus
12/17/2021, 7:02 PMAlexandre Brown
12/17/2021, 7:05 PMbackend/road-classification/usecases/build.gradle.kts
dependencies {
implementation(project(":core:entities"))
implementation(project(":core:usecases"))
}
backend/road-classification/build.gradle.kts
EMPTY
backend/build.gradle.kts
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val testImplementation by configurations
val implementation by configurations
val kotlinxCoroutinesVersion: String by project
val kotlinxDatetimeVersion: String by project
val kotestVersion: String by project
val mockkVersion: String by project
val logbackVersion: String by project
val kodeinVersion: String by project
val ktorVersion: String by project
val entryPointPath = "MainKt"
plugins {
application
kotlin("jvm") version "1.6.0" apply false
kotlin("plugin.serialization") version "1.6.0" apply false
}
application {
mainClass.set(entryPointPath)
}
repositories {
maven {
url = uri("<https://maven.pkg.jetbrains.space/public/p/ktor/eap>")
}
}
dependencies {
project(":backend:road-classification").dependencyProject.allprojects.forEach(::implementation)
implementation("io.ktor:ktor-serialization:$ktorVersion")
implementation("io.ktor:ktor-server-core:$ktorVersion")
implementation("io.ktor:ktor-server-cio:$ktorVersion")
implementation("io.ktor:ktor-server-locations:$ktorVersion")
implementation("io.ktor:ktor-server-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-server-websockets:$ktorVersion")
implementation("ch.qos.logback:logback-classic:$logbackVersion")
implementation("org.kodein.di:kodein-di-framework-ktor-server-jvm:$kodeinVersion")
testImplementation("io.ktor:ktor-server-tests:$ktorVersion")
}
tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs += listOf("-Xopt-in=io.ktor.server.locations.KtorExperimentalLocationsAPI")
}
allprojects {
apply {
plugin("org.jetbrains.kotlin.jvm")
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "11"
}
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-datetime:$kotlinxDatetimeVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
testImplementation("io.kotest:kotest-property:$kotestVersion")
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
testImplementation("io.mockk:mockk:$mockkVersion")
}
tasks.withType<Test> {
useJUnitPlatform()
}
}
core/usecases/build.gradle.kts
EMPTY
core/build.gradle.kts
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
plugins {
kotlin("multiplatform") version "1.6.0" apply false
}
subprojects {
apply {
plugin("org.jetbrains.kotlin.multiplatform")
}
extensions.getByType<KotlinMultiplatformExtension>().apply {
/* Targets configuration omitted.
* To find out how to configure the targets, please follow the link:
* <https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#setting-up-targets> */
jvm {
compilations.all {
kotlinOptions.jvmTarget = "11"
}
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val jvmMain by getting
val jvmTest by getting
val nativeMain by getting
val nativeTest by getting
}
}
}
Big Chungus
12/17/2021, 7:07 PMapply {
plugin("org.jetbrains.kotlin.jvm")
}
Which does absolutely nothing
To correctly apply plugins you need this
apply(plugin = "plugin.id")
Alexandre Brown
12/17/2021, 7:08 PMimport org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
plugins {
kotlin("multiplatform") version "1.6.0" apply false
}
subprojects {
apply(plugin = "org.jetbrains.kotlin.multiplatform")
extensions.getByType<KotlinMultiplatformExtension>().apply {
/* Targets configuration omitted.
* To find out how to configure the targets, please follow the link:
* <https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#setting-up-targets> */
jvm {
compilations.all {
kotlinOptions.jvmTarget = "11"
}
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val jvmMain by getting
val jvmTest by getting
val nativeMain by getting
val nativeTest by getting
}
}
}
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val testImplementation by configurations
val implementation by configurations
val kotlinxCoroutinesVersion: String by project
val kotlinxDatetimeVersion: String by project
val kotestVersion: String by project
val mockkVersion: String by project
val logbackVersion: String by project
val kodeinVersion: String by project
val ktorVersion: String by project
val entryPointPath = "MainKt"
plugins {
application
kotlin("jvm") version "1.6.0" apply false
kotlin("plugin.serialization") version "1.6.0" apply false
}
application {
mainClass.set(entryPointPath)
}
repositories {
maven {
url = uri("<https://maven.pkg.jetbrains.space/public/p/ktor/eap>")
}
}
dependencies {
project(":backend:road-classification").dependencyProject.allprojects.forEach(::implementation)
implementation("io.ktor:ktor-serialization:$ktorVersion")
implementation("io.ktor:ktor-server-core:$ktorVersion")
implementation("io.ktor:ktor-server-cio:$ktorVersion")
implementation("io.ktor:ktor-server-locations:$ktorVersion")
implementation("io.ktor:ktor-server-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-server-websockets:$ktorVersion")
implementation("ch.qos.logback:logback-classic:$logbackVersion")
implementation("org.kodein.di:kodein-di-framework-ktor-server-jvm:$kodeinVersion")
testImplementation("io.ktor:ktor-server-tests:$ktorVersion")
}
tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs += listOf("-Xopt-in=io.ktor.server.locations.KtorExperimentalLocationsAPI")
}
allprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "11"
}
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-datetime:$kotlinxDatetimeVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
testImplementation("io.kotest:kotest-property:$kotestVersion")
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
testImplementation("io.mockk:mockk:$mockkVersion")
}
tasks.withType<Test> {
useJUnitPlatform()
}
}
Big Chungus
12/17/2021, 7:15 PMAlexandre Brown
12/17/2021, 7:16 PMdependencies {
implementation(project(":core:entities"))
implementation(project(":core:usecases"))
}
Big Chungus
12/17/2021, 7:17 PMAlexandre Brown
12/17/2021, 7:17 PMJavier
12/17/2021, 7:17 PMBig Chungus
12/17/2021, 7:17 PMAlexandre Brown
12/17/2021, 7:17 PMBig Chungus
12/17/2021, 7:18 PMAlexandre Brown
12/17/2021, 7:22 PMBig Chungus
12/17/2021, 7:22 PMCircular dependency between the following tasks:
:backend:road-classification:usecases:classes
\--- :backend:road-classification:usecases:compileJava
+--- :backend:road-classification:usecases:compileKotlin
| \--- :backend:road-classification:usecases:jar
| +--- :backend:road-classification:usecases:classes (*)
| +--- :backend:road-classification:usecases:compileKotlin (*)
| \--- :backend:road-classification:usecases:inspectClassesForKotlinIC
| +--- :backend:road-classification:usecases:classes (*)
| \--- :backend:road-classification:usecases:compileKotlin (*)
\--- :backend:road-classification:usecases:jar (*)
Alexandre Brown
12/17/2021, 7:41 PMbackend:road-classification:usecases
references core which references nobody...Big Chungus
12/17/2021, 7:44 PMAlexandre Brown
12/17/2021, 7:45 PMBig Chungus
12/17/2021, 7:46 PMAlexandre Brown
12/17/2021, 7:46 PMbuild.gradle.kts
subprojects {
group = "com.mdai"
version = "1.0.0"
repositories {
mavenCentral()
}
}
The fact that all sub projects had the same group caused a name clash.
Moving this out of the root build.gradle.kts
group = "com.mdai"
version = "1.0.0"
And putting it inside the core/build.gradle.kts
and inside backend/build.gradle.kts
and of course making sure they both have unique group names fixed my issue.
Eg: backend build.gradle.kts
:
subprojects {
group = "com.mdai.backend"
version = "1.0.0"
core build.gradle.kts
:
subprojects {
group = "com.mdai.core"
version = "1.0.0"
It actually didn't make sense to have a single group name for multiple apps/libs, I suspect this was a leftover from the initial project setup 🤦
Thanks again for your help!Big Chungus
12/17/2021, 9:17 PMAlexandre Brown
12/17/2021, 9:25 PMbackend
, core
and library
could all be in separate repos if I wanted to. For simplicity I put them in the same repo since they both share core
. But I see backend
as being an artifact, core
as being another one and library
as another. They can all be deployed independently.core
(eg: core/entities
) and I was able to reference it indeed. This is how I figured out it had to do with a name clash.group
represents is not right. What do you think?
I could also keep the same group and have the module named differently like core/core-usecases
instead of core/usecases
Big Chungus
12/17/2021, 9:50 PMAlexandre Brown
12/17/2021, 9:54 PMBig Chungus
12/17/2021, 9:55 PMAlexandre Brown
12/17/2021, 10:02 PM