Skip to content

Commit 2372221

Browse files
hotchemihotchemi
authored andcommitted
Tweak publishing codes.
- Specify annotation module info explicitly due to library module. - Fix the way of publishing aar and remove dcendents:android-maven-gradle-plugin.
1 parent 92540b7 commit 2372221

File tree

5 files changed

+33
-10
lines changed

5 files changed

+33
-10
lines changed

annotation/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ apply plugin: 'java-library'
22
apply plugin: 'maven-publish'
33
apply plugin: 'com.jfrog.bintray'
44

5+
group = GROUP_ID
6+
version = VERSION
7+
58
targetCompatibility = JavaVersion.VERSION_1_6
69
sourceCompatibility = JavaVersion.VERSION_1_6
710

@@ -33,6 +36,8 @@ bintray {
3336
user = bintrayUser
3437
key = bintrayKey
3538
dryRun = dryRun
39+
publish = true
40+
3641
pkg {
3742
repo = REPO
3843
userOrg = USER

build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ buildscript {
99
dependencies {
1010
classpath "com.android.tools.build:gradle:$GRADLE_PLUGIN_VERSION"
1111
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
12-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.3'
13-
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
12+
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$BINTRAY_PLUGIN_VERSION"
1413
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:$JFROG_PLUGIN_VERSION"
1514
}
1615
}

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ GRADLE_PLUGIN_VERSION = 3.2.0-beta01
1818
KOTLIN_VERSION = 1.2.50
1919
CONFIG_PLUGIN_VERSION = 2.2.2
2020
JFROG_PLUGIN_VERSION = 4.1.1
21+
BINTRAY_PLUGIN_VERSION = 1.8.4
2122
SUPPORT_LIBRARY_VERSION = 27.0.2
2223
ANDROIDX_LIBRARY_VERSION= 1.0.0-alpha3
2324
JAVAPOET_VERSION = 1.9.0

library/build.gradle

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ group = GROUP_ID
22
version = VERSION
33

44
apply plugin: 'com.android.library'
5+
apply plugin: 'maven-publish'
56
apply plugin: 'com.jfrog.bintray'
6-
apply plugin: 'com.github.dcendents.android-maven'
77

88
android {
99
compileSdkVersion COMPILE_SDK_VERSION
@@ -42,10 +42,11 @@ dependencies {
4242
}
4343

4444
bintray {
45-
configurations = ['archives']
45+
publications = ['MyPublication']
4646
user = bintrayUser
4747
key = bintrayKey
4848
dryRun = dryRun
49+
publish = true
4950

5051
pkg {
5152
repo = REPO
@@ -61,15 +62,31 @@ bintray {
6162
}
6263
}
6364

64-
install {
65-
repositories.mavenInstaller {
66-
pom.project {
67-
packaging 'aar'
68-
name ARTIFACT_ID_LIBRARY
65+
publishing {
66+
publications {
67+
MyPublication(MavenPublication) {
68+
artifact sourcesJar
69+
artifact javadocJar
70+
artifact "$buildDir/outputs/aar/library-release.aar"
6971
groupId GROUP_ID
7072
artifactId ARTIFACT_ID_LIBRARY
7173
version VERSION
72-
url WEBSITE
74+
75+
pom.withXml {
76+
def dependenciesNode = asNode().appendNode('dependencies')
77+
// Iterate over the compile dependencies, adding a <dependency> node for each
78+
configurations.implementation.allDependencies.each {
79+
if (it.group != null && it.name != null && it.version != null) {
80+
def dependencyNode = dependenciesNode.appendNode('dependency')
81+
dependencyNode.appendNode('groupId', it.group)
82+
// to change annotation module artifactId explicitly
83+
// ref: https://github.com/dcendents/android-maven-gradle-plugin/issues/9#issuecomment-73550293
84+
def artifactId = (it.group == GROUP_ID && it.name == "annotation") ? ARTIFACT_ID_ANNOTATION : it.name
85+
dependencyNode.appendNode('artifactId', artifactId)
86+
dependencyNode.appendNode('version', it.version)
87+
}
88+
}
89+
}
7390
}
7491
}
7592
}

processor/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ bintray {
5959
user = bintrayUser
6060
key = bintrayKey
6161
dryRun = dryRun
62+
publish = true
6263

6364
pkg {
6465
repo = REPO

0 commit comments

Comments
 (0)