mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 15:20:54 +03:00
294 lines
8.1 KiB
Groovy
294 lines
8.1 KiB
Groovy
plugins {
|
|
id "java"
|
|
id "jvm-test-suite"
|
|
id "groovy"
|
|
id "jacoco"
|
|
id "com.github.blindpirate.osgi" version '0.0.6'
|
|
id "maven-publish"
|
|
id "signing"
|
|
id 'pl.allegro.tech.build.axion-release' version '1.15.3'
|
|
id "com.github.hierynomus.license" version "0.16.1"
|
|
id "com.bmuschko.docker-remote-api" version "9.2.1"
|
|
id 'ru.vyarus.github-info' version '2.0.0'
|
|
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
|
|
}
|
|
|
|
group = "com.hierynomus"
|
|
ext.moduleName = "${project.group}.${project.name}"
|
|
|
|
defaultTasks "build"
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
github {
|
|
user 'hierynomus'
|
|
license 'Apache'
|
|
}
|
|
|
|
scmVersion {
|
|
tag {
|
|
prefix = 'v'
|
|
versionSeparator = ''
|
|
}
|
|
hooks {
|
|
pre 'fileUpdate', [file: 'README.adoc', pattern: { v, c -> /:sshj_version: .*/}, replacement: { v, c -> ":sshj_version: $v" }]
|
|
pre 'commit'
|
|
}
|
|
}
|
|
|
|
project.version = scmVersion.version
|
|
|
|
compileJava {
|
|
options.release = 8
|
|
}
|
|
|
|
configurations.implementation.transitive = false
|
|
|
|
def bouncycastleVersion = "1.80"
|
|
def sshdVersion = "2.15.0"
|
|
|
|
dependencies {
|
|
implementation "org.slf4j:slf4j-api:2.0.17"
|
|
implementation "org.bouncycastle:bcprov-jdk18on:$bouncycastleVersion"
|
|
implementation "org.bouncycastle:bcpkix-jdk18on:$bouncycastleVersion"
|
|
implementation "com.hierynomus:asn-one:0.6.0"
|
|
}
|
|
|
|
license {
|
|
header rootProject.file('LICENSE_HEADER')
|
|
strictCheck true
|
|
mapping {
|
|
java = 'SLASHSTAR_STYLE'
|
|
}
|
|
excludes([
|
|
'**/com/hierynomus/sshj/userauth/keyprovider/bcrypt/*.java',
|
|
'**/files/test_file_*.txt',
|
|
])
|
|
}
|
|
|
|
java {
|
|
withJavadocJar()
|
|
withSourcesJar()
|
|
}
|
|
|
|
if (!JavaVersion.current().isJava9Compatible()) {
|
|
throw new GradleScriptException("Minimum compilation version is Java 9")
|
|
}
|
|
|
|
// This disables the pedantic doclint feature of JDK8
|
|
if (JavaVersion.current().isJava8Compatible()) {
|
|
tasks.withType(Javadoc) {
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
}
|
|
}
|
|
|
|
testing {
|
|
suites {
|
|
configureEach {
|
|
useJUnitJupiter()
|
|
dependencies {
|
|
implementation "org.slf4j:slf4j-api:2.0.17"
|
|
implementation 'org.spockframework:spock-core:2.3-groovy-3.0'
|
|
implementation "org.mockito:mockito-core:5.16.1"
|
|
implementation "org.assertj:assertj-core:3.27.3"
|
|
implementation "ru.vyarus:spock-junit5:1.2.0"
|
|
implementation "org.apache.sshd:sshd-core:$sshdVersion"
|
|
implementation "org.apache.sshd:sshd-sftp:$sshdVersion"
|
|
implementation "org.apache.sshd:sshd-scp:$sshdVersion"
|
|
implementation "ch.qos.logback:logback-classic:1.5.18"
|
|
}
|
|
|
|
targets {
|
|
all {
|
|
testTask.configure {
|
|
testLogging {
|
|
showStandardStreams = false
|
|
exceptionFormat = 'full'
|
|
}
|
|
include "**/*Test.*"
|
|
include "**/*Spec.*"
|
|
afterSuite { descriptor, result ->
|
|
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")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
test {
|
|
sources {
|
|
groovy {
|
|
srcDirs = ['src/test/groovy']
|
|
}
|
|
}
|
|
}
|
|
|
|
integrationTest(JvmTestSuite) {
|
|
dependencies {
|
|
implementation project()
|
|
implementation platform('org.testcontainers:testcontainers-bom:1.20.6')
|
|
implementation 'org.testcontainers:junit-jupiter'
|
|
}
|
|
|
|
sources {
|
|
java {
|
|
srcDirs = ['src/itest/java']
|
|
}
|
|
|
|
resources {
|
|
srcDirs = ['src/itest/resources']
|
|
}
|
|
}
|
|
|
|
targets {
|
|
all {
|
|
testTask.configure {
|
|
shouldRunAfter(test)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
project.tasks.compileGroovy.onlyIf { false }
|
|
|
|
task writeSshjVersionProperties {
|
|
doLast {
|
|
project.file("${project.buildDir}/resources/main").mkdirs()
|
|
project.file("${project.buildDir}/resources/main/sshj.properties").withWriter { w ->
|
|
w.append("sshj.version=${version}")
|
|
}
|
|
}
|
|
}
|
|
|
|
jar.dependsOn writeSshjVersionProperties
|
|
jar {
|
|
inputs.property("moduleName", moduleName)
|
|
manifest {
|
|
attributes 'Automatic-Module-Name': moduleName
|
|
|
|
// please see http://bnd.bndtools.org/chapters/390-wrapping.html
|
|
instruction "Bundle-Description", "SSHv2 library for Java"
|
|
instruction "Bundle-License", "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
|
instruction "Import-Package", "!net.schmizz.*"
|
|
instruction "Import-Package", "!com.hierynomus.sshj.*"
|
|
instruction "Import-Package", "javax.crypto*"
|
|
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*;resolution:=optional"
|
|
instruction "Import-Package", "org.bouncycastle.jce.provider;resolution:=optional"
|
|
instruction "Import-Package", "*"
|
|
instruction "Export-Package", "com.hierynomus.sshj.*;version=\"${project.jar.manifest.version}\""
|
|
instruction "Export-Package", "net.schmizz.*;version=\"${project.jar.manifest.version}\""
|
|
}
|
|
}
|
|
|
|
sourcesJar {
|
|
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"
|
|
)
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
maven(MavenPublication) {
|
|
from(components.java)
|
|
}
|
|
}
|
|
}
|
|
|
|
project.signing {
|
|
required { project.gradle.taskGraph.hasTask("release") }
|
|
sign publishing.publications.maven
|
|
|
|
if (project.hasProperty("signingKeyId") || project.hasProperty("signingKey")) {
|
|
def signingKeyId = project.findProperty("signingKeyId")
|
|
def signingKey = project.findProperty("signingKey")
|
|
def signingPassword = project.findProperty("signingPassword")
|
|
if (signingKeyId) {
|
|
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
|
|
} else if (signingKey) {
|
|
useInMemoryPgpKeys(signingKey, signingPassword)
|
|
}
|
|
}
|
|
}
|
|
|
|
project.plugins.withType(MavenPublishPlugin).all {
|
|
PublishingExtension publishing = project.extensions.getByType(PublishingExtension)
|
|
publishing.publications.withType(MavenPublication).all { mavenPublication ->
|
|
mavenPublication.pom {
|
|
name = "${project.name}"
|
|
description = 'SSHv2 library for Java'
|
|
inceptionYear = '2009'
|
|
url = "https://github.com/hierynomus/${project.name}"
|
|
licenses {
|
|
license {
|
|
name = "The Apache License, Version 2.0"
|
|
url = "https://www.apache.org/licenses/LICENSE-2.0"
|
|
}
|
|
}
|
|
developers {
|
|
developer {
|
|
id = "hierynomus"
|
|
name = "Jeroen van Erp"
|
|
email = "jeroen@hierynomus.com"
|
|
}
|
|
developer {
|
|
id = "shikhar"
|
|
name = "Shikhar Bhushan"
|
|
email = "shikhar@schmizz.net"
|
|
url = "http://schmizz.net"
|
|
roles = ["Previous Lead developer"]
|
|
}
|
|
developer {
|
|
id = "iterate"
|
|
name = "David Kocher"
|
|
email = "dkocher@iterate.ch"
|
|
organization = "iterate GmbH"
|
|
organizationUrl = "https://iterate.ch"
|
|
roles = ["Developer"]
|
|
}
|
|
}
|
|
scm {
|
|
url = "https://github.com/hierynomus/${project.name}"
|
|
connection = "scm:git@github.com:hierynomus/${project.name}.git"
|
|
developerConnection = "scm:git@github.com:hierynomus/${project.name}.git"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
nexusPublishing {
|
|
repositories {
|
|
sonatype() //sonatypeUsername and sonatypePassword properties are used automatically
|
|
}
|
|
|
|
connectTimeout = Duration.ofMinutes(3)
|
|
clientTimeout = Duration.ofMinutes(3)
|
|
}
|
|
|
|
jacocoTestReport {
|
|
reports {
|
|
xml.required = true
|
|
html.required = true
|
|
}
|
|
}
|
|
|
|
project.tasks.release.dependsOn([project.tasks.integrationTest, project.tasks.build])
|
|
project.tasks.jacocoTestReport.dependsOn(project.tasks.test)
|
|
project.tasks.check.dependsOn(project.tasks.jacocoTestReport)
|