Added OSGI manifest to -sources.jar (Fixes #242)

This commit is contained in:
Jeroen van Erp
2016-04-11 10:56:18 +02:00
parent c3f75cda19
commit 4c9ebc306d

View File

@@ -1,8 +1,8 @@
plugins { plugins {
id "java" id "java"
id "maven" id "maven"
id "signing" id "signing"
id "osgi" id "osgi"
} }
apply plugin: "java" apply plugin: "java"
@@ -14,92 +14,93 @@ group = "com.hierynomus"
version = "0.16.0-SNAPSHOT" version = "0.16.0-SNAPSHOT"
repositories { repositories {
mavenCentral() mavenCentral()
mavenLocal() mavenLocal()
} }
sourceCompatibility = 1.7 sourceCompatibility = 1.7
targetCompatibility = 1.7 targetCompatibility = 1.7
configurations { configurations {
compile { compile {
transitive = false transitive = false
} }
} }
test { test {
testLogging { testLogging {
exceptionFormat = 'full' exceptionFormat = 'full'
} }
include "**/*Test.*" include "**/*Test.*"
if (!project.hasProperty("allTests")) { if (!project.hasProperty("allTests")) {
useJUnit { useJUnit {
excludeCategories 'com.hierynomus.sshj.test.SlowTests' excludeCategories 'com.hierynomus.sshj.test.SlowTests'
excludeCategories 'com.hierynomus.sshj.test.KnownFailingTests' excludeCategories 'com.hierynomus.sshj.test.KnownFailingTests'
}
} }
}
afterSuite { descriptor, result -> afterSuite { descriptor, result ->
if (descriptor.className != null) { if (descriptor.className != null) {
def indicator = "\u001B[32m✓\u001b[0m" def indicator = "\u001B[32m✓\u001b[0m"
if (result.failedTestCount > 0) { if (result.failedTestCount > 0) {
indicator = "\u001B[31m✘\u001b[0m" 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") 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.vrallev.ecc:ecc-25519-java:1.0.1" compile "net.vrallev.ecc:ecc-25519-java:1.0.1"
testCompile "junit:junit:4.11" testCompile "junit:junit:4.11"
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'
} }
jar { jar {
manifest { manifest {
instruction "Bundle-Description", "SSHv2 library for Java" instruction "Bundle-Description", "SSHv2 library for Java"
instruction "Bundle-License", "http://www.apache.org/licenses/LICENSE-2.0.txt" instruction "Bundle-License", "http://www.apache.org/licenses/LICENSE-2.0.txt"
instruction "Import-Package", "!net.schmizz.*" instruction "Import-Package", "!net.schmizz.*"
instruction "Import-Package", "javax.crypto*" instruction "Import-Package", "javax.crypto*"
instruction "Import-Package", "net.i2p*" instruction "Import-Package", "net.i2p*"
instruction "Import-Package", "com.jcraft.jzlib*;version=\"[1.1,2)\";resolution:=optional" 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.slf4j*;version=\"[1.7,5)\""
instruction "Import-Package", "org.bouncycastle*" instruction "Import-Package", "org.bouncycastle*"
instruction "Import-Package", "*" instruction "Import-Package", "*"
instruction "Export-Package", "net.schmizz.*" instruction "Export-Package", "net.schmizz.*"
} }
} }
task javadocJar(type: Jar) { task javadocJar(type: Jar) {
classifier = 'javadoc' classifier = 'javadoc'
from javadoc from javadoc
} }
task sourcesJar(type: Jar) { task sourcesJar(type: Jar) {
classifier = 'sources' classifier = 'sources'
from sourceSets.main.allSource from sourceSets.main.allSource
manifest = project.tasks.jar.manifest
} }
artifacts { artifacts {
archives javadocJar, sourcesJar archives javadocJar, sourcesJar
} }
signing { signing {
required { !version.contains("SNAPSHOT") && gradle.taskGraph.hasTask("uploadArchives") } required { !version.contains("SNAPSHOT") && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives sign configurations.archives
} }
// This disables the pedantic doclint feature of JDK8 // This disables the pedantic doclint feature of JDK8
@@ -110,74 +111,74 @@ if (JavaVersion.current().isJava8Compatible()) {
} }
uploadArchives { uploadArchives {
if(project.hasProperty('sonatypeUsername')) { if (project.hasProperty('sonatypeUsername')) {
repositories.mavenDeployer { repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
configuration = configurations.archives configuration = configurations.archives
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') { repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
authentication(userName: sonatypeUsername, password: sonatypePassword) authentication(userName: sonatypeUsername, password: sonatypePassword)
}
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name "sshj"
description "SSHv2 library for Java"
url "https://github.com/hierynomus/sshj"
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 {
developer {
id "hierynomus"
name "Jeroen van Erp"
email "jeroen@javadude.nl"
roles {
role "Lead developer"
} }
} snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
developer { authentication(userName: sonatypeUsername, password: sonatypePassword)
id "shikhar"
name "Shikhar Bhushan"
email "shikhar@schmizz.net"
url "http://schmizz.net"
roles {
role "Previous lead developer"
} }
}
developer { pom.project {
id "iterate" name "sshj"
name "David Kocher" description "SSHv2 library for Java"
email "dkocher@iterate.ch" url "https://github.com/hierynomus/sshj"
organization "iterage GmbH" inceptionYear "2009"
organizationUrl "https://iterate.ch"
roles { issueManagement {
role "Developer" 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 {
developer {
id "hierynomus"
name "Jeroen van Erp"
email "jeroen@javadude.nl"
roles {
role "Lead developer"
}
}
developer {
id "shikhar"
name "Shikhar Bhushan"
email "shikhar@schmizz.net"
url "http://schmizz.net"
roles {
role "Previous lead developer"
}
}
developer {
id "iterate"
name "David Kocher"
email "dkocher@iterate.ch"
organization "iterage GmbH"
organizationUrl "https://iterate.ch"
roles {
role "Developer"
}
}
}
} }
}
} }
}
} }
}
} }