From 23722210113e1bebf57614f124b1af9babaeb6ae Mon Sep 17 00:00:00 2001 From: hotchemi Date: Thu, 12 Jul 2018 01:35:38 +0900 Subject: [PATCH] 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. --- annotation/build.gradle | 5 +++++ build.gradle | 3 +-- gradle.properties | 1 + library/build.gradle | 33 +++++++++++++++++++++++++-------- processor/build.gradle | 1 + 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/annotation/build.gradle b/annotation/build.gradle index 9e5f54dc..fe47175e 100644 --- a/annotation/build.gradle +++ b/annotation/build.gradle @@ -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 @@ -33,6 +36,8 @@ bintray { user = bintrayUser key = bintrayKey dryRun = dryRun + publish = true + pkg { repo = REPO userOrg = USER diff --git a/build.gradle b/build.gradle index efa3bbbe..d46e8f54 100644 --- a/build.gradle +++ b/build.gradle @@ -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" } } diff --git a/gradle.properties b/gradle.properties index 4ea15dfc..d9f3cf79 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/library/build.gradle b/library/build.gradle index 69274d7c..35b6fab6 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -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 @@ -42,10 +42,11 @@ dependencies { } bintray { - configurations = ['archives'] + publications = ['MyPublication'] user = bintrayUser key = bintrayKey dryRun = dryRun + publish = true pkg { repo = REPO @@ -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 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) + } + } + } } } } diff --git a/processor/build.gradle b/processor/build.gradle index a0c89f6b..cd124f54 100644 --- a/processor/build.gradle +++ b/processor/build.gradle @@ -59,6 +59,7 @@ bintray { user = bintrayUser key = bintrayKey dryRun = dryRun + publish = true pkg { repo = REPO