Carter
04/11/2024, 2:34 PMkotlin.js.yarn=false
?
> Task :browser-route-lib:jsBrowserTest
Error during loading "kotlin-test-js-runner/karma-kotlin-reporter.js" plugin:
Cannot find module 'karma/lib/utils/path-utils'
Require stack:
- ~/kmp-sigma/build/js/packages_imported/kotlin-test-js-runner/0.0.1/karma-kotlin-reporter.js
- ~/kmp-sigma/build/js/packages/Sigma-browser-route-lib-test/node_modules/karma/lib/plugin.js
- ~/kmp-sigma/build/js/packages/Sigma-browser-route-lib-test/node_modules/karma/lib/server.js
- ~/kmp-sigma/build/js/packages/Sigma-browser-route-lib-test/node_modules/karma/lib/cli.js
- ~/kmp-sigma/build/js/packages/Sigma-browser-route-lib-test/node_modules/karma/bin/karma
Cannot load "sourcemap", it is not registered!
Perhaps you are missing some plugin?
Server start failed on port 9876: Error: No provider for "framework:mocha"! (Resolving: framework:mocha)
Can not load reporter "karma-kotlin-reporter", it is not registered!
Perhaps you are missing some plugin?
java.lang.IllegalStateException: command '~/.gradle/nodejs/node-v20.12.1-darwin-arm64/bin/node' exited with errors (exit code: 1)
tapchicoma
04/11/2024, 2:52 PMIlya Goncharov [JB]
04/11/2024, 2:54 PMCarter
04/11/2024, 2:55 PMAnton Mefodichev
04/27/2024, 6:53 AMIlya Goncharov [JB]
04/29/2024, 8:32 AMpackage-lock.json
at all (both in kotlin-js-store
and in build/js
)Carter
05/01/2024, 6:32 PM./gradlew resolveAll kotlinStorePackageLock
(resolveAll described below)
3. I commit the lockfile
4. I run ./gradlew check
or ./gradlew assemble
and it succeeds
5. I run ./gradlew :server-app:prepareDockerDeployment
and it fails (this task just takes the server-app JAR file, plus a Dockerfile, and puts them in a separate directory)
6. I delete the lock file and the build directory
7. I run ./gradlew :server-app:prepareDockerDeployment kotlinStorePackageLock
but Git shows no differences between the re-generated lock file and the one committed in step 1
The resolveAll
task is present in all modules via a convention plugin, and it does the following
tasks {
// invoke with `./gradlew resolveAll --write-locks` when updating dependencies
register("resolveAll", ResolveAllDependencies::class)
}
@CacheableTask
abstract class ResolveAllDependencies : DefaultTask() {
@get:Input
abstract val dependencies: SetProperty<ResolvedComponentResult>
init {
@Suppress("LeakingThis")
with(dependencies) {
finalizeValueOnRead()
project.configurations.all {
if (isCanBeResolved) {
add(incoming.resolutionResult.rootComponent)
}
}
}
}
@TaskAction
fun resolve() { /* no-op */
}
}
:server-app
is a JVM application. The one tricky thing it does is copy the output of :browser-app
which is a Compose for Web app into its JAR file. It does that by the following
browser-app/build.gradle.kts
configurations.register("browserAppProduction") {
isCanBeConsumed = true
isCanBeResolved = true
}.also { configuration ->
artifacts {
val resourcesTask = tasks.getByName("jsBrowserDistribution")
resourcesTask.outputs.files.forEach { file ->
add(configuration.name, file) {
builtBy(resourcesTask)
}
}
val webpackTask = tasks.getByName("jsBrowserProductionWebpack")
webpackTask.outputs.files.forEach { file ->
add(configuration.name, file) {
builtBy(webpackTask)
}
}
}
}
server-app/build.gradle.kts
kotlin {
sourceSets {
getByName("jvmMain") {
dependencies {
implementation(
project(
mapOf(
"path" to ":browser-app",
"configuration" to "browserAppProduction"
)
)
)
}
}
}
}
Anton Mefodichev
07/05/2024, 10:44 AM