Chris Miller
08/30/2023, 10:57 PMcompose-web/build.gradle.kts
I have:
private val webDistribution by configurations.registering {
isCanBeConsumed = true
isCanBeResolved = false
}
artifacts {
add(webDistribution.name, tasks.named("jsBrowserDistribution"))
}
In backend/build.gradle.kts
I have:
private val webOutput by configurations.creating {
isCanBeConsumed = false
isCanBeResolved = true
}
dependencies {
webOutput(project(":compose-web", configuration = "webDistribution"))
}
val copyWebOutput by tasks.registering(Copy::class) {
from(webOutput)
into(project.layout.buildDirectory.dir("app"))
}
sourceSets.main.configure { resources.srcDir(copyWebOutput) }
The jsBrowserDistribution
task is triggered before copyWebOutput
, however copyWebOutput
isn't waiting for jsBrowserDistribution
to finish. As a result the compose-web/build/dist/js/productionExecutable/compose-web.js
doesn't get generated until a few seconds after the copyWebOutput
task has already run, and hence doesn't get copied across to backend/build/app/compose-web.js
. I see there are also static files from compose-web/src/jsMain/resources
that get copied to compose-web/build/dist/js/productionExecutable
by the jsBrowserProductionExecutableDistribution
task, is that causing this problem? How can I solve it?