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,15 +1,19 @@
import java.text.SimpleDateFormat
plugins { plugins {
id "java" id "java"
id "groovy" id "groovy"
id "maven"
id "idea"
id "signing"
id "osgi" id "osgi"
id "maven-publish"
id "org.ajoberstar.release-opinion" version "1.4.2" id "org.ajoberstar.release-opinion" version "1.4.2"
id "com.github.hierynomus.license" version "0.12.1" id "com.github.hierynomus.license" version "0.12.1"
id "com.jfrog.bintray" version "1.7"
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()
@@ -20,50 +24,6 @@ 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 {
@@ -84,6 +44,26 @@ dependencies {
} }
license {
header rootProject.file('LICENSE_HEADER')
strictCheck true
mapping {
java = 'SLASHSTAR_STYLE'
}
excludes(['**/djb/Curve25519.java', '**/sshj/common/Base64.java'])
}
release {
grgit = org.ajoberstar.grgit.Grgit.open(project.projectDir)
}
// This disables the pedantic doclint feature of JDK8
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
jar { jar {
manifest { manifest {
instruction "Bundle-Description", "SSHv2 library for Java" instruction "Bundle-Description", "SSHv2 library for Java"
@@ -119,61 +99,41 @@ task sourcesJar(type: Jar) {
} }
} }
artifacts { tasks.withType(Test) {
archives javadocJar, sourcesJar testLogging {
exceptionFormat = 'full'
} }
include "**/*Test.*"
signing { include "**/*Spec.*"
required { !version.toString().contains("SNAPSHOT") && gradle.taskGraph.hasTask("uploadArchives") } if (!project.hasProperty("allTests")) {
sign configurations.archives useJUnit {
} excludeCategories 'com.hierynomus.sshj.test.SlowTests'
excludeCategories 'com.hierynomus.sshj.test.KnownFailingTests'
// This disables the pedantic doclint feature of JDK8
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
} }
} }
uploadArchives { afterSuite { descriptor, result ->
if (project.hasProperty('sonatypeUsername')) { if (descriptor.className != null) {
repositories.mavenDeployer { def indicator = "\u001B[32m✓\u001b[0m"
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } if (result.failedTestCount > 0) {
indicator = "\u001B[31m✘\u001b[0m"
configuration = configurations.archives }
logger.lifecycle("$indicator Test ${descriptor.name}; Executed: ${result.testCount}/\u001B[32m${result.successfulTestCount}\u001B[0m/\u001B[31m${result.failedTestCount}\u001B[0m")
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') { }
authentication(userName: sonatypeUsername, password: sonatypePassword)
} }
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
authentication(userName: sonatypeUsername, password: sonatypePassword)
} }
pom.project { project.tasks.compileGroovy.onlyIf { false }
name "sshj"
github {
user 'hierynomus'
license 'Apache'
}
pom {
description "SSHv2 library for Java" description "SSHv2 library for Java"
url "https://github.com/hierynomus/sshj" url "https://github.com/hierynomus/sshj"
inceptionYear "2009" inceptionYear "2009"
issueManagement {
system "github"
url "https://github.com/hierynomus/sshj/issues"
}
scm {
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 {
license {
name "Apache 2"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
developers { developers {
developer { developer {
id "hierynomus" id "hierynomus"
@@ -204,9 +164,48 @@ uploadArchives {
} }
} }
} }
publishing {
publications {
Sshj(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
} }
} }
} }
tasks.compileGroovy.onlyIf { false }
tasks.release.dependsOn 'build', 'uploadArchives' 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
}
}
}
}
}
project.tasks.release.dependsOn([project.tasks.build, project.tasks.bintrayUpload])