生成的JavaDoc与Android摇篮插件 [英] Generate JavaDocs with Android Gradle plugin

查看:132
本文介绍了生成的JavaDoc与Android摇篮插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何生成JavaDoc中使用新的摇篮构建系统的Andr​​oid项目?

How can I generate JavaDocs for an Android project using the new Gradle build system?

下面是我想出了,但它不能正常工作。

Here is what I have come up with but it doesn't work.

task generateJavadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    ext.cp = android.libraryVariants.collect { variant ->
        variant.javaCompile.classpath.files
    }
    classpath = files(ext.cp) 
}

主要的问题是,我没有得到相应的android.jar在classpath所以有的JavaDoc中的链接都没有解决。我必须找到一种方式来获得的类路径上所有必要的罐子。

The main problem is that I do not get the appropriate android.jar on the classpath so some of the links in the JavaDocs are not resolved. I have to find a way to get all the necessary jars on the classpath.

与我接过它是在方法的另一个问题收集类路径的所有版本的变种,而不是选择之一。

Another problem with the approach I took is it collects the classpaths for all the build variants, rather than selecting one.

推荐答案

我最终解决的是如下解决办法:

The solution I ended up settling on is as follows:

android.libraryVariants.all { variant ->

    task("generate${variant.name}Javadoc", type: Javadoc) {
        description "Generates Javadoc for $variant.name."
        source = variant.javaCompile.source
        ext.androidJar = "${android.plugin.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
        classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
    }

}

泽维尔Ducrohet确认这是办法做到这一点(与警告)在ADT-dev的组,<一个href="https://groups.google.com/forum/#!searchin/adt-dev/javadoc/adt-dev/seRizEn8ICA/bafEvUl6mzsJ">https://groups.google.com/forum/#!searchin/adt-dev/javadoc/adt-dev/seRizEn8ICA/bafEvUl6mzsJ.

这篇关于生成的JavaDoc与Android摇篮插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆