0

我正在尝试在 Android 项目中生成 KDoc 文档。以下是添加此功能的相关文件。

build.gradle(根级别):

buildscript {
    ...
    ext.dokka_version = "0.10.1"
    repositories {
        ...
        maven { url "https://dl.bintray.com/kotlin/kotlin-eap/" }
    }
    dependencies {
        ...
        classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
    }
}
...

build.gradle(模块:应用程序)

...
apply plugin: 'org.jetbrains.dokka'

...

dokka {
    outputFormat = 'html' // use 'javadoc' to get standard java docs
    outputDirectory = "$buildDir/javadoc"

    configuration {
        includeNonPublic = false
        skipEmptyPackages = true
        skipDeprecated = true
        reportUndocumented = true
        jdkVersion = 8
    }
}

后来,我./gradlew dokka从命令行运行。但是没有产生任何输出。以下是我得到的:

> Task :app:dokka
logging: loading modules: [java.se, jdk.accessibility, jdk.attach, jdk.compiler, jdk.dynalink, jdk.httpserver, jdk.jartool, jdk.javadoc, jdk.jconsole, jdk.jdi, jdk.jfr, jdk.jshell, jdk.jsobject, jdk.management, jdk.management.jfr, jdk.net, jdk.scripting.nashorn, jdk.sctp, jdk.security.auth, jdk.security.jgss, jdk.unsupported, jdk.unsupported.desktop, jdk.xml.dom, java.base, java.compiler, java.datatransfer, java.desktop, java.xml, java.instrument, java.logging, java.management, java.management.rmi, java.rmi, java.naming, java.net.http, java.prefs, java.scripting, java.security.jgss, java.security.sasl, java.sql, java.transaction.xa, java.sql.rowset, java.xml.crypto, jdk.internal.jvmstat, jdk.management.agent, jdk.jdwp.agent, jdk.internal.ed, jdk.internal.le, jdk.internal.opt]
No documentation for io.elektrifi.outageplanner.GettingStartedActivity (GettingStartedActivity.kt:9)
No documentation for io.elektrifi.outageplanner.GettingStartedActivity$<init>() (GettingStartedActivity.kt:9)
No documentation for io.elektrifi.outageplanner.GettingStartedActivity$onCreate(android.os.Bundle) (GettingStartedActivity.kt:10)
No documentation for io.elektrifi.outageplanner.LoginActivity (LoginActivity.kt:6)
No documentation for io.elektrifi.outageplanner.LoginActivity$<init>() (LoginActivity.kt:6)
No documentation for io.elektrifi.outageplanner.LoginActivity$onCreate(android.os.Bundle) (LoginActivity.kt:7)
No documentation for io.elektrifi.outageplanner.MainActivity (MainActivity.kt:17)
No documentation for io.elektrifi.outageplanner.MainActivity$<init>() (MainActivity.kt:17)
No documentation for io.elektrifi.outageplanner.MainActivity$onCreate(android.os.Bundle) (MainActivity.kt:18)
No documentation for io.elektrifi.outageplanner.RegisterActivity (RegisterActivity.kt:6)
No documentation for io.elektrifi.outageplanner.RegisterActivity$<init>() (RegisterActivity.kt:6)
No documentation for io.elektrifi.outageplanner.RegisterActivity$onCreate(android.os.Bundle) (RegisterActivity.kt:7)
No documentation for io.elektrifi.outageplanner.SplashScreenActivity (SplashScreenActivity.kt:16)
No documentation for io.elektrifi.outageplanner.SplashScreenActivity$<init>() (SplashScreenActivity.kt:16)
No documentation for io.elektrifi.outageplanner.SplashScreenActivity$onCreate(android.os.Bundle) (SplashScreenActivity.kt:19)

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.1.1/userguide/command_line_interface.html#sec:command_line_warnings

其实MainActivity里面有一个小demo脚本。我不确定为什么什么都没有生成。请让我知道我的配置是否正确。此外,拥有一个工作配置会很棒。

4

1 回答 1

0

I am a newbie, so I did not realise it. The above configuration works. The KDoc comments must be above the class or function for which we are documenting. I was starting the commenting with /** and ending with */ at the very top of the Kotlin file (before import and package) and it didn't work.

于 2020-07-20T14:59:39.960 回答