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

ExternalDocumentationLinks: Use name as convention value for url #107

Open
hfhbd opened this issue Jul 5, 2023 · 3 comments · May be fixed by #113
Open

ExternalDocumentationLinks: Use name as convention value for url #107

hfhbd opened this issue Jul 5, 2023 · 3 comments · May be fixed by #113
Labels
enhancement New feature or request

Comments

@hfhbd
Copy link

hfhbd commented Jul 5, 2023

Current behavior:

externalDocumentationLinks {
  register("serialization") {
    url("https://kotlin.github.io/kotlinx.serialization")
  }
}

New design:

externalDocumentationLinks {
  register("https://kotlin.github.io/kotlinx.serialization")
}

I guess you don't use the name at all?

@aSemy
Copy link
Contributor

aSemy commented Jul 6, 2023

Thanks for the report!

My intention for not using the URL for the name is to allow for Gradle to generate Kotlin DSL accessors. This means that some common ones can be added in Dokkatoo, or I can define my own in a convention plugin, and they'll be easier to manually enable/disable in build scripts. E.g.

dokkatoo {
  dokkatooSourceSets.named("main") { 
    externalDocumentationLinks {
      kotlinStdlib {
        enabled = true
      }
    }
  }
}

Although Gradle doesn't generate accessors for nested types like this for some reason. Maybe it will work one day?

I can see that the current definition could be less verbose. What do you think about adding a helper function? E.g.

dokkatoo {
  dokkatooSourceSets.configureEach {
    externalDocumentationLink("https://docs.gradle.org/${gradle.gradleVersion}/javadoc/")
  }
}

Under the hood this would automatically add a external doc link, either using the URL as the name, though perhaps it could try and generate a DSL accessor compatible name.

What would be cool is to add a lot more external doc links. Some common ones are already added. And then, even if the Kotlin DSL accessor doesn't work, they could even be automatically enabled if a dependency is detected.

@aSemy aSemy added the enhancement New feature or request label Jul 6, 2023
@hfhbd
Copy link
Author

hfhbd commented Jul 6, 2023

The helper method sounds good too.

Regarding more external doc links, do you have a name schema for kotlinx, eg kotlinx-serialization?

@aSemy aSemy linked a pull request Aug 15, 2023 that will close this issue
@EdricChan03
Copy link
Contributor

Although Gradle doesn't generate accessors for nested types like this for some reason. Maybe it will work one day?

Late to the conversation, but this is filed as a feature at gradle/gradle#9264 :)

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

Successfully merging a pull request may close this issue.

3 participants