1515 */
1616
1717plugins {
18- id ' com.github.dcendents.android-maven ' version ' 2.0 '
19- id ' com.jfrog.bintray ' version ' 1.8.0 '
18+ id ' com.jfrog.bintray ' version ' 1.8.4 '
19+ id ' maven-publish '
2020}
2121
2222def localPropertiesFile = rootProject. file(' local.properties' )
@@ -64,26 +64,92 @@ dependencies {
6464group = ' saschpe.android'
6565version = android. defaultConfig. versionName
6666
67- ext {
68- siteUrl = ' https://github.com/saschpe/android-exoplayer2-ext-icy'
69- gitUrl = ' https://github.com/saschpe/android-exoplayer2-ext-icy.git'
70- descr = ' ExoPlayer2 Shoutcast Metadata Protocol (ICY) extension.'
67+ task androidJavadocs (type : Javadoc ) {
68+ source = android. sourceSets. main. java. srcDirs
69+ classpath + = project. files(android. getBootClasspath(). join(File . pathSeparator))
70+ android. libraryVariants. all { variant ->
71+ if (variant. name == ' release' ) {
72+ owner. classpath + = variant. javaCompile. classpath
73+ }
74+ }
75+ exclude ' **/R.html' , ' **/R.*.html' , ' **/index.html'
76+ }
77+
78+ task androidJavadocsJar (type : Jar , dependsOn : androidJavadocs) {
79+ classifier = ' javadoc'
80+ from androidJavadocs. destinationDir
81+ }
82+
83+ task androidSourcesJar (type : Jar ) {
84+ classifier = ' sources'
85+ from android. sourceSets. main. java. srcDirs
86+ }
87+
88+ afterEvaluate { // https://groups.google.com/forum/#!topic/adt-dev/kzbEHAGbFVg
89+ publishing. publications {
90+ mavenAndroid(MavenPublication ) {
91+ groupId
92+ artifactId project. name
93+ version this . version
94+
95+ artifact bundleReleaseAar
96+ artifact androidJavadocsJar
97+ artifact androidSourcesJar
98+
99+ pom. withXml {
100+ final dependenciesNode = asNode(). appendNode(' dependencies' )
101+
102+ ext. addDependency = { Dependency dep , String scope ->
103+ if (dep. group == null || dep. version == null || dep. name == null || dep. name == " unspecified" )
104+ return // ignore invalid dependencies
105+
106+ final dependencyNode = dependenciesNode. appendNode(' dependency' )
107+ dependencyNode. appendNode(' groupId' , dep. group)
108+ dependencyNode. appendNode(' artifactId' , dep. name)
109+ dependencyNode. appendNode(' version' , dep. version)
110+ dependencyNode. appendNode(' scope' , scope)
111+
112+ if (! dep. transitive) {
113+ // If this dependency is transitive, we should force exclude all its dependencies them from the POM
114+ final exclusionNode = dependencyNode. appendNode(' exclusions' ). appendNode(' exclusion' )
115+ exclusionNode. appendNode(' groupId' , ' *' )
116+ exclusionNode. appendNode(' artifactId' , ' *' )
117+ } else if (! dep. properties. excludeRules. empty) {
118+ // Otherwise add specified exclude rules
119+ final exclusionNode = dependencyNode. appendNode(' exclusions' ). appendNode(' exclusion' )
120+ dep. properties. excludeRules. each { ExcludeRule rule ->
121+ exclusionNode. appendNode(' groupId' , rule. group ?: ' *' )
122+ exclusionNode. appendNode(' artifactId' , rule. module ?: ' *' )
123+ }
124+ }
125+ }
126+
127+ // List all "compile" dependencies (for old Gradle)
128+ configurations. compile. getAllDependencies(). each { dep -> addDependency(dep, " compile" ) }
129+ // List all "api" dependencies (for new Gradle) as "compile" dependencies
130+ configurations. api. getAllDependencies(). each { dep -> addDependency(dep, " compile" ) }
131+ // List all "implementation" dependencies (for new Gradle) as "runtime" dependencies
132+ configurations. implementation. getAllDependencies(). each { dep -> addDependency(dep, " runtime" ) }
133+ }
134+ }
135+ }
71136}
72137
73138bintray {
74139 user = project. properties[" bintray.user" ]
75140 key = project. properties[" bintray.apikey" ]
76-
77- configurations = [' archives' ] // When uploading configuration files
141+ publications = [' mavenAndroid' ]
142+ configurations = [' archives' ]
143+ override = true
78144 pkg {
79145 repo = ' maven'
80146 name = ' android-exoplayer2-ext-icy'
81147 userOrg = ' saschpe'
82- websiteUrl = siteUrl
148+ websiteUrl = ' https://github.com/saschpe/android-exoplayer2-ext-icy '
83149 issueTrackerUrl = ' https://github.com/saschpe/android-exoplayer2-ext-icy/issues'
84- vcsUrl = gitUrl
150+ vcsUrl = ' https://github.com/saschpe/android-exoplayer2-ext-icy.git '
85151 licenses = [' Apache-2.0' ]
86- desc = descr
152+ desc = ' ExoPlayer2 Shoutcast Metadata Protocol (ICY) extension. '
87153 labels = [' aar' , ' android' ]
88154 publish = true
89155 publicDownloadNumbers = true
@@ -92,65 +158,13 @@ bintray {
92158 githubReleaseNotesFile = ' README.md'
93159
94160 version {
95- name = android. defaultConfig. versionName
96- desc = descr
161+ name = this . version
162+ desc = " ${ project.name} ${ this.version} "
163+ released = new Date ()
164+ vcsTag = this . version
97165 gpg {
98166 sign = true
99167 }
100168 }
101169 }
102- }
103-
104- task createPom {
105- pom {
106- project {
107- packaging ' aar'
108-
109- name project. name
110- description descr
111- url siteUrl
112- inceptionYear ' 2018'
113-
114- licenses {
115- license {
116- name ' The Apache Software License, Version 2.0'
117- url ' http://www.apache.org/licenses/LICENSE-2.0.txt'
118- }
119- }
120- scm {
121- connection gitUrl
122- developerConnection gitUrl
123- url siteUrl
124- }
125- developers {
126- developer {
127- id ' saschpe'
128- name ' Sascha Peilicke'
129- email ' sascha@peilicke.de'
130- }
131- }
132- }
133- }. writeTo(" $buildDir /poms/pom-default.xml" ). writeTo(" pom.xml" )
134- }
135- build. dependsOn createPom
136-
137- task sourcesJar (type : Jar ) {
138- from android. sourceSets. main. java. srcDirs
139- classifier = ' sources'
140- }
141-
142- task javadoc (type : Javadoc ) {
143- source = android. sourceSets. main. java. srcDirs
144- classpath + = project. files(android. getBootClasspath(). join(File . pathSeparator))
145- failOnError false
146- }
147-
148- task javadocJar (type : Jar , dependsOn : javadoc) {
149- classifier = ' javadoc'
150- from javadoc. destinationDir
151- }
152-
153- artifacts {
154- archives javadocJar
155- archives sourcesJar
156- }
170+ }
0 commit comments