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

How do I select a Java file? #2590

Closed
2017398956 opened this issue Jul 28, 2022 · 6 comments
Closed

How do I select a Java file? #2590

2017398956 opened this issue Jul 28, 2022 · 6 comments
Labels
question A user question, can be resolved if the question is answered/resolved

Comments

@2017398956
Copy link
Contributor

2017398956 commented Jul 28, 2022

Question
when I select a kotlin file ,like this:
sourceRoots.setFrom(file("./xxx/xxx.kt"))
it works well.
But when i select a java file :
sourceRoots.setFrom(file("./xxx/xxxx.java"))
it not woking .

Task:dokkaHtml

Installation

  • Operating system: macOS 12.4
  • Build tool: Gradle v7.3.3
  • Dokka version: 1.7.10
  • IDE:Android Studio Chipmunk | 2021.2.1 Patch 1
@2017398956 2017398956 added the question A user question, can be resolved if the question is answered/resolved label Jul 28, 2022
@IgnatBeresnev
Copy link
Member

IgnatBeresnev commented Jul 28, 2022

Hi! Not sure why the behaviour is different for kotlin and java files.

Out of curiosity, is there any specific reason you need to select only one file?

Pretty sure it works if you specify the folder path, like

sourceRoots.setFrom(file("./xxx/xxx"))

@2017398956
Copy link
Contributor Author

Hi! Not sure why the behaviour is different for kotlin and java files.

Out of curiosity, is there any specific reason you need to select only one file?

Pretty sure it works if you specify the folder path, like

sourceRoots.setFrom(file("./xxx/xxx"))

Yes, a java folder path is ok but I only need partly java files of some folders , if using the whole folder is too many classes to my users.

@daymxn
Copy link

daymxn commented Jul 29, 2022

Hi! Not sure why the behaviour is different for kotlin and java files.
Out of curiosity, is there any specific reason you need to select only one file?
Pretty sure it works if you specify the folder path, like

sourceRoots.setFrom(file("./xxx/xxx"))

Yes, a java folder path is ok but I only need partly java files of some folders , if using the whole folder is too many classes to my users.

FWIW, you can also utilize perPackageOption.matchingRegex to filter files, which could be useful if you're needing a portion of files in a directory. Although, if you only need one or two files- it would definitely be overkill.

@2017398956
Copy link
Contributor Author

2017398956 commented Jul 31, 2022

Hi! Not sure why the behaviour is different for kotlin and java files.
Out of curiosity, is there any specific reason you need to select only one file?
Pretty sure it works if you specify the folder path, like

sourceRoots.setFrom(file("./xxx/xxx"))

Yes, a java folder path is ok but I only need partly java files of some folders , if using the whole folder is too many classes to my users.

FWIW, you can also utilize perPackageOption.matchingRegex to filter files, which could be useful if you're needing a portion of files in a directory. Although, if you only need one or two files- it would definitely be overkill.

I've tried with this:

    dokkaSourceSets {
        moduleName.set("test")
        named("main"){
            sourceRoots.setFrom(file("./xxx/utils/"))
        }
        configureEach {  /* configure all source sets */
            includeNonPublic.set(false)
            skipDeprecated.set(false)
            reportUndocumented.set(true)
            skipEmptyPackages.set(true)
            noStdlibLink.set(true)
            noJdkLink.set(true)
            noAndroidSdkLink.set(true)
            perPackageOption {
                matchingRegex.set("^\\S{0,}PhoneUtil.java\$")
            }
        }
    }

but it still doesn't work.

@2017398956
Copy link
Contributor Author

I solved the problem by modifying the source file (org.jetbrains.dokka.base.translators.psi.DefaultPsiToDocumentableTranslator).
Anyone who needs it can replacing the file xxxxx/.gradle/caches/modules-2/files-2.1/org.jetbrains.dokka/dokka-base/1.7.10/219488e3e446fd30b6bda2472c4b99903ecc0e73/dokka-base-1.7.10.jar by
dokka-base-1.7.10.jar.zip

@IgnatBeresnev
Copy link
Member

Fixed in #2604, will be released in 1.7.20

mapbox-github-ci-writer-public-1 bot pushed a commit to mapbox/mapbox-maps-android that referenced this issue May 5, 2023
Workaround for bug Kotlin/dokka#2590
The way it's solved is by copying the individual java files to a separate folder
which then is added as part of the Dokka sourceset
mapbox-github-ci-writer-public-1 bot pushed a commit to mapbox/mapbox-maps-android that referenced this issue May 5, 2023
Workaround for bug Kotlin/dokka#2590
The way it's solved is by copying the individual java files to a separate folder
which then is added as part of the Dokka sourceset
JulieGibbs added a commit to JulieGibbs/mapbox-maps-android that referenced this issue Apr 28, 2024
Workaround for bug Kotlin/dokka#2590
The way it's solved is by copying the individual java files to a separate folder
which then is added as part of the Dokka sourceset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A user question, can be resolved if the question is answered/resolved
Projects
None yet
Development

No branches or pull requests

3 participants