Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin/JS 1.9.0 and multi modules: Failed build: java.lang.UnsupportedOperationException: Empty collection can't be reduced. #3063

Closed
hfhbd opened this issue Jul 7, 2023 · 5 comments
Labels

Comments

@hfhbd
Copy link
Contributor

hfhbd commented Jul 7, 2023

Describe the bug
Update Kotlin from 1.8.22 to 1.9.0:

java.lang.UnsupportedOperationException: Empty collection can't be reduced.

Expected behaviour
Successful build

Build scan
https://scans.gradle.com/s/4zn2v2imwg7m4/failure?expanded-stacktrace=WyIwLTEiLCIwIl0#1

To Reproduce
sqldelight/sqldelight#4338

Dokka configuration

tasks.named("dokkaHtmlMultiModule") {
  outputDirectory = file("$rootDir/docs/2.x")

  moduleName.set("SQLDelight")
  pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase": """
    {
      "footerMessage": "Copyright © 2022 Square, Inc.",
      "customStyleSheets": ["${file("docs/css/logo-styles.css")}"]
    }
  """])

  // https://github.com/Kotlin/dokka/issues/2954
  dependsOn(":sqldelight-compiler:dokkaHtmlMultiModule")
}

Installation

  • Operating system: Linux
  • Build tool: Gradle 8.2
  • Dokka version: 1.8.20

Additional context
n/A

Are you willing to provide a PR?
No

@IgnatBeresnev
Copy link
Member

We're aware of the issue (duplicate: #3038), but there was a change in behaviour upstream (KGP), and I'm afraid we can't do anything about it from Dokka's side.

The cause of the build failure is likely that you have a multiplatform project with a single target, and such projects aren't officially supported by Kotlin (see KT-52664). Adding a phantom target should help as it would trigger a change of behaviour in KGP, and Dokka would be able to proceed without errors. I'll try to get someone from the multiplatform team to provide more details.

In the future, we'll try to warn users about this proactively (#3059) instead of letting it fail with obscure errors.

@hfhbd
Copy link
Contributor Author

hfhbd commented Jul 7, 2023

Hm, yeah, of course we use the multiplatform plugin with a single js platform, because the js plugin is deprecated since 1.9.0.

@joffrey-bion
Copy link

I'm afraid we can't do anything about it from Dokka's side.

Could you please expand on this? The exception is thrown from Dokka's gradle plugin, so at first glance it's hard to get why the plugin cannot get that list/info in a different way that doesn't crash in this case.

@CLOVIS-AI
Copy link
Contributor

Adding a phantom target should help as it would trigger a change of behaviour in KGP, and Dokka would be able to proceed without errors.

Can you clarify if this is something we can do in our own projects?

@IgnatBeresnev
Copy link
Member

We found a workaround in Dokka for this particular issue, and the fix will be released in Dokka 1.9.0, which should hopefully happen next week.

I've provided more details on single-target multiplatform project support in general and on this particular issue in #3122.

To reduce the spread of information and keep the discussion in a single place, I'll close this issue in favour of #3122 - let's continue there if anyone has anything to add.

Can you clarify if this is something we can do in our own projects?

Yep. I've added an example to #3122 - please, have a look :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants