1717apply plugin : ' signing'
1818apply plugin : ' maven-publish'
1919
20- version = project. ext. VERSION_NAME
21-
2220def isReleaseBuild () {
2321 return VERSION_NAME . contains(" SNAPSHOT" ) == false
2422}
@@ -42,25 +40,15 @@ def getRepositoryPassword() {
4240}
4341
4442afterEvaluate { project ->
45- task androidSourcesJar(type : Jar ) {
46- classifier = ' sources'
47- from android. sourceSets. main. java. source
48- }
49-
50-
5143 publishing {
5244 publications {
5345 library(MavenPublication ) {
5446 groupId POM_GROUP
5547 artifactId POM_ARTIFACT_ID
5648 version VERSION_NAME
5749
58- artifact(" ${ buildDir} /outputs/aar/${ artifactId} -release.aar" )
59- if (project. getPlugins(). hasPlugin(' com.android.application' ) ||
60- project. getPlugins(). hasPlugin(' com.android.library' )) {
61- artifact(androidSourcesJar)
62- } else {
63- artifact(sourcesJar)
50+ afterEvaluate {
51+ from(components[" release" ])
6452 }
6553
6654 pom {
@@ -90,35 +78,6 @@ afterEvaluate { project ->
9078 roles = [" developer" ]
9179 }
9280 }
93-
94- withXml {
95- def dependenciesNode = asNode(). appendNode(' dependencies' )
96-
97- def apiDependencies = configurations. api. allDependencies
98-
99- // Dependency may exist in both api and implementation block.
100- // Prioritize as api over implementation.
101- def implementationDependencies =
102- configurations. implementation. allDependencies. findAll {
103- ! apiDependencies. contains(it)
104- }
105-
106- apiDependencies. each {
107- def dependencyNode = dependenciesNode. appendNode(' dependency' )
108- dependencyNode. appendNode(' groupId' , it. group)
109- dependencyNode. appendNode(' artifactId' , it. name)
110- dependencyNode. appendNode(' version' , it. version)
111- dependencyNode. appendNode(' scope' , " compile" )
112- }
113-
114- implementationDependencies. each {
115- def dependencyNode = dependenciesNode. appendNode(' dependency' )
116- dependencyNode. appendNode(' groupId' , it. group)
117- dependencyNode. appendNode(' artifactId' , it. name)
118- dependencyNode. appendNode(' version' , it. version)
119- dependencyNode. appendNode(' scope' , " runtime" )
120- }
121- }
12281 }
12382 }
12483 }
0 commit comments