简体   繁体   English

Android Dokka-仅为我的代码生成文档,并跳过其他所有内容

[英]Android Dokka - Only generate docs for my code and skip everything else

I'm using Dokka v0.9.17 for Android. 我正在为Android使用Dokka v0.9.17 When I run ./gradlew dokka it generates the docs but it include so many packages that I don't care about like android.support.fragment and packages for all the third party libraries. 当我运行./gradlew dokka它会生成文档,但是它包含了很多我不关心的软件包,例如android.support.fragment和所有第三方库的软件包。 How can I tell Dokka to only generate doc for my code? 如何告诉Dokka只为我的代码生成文档?

How can I remove Dagger _Factory files from the doc? 如何从文档中删除Dagger _Factory文件?

My configuration is like this 我的配置是这样的

dokka {
    moduleName = 'app'
    outputFormat = 'html'
    outputDirectory = "$buildDir/javadoc"
    includeNonPublic = true
    skipEmptyPackages = true
    noStdlibLink = true
}

Paragones had the correct answer to a different so issue Paragones对另一个问题有正确的答案

https://github.com/Kotlin/dokka/issues/258 https://github.com/Kotlin/dokka/issues/258

namely you need to add this task and modify it to only delete the stuff you want deleted: 也就是说,您需要添加此任务并将其修改为仅删除要删除的内容:

task deleteUnusedDokkaAssets(type: Delete) {
  file("$rootDir/docs").listFiles().each {        
    if(it.name.contains("android.R")) project.delete it
    if(it.name.contains("android.support")) project.delete it
    if(it.name.contains("com.google")) project.delete it  
    if(it.name.contains("com.crashlytics")) project.delete it
  }
}

note you will not need the android.R line with the updated version of dokka 注意,您不需要带有dokka更新版本的android.R行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM