From 7c3729330f1ce4c254edddbb581f53671852d3c1 Mon Sep 17 00:00:00 2001 From: Jens Neuhalfen Date: Fri, 10 Feb 2017 23:28:17 +0100 Subject: [PATCH] Publish on bintray (and then jcenter) --- bintray.gradle | 89 +++++++++++++++++++++++++++++++++ build.gradle | 18 +++++-- examples/reencrypt/build.gradle | 2 +- gradle.properties.tpl | 4 +- jcenter.gradle | 66 ------------------------ settings.gradle | 1 + 6 files changed, 106 insertions(+), 74 deletions(-) create mode 100644 bintray.gradle delete mode 100644 jcenter.gradle create mode 100644 settings.gradle diff --git a/bintray.gradle b/bintray.gradle new file mode 100644 index 00000000..8d5267d2 --- /dev/null +++ b/bintray.gradle @@ -0,0 +1,89 @@ +def pomConfig = { + + scm { + connection 'scm:git:https://github.com/neuhalje/bouncy-gpg.git' + developerConnection 'scm:git:https://github.com/neuhalje/bouncy-gpg.git' + url 'https://github.com/neuhalje/bouncy-gpg/' + } + + licenses { + license { + name 'WTFPL' + url 'http://www.wtfpl.net/' + } + } + + developers { + developer { + id 'neuhalje' + name 'Jens Neuhalfen' + email 'neuhalje@neuhalfen.name' + } + } +} + +task javadocJar(type: Jar) { + classifier = 'javadoc' + from javadoc +} + +task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.main.allSource +} + +artifacts { + archives javadocJar, sourcesJar +} + +signing { + sign configurations.archives +} + +publishing { + publications { + maven(MavenPublication) { + from components.java + artifact sourcesJar + artifact javadocJar + groupId group + artifactId 'bouncy-gpg' + version property('version') + + pom.withXml { + def root = asNode() + root.appendNode('description', 'Make using Bouncy Castle with OpenPGP fun again!') + root.appendNode('name', 'bouncy-gpg') + root.appendNode('url', 'https://github.com/neuhalje/bouncy-gpg') + root.children().last() + pomConfig + } + } + } +} + +bintray { + user = property('bintray_Username') + key = property('bintray_Password') + + dryRun = false //[Default: false] Whether to run this as dry-run, without deploying + publish = true //[Default: false] Whether version should be auto published after an upload + override = false //[Default: false] Whether to override version artifacts already published + + pkg { + repo = 'maven' + name = 'bouncy-gpg' + licenses = ['WTFPL'] + vcsUrl = 'https://github.com/neuhalje/bouncy-gpg.git' + websiteUrl = 'https://github.com/neuhalje/bouncy-gpg' + labels = ['batch-job', 'bouncycastle', 'bouncy-castle', 'gpg', 'gnupg', 'security', 'encryption', 'decryption'] + + version { + name = property('version') + desc = 'Make using Bouncy Castle with OpenPGP fun again!' + released = new Date() + vcsTag = property('version') + } + } + + publications = ['maven'] +} diff --git a/build.gradle b/build.gradle index ae46d273..7204bea2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,18 +1,26 @@ +buildscript { + repositories { + jcenter() + } +} + plugins { id 'java' id 'jacoco' // deploy to maven central id 'maven' + id 'maven-publish' id 'signing' - + id "com.jfrog.bintray" version "1.7" } sourceCompatibility = 1.8 targetCompatibility = 1.8 -version = '2.0.0' +group= 'name.neuhalfen.projects.crypto.bouncycastle.openpgp' +version= '2.0.0' repositories { jcenter() @@ -54,11 +62,11 @@ jacocoTestReport { check.dependsOn jacocoTestReport -// JCenter deployment +// bintray deployment // configured in gradle.properties -if ( hasProperty('jcenter_Username')) { - apply from: 'jcenter.gradle' +if (hasProperty('bintray_Username')) { + apply from: 'bintray.gradle' } // Misc diff --git a/examples/reencrypt/build.gradle b/examples/reencrypt/build.gradle index 214ce5c6..d8b3ee28 100644 --- a/examples/reencrypt/build.gradle +++ b/examples/reencrypt/build.gradle @@ -27,7 +27,7 @@ dependencies { compile 'org.bouncycastle:bcprov-jdk15on:1.56' compile 'org.bouncycastle:bcpg-jdk15on:1.56' - compile 'name.neuhalfen.projects.crypto.bouncycastle.openpgp:Bouncy-gpg:2.+' + compile 'name.neuhalfen.projects.crypto.bouncycastle.openpgp:bouncy-gpg:2.+' compile 'org.slf4j:slf4j-api:1.7.22' compile 'ch.qos.logback:logback-classic:1.2.1' diff --git a/gradle.properties.tpl b/gradle.properties.tpl index 4bf41f38..b47b16e2 100644 --- a/gradle.properties.tpl +++ b/gradle.properties.tpl @@ -3,5 +3,5 @@ signing.keyId=YourKeyId signing.password=YourPublicKeyPassword signing.secretKeyRingFile=PathToYourKeyRingFile -jcenter_Username=your-jcenter-id -jcenter_Password=your-jcenter-password +bintray_Username=your-jcenter-id +bintray_Password=your-jcenter-password diff --git a/jcenter.gradle b/jcenter.gradle deleted file mode 100644 index 1518c512..00000000 --- a/jcenter.gradle +++ /dev/null @@ -1,66 +0,0 @@ -task javadocJar(type: Jar) { - classifier = 'javadoc' - from javadoc -} - -task sourcesJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.allSource -} - -artifacts { - archives javadocJar, sourcesJar -} - -signing { - sign configurations.archives -} - -group = "name.neuhalfen.projects.crypto.bouncycastle.openpgp" -archivesBaseName = "Bouncy-gpg" - - -uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { - authentication(userName: jcenter_Username, password: jcenter_Password) - } - - snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { - authentication(userName: jcenter_Username, password: jcenter_Password) - } - - pom.project { - name 'Bouncy-gpg' - packaging 'jar' - // optionally artifactId can be defined here - description 'Make using Bouncy Castle with OpenPGP fun again!' - url 'https://github.com/neuhalje/bouncy-gpg' - - scm { - connection 'scm:git:https://github.com/neuhalje/bouncy-gpg.git' - developerConnection 'scm:git:https://github.com/neuhalje/bouncy-gpg.git' - url 'https://github.com/neuhalje/bouncy-gpg/' - } - - licenses { - license { - name 'WTFPL' - url 'http://www.wtfpl.net/' - } - } - - developers { - developer { - id 'neuhalje' - name 'Jens Neuhalfen' - email 'neuhalje@neuhalfen.name' - } - } - } - } - } -} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..9005486f --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'bouncy-gpg' \ No newline at end of file