Skip to content

Commit

Permalink
Use maven-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
joeha480 committed Mar 20, 2019
1 parent d4d6a7f commit 0620219
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 60 deletions.
109 changes: 57 additions & 52 deletions build.gradle
@@ -1,6 +1,6 @@
plugins {
id 'application'
id 'maven'
id 'maven-publish'
id 'signing'
}

Expand Down Expand Up @@ -66,7 +66,7 @@ jar.doFirst {
'Implementation-Title': "$releaseName",
'Implementation-Version': version,
'Implementation-URL': "$repositoryURL",
'Class-Path': configurations.runtime.collect { it.getName() }.join(' ') //'${core.classpath.attribute}'
'Class-Path': configurations.runtimeClasspath.collect { it.getName() }.join(' ') //'${core.classpath.attribute}'
)
}
from sourceSets.main.allJava
Expand Down Expand Up @@ -94,30 +94,30 @@ dependencies {
}
compile 'org.daisy.streamline:streamline-api:1.3.0'

runtime 'org.daisy.braille:braille-utils.impl:6.0.0'
runtime ('org.daisy.dotify:dotify.formatter.impl:4.4.0') {
runtimeOnly 'org.daisy.braille:braille-utils.impl:6.0.0'
runtimeOnly ('org.daisy.dotify:dotify.formatter.impl:4.4.0') {
exclude module: 'Saxon-HE'
}
runtime 'org.daisy.dotify:dotify.hyphenator.impl:4.0.0'
runtime 'org.daisy.dotify:dotify.text.impl:4.0.0'
runtime 'org.daisy.dotify:dotify.translator.impl:4.0.0'
runtime ('org.daisy.dotify:dotify.task.impl:4.6.0') {
runtimeOnly 'org.daisy.dotify:dotify.hyphenator.impl:4.0.0'
runtimeOnly 'org.daisy.dotify:dotify.text.impl:4.0.0'
runtimeOnly 'org.daisy.dotify:dotify.translator.impl:4.0.0'
runtimeOnly ('org.daisy.dotify:dotify.task.impl:4.6.0') {
exclude module: 'Saxon-HE'
exclude module: 'streamline-api'
}
runtime group: "com.googlecode.texhyphj", name: "texhyphj", version: "1.2"
//runtime 'xerces:xercesImpl:2.11.0'

testCompile group: 'junit', name: 'junit', version: "$versions.junit"

testCompile "javax.inject:javax.inject:1"
testCompile "org.ops4j.pax.exam:pax-exam-junit4:$versions.paxExam"
testRuntime "org.ops4j.pax.exam:pax-exam-container-native:$versions.paxExam"
testRuntime "org.ops4j.pax.exam:pax-exam-link-mvn:$versions.paxExam"
testRuntime "org.ops4j.pax.url:pax-url-aether:$versions.paxUrl"
testRuntime "org.ops4j.pax.url:pax-url-reference:$versions.paxUrl"
testRuntime "org.ops4j.pax.url:pax-url-wrap:$versions.paxUrl"
testRuntime "org.apache.felix:org.apache.felix.framework:$versions.felix"
runtimeOnly group: "com.googlecode.texhyphj", name: "texhyphj", version: "1.2"
//runtimeOnly 'xerces:xercesImpl:2.11.0'

testImplementation group: 'junit', name: 'junit', version: "$versions.junit"

testImplementation "javax.inject:javax.inject:1"
testImplementation "org.ops4j.pax.exam:pax-exam-junit4:$versions.paxExam"
testRuntimeOnly "org.ops4j.pax.exam:pax-exam-container-native:$versions.paxExam"
testRuntimeOnly "org.ops4j.pax.exam:pax-exam-link-mvn:$versions.paxExam"
testRuntimeOnly "org.ops4j.pax.url:pax-url-aether:$versions.paxUrl"
testRuntimeOnly "org.ops4j.pax.url:pax-url-reference:$versions.paxUrl"
testRuntimeOnly "org.ops4j.pax.url:pax-url-wrap:$versions.paxUrl"
testRuntimeOnly "org.apache.felix:org.apache.felix.framework:$versions.felix"
testCompile("org.osgi:org.osgi.core:$versions.osgi")
testCompile("org.osgi:org.osgi.compendium:$versions.osgi")
}
Expand Down Expand Up @@ -154,56 +154,61 @@ task sourcesJar(type: Jar) {
from sourceSets.main.allSource
}

artifacts {
archives javadocJar, sourcesJar
}

ext.isReleaseVersion = !version.endsWith("SNAPSHOT")

signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
required { isReleaseVersion }
sign publishing.publications
}

uploadArchives {
publishing {
//Only upload if a git hash is supplied. On Travis only upload snapshots.
enabled = repoRevision.size()==40 && System.getenv("TRAVIS_BUILD_ID")!=null
repositories {
mavenDeployer {
//enabled = repoRevision.size()==40 && System.getenv("TRAVIS_BUILD_ID")!=null
publications {
maven(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
/*
if (isReleaseVersion) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
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 {
name 'dotify-cli'
packaging 'jar'
description 'Dotify CLI'
url "$repositoryURL"
}*/
pom {
name = 'dotify-cli'
packaging = 'jar'
description = 'Dotify CLI'
url = "$repositoryURL"
scm {
connection "$repositorySCM"
developerConnection "$repositorySCM"
url "$repositoryURL"
connection = "$repositorySCM"
developerConnection = "$repositorySCM"
url = "$repositoryURL"
}
licenses {
licenses {
license {
name 'LGPL'
url 'http://www.gnu.org/licenses/lgpl.html'
name = 'LGPL'
url = 'http://www.gnu.org/licenses/lgpl.html'
}
}
}
developers {
developer {
id 'joel'
name 'Joel Håkansson'
id = 'joel'
name = 'Joel Håkansson'
}
}
}
}
}
repositories {
maven {
def stagingRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : stagingRepoUrl
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
}
}

wrapper {
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
@@ -0,0 +1 @@
rootProject.name='dotify-cli'
13 changes: 5 additions & 8 deletions upload.sh
@@ -1,5 +1,5 @@
#!/bin/bash
#version: 2016-05-27
#version: 2019-03-13 (use maven publish)

branch=$TRAVIS_BRANCH
if [ -z "$branch" ]; then
Expand Down Expand Up @@ -37,12 +37,12 @@ if [ "$prop_change" = "false" ]; then
fi

if [ "$pullrequest" = "false" ]; then
if [ $branch = "master" ]; then
echo "On master branch."
if [ $branch = "master" -o "$is_release" = "false" ]; then
echo "On master branch or snapshot version."
if [ -n "$SONATYPE_USER" ]; then
if [ -n "$SONATYPE_PASSWORD" ]; then
echo "Starting upload..."
./gradlew uploadArchives -PsonatypeUsername=$SONATYPE_USER -PsonatypePassword=$SONATYPE_PASSWORD -PrepositoryRevision=$revision -Psigning.keyId=$SIGNING_KEY -Psigning.password=$SIGNING_PASSWORD -Psigning.secretKeyRingFile=secring.gpg
./gradlew publishMavenPublicationToMavenRepository -PsonatypeUsername=$SONATYPE_USER -PsonatypePassword=$SONATYPE_PASSWORD -PrepositoryRevision=$revision -Psigning.keyId=$SIGNING_KEY -Psigning.password=$SIGNING_PASSWORD -Psigning.secretKeyRingFile=secring.gpg
else
echo "SONATYPE_PASSWORD not set. Skipping upload."
fi
Expand All @@ -54,7 +54,4 @@ if [ "$pullrequest" = "false" ]; then
fi
else
echo "Pull request. Skipping upload."
fi



fi

0 comments on commit 0620219

Please sign in to comment.