Skip to content

Commit 4cf9de8

Browse files
committed
Gradle: Upload signed Spongy Castle artifacts to Sonatype OSS Nexus
http://yennicktrevels.com/blog/2013/10/11/automated-gradle-project-deployment-to-sonatype-oss-repository/ Using a 'spongycastle' subgroup (ie com.madgag.spongycastle) to give a useful grouping, apparently this is legit: https://docs.sonatype.org/display/Repository/Choosing+your+Coordinates Also guard against missing gradle.properties for travis, which doesn't have to do signing or uploading to sonatype.
1 parent eb6c5f5 commit 4cf9de8

File tree

1 file changed

+81
-4
lines changed

1 file changed

+81
-4
lines changed

build.gradle

Lines changed: 81 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,89 @@ ext {
3232
bcTestDataHome = file('core/src/test/data').absolutePath
3333
}
3434

35-
task printProperties << {
36-
println bcTestDataHome
37-
}
38-
3935
subprojects {
4036
apply plugin: 'eclipse'
37+
apply plugin: 'java'
38+
apply plugin: 'maven'
39+
apply plugin: 'signing'
40+
41+
group = 'com.madgag.spongycastle'
42+
43+
task javadocJar(type: Jar, dependsOn: javadoc) {
44+
classifier = 'javadoc'
45+
from 'build/docs/javadoc'
46+
}
47+
48+
task sourcesJar(type: Jar) {
49+
from sourceSets.main.allSource
50+
classifier = 'sources'
51+
}
52+
53+
artifacts {
54+
archives jar
55+
56+
archives javadocJar
57+
archives sourcesJar
58+
}
59+
60+
if (project.hasProperty("signing.keyId")) {
61+
signing {
62+
sign configurations.archives
63+
}
64+
}
65+
66+
if (project.hasProperty("sonatypeUsername")) {
67+
uploadArchives {
68+
repositories {
69+
mavenDeployer {
70+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
71+
72+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
73+
authentication(userName: sonatypeUsername, password: sonatypePassword)
74+
}
75+
76+
pom.project {
77+
name 'Spongy Castle'
78+
packaging 'jar'
79+
description 'Spongy Castle is a package-rename (org.bouncycastle.* to org.spongycastle.*) of Bouncy Castle\n' +
80+
'intended for the Android platform. Android unfortunately ships with a stripped-down version of\n' +
81+
'Bouncy Castle, which prevents easy upgrades - Spongy Castle overcomes this and provides a full,\n' +
82+
'up-to-date version of the Bouncy Castle cryptographic libs.'
83+
url 'http://rtyley.github.io/spongycastle/'
84+
85+
scm {
86+
url 'scm:git@github.com:rtyley/spongycastle.git'
87+
connection 'scm:git@github.com:rtyley/spongycastle.git'
88+
developerConnection 'scm:git@github.com:rtyley/spongycastle.git'
89+
}
90+
91+
licenses {
92+
license {
93+
name 'Bouncy Castle Licence'
94+
url 'http://www.bouncycastle.org/licence.html'
95+
distribution 'repo'
96+
}
97+
}
98+
99+
developers {
100+
developer {
101+
id 'rtyley'
102+
name 'Roberto Tyley'
103+
}
104+
}
105+
}
106+
}
107+
}
108+
}
109+
}
110+
111+
repositories {
112+
mavenCentral()
113+
}
114+
115+
dependencies {
116+
testCompile group: 'junit', name: 'junit', version: '4.11'
117+
}
41118

42119
sourceCompatibility = 1.5
43120
targetCompatibility = 1.5

0 commit comments

Comments
 (0)