Changed release process to bintray

This commit is contained in:
Jeroen van Erp
2016-09-30 11:03:22 +02:00
parent 2f6025d9ba
commit 6e56cd9d0a

View File

@@ -1,18 +1,22 @@
import java.text.SimpleDateFormat
plugins { plugins {
id "java" id "java"
id "groovy" id "groovy"
id "maven" id "osgi"
id "idea" id "maven-publish"
id "signing" id "org.ajoberstar.release-opinion" version "1.4.2"
id "osgi" id "com.github.hierynomus.license" version "0.12.1"
id "org.ajoberstar.release-opinion" version "1.4.2" id "com.jfrog.bintray" version "1.7"
id "com.github.hierynomus.license" version "0.12.1" id 'ru.vyarus.pom' version '1.0.3'
id 'ru.vyarus.github-info' version '1.1.0'
} }
group = "com.hierynomus" group = "com.hierynomus"
defaultTasks "build"
repositories { repositories {
mavenCentral() mavenCentral()
} }
sourceCompatibility = 1.6 sourceCompatibility = 1.6
@@ -20,193 +24,188 @@ targetCompatibility = 1.6
configurations.compile.transitive = false configurations.compile.transitive = false
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
license {
mapping {
java = 'SLASHSTAR_STYLE'
}
header rootProject.file('LICENSE_HEADER')
strictCheck true
excludes(['**/djb/Curve25519.java', '**/sshj/common/Base64.java'])
}
release {
grgit = org.ajoberstar.grgit.Grgit.open(project.projectDir)
}
test {
testLogging {
exceptionFormat = 'full'
}
include "**/*Test.*"
include "**/*Spec.*"
if (!project.hasProperty("allTests")) {
useJUnit {
excludeCategories 'com.hierynomus.sshj.test.SlowTests'
excludeCategories 'com.hierynomus.sshj.test.KnownFailingTests'
}
}
afterSuite { descriptor, result ->
if (descriptor.className != null) {
def indicator = "\u001B[32m✓\u001b[0m"
if (result.failedTestCount > 0) {
indicator = "\u001B[31m✘\u001b[0m"
}
logger.lifecycle("$indicator Test ${descriptor.name}; Executed: ${result.testCount}/\u001B[32m${result.successfulTestCount}\u001B[0m/\u001B[31m${result.failedTestCount}\u001B[0m")
}
}
}
def bouncycastleVersion = "1.51" def bouncycastleVersion = "1.51"
dependencies { dependencies {
compile "org.slf4j:slf4j-api:1.7.7" compile "org.slf4j:slf4j-api:1.7.7"
compile "org.bouncycastle:bcprov-jdk15on:$bouncycastleVersion" compile "org.bouncycastle:bcprov-jdk15on:$bouncycastleVersion"
compile "org.bouncycastle:bcpkix-jdk15on:$bouncycastleVersion" compile "org.bouncycastle:bcpkix-jdk15on:$bouncycastleVersion"
compile "com.jcraft:jzlib:1.1.3" compile "com.jcraft:jzlib:1.1.3"
compile "net.i2p.crypto:eddsa:0.1.0" compile "net.i2p.crypto:eddsa:0.1.0"
testCompile "junit:junit:4.11" testCompile "junit:junit:4.11"
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4' testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
testCompile "org.mockito:mockito-core:1.9.5" testCompile "org.mockito:mockito-core:1.9.5"
testCompile "org.apache.sshd:sshd-core:1.1.0" testCompile "org.apache.sshd:sshd-core:1.1.0"
testRuntime "ch.qos.logback:logback-classic:1.1.2" testRuntime "ch.qos.logback:logback-classic:1.1.2"
testCompile 'org.glassfish.grizzly:grizzly-http-server:2.3.17' testCompile 'org.glassfish.grizzly:grizzly-http-server:2.3.17'
testCompile 'org.apache.httpcomponents:httpclient:4.5.2' testCompile 'org.apache.httpcomponents:httpclient:4.5.2'
} }
jar { license {
manifest { header rootProject.file('LICENSE_HEADER')
instruction "Bundle-Description", "SSHv2 library for Java" strictCheck true
instruction "Bundle-License", "http://www.apache.org/licenses/LICENSE-2.0.txt" mapping {
instruction "Import-Package", "!net.schmizz.*" java = 'SLASHSTAR_STYLE'
instruction "Import-Package", "javax.crypto*" }
instruction "Import-Package", "net.i2p*" excludes(['**/djb/Curve25519.java', '**/sshj/common/Base64.java'])
instruction "Import-Package", "com.jcraft.jzlib*;version=\"[1.1,2)\";resolution:=optional"
instruction "Import-Package", "org.slf4j*;version=\"[1.7,5)\""
instruction "Import-Package", "org.bouncycastle*"
instruction "Import-Package", "*"
instruction "Export-Package", "net.schmizz.*"
}
} }
task javadocJar(type: Jar) { release {
classifier = 'javadoc' grgit = org.ajoberstar.grgit.Grgit.open(project.projectDir)
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
manifest {
attributes(
// Add the needed OSGI attributes
"Bundle-ManifestVersion": "2",
"Bundle-Name": "${project.jar.manifest.name} Source",
"Bundle-Version": project.jar.manifest.version,
"Eclipse-SourceBundle": "${project.jar.manifest.symbolicName};version=\"${project.jar.manifest.version}\";roots:=\".\"",
"Bundle-SymbolicName": "${project.jar.manifest.symbolicName}.source"
)
}
}
artifacts {
archives javadocJar, sourcesJar
}
signing {
required { !version.toString().contains("SNAPSHOT") && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
} }
// This disables the pedantic doclint feature of JDK8 // This disables the pedantic doclint feature of JDK8
if (JavaVersion.current().isJava8Compatible()) { if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) { tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet') options.addStringOption('Xdoclint:none', '-quiet')
} }
} }
uploadArchives { jar {
if (project.hasProperty('sonatypeUsername')) { manifest {
repositories.mavenDeployer { instruction "Bundle-Description", "SSHv2 library for Java"
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } instruction "Bundle-License", "http://www.apache.org/licenses/LICENSE-2.0.txt"
instruction "Import-Package", "!net.schmizz.*"
instruction "Import-Package", "javax.crypto*"
instruction "Import-Package", "net.i2p*"
instruction "Import-Package", "com.jcraft.jzlib*;version=\"[1.1,2)\";resolution:=optional"
instruction "Import-Package", "org.slf4j*;version=\"[1.7,5)\""
instruction "Import-Package", "org.bouncycastle*"
instruction "Import-Package", "*"
instruction "Export-Package", "net.schmizz.*"
}
}
configuration = configurations.archives task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') { task sourcesJar(type: Jar) {
authentication(userName: sonatypeUsername, password: sonatypePassword) classifier = 'sources'
} from sourceSets.main.allSource
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') { manifest {
authentication(userName: sonatypeUsername, password: sonatypePassword) attributes(
} // Add the needed OSGI attributes
"Bundle-ManifestVersion": "2",
"Bundle-Name": "${project.jar.manifest.name} Source",
"Bundle-Version": project.jar.manifest.version,
"Eclipse-SourceBundle": "${project.jar.manifest.symbolicName};version=\"${project.jar.manifest.version}\";roots:=\".\"",
"Bundle-SymbolicName": "${project.jar.manifest.symbolicName}.source"
)
}
}
pom.project { tasks.withType(Test) {
name "sshj" testLogging {
description "SSHv2 library for Java" exceptionFormat = 'full'
url "https://github.com/hierynomus/sshj" }
inceptionYear "2009" include "**/*Test.*"
include "**/*Spec.*"
if (!project.hasProperty("allTests")) {
useJUnit {
excludeCategories 'com.hierynomus.sshj.test.SlowTests'
excludeCategories 'com.hierynomus.sshj.test.KnownFailingTests'
}
}
issueManagement { afterSuite { descriptor, result ->
system "github" if (descriptor.className != null) {
url "https://github.com/hierynomus/sshj/issues" def indicator = "\u001B[32m✓\u001b[0m"
} if (result.failedTestCount > 0) {
indicator = "\u001B[31m✘\u001b[0m"
}
logger.lifecycle("$indicator Test ${descriptor.name}; Executed: ${result.testCount}/\u001B[32m${result.successfulTestCount}\u001B[0m/\u001B[31m${result.failedTestCount}\u001B[0m")
}
}
}
scm { project.tasks.compileGroovy.onlyIf { false }
connection "scm:git:git://github.com/hierynomus/sshj.git"
developerConnection "scm:git:git@github.com:hierynomus/sshj.git"
url "https://github.com/hierynomus/sshj.git"
}
licenses { github {
license { user 'hierynomus'
name "Apache 2" license 'Apache'
url "http://www.apache.org/licenses/LICENSE-2.0.txt" }
distribution "repo"
}
}
developers { pom {
developer { description "SSHv2 library for Java"
id "hierynomus" url "https://github.com/hierynomus/sshj"
name "Jeroen van Erp" inceptionYear "2009"
email "jeroen@javadude.nl" developers {
roles { developer {
role "Lead developer" id "hierynomus"
} name "Jeroen van Erp"
} email "jeroen@javadude.nl"
developer { roles {
id "shikhar" role "Lead developer"
name "Shikhar Bhushan" }
email "shikhar@schmizz.net" }
url "http://schmizz.net" developer {
roles { id "shikhar"
role "Previous lead developer" name "Shikhar Bhushan"
} email "shikhar@schmizz.net"
} url "http://schmizz.net"
developer { roles {
id "iterate" role "Previous lead developer"
name "David Kocher" }
email "dkocher@iterate.ch" }
organization "iterage GmbH" developer {
organizationUrl "https://iterate.ch" id "iterate"
roles { name "David Kocher"
role "Developer" email "dkocher@iterate.ch"
} organization "iterage GmbH"
} organizationUrl "https://iterate.ch"
} roles {
} role "Developer"
}
}
}
}
publishing {
publications {
Sshj(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}
if (project.hasProperty("bintrayUsername") && project.hasProperty("bintrayApiKey")) {
bintray {
user = project.property("bintrayUsername")
key = project.property("bintrayApiKey")
publish = true
publications = ["Sshj"]
pkg {
repo = "maven"
name = project.name
licenses = ["Apache-2.0"]
vcsUrl = "https://github.com/hierynomus/sshj.git"
labels = ["ssh", "sftp", "secure-shell", "network", "file-transfer"]
githubRepo = "hierynomus/sshj"
version {
name = project.version.toString()
vcsTag = "v${project.version}"
released = new SimpleDateFormat('yyyy-MM-dd\'T\'HH:mm:ss.SSSZZ').format(new Date())
gpg {
sign = true
passphrase = project.property("signing.password")
} }
mavenCentralSync {
sync = true
user = project.property("sonatypeUsername")
password = project.property("sonatypePassword")
close = 1
}
}
} }
}
} }
tasks.compileGroovy.onlyIf { false } project.tasks.release.dependsOn([project.tasks.build, project.tasks.bintrayUpload])
tasks.release.dependsOn 'build', 'uploadArchives'