dokkatoo icon indicating copy to clipboard operation
dokkatoo copied to clipboard

Consider using different Gradle attributes for `dokkatooHtmlPublicationPluginClasspathApiOnlyConsumable`

Open martinbonnin opened this issue 4 months ago • 9 comments

After upgrating to 2.1.0, we started having KSP errors because the KSP classpath would select the dokkatooHtmlPublicationPluginClasspathApiOnlyConsumable variant of some projects instead of the jvmRuntimeElements ones. They are indeed quite similar:

--------------------------------------------------
Variant dokkatooHtmlPublicationPluginClasspathApiOnlyConsumable
--------------------------------------------------
Shared Dokka Plugins for consumers that will assemble a html Publication using the Dokka Module that this project produces

Capabilities
    - com.apollographql.apollo3:apollo-ast:4.0.0-beta.5-SNAPSHOT (default capability)
Attributes
    - dev.adamko.dokkatoo.classpath  = dokka-publication-plugins
    - dev.adamko.dokkatoo.format     = html
    - org.gradle.category            = library
    - org.gradle.dependency.bundling = external
    - org.gradle.jvm.environment     = standard-jvm
    - org.gradle.libraryelements     = jar
    - org.gradle.usage               = java-runtime

vs

--------------------------------------------------
Variant jvmRuntimeElements
--------------------------------------------------
Elements of runtime for main.

Capabilities
    - com.apollographql.apollo3:apollo-ast:4.0.0-beta.5-SNAPSHOT (default capability)
Attributes
    - org.gradle.category                = library
    - org.gradle.jvm.environment         = standard-jvm
    - org.gradle.libraryelements         = jar
    - org.gradle.usage                   = java-runtime
    - org.jetbrains.kotlin.platform.type = jvm
Artifacts
    - build/libs/apollo-ast-jvm-4.0.0-beta.5-SNAPSHOT.jar (artifactType = jar)

I was able to workaround by forcing "unselection" of the dokkatoo variant:

  configurations.configureEach {
    if (name.lowercase().contains("dokkatooHtmlPublicationPluginClasspathApiOnlyConsumable".lowercase())) {
      attributes {
        attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class.java, "poison"))
      }
    }
  }

TBH I'm not 100% what the root cause is but would it be possible to use more specific attributes for dokkatooHtmlPublicationPluginClasspathApiOnlyConsumable? Maybe org.gradle.usage = dokkatoo-plugin?

martinbonnin avatar Feb 12 '24 15:02 martinbonnin