From 6d4b8e533089ab315a6970dbbb86a6c811acf30f Mon Sep 17 00:00:00 2001 From: Manas Chaudhari Date: Fri, 29 Jul 2016 11:19:59 +0530 Subject: [PATCH 1/2] Add bintray plugin for publishing --- android-mvvm/build.gradle | 2 ++ build.gradle | 2 ++ gradle/bintray-push.gradle | 27 +++++++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 gradle/bintray-push.gradle diff --git a/android-mvvm/build.gradle b/android-mvvm/build.gradle index 62bcd37..131e81d 100644 --- a/android-mvvm/build.gradle +++ b/android-mvvm/build.gradle @@ -68,3 +68,5 @@ dependencies { compile 'com.android.support:recyclerview-v7:24.0.0' compile 'com.android.support:appcompat-v7:24.0.0' } + +apply from: rootProject.file('gradle/bintray-push.gradle') \ No newline at end of file diff --git a/build.gradle b/build.gradle index 03bced9..9ca9021 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,8 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:2.1.0' + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/bintray-push.gradle b/gradle/bintray-push.gradle new file mode 100644 index 0000000..df1d7b1 --- /dev/null +++ b/gradle/bintray-push.gradle @@ -0,0 +1,27 @@ + +ext { + bintrayRepo = 'maven' + bintrayName = 'android-mvvm' + + publishedGroupId = 'com.manaschaudhari' + libraryName = 'Android MVVM' + artifact = 'android-mvvm' + + libraryDescription = 'Tools for implementing MVVM on Android' + + siteUrl = 'https://github.com/manas-chaudhari/android-mvvm' + gitUrl = 'https://github.com/manas-chaudhari/android-mvvm.git' + + libraryVersion = '0.1.0' + + developerId = 'manas-chaudhari' + developerName = 'Manas Chaudhari' + developerEmail = 'chaudhari.manas@gmail.com' + + licenseName = 'The Apache Software License, Version 2.0' + licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + allLicenses = ["Apache-2.0"] +} + +apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle' +apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle' \ No newline at end of file From 1ca992a02051c54ab60d510197da3c75461c9a1d Mon Sep 17 00:00:00 2001 From: Manas Chaudhari Date: Wed, 3 Aug 2016 19:13:53 +0530 Subject: [PATCH 2/2] Use local gradle files for bintray config --- gradle/bintray-push.gradle | 4 +-- gradle/bintray/bintray.gradle | 57 +++++++++++++++++++++++++++++++++++ gradle/bintray/install.gradle | 43 ++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 gradle/bintray/bintray.gradle create mode 100644 gradle/bintray/install.gradle diff --git a/gradle/bintray-push.gradle b/gradle/bintray-push.gradle index df1d7b1..3cb97f0 100644 --- a/gradle/bintray-push.gradle +++ b/gradle/bintray-push.gradle @@ -23,5 +23,5 @@ ext { allLicenses = ["Apache-2.0"] } -apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle' -apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle' \ No newline at end of file +apply from: rootProject.file('gradle/bintray/install.gradle') +apply from: rootProject.file('gradle/bintray/bintray.gradle') \ No newline at end of file diff --git a/gradle/bintray/bintray.gradle b/gradle/bintray/bintray.gradle new file mode 100644 index 0000000..2c931c0 --- /dev/null +++ b/gradle/bintray/bintray.gradle @@ -0,0 +1,57 @@ +// Source: https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle +apply plugin: 'com.jfrog.bintray' + +version = libraryVersion + +if (project.hasProperty("android")) { // Android libraries + task sourcesJar(type: Jar) { + classifier = 'sources' + from android.sourceSets.main.java.srcDirs + } + + task javadoc(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + } +} else { // Java libraries + task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource + } +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives javadocJar + archives sourcesJar +} + +// Bintray +bintray { + user = hasProperty('bintrayUser') ? bintrayUser : "" + key = hasProperty('bintrayKey') ? bintrayKey : "" + + configurations = ['archives'] + pkg { + repo = bintrayRepo + name = bintrayName + desc = libraryDescription + websiteUrl = siteUrl + vcsUrl = gitUrl + licenses = allLicenses + publish = true + publicDownloadNumbers = true + version { + desc = libraryDescription + gpg { + sign = true //Determines whether to GPG sign the files. The default is false + passphrase = hasProperty('bintrayGpgPassword') ? bintrayGpgPassword : "" + //Optional. The passphrase for GPG signing' + } + } + } +} diff --git a/gradle/bintray/install.gradle b/gradle/bintray/install.gradle new file mode 100644 index 0000000..b6803a3 --- /dev/null +++ b/gradle/bintray/install.gradle @@ -0,0 +1,43 @@ +//Source; https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle +apply plugin: 'com.github.dcendents.android-maven' + +group = publishedGroupId // Maven Group ID for the artifact + +install { + repositories.mavenInstaller { + // This generates POM.xml with proper parameters + pom { + project { + packaging 'aar' + groupId publishedGroupId + artifactId artifact + + // Add your description here + name libraryName + description libraryDescription + url siteUrl + + // Set your license + licenses { + license { + name licenseName + url licenseUrl + } + } + developers { + developer { + id developerId + name developerName + email developerEmail + } + } + scm { + connection gitUrl + developerConnection gitUrl + url siteUrl + + } + } + } + } +}