Skip to content

Commit

Permalink
Prepare publishing artifacts to jcenter
Browse files Browse the repository at this point in the history
  • Loading branch information
neuhalje committed Jan 31, 2017
1 parent c530916 commit 09e85b8
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ bouncy-castle-examples.iml
build/
.DS_Store
out/
gradle.properties
30 changes: 22 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
plugins {
id 'java'
id 'application'
id 'jacoco'
}
id 'java'
id 'application'
id 'jacoco'

// deploy to maven central
id 'maven'
id 'signing'

mainClassName = "name.neuhalfen.projects.crypto.bouncycastle.openpgp.example.Main"
}


sourceCompatibility = 1.7
targetCompatibility = 1.7
mainClassName = 'name.neuhalfen.projects.crypto.bouncycastle.openpgp.example.Main'

version = '1.1.0'

jar {
manifest {
attributes 'Implementation-Title': 'Bouncycastle Examples',
'Implementation-Version': version,
'Main-Class': 'name.neuhalfen.projects.crypto.bouncycastle.openpgp.example.Main'
'Implementation-Version': version,
'Main-Class': mainClassName
}
}

Expand Down Expand Up @@ -48,6 +52,7 @@ test {
classDumpFile = file("$buildDir/jacoco/classpathdumps")
}
}

jacocoTestReport {
reports {
xml.enabled true
Expand All @@ -57,10 +62,19 @@ jacocoTestReport {
}
}

check.dependsOn jacocoTestReport

// JCenter deployment
// configured in gradle.properties

if ( hasProperty('jcenter_Username')) {
apply from: 'jcenter.gradle'
}
// Misc


task wrapper(type: Wrapper) {
gradleVersion = '2.7'
}

check.dependsOn jacocoTestReport

7 changes: 7 additions & 0 deletions gradle.properties.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

signing.keyId=YourKeyId
signing.password=YourPublicKeyPassword
signing.secretKeyRingFile=PathToYourKeyRingFile

jcenter_Username=your-jcenter-id
jcenter_Password=your-jcenter-password
66 changes: 66 additions & 0 deletions jcenter.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}

artifacts {
archives javadocJar, sourcesJar
}

signing {
sign configurations.archives
}

group = "name.neuhalfen.projects.crypto.bouncycastle.openpgp"
archivesBaseName = "Bouncy-gpg"


uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: jcenter_Username, password: jcenter_Password)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: jcenter_Username, password: jcenter_Password)
}

pom.project {
name 'Bouncy-gpg'
packaging 'jar'
// optionally artifactId can be defined here
description 'Make using Bouncy Castle with OpenPGP fun again!'
url 'https://github.com/neuhalje/bouncy-gpg'

scm {
connection 'scm:git:https://github.com/neuhalje/bouncy-gpg.git'
developerConnection 'scm:git:https://github.com/neuhalje/bouncy-gpg.git'
url 'https://github.com/neuhalje/bouncy-gpg/'
}

licenses {
license {
name 'WTFPL'
url 'http://www.wtfpl.net/'
}
}

developers {
developer {
id 'neuhalje'
name 'Jens Neuhalfen'
email 'neuhalje@neuhalfen.name'
}
}
}
}
}
}

0 comments on commit 09e85b8

Please sign in to comment.