Skip to content

Commit

Permalink
refactors publish gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickfav committed Feb 5, 2017
1 parent fe44aff commit c42c0ae
Showing 1 changed file with 46 additions and 34 deletions.
80 changes: 46 additions & 34 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,47 @@ apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

def final publishConfig = [
name : 'Plan B',
group : 'at.favre.lib',
siteUrl : 'https://github.com/patrickfav/planb-android',
gitUrl : 'https://github.com/patrickfav/planb-android.git',
issueTrackerUrl : 'https://github.com/patrickfav/planb-android/issues',
githubRepo : 'patrickfav/planb-android',

descriptionText : 'A crash recovery library for Android. It allows tracking and handling crashes with different rules for debugging and production.',

syncWithMavenCentral: true,
uploadDryRun : true,
uploadAutoPublish : true,
uploadOverride : true,

pomDevId : 'pfavre',
pomDevName : 'Patrick Favre-Bulle',
pomDevMail : '[email protected]',

licenseName : 'The Apache Software License, Version 2.0',
licenseBintray : 'Apache-2.0',
licenseUrl : 'http://www.apache.org/licenses/LICENSE-2.0.txt',

bintrayLabels : ['android', 'crash', 'crash-reporting', 'crash-recovery', 'android-library']
name : 'Plan B',
group : 'at.favre.lib',
version : rootProject.ext.versionNameLib,
descriptionText : 'A crash recovery library for Android. It allows tracking and handling crashes with different rules for debugging and production.',
inceptionYear : '2016',
siteUrl : 'https://github.com/patrickfav/planb-android',
gitUrl : 'https://github.com/patrickfav/planb-android.git',
issueTrackerUrl : 'https://github.com/patrickfav/planb-android/issues',
issueTrackerName : 'Github',
githubRepo : 'patrickfav/planb-android',

pomDevId : 'pfavre',
pomDevName : 'Patrick Favre-Bulle',
pomDevMail : '[email protected]',

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

bintrayLabels : ['android', 'crash', 'crash-reporting', 'crash-recovery', 'android-library'],

bintrayUploadDryRun : false, //Whether to only mock uploading
bintrayUploadAutoPublish: true, //Whether version should be auto published after an upload
bintrayUploadOverride : true, //[Default: false] Whether to override version artifacts already published
bintrayPubDlNumbers : true, //Whether to show public dl stats in bintray
bintraySyncMavenCentral : false
]

install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
version rootProject.ext.versionNameLib
version publishConfig.version
project {
name publishConfig.name
group publishConfig.group
groupId publishConfig.group
packaging 'aar'
description publishConfig.descriptionText
url publishConfig.siteUrl
inceptionYear publishConfig.inceptionYear

// Set your license
licenses {
license {
name publishConfig.licenseName
Expand All @@ -58,6 +61,11 @@ install {
developerConnection publishConfig.gitUrl
url publishConfig.siteUrl
}

issueManagement {
system publishConfig.issueTrackerName
url publishConfig.issueTrackerUrl
}
}
}
}
Expand Down Expand Up @@ -94,29 +102,33 @@ bintray {

configurations = ['archives']

dryRun = publishConfig.uploadDryRun
publish = publishConfig.uploadAutoPublish
dryRun = publishConfig.bintrayUploadDryRun
publish = publishConfig.bintrayUploadAutoPublish
//Whether version should be auto published after an upload
override = publishConfig.uploadOverride
override = publishConfig.bintrayUploadOverride
//[Default: false] Whether to override version artifacts already published

pkg {
repo = "maven"
// it is the name that appears in bintray when logged
name = project.buildDir.getParentFile().name
group publishConfig.group

desc = publishConfig.descriptionText
issueTrackerUrl = publishConfig.issueTrackerUrl
websiteUrl = publishConfig.siteUrl
vcsUrl = publishConfig.gitUrl
licenses = [publishConfig.licenseBintray]

licenses = publishConfig.licenseBintray

githubRepo = publishConfig.githubRepo
githubReleaseNotesFile = 'CHANGELOG'
labels = publishConfig.bintrayLabels
publicDownloadNumbers = publishConfig.bintrayPubDlNumbers

version {

name = rootProject.ext.versionNameLib
vcsTag = rootProject.ext.versionNameLib
name = publishConfig.version
vcsTag = publishConfig.version
released = new Date()

gpg {
Expand All @@ -125,7 +137,7 @@ bintray {
}

mavenCentralSync {
sync = publishConfig.syncWithMavenCentral
sync = publishConfig.bintraySyncMavenCentral
//Optional (true by default). Determines whether to sync the version to Maven Central.
user = properties.getProperty("bintray.oss.user") //OSS user token
password = properties.getProperty("bintray.oss.password") //OSS user password
Expand Down

0 comments on commit c42c0ae

Please sign in to comment.