How to generate source.jar of the public API of a closed source AAR?

送分小仙女□ 提交于 2020-05-14 01:50:07

问题


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.*

Is this possible with gradle 3.4?

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


回答1:


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/**'
}


来源:https://stackoverflow.com/questions/54343786/how-to-generate-source-jar-of-the-public-api-of-a-closed-source-aar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!