hydraulic-software/conveyor

`writeConveyorConfig` throws `Configuration with name 'desktopRuntimeClasspath' not found.`

zacharee opened this issue · 2 comments

Describe the bug
In my Compose Multiplatform project, after doing some dependency upgrades, the writeConveyorConfig task fails with Configuration with name 'desktopRuntimeClasspath' not found..

To Reproduce
Steps to reproduce the behavior:

  1. Clone the project from the link above.
  2. Run ./gradlew :desktop:writeConveyorConfig.

Expected behavior
The task should complete successfully.

Desktop (please complete the following information):

  • OS: macOS 14.5
  • Compose: 1.6.10-dev1608
  • Kotlin: 2.0.0-RC2-277

Additional context
Looking at the source, I think project.configurations.getByName("desktopRuntimeClasspath") should be project.configurations.findByName("desktopRuntimeClasspath") in ConveyorConfigTask#importFromDependencyConfigurations().

My project does have jvmRuntimeClasspath defined, so Conveyor should be able to use that, but since it calls getByName(), the task fails instead of returning null.

I think you're right. Does the following logic look correct?

        val configNames = setOf("runtimeClasspath", "desktopRuntimeClasspath", "jvmRuntimeClasspath")
        val runtimeClasspathConfiguration = try {
            configNames.firstNotNullOf { project.configurations.findByName(it) }
        } catch (e: NoSuchElementException) {
            throw Exception("Could not locate the classpath configuration, tried $configNames")
        }

The Gradle plugin has been extensively refactored on our dev branch to make it compatible with the configuration cache, so I won't apply this patch as-is immediately, but will try to release the new plugin ASAP.

I think that looks right. I worked around it for now by adding

project.configurations.create("desktopRuntimeClasspath") {
    extendsFrom(project.configurations.findByName("jvmRuntimeClasspath"))
}

to my Gradle config.