GithubHelp home page GithubHelp logo

Comments (5)

EdricChan03 avatar EdricChan03 commented on May 23, 2024 1

I can confirm the sources seem to work correctly:

Screenshot of updated generated Dokka docs, with sources correctly added

from dokkatoo.

aSemy avatar aSemy commented on May 23, 2024 1

I'm currently playing around with migrating to Dokkatoo in cashapp/redwood but we're seeing the same issue with 1.2.0. My WIP branch is here: cashapp/redwood#936

hi @chrisbanes, I can take a look at the branch. Can you open a new issue please? Ideally with a small reproducer.

At first glance I can see that the project is using the legacy method of applying plugins, which might mean that Dokkatoo can't automatically pick up the classpath of a module (which is performed in DokkatooKotlinAdapter).

You can look in the generated my-subproject/build/dokka-config/html/dokka_parameters.json file in each subproject to see what classpath has been picked up.

For a quick-fix you could try the workaround mentioned in #44 (comment) and manually add files to the classpath

// build.gradle.kts

dokkatoo {
  dokkatooSourceSets.configureEach {
    // workaround for https://github.com/adamko-dev/dokkatoo/issues/44
    classpath.from(configurations.compileClasspath.map { it.incoming.artifactView { lenient(true) }.artifacts.artifactFiles })
  }
}

from dokkatoo.

aSemy avatar aSemy commented on May 23, 2024

Thanks, I've taken a look and I think that Dokkatoo that this error is just one symptom.

DokkatooKotlinAdapter is supposed to automatically convert any Kotlin Multiplatform source sets to an equivalent Dokka source set, but when I look in ./build/dokka-config/html/dokka_parameters.json the platform type for all source sets is common, while it should be jvm or js etc. The classpath doesn't seem to be shared across the source sets either.

I'll try to refactor DokkatooKotlinAdapter but I found it extremely difficult to do workaround Gradle's Configuration Cache restrictions.

For now, you can try and manually construct the source sets. I've not done this before, and there's no example, so it will need some experimentation. Here's a start:

dokkatoo {

  dokkatooSourceSets.clear() // clear the bugged source sets generated by Dokkatoo

  dokkatooSourceSets.create("common") {
    displayName.set("Common")
    analysisPlatform.set(KotlinPlatform.Common)
    sourceRoots.from("src/commonMain/kotlin")
    val dokkatooCommonClasspath by configurations.registering {
      isCanBeResolved = true
      isCanBeConsumed = false
      extendsFrom(
        configurations.getByName("commonMainImplementation"),
        configurations.getByName("commonMainCompileOnly"),
        configurations.getByName("commonMainRuntimeOnly"),
        configurations.getByName("commonMainApi"),
      )
    }

    classpath.from(dokkatooCommonClasspath.map { it.incoming.artifacts.artifactFiles })
  }

  dokkatooSourceSets.create("jvm") {
    displayName.set("JVM")
    analysisPlatform.set(KotlinPlatform.JVM)
    sourceRoots.from("src/jvmMain/kotlin")

    val dokkatooJvmClasspath by configurations.registering {
      isCanBeResolved = true
      isCanBeConsumed = false
      extendsFrom(
        configurations.getByName("jvmCompileClasspath"),
        configurations.getByName("jvmRuntimeClasspath"),
      )
    }

    classpath.from(dokkatooJvmClasspath.map { it.incoming.artifacts.artifactFiles })
  }
}

from dokkatoo.

aSemy avatar aSemy commented on May 23, 2024

@EdricChan03 I've refactored the Kotlin Multiplatform configuration, and added some tests to verify that this problem doesn't occur in the same projects. Please could you check if 1.2.0-SNAPSHOT resolves the issue? If you could also check #51 at the same time, it would be much appreciated!

from dokkatoo.

chrisbanes avatar chrisbanes commented on May 23, 2024

I'm currently playing around with migrating to Dokkatoo in cashapp/redwood but we're seeing the same issue with 1.2.0. My WIP branch is here: cashapp/redwood#936

from dokkatoo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.