Skip to content

Commit

Permalink
Merge pull request #30 from manas-chaudhari/publish
Browse files Browse the repository at this point in the history
Add script to publish library
  • Loading branch information
manas-chaudhari authored Aug 3, 2016
2 parents 358d59e + 1ca992a commit 0258923
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 0 deletions.
2 changes: 2 additions & 0 deletions android-mvvm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions gradle/bintray-push.gradle
Original file line number Diff line number Diff line change
@@ -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 = '[email protected]'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}

apply from: rootProject.file('gradle/bintray/install.gradle')
apply from: rootProject.file('gradle/bintray/bintray.gradle')
57 changes: 57 additions & 0 deletions gradle/bintray/bintray.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
}
}
}
43 changes: 43 additions & 0 deletions gradle/bintray/install.gradle
Original file line number Diff line number Diff line change
@@ -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

}
}
}
}
}

0 comments on commit 0258923

Please sign in to comment.