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

Dokka 1.7.20+ ignores sourceLinks block on android library projects #2876

Open
Claudemirovsky opened this issue Feb 16, 2023 · 2 comments
Open
Labels
bug configuration An issue/PR related to Dokka's configuration by the user platform: android-jvm An issue/PR that has some Android platform specifics regression An issue/bug that appeared after recent changes runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin

Comments

@Claudemirovsky
Copy link

Claudemirovsky commented Feb 16, 2023

Describe the bug
On dokka v1.7.20 and 1.8.10, the sourceLinks block is ignored on ANDROID library projects, but seems to work as expected on JVM libraries.

Expected behaviour
The source link for methods should appear on generated docs of android library projects.

Screenshots
This screenshot shows the documentation generated by the jvm-lib-working branch of the attached file. Thats the expected behaviour in android-library projects.
JVM-LIB-WORKING

This is the actual behaviour, it does not show the [sources] link. This screenshot shows the documentation generated by the android-lib-bug branch of the attached file.
ANDROID-LIB-BUG

This screenshot was taken while using dokka 1.7.10 on the android-lib-bug branch of the attached file. Note that a "sources" tab appears as expected for this version.
ANDROID-DOKKA-1 7 10

To Reproduce
See dokka-bug.zip
In it there are two branches, jvm-lib-working and android-lib-bug, so you can switch between the functional and the non-functional state.

Step 1: Enter the project directory
Step 2: Switch to android-lib-bug branch
Step 3: Run ./gradlew :lib:dokkaHtml
Step 4: Verify generated docs at lib/build/dokka/html

Dokka configuration
Configuration of dokka used to reproduce the bug

Copy-pasted from the attached project.

tasks.withType<DokkaTask>().configureEach {
    dokkaSourceSets.configureEach {
        offlineMode.set(true)
        sourceLink {
            localDirectory.set(file("src"))
            remoteUrl.set(URL("https://httpbin.org/anything"))
            remoteLineSuffix.set("#L")
        }
    }
}

Installation

  • Operating system: GNU/Linux Debian Bookworm
  • Build tool: Gradle v7.6
  • Dokka version: 1.7.20+

Additional context
As i said, this bug only happens on dokka 1.7.20 and 1.8.10, from 1.7.10 down the sourceLinks block isnt ignored on android library projects.
Although I have no proof, I suspect that this bug is related to this PR.

Are you willing to provide a PR?
Unfortunately for the time being I don't have enough knowledge to fix it.

@IgnatBeresnev IgnatBeresnev added the platform: android-jvm An issue/PR that has some Android platform specifics label Feb 21, 2023
@IgnatBeresnev IgnatBeresnev added runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin configuration An issue/PR related to Dokka's configuration by the user labels Apr 26, 2023
@IgnatBeresnev
Copy link
Member

Although I have no proof, I suspect that this bug is related to #2476.

I don't think this PR is the cause as it only changed the visuals of the source links, it didn't touch the configuration.

And seeing how it's working for non-android projects, I think something configuration-related was broken all of a sudden - maybe our integration with AGP, or maybe there's a bug in KGP or something - it needs to be researched.

@IgnatBeresnev
Copy link
Member

There's a similar report in Kotlin Community Slack by @covercash2:

it’s only our Android modules that aren’t linking source docs correctly. it ended up that we do need it to be localDirectory.set(projectDir.resolve("src/main/java"), and in our Kotlin-only module the source code is linked properly. however, all our other modules have Android dependencies and do not link correctly. i’m not certain this is the problem, but it seems to be the only difference i can find

@IgnatBeresnev IgnatBeresnev added the regression An issue/bug that appeared after recent changes label Apr 26, 2023
SimonMarquis added a commit to adevinta/spark-android that referenced this issue May 26, 2023
- Parse module and package docs. We'll need to update these markdown files to follow the specs.
- Parse snippets for sample code
- Configure source link (currently broken, Kotlin/dokka#2876)
SimonMarquis added a commit to adevinta/spark-android that referenced this issue May 31, 2023
- Parse module and package docs. We'll need to update these markdown files to follow the specs.
- Parse snippets for sample code
- Configure source link (currently broken, Kotlin/dokka#2876)
SimonMarquis added a commit to adevinta/spark-android that referenced this issue May 31, 2023
- Parse module and package docs. We'll need to update these markdown files to follow the specs.
- Parse snippets for sample code
- Configure source link (currently broken, Kotlin/dokka#2876)
SimonMarquis added a commit to adevinta/spark-android that referenced this issue May 31, 2023
- Parse module and package docs. We'll need to update these markdown files to follow the specs.
- Parse snippets for sample code
- Configure source link (currently broken, Kotlin/dokka#2876)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug configuration An issue/PR related to Dokka's configuration by the user platform: android-jvm An issue/PR that has some Android platform specifics regression An issue/bug that appeared after recent changes runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin
Projects
None yet
Development

No branches or pull requests

2 participants