Justin
01/13/2021, 4:29 PMProject
• SubProjectA
_Dependencies_:
• SubProjectB
_Dependencies_:
SubProjectA
• SubProjectC
_Dependencies_:
SubProjectB
--------------------------------------------
...I am trying to create a Javascript build of SubProjectC that can be used by a Typescript-based backend service.
The goal is to be able to add the JS build of SubProjectC via yarn
(or npm
).
I am able to create a JS build by adding the following in the build.gradle.kts
of all subprojects:
js(IR) {
useCommonJs()
browser {
testTask {
enabled = false
}
}
binaries.executable()
}
But when I try to call methods on the build of SubProjectC, it says it cannot find the nested dependencies (i.e. SubProjectA/SubProjectB).
Anyone know of any sample projects out there with this sort of layout?turansky
01/13/2021, 4:32 PMapi
or implementation
dependency configuration for A
and B
?Justin
01/13/2021, 4:34 PMsourceSets {
all {
languageSettings.apply {
useExperimentalAnnotation("kotlin.RequiresOptIn")
useExperimentalAnnotation("kotlin.ExperimentalStdlibApi")
useExperimentalAnnotation("kotlinx.serialization.ExperimentalSerializationApi")
}
}
named("commonMain") {
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serialization_version")
api(project(":SubProjectB"))
}
}
named("commonTest") {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation(kotlin("reflect"))
implementation(project(":SubProjectA"))
}
}
named("jsMain") {
dependencies {
implementation(kotlin("stdlib-js"))
api(project(":SubProjectB"))
}
}
named("jsTest") {
dependencies {
implementation(kotlin("test-js"))
}
}
}
Justin
01/13/2021, 4:36 PMsourceSets {
all {
languageSettings.useExperimentalAnnotation("kotlin.RequiresOptIn")
languageSettings.useExperimentalAnnotation("kotlin.ExperimentalStdlibApi")
languageSettings.useExperimentalAnnotation("kotlinx.serialization.ExperimentalSerializationApi")
}
named("commonMain") {
dependencies {
implementation(kotlin("stdlib"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serialization_version")
}
}
named("commonTest") {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation(kotlin("reflect"))
implementation(project(":SubProjectA"))
}
kotlin.setSrcDirs(kotlin.srcDirs + "build/codegen")
}
named("jsMain") {
dependencies {
implementation(kotlin("stdlib-js"))
}
}
named("jsTest") {
dependencies {
implementation(kotlin("test-js"))
}
}
}
turansky
01/13/2021, 5:53 PMA
api in C
then you need add this
implementation(project(":SubProjectA"))
in C
project too