Skip to content

Commit

Permalink
Tweak publishing codes.
Browse files Browse the repository at this point in the history
- Specify annotation module info explicitly due to library module.
- Fix the way of publishing aar and remove dcendents:android-maven-gradle-plugin.
  • Loading branch information
hotchemi authored and hotchemi committed Jul 11, 2018
1 parent 92540b7 commit 2372221
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 10 deletions.
5 changes: 5 additions & 0 deletions annotation/build.gradle
Expand Up @@ -2,6 +2,9 @@ apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

group = GROUP_ID
version = VERSION

targetCompatibility = JavaVersion.VERSION_1_6
sourceCompatibility = JavaVersion.VERSION_1_6

Expand Down Expand Up @@ -33,6 +36,8 @@ bintray {
user = bintrayUser
key = bintrayKey
dryRun = dryRun
publish = true

pkg {
repo = REPO
userOrg = USER
Expand Down
3 changes: 1 addition & 2 deletions build.gradle
Expand Up @@ -9,8 +9,7 @@ buildscript {
dependencies {
classpath "com.android.tools.build:gradle:$GRADLE_PLUGIN_VERSION"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$BINTRAY_PLUGIN_VERSION"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:$JFROG_PLUGIN_VERSION"
}
}
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Expand Up @@ -18,6 +18,7 @@ GRADLE_PLUGIN_VERSION = 3.2.0-beta01
KOTLIN_VERSION = 1.2.50
CONFIG_PLUGIN_VERSION = 2.2.2
JFROG_PLUGIN_VERSION = 4.1.1
BINTRAY_PLUGIN_VERSION = 1.8.4
SUPPORT_LIBRARY_VERSION = 27.0.2
ANDROIDX_LIBRARY_VERSION= 1.0.0-alpha3
JAVAPOET_VERSION = 1.9.0
Expand Down
33 changes: 25 additions & 8 deletions library/build.gradle
Expand Up @@ -2,8 +2,8 @@ group = GROUP_ID
version = VERSION

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'

android {
compileSdkVersion COMPILE_SDK_VERSION
Expand Down Expand Up @@ -42,10 +42,11 @@ dependencies {
}

bintray {
configurations = ['archives']
publications = ['MyPublication']
user = bintrayUser
key = bintrayKey
dryRun = dryRun
publish = true

pkg {
repo = REPO
Expand All @@ -61,15 +62,31 @@ bintray {
}
}

install {
repositories.mavenInstaller {
pom.project {
packaging 'aar'
name ARTIFACT_ID_LIBRARY
publishing {
publications {
MyPublication(MavenPublication) {
artifact sourcesJar
artifact javadocJar
artifact "$buildDir/outputs/aar/library-release.aar"
groupId GROUP_ID
artifactId ARTIFACT_ID_LIBRARY
version VERSION
url WEBSITE

pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
// Iterate over the compile dependencies, adding a <dependency> node for each
configurations.implementation.allDependencies.each {
if (it.group != null && it.name != null && it.version != null) {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
// to change annotation module artifactId explicitly
// ref: https://github.com/dcendents/android-maven-gradle-plugin/issues/9#issuecomment-73550293
def artifactId = (it.group == GROUP_ID && it.name == "annotation") ? ARTIFACT_ID_ANNOTATION : it.name
dependencyNode.appendNode('artifactId', artifactId)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions processor/build.gradle
Expand Up @@ -59,6 +59,7 @@ bintray {
user = bintrayUser
key = bintrayKey
dryRun = dryRun
publish = true

pkg {
repo = REPO
Expand Down

0 comments on commit 2372221

Please sign in to comment.