Skip to content

Commit

Permalink
Merge hotfix/v0.1.1 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
dathoangse authored May 18, 2019
2 parents ce8a44d + bf7ae1e commit 040b29c
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 84 deletions.
14 changes: 10 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ jobs:
if: tag =~ ^v
script:
- ./prepare_before_publish
- ./gradlew publish

after_script:
- ./clean_after_publish
- ./gradlew core:publish
- ./cleanup_after_publish

# - stage: release
# name: "Publish snapshot"
# if: branch =~ ^(hotfix|release)\/.*
# script:
# - ./prepare_before_publish
# - ./gradlew core:publish -PSNAPSHOT=true
# - ./cleanup_after_publish
158 changes: 83 additions & 75 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@
plugins {
// Apply the java-library plugin to add support for Java Library
id 'java-library'
id 'maven-publish'
id 'signing'
}

repositories {
jcenter()
}

dependencies {
compile project(':core')
compile project(':simple-middlewares')
}

allprojects {
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'pmd'
apply plugin: 'findbugs'
apply plugin: 'maven-publish'
apply plugin: 'signing'

checkstyle {
toolVersion = '8.18'
Expand Down Expand Up @@ -54,100 +59,103 @@ allprojects {
options.compilerArgs << "-Werror"
}
}
}

task sourceJar(type: Jar) {
classifier "sources"
from sourceSets.main.allJava
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier "javadoc"
from javadoc.destinationDir
}
task sourceJar(type: Jar) {
classifier "sources"
from sourceSets.main.allJava
}

artifacts {
archives jar
archives sourceJar
archives javadocJar
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier "javadoc"
from javadoc.destinationDir
}

publishing {
publications {
mavenJava(MavenPublication) {
customizePom(pom)
groupId 'net.dathoang.cqrs.commandbus'
artifactId 'core'
version '0.1.0'
artifacts {
archives jar
archives sourceJar
archives javadocJar
}

from components.java
publishing {
publications {
mavenJava(MavenPublication) {
customizePom(pom)
groupId 'net.dathoang.cqrs.commandbus'
version '0.1.1'

artifact(sourceJar) {
classifier = 'sources'
}
artifact(javadocJar) {
classifier = 'javadoc'
}
from components.java

// Create the sign pom artifact
pom.withXml {
def pomFile = file("${project.buildDir}/generated-pom.xml")
writeTo(pomFile)
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
artifact(pomAscFile) {
classifier = null
extension = 'pom.asc'
artifact(sourceJar) {
classifier = 'sources'
}
artifact(javadocJar) {
classifier = 'javadoc'
}
}

// Create the signed artifacts
project.tasks.signArchives.signatureFiles.each {
artifact(it) {
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
if (matcher.find()) {
classifier = matcher.group(1)
} else {
// Create the sign pom artifact
pom.withXml {
def pomFile = file("${project.buildDir}/generated-pom.xml")
writeTo(pomFile)
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
artifact(pomAscFile) {
classifier = null
extension = 'pom.asc'
}
}

// Create the signed artifacts
project.tasks.signArchives.signatureFiles.each {
artifact(it) {
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
if (matcher.find()) {
classifier = matcher.group(1)
} else {
classifier = null
}
extension = 'jar.asc'
}
extension = 'jar.asc'
}
}
}
}
repositories {
maven {
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
credentials {
username project.properties['CQRS_COMMANDBUS_SONATYPE_USERNAME']
password project.properties['CQRS_COMMANDBUS_SONATYPE_PASSWORD']
repositories {
maven {
if (project.properties['SNAPSHOT'] != 'true') {
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
} else {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
credentials {
username project.properties['CQRS_COMMANDBUS_SONATYPE_USERNAME']
password project.properties['CQRS_COMMANDBUS_SONATYPE_PASSWORD']
}
}
}
}
}

model {
tasks.generatePomFileForMavenJavaPublication {
destination = file("$buildDir/generated-pom.xml")
}
model {
tasks.generatePomFileForMavenJavaPublication {
destination = file("$buildDir/generated-pom.xml")
}

tasks.publishMavenJavaPublicationToMavenLocal {
dependsOn project.tasks.signArchives
}
tasks.publishMavenJavaPublicationToMavenRepository {
dependsOn project.tasks.signArchives
tasks.publishMavenJavaPublicationToMavenLocal {
dependsOn project.tasks.signArchives
}
tasks.publishMavenJavaPublicationToMavenRepository {
dependsOn project.tasks.signArchives
}
}
}

signing {
sign configurations.archives
}
signing {
sign configurations.archives
}

gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof Sign }) {
allprojects {
ext."signing.keyId" = project.properties['CQRS_COMMANDBUS_SIGNING_KEY_ID']
ext."signing.secretKeyRingFile" = project.properties['CQRS_COMMANDBUS_SECRET_KEYRING_FILE']
ext."signing.password" = project.properties['CQRS_COMMANDBUS_SIGNING_PASSWORD']
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof Sign }) {
allprojects {
ext."signing.keyId" = project.properties['CQRS_COMMANDBUS_SIGNING_KEY_ID']
ext."signing.secretKeyRingFile" = project.properties['CQRS_COMMANDBUS_SECRET_KEYRING_FILE']
ext."signing.password" = project.properties['CQRS_COMMANDBUS_SIGNING_PASSWORD']
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cleanup_after_publish
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

rm -f .secret_ring
rm -f core/.secret_ring
8 changes: 8 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ jacocoTestReport {
html.enabled false
}
}

publishing {
publications {
mavenJava(MavenPublication) {
artifactId 'core'
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface PipelineContextContainer {
* Get the handling data of the middleware for the current command.
* @param middlewareClass the class of the current middleware (for name-spacing)
* @param key the key of the data
* @return the data at key {@param key} for the middleware {@param middlewareClass}
* @return the data at key key for the middleware middlewareClass
*/
Object getMiddlewareData(Class<? extends Middleware> middlewareClass, String key);

Expand All @@ -26,7 +26,7 @@ public interface PipelineContextContainer {
void setMiddlewareData(Class<? extends Middleware> middlewareClass, String key, Object value);

/**
* Set the context instance {@param instance} to be injected into inner middleware in the pipeline
* Set the context instance to be injected into inner middleware in the pipeline
* or into the command handler.
* The current middleware's context injection supports:
* - Method injection
Expand All @@ -37,7 +37,7 @@ public interface PipelineContextContainer {
* {@link MiddlewareContext} annotation instead of @Context annotation.
*
* @param contextClass the class type of the context.
* @param instance the context instance which will be provided to the inner middleware & command
* @param instance the context instance which will be provided to the inner middleware and command
* handler.
* @param <R> the type of the context.
*/
Expand Down
2 changes: 1 addition & 1 deletion prepare_before_publish
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

echo $CQRS_COMMANDBUS_GPG_SECRET_RING_BASE64 | base64 --decode > .secret_ring
echo $CQRS_COMMANDBUS_GPG_SECRET_RING_BASE64 | base64 --decode > core/.secret_ring

0 comments on commit 040b29c

Please sign in to comment.