File tree Expand file tree Collapse file tree 1 file changed +11
-23
lines changed
Expand file tree Collapse file tree 1 file changed +11
-23
lines changed Original file line number Diff line number Diff line change @@ -4,35 +4,23 @@ apply plugin: "maven-publish"
44apply plugin : " signing"
55group = rootProject. group
66version = rootProject. version
7- task androidJavadocs (type : Javadoc ) {
8- // 设置源码所在的位置
9- source = android. sourceSets. main. java. srcDirs
10- }
11-
12- // 将文档打包成jar,生成javadoc.jar
13- task androidJavadocsJar (type : Jar ) {
14- // 指定文档名称
15- archiveClassifier. set(' javadoc' )
16- from androidJavadocs. destinationDir
17- }
18-
19- // 将源码打包 ,生成sources.jar
20- task androidSourcesJar (type : Jar ) {
21- archiveClassifier. set(' sources' )
22- from android. sourceSets. main. java. srcDirs
23- }
24-
25- artifacts {
26- archives androidSourcesJar // 将源码打包进aar,这样使用方可以看到方法注释.
27- archives androidJavadocsJar // 将注释打包进aar
7+ task sourceJar (type : Jar ) {
8+ if (project. hasProperty(" kotlin" )) {
9+ from android. sourceSets. main. java. getSrcDirs()
10+ } else if (project. hasProperty(" android" )) {
11+ from android. sourceSets. main. java. sourceFiles
12+ } else {
13+ from sourceSets. main. allSource
14+ }
15+ archiveClassifier = ' sources'
2816}
29-
3017afterEvaluate {
3118 publishing {
3219 publications {
3320 mavenJava(MavenPublication ) {
21+ artifact sourceJar
3422 artifactId = PROJ_NAME
35- from components. release
23+ from( components. release)
3624 pom {
3725 packaging = " aar"
3826 name = PROJ_BASENAME
You can’t perform that action at this time.
0 commit comments