如何生成封闭源AAR的公共API的source.jar? [英] How to generate source.jar of the public API of a closed source AAR?

查看:345
本文介绍了如何生成封闭源AAR的公共API的source.jar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Kotlin中开发了一个封闭的资源库,该库以AAR的形式发布.不幸的是,我们的用户无法在IDE中看到KDoc(用于Kotlin的JavaDoc).因此,我们只想发布公共API的源代码.包foo.bar.api.*foo.bar.internal.*

We develop a closed sources library in Kotlin that is released as AAR. Unfortunatly our users can't see the KDoc (JavaDoc for Kotlin) in the IDE. Therefore we want to release the source of the public API only. The internals and the public API can be distingushed by there packages foo.bar.api.* and foo.bar.internal.*

gradle 3.4有可能吗?

Is this possible with gradle 3.4?

我找到了创建包含Javadoc和源代码的Android库AAR ,但我们不想包含所有来源.

I found Create Android library AAR including javadoc and sources but we don't want to include all sources.

推荐答案

让我们假设您已经知道如何创建和使用javadocsources工件.仅 Jar 类型创建一个特殊的zip存档并为其复制文件.因此,您也可以排除文件:

Let's assume you know already how to create and use the javadoc and sources artifacts. The Jar type only creates a special zip archive and copies the files for it. So you can exclude files as well:

task androidSourcesJar(type: Jar) {
    classifier = 'sources'
    baseName = artifact_id
    from android.sourceSets.main.java.srcDirs
    exclude 'foo./bar/internal/**'
}

这篇关于如何生成封闭源AAR的公共API的source.jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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