Ido Flax
11/01/2023, 4:42 PMIdo Flax
11/01/2023, 4:54 PMJacob Ras
11/01/2023, 4:55 PMIdo Flax
11/01/2023, 4:57 PMIdo Flax
11/01/2023, 4:58 PM.
├── build.gradle.kts
├── ktor-server-task-scheduler-core
│ ├── build.gradle.kts
│ └── src
│ ├── commonMain
│ ├── commonTest
│ ├── jvmMain
│ ├── jvmTest
│ ├── nativeMain
│ └── nativeTest
├── ktor-server-task-scheduler-jdbc
│ ├── build
│ │ └── tmp
│ ├── build.gradle.kts
│ └── src
│ ├── commonMain
│ ├── commonTest
│ ├── jvmMain
│ └── jvmTest
├── ktor-server-task-scheduler-mongodb
│ ├── build
│ │ └── tmp
│ ├── build.gradle.kts
│ └── src
│ ├── commonMain
│ ├── commonTest
│ ├── jvmMain
│ ├── jvmTest
│ ├── nativeMain
│ └── nativeTest
└── ktor-server-task-scheduler-redis
├── build
│ └── tmp
├── build.gradle.kts
├── redis-client
│ ├── build
│ ├── build.gradle.kts
│ └── src
└── src
├── commonMain
├── commonTest
├── jvmMain
├── jvmTest
├── nativeMain
└── nativeTest
Core build tree:
├── libs
│ ├── core-jvm-1.2.6-sources.jar
│ ├── core-jvm-1.2.6.jar
│ ├── ktor-server-task-scheduler-core-jvm-1.2.6-sources.jar
│ ├── ktor-server-task-scheduler-core-jvm-1.2.6.jar
│ └── ktor-server-task-scheduler-core-metadata-1.2.6.jar
core build:
plugins {
id("ktor-server-plugin-conventions")
kotlin("plugin.serialization") version libs.versions.kotlin.asProvider().get()
}
kotlin {
explicitApi()
sourceSets {
commonMain {
dependencies {
api(libs.krontab)
}
}
}
}
jdbc build:
plugins {
id("ktor-server-plugin-conventions")
}
kotlin {
explicitApi()
targets {
jvm()
}
sourceSets {
commonMain {
dependencies {
api(projects.ktorServerTaskScheduler.core)
implementation(projects.common)
}
}
jvmMain {
dependencies {
implementation(libs.exposed.core)
implementation(libs.exposed.jdbc)
implementation(libs.exposed.dao)
implementation(libs.exposed.kotlin.datetime)
}
}
jvmTest {
dependencies {
implementation(libs.kotest.extensions.testcontainers)
implementation(libs.testcontainers)
implementation(libs.testcontainers.postgres)
implementation(libs.kotest.property)
}
}
}
}
In the attached image you can see what isn’t available in jdbc/jvmMain (left) vs jdbc/commonMain (right)dsavvinov
11/02/2023, 3:48 PMktor-server-plugin-conventions
is your own convention plugin? If yes, knowing what’s inside of it will be necessary for investigating the issueIdo Flax
11/02/2023, 3:59 PMextensions.findByType(KotlinMultiplatformExtension::class)?.apply {
explicitApi()
jvm {
jvmToolchain(versionOf("java").toInt())
tasks.named("jvmJar", Jar::class).configure {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(
listOf(
configurations["jvmCompileClasspath"],
configurations["jvmRuntimeClasspath"],
).map { it.map { if (it.isDirectory) it else zipTree(it) } },
)
}
}
this.sourceSets.apply {
commonMain {
dependencies {
implementation(library("kotlinx-datetime"))
implementation(library("kotlinx-coroutines-core"))
implementation(library("arrow-core"))
implementation(library("arrow-fx-coroutines"))
implementation(library("kotlin-logging"))
}
}
commonTest {
dependencies {
implementation(kotlin("test"))
implementation(library("kotlinx-coroutines-test"))
implementation(library("kotest-framework-engine"))
implementation(library("kotest-framework-datatest"))
implementation(library("kotest-assertions-core"))
}
}
jvmTest {
dependencies {
implementation(library("kotest-runner-junit5"))
implementation(library("logback-classic"))
implementation(library("mockk"))
}
}
}
this.conventionSpecifics()
}
...
override fun KotlinMultiplatformExtension.conventionSpecifics() {
// Support mac OS?
// macosArm64()
// macosX64()
linuxX64("native")
nativeTarget.apply {
binaries {
sharedLib {
this.baseName = "ktor"
}
}
configure()
}
sourceSets.apply {
commonMain {
with(this.project) {
dependencies {
implementation(library("ktor-server-core"))
implementation(library("ktor-server-config-yaml"))
implementation(library("ktor-server-auth"))
}
}
}
commonTest {
with(this.project) {
dependencies {
implementation(library("ktor-server-test-host"))
implementation(library("ktor-server-status-pages"))
}
}
}
}
Ido Flax
11/02/2023, 3:59 PMIdo Flax
11/02/2023, 4:45 PMIdo Flax
11/02/2023, 10:03 PMapply("org.gradle.java-library")
apply("java-library-distribution")
When i remove them, it seems to work. I still can’t reproduce this in my minimal reproduction project though… @dsavvinov if you have any insight into why that might be the case, i would be curious to knowdsavvinov
11/06/2023, 10:58 AMIdo Flax
11/06/2023, 4:38 PMopen class Conventions : Plugin<Project> {
open fun KotlinMultiplatformExtension.conventionSpecifics() {}
override fun apply(project: Project) {
with(project) {
with(plugins) {
// apply("org.gradle.java-library")
// apply("java-library-distribution")
Or just one of them. Then after building, the projects in ktor-server
should be brokendsavvinov
11/08/2023, 4:28 PMapply("org.gradle.java-library")
and apply("java-library-distribution")
uncommented works for me in: IntelliJ 2032.2.4 (latest stable), build #IU-232.10203.10
Could you please create a YouTrack issue at kotl.in/issue ? We have dedicated Support Engineers working there, they will be able to handle this faster and more reliably than me (as I might not be able to respond quick enough, as now, for example)Ido Flax
11/09/2023, 12:08 PM