File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ publishing {
1212 version getVersionName()
1313
1414 artifact(" $buildDir /outputs/aar/${ project.getName()} -release.aar" )
15+ if (gradle. startParameter. taskNames. any { it. contains(' publishToMavenLocal' ) }) {
16+ artifact sourcesJar
17+ artifact javadocJar
18+ }
1519
1620 // Self-explanatory metadata for the most part
1721 pom {
Original file line number Diff line number Diff line change @@ -51,6 +51,31 @@ dependencies {
5151 androidTestImplementation ' androidx.test.espresso:espresso-core:3.4.0'
5252 implementation " org.jetbrains.kotlin:kotlin-reflect:1.6.21"
5353}
54+ task sourcesJar (type : Jar ) {
55+ archiveClassifier. set(' sources' )
56+ from android. sourceSets. main. java. srcDirs
57+ }
58+
59+ task javadoc (type : Javadoc ) {
60+ configurations. implementation. setCanBeResolved(true )
61+
62+ failOnError false
63+ source = android. sourceSets. main. java. sourceFiles
64+ classpath + = project. files(android. getBootClasspath(). join(File . pathSeparator))
65+ classpath + = configurations. implementation
66+ }
67+
68+ // build a jar with javadoc
69+ task javadocJar (type : Jar , dependsOn : javadoc) {
70+ archiveClassifier. set(' javadoc' )
71+ from javadoc. destinationDir
72+ }
73+
74+ // Attach Javadocs and Sources jar
75+ artifacts {
76+ archives sourcesJar
77+ archives javadocJar
78+ }
5479
5580apply from : rootProject. file(' gradle/mvn-publish.gradle' )
5681tasks. named(" signReleasePublication" ) {
You can’t perform that action at this time.
0 commit comments