Skip to content

Instantly share code, notes, and snippets.

@AfzalivE
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AfzalivE/7ae1ae00459724b36464 to your computer and use it in GitHub Desktop.
Save AfzalivE/7ae1ae00459724b36464 to your computer and use it in GitHub Desktop.
Bintray publishing
group = com.afzaln
baseName = fab
pkgName = FloatingActionButton
description = FloationActionButton implementation forked from Clans, has automatic quick return on scroll
siteUrl = https://github.com/afzalive/FloatingActionButton
issuesUrl = https://github.com/afzalive/FloatingActionButton/issues
gitUrl = https://github.com/afzalive/FloatingActionButton.git
licenceName = Apache License Version 2.0
licenceUrl = http://www.apache.org/licenses/LICENSE-2.0.txt
licenceDistribution = repo
pkgPackaging = aar
developerId = your-username
developerName = Your Name
developerEmail = someemail@emailservice.com
publishJavadoc = true
publishSources = true
publishDownloadNumbers = true
// call this in your module's build.gradle file
apply from: 'gradle-mvn-push.gradle'
/*
* Copyright 2013 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
def Properties bintrayProps = new Properties()
File bintrayProperties = file('bintray.properties')
if (bintrayProperties.exists()) {
bintrayProps.load(new FileInputStream(bintrayProperties))
}
group = bintrayProps['group']
project.archivesBaseName = bintrayProps['baseName']
project.version = VERSION_NAME
def pkgName = bintrayProps['pkgName']
def description = bintrayProps['description']
def siteUrl = bintrayProps['siteUrl'] // Homepage URL of the library
def gitUrl = bintrayProps['gitUrl'] // Git repository URL
def issuesUrl = bintrayProps['issuesUrl']
def licenceName = bintrayProps['licenceName']
def licenceUrl = bintrayProps['licenceUrl']
def licenceDistribution = bintrayProps['licenceDistribution']
def pkgPackaging = bintrayProps['pkgPackaging']
def developerId = bintrayProps['developerId']
def developerName = bintrayProps['developerName']
def developerEmail = bintrayProps['developerEmail']
def developerOrg = bintrayProps['developerOrg']
def publishJavadoc = bintrayProps['publishJavadoc']
def publishSources = bintrayProps['publishSources']
def publishDownloadNumbers = bintrayProps['publishDownloadNumbers']
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
destinationDir = new File("../javadoc")
options {
links "http://docs.oracle.com/javase/7/docs/api/"
linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference"
noTimestamp true
}
exclude '**/BuildConfig.java'
exclude '**/R.java'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
if (publishJavadoc) {
archives javadocJar
}
if (publishSources) {
archives sourcesJar
}
}
def pomConfig = {
licenses {
license {
name licenceName
url licenceUrl
distribution licenceDistribution
}
}
developers {
developer {
id developerId
name developerName
if (developerEmail) {
email developerEmail
}
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId project.archivesBaseName
version project.version
pom {
packaging pkgPackaging
}
pom.withXml {
def root = asNode()
root.appendNode('description', description)
root.children().last() + pomConfig
}
}
}
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties['bintray.user']
key = properties['bintray.apikey']
configurations = ['archives']
publications = ['mavenJava']
// dryRun = true
publish = true
pkg {
repo = "maven"
if (developerOrg) {
userOrg = developerOrg
}
name = pkgName
desc = description
websiteUrl = siteUrl
vcsUrl = gitUrl
issueTrackerUrl = issuesUrl
publicDownloadNumbers = publishDownloadNumbers
version {
name = project.version
vcsTag = project.version
}
}
}
# add these lines to your local.properties, usually you don't commit this file to git
bintray.user=YOUR_USERNAME
bintray.apikey=YOUR_BINTRAY_API_KEY
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
// version 1.1.1 has a bug which doesn't allow you to call getBootClasspath in gradle-mvn-push.gradle
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
project.ext.VERSION_CODE = 1
project.ext.VERSION_NAME = "1.4.1"
repositories {
jcenter()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment