Skip to content

Commit

Permalink
Bintray publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentuso committed Dec 1, 2015
1 parent 8b77fd1 commit 0188bb7
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 26 deletions.
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1"
}
}

Expand Down
21 changes: 20 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,23 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
GROUP=com.tusoapps
VERSION_NAME=0.1.0
VERSION_CODE=1

LIBRARY_PACKAGING=aar
LIBRARY_NAME=welcome
LIBRARY_ARTIFACT_ID=welcome
LIBRARY_URL=https://github.com/stephentuso/welcome-android
LIBRARY_DESCRIPTION=A customizable welcome screen for Android
LIBRARY_VCS_URL=https://github.com/stephentuso/welcome-android.git
LIBRARY_VCS_CONNECTION=scm:git@github.com:stephentuso/welcome-android.git
LIBRARY_VCS_DEV_CONNECTION=scm:git@github.com:stephentuso/welcome-android.git
BINTRAY_LICENSE=Apache-2.0
LIBRARY_LICENSE_NAME=The Apache Software License, Version 2.0
LIBRARY_LICENSE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
LIBRARY_LICENSE_DIST=repo
DEVELOPER_ID=stephentuso
DEVELOPER_NAME=Stephen Tuso
DEVELOPER_EMAIL=stephen@tusoapps.com
115 changes: 115 additions & 0 deletions gradle/bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
// Based on https://github.com/msdx/gradle-publish
group = GROUP
version = VERSION_NAME
project.archivesBaseName = LIBRARY_ARTIFACT_ID

apply plugin: 'com.jfrog.bintray'
apply plugin: "com.jfrog.artifactory"
apply plugin: 'maven-publish'

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += configurations.compile
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

javadoc {
options{
encoding "UTF-8"
charSet 'UTF-8'
author true
version true
links "http://docs.oracle.com/javase/7/docs/api"
title LIBRARY_ARTIFACT_ID
}
}


def pomConfig = {
licenses {
license {
name LIBRARY_LICENSE_NAME
url LIBRARY_LICENSE_URL
distribution LIBRARY_LICENSE_DIST
}
}
developers {
developer {
id DEVELOPER_ID
name DEVELOPER_NAME
email DEVELOPER_EMAIL
}
}
}

publishing {
publications {
mavenJava(MavenPublication) {
artifactId LIBRARY_ARTIFACT_ID
artifact javadocJar
artifact sourcesJar

pom{
packaging 'aar'
}
pom.withXml {
def root = asNode()
root.appendNode('description', LIBRARY_DESCRIPTION)
root.children().last() + pomConfig
}
}
}
}

afterEvaluate {
publishing.publications.mavenJava.artifact(bundleRelease)
}

bintray {
user = BINTRAY_USER
key = BINTRAY_API_KEY

publications = ['mavenJava']
publish = true

pkg {
repo = 'maven'
name = LIBRARY_NAME
desc = LIBRARY_DESCRIPTION
websiteUrl = LIBRARY_URL
vcsUrl = LIBRARY_VCS_URL
licenses = [BINTRAY_LICENSE]
publicDownloadNumbers = true
}
}

artifactory {
contextUrl = 'http://oss.jfrog.org/artifactory'
resolve {
repository {
repoKey = 'libs-release'
}
}
publish {
repository {
repoKey = 'oss-snapshot-local' //The Artifactory repository key to publish to
username = bintray.user
password = bintray.key
maven = true
}
defaults {
publications('mavenJava')
publishArtifacts = true
}
}
}
26 changes: 4 additions & 22 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ android {
defaultConfig {
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "0.0.8"
versionCode Integer.parseInt(VERSION_CODE)
versionName VERSION_NAME
}

buildTypes {
release {
minifyEnabled false
Expand All @@ -25,23 +26,4 @@ dependencies {
compile 'com.android.support:preference-v7:23.1.0'
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.getDestinationDir()
}

artifacts {
archives sourcesJar
archives javadocJar
}
apply from: '../gradle/bintray.gradle'

0 comments on commit 0188bb7

Please sign in to comment.