cashapp / zipline

Run Kotlin/JS libraries in Kotlin/JVM and Kotlin/Native programs
Apache License 2.0
2.04k stars 154 forks source link

PropertyQueryException: Failed to query compileDevelopmentExecutableKotlinJsZipline property outputDir #1354

Closed swankjesse closed 3 months ago

swankjesse commented 3 months ago

Our builds are crashing like this:

org.gradle.api.internal.provider.AbstractProperty$PropertyQueryException: Failed to query the value of task ':test-app:presenter-treehouse:compileDevelopmentExecutableKotlinJsZipline' property 'outputDir'.

I believe the root cause is the Android Gradle plugin’s BuildAnalyzerConfiguratorService, which attempts to retrieve every task’s output directory.

        project.gradle.taskGraph.whenReady { taskGraph ->
            val outputFileToTasksMap = mutableMapOf<String, MutableList<String>>()
            val taskNameToTaskInfoMap = mutableMapOf<String, AndroidGradlePluginAttributionData.TaskInfo>()
            taskGraph.allTasks.forEach { task ->

                task.outputs.files.forEach { outputFile ->
                    outputFileToTasksMap.computeIfAbsent(outputFile.absolutePath) {
                        ArrayList()
                    }.add(task.path)
                }
      ...

Unfortunately, we’re choosing our output directory based on another task’s output directory.

JakeWharton commented 3 months ago

Seems like as good of time as any to break that behavior and use a more normal strategy of an arbitrary dir + something based on task/target names.

Redwood has been consuming the task output without caring about where it lives and it works great: https://github.com/cashapp/redwood/blob/e76c025e697392c5109c1d7e2edde5507a6b1a2a/build-support/src/main/kotlin/app/cash/redwood/buildsupport/RedwoodBuildPlugin.kt#L517-L519. Shouldn't be too hard to migrate our internal usage of hard-coded paths to be well behaved.