prepare for jar publication
This commit is contained in:
parent
34a9409f46
commit
3f351feab9
@ -8,5 +8,12 @@ script:
|
||||
- ./gradlew check
|
||||
- ./gradlew javadoc
|
||||
- ./gradlew jacocoTestReport
|
||||
deploy:
|
||||
provider: script
|
||||
skip_cleanup: true
|
||||
script: ./gradlew bintrayUpload -Ddeployment=true
|
||||
on:
|
||||
tags: true
|
||||
jdk: oraclejdk8
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
55
build.gradle
55
build.gradle
@ -1,11 +1,38 @@
|
||||
buildscript {
|
||||
project.ext.DEPLOYMENT = System.getProperty('deployment') ?: false
|
||||
project.ext.VCS_TAG = System.getProperty('TRAVIS_TAG') ?: System.getenv('TRAVIS_TAG')
|
||||
project.ext.POM = [
|
||||
groupId : 'ch.streamly',
|
||||
artifactId : 'chronicle-flux',
|
||||
description: 'A reactive driver for Chronicle-Queue.',
|
||||
developers : [
|
||||
[
|
||||
id : 'mgabriel',
|
||||
name : 'Mathieu Gabriel',
|
||||
email: 'dev@streamly.ch'
|
||||
]
|
||||
]]
|
||||
project.ext.INFO = [
|
||||
repo : 'https://github.com/matgabriel/chronicle-flux.git',
|
||||
url : 'https://github.com/matgabriel/chronicle-flux',
|
||||
github : 'https://github.com/matgabriel/chronicle-flux',
|
||||
githubIssues: 'https://github.com/matgabriel/chronicle-flux/issues'
|
||||
]
|
||||
project.ext.BINTRAY = [
|
||||
repo : 'streamly-repo',
|
||||
name : 'ch.streamly:chronicle-flux',
|
||||
organization: 'streamly',
|
||||
userName : System.getenv('BINTRAY_USER'),
|
||||
apiToken : System.getenv('BINTRAY_API_TOKEN')
|
||||
]
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
group 'ch.streamly'
|
||||
group POM.groupId
|
||||
|
||||
|
||||
apply plugin: 'java'
|
||||
@ -13,7 +40,7 @@ apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'jacoco'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
def chronicleVersion = '5.16.8'
|
||||
def reactorVersion = '3.1.7.RELEASE'
|
||||
@ -22,6 +49,15 @@ repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
if (DEPLOYMENT) {
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
|
||||
println 'Applying deployment scripts'
|
||||
apply from: './scripts/bintray-deploy.gradle'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.slf4j:slf4j-api:1.7.25"
|
||||
compile "io.projectreactor:reactor-core:$reactorVersion"
|
||||
@ -48,6 +84,21 @@ jacocoTestReport {
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
javadoc.failOnError = false
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
archives javadocJar
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,6 @@
|
||||
#Mon Aug 20 10:35:14 CEST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip
|
||||
|
83
scripts/bintray-deploy.gradle
Normal file
83
scripts/bintray-deploy.gradle
Normal file
@ -0,0 +1,83 @@
|
||||
project.ext.getDeploymentVersion = {
|
||||
String tmpDeploymentVersion = VCS_TAG.replaceFirst("v", "");
|
||||
if (!tmpDeploymentVersion.matches("\\d+\\.\\d+\\.\\d+")) {
|
||||
throw new RuntimeException("Version is not valid. Correct format is like 1.0.2 but was " + tmpDeploymentVersion)
|
||||
}
|
||||
return tmpDeploymentVersion;
|
||||
}
|
||||
|
||||
bintrayUpload.doFirst {
|
||||
println "Deploying version ${getDeploymentVersion()} from vscTag ${VCS_TAG}"
|
||||
}
|
||||
|
||||
def pomConfig = {
|
||||
licenses {
|
||||
license {
|
||||
name "The Apache Software License, Version 2.0"
|
||||
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
distribution "repo"
|
||||
}
|
||||
}
|
||||
developers {
|
||||
POM.developers.each { dev ->
|
||||
developer {
|
||||
id dev.id
|
||||
name dev.name
|
||||
email dev.email
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scm {
|
||||
connection "scm:git:${INFO.repo}"
|
||||
developerConnection "scm:git:${INFO.repo}"
|
||||
url "${INFO.repo}"
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenPublication(MavenPublication) {
|
||||
from components.java
|
||||
artifact sourcesJar {
|
||||
classifier "sources"
|
||||
}
|
||||
artifact javadocJar {
|
||||
classifier "javadoc"
|
||||
}
|
||||
groupId POM.groupId
|
||||
artifactId POM.artifactId
|
||||
version getDeploymentVersion()
|
||||
pom.withXml {
|
||||
def root = asNode()
|
||||
root.appendNode('description', POM.description)
|
||||
root.appendNode('name', POM.artifactId)
|
||||
root.appendNode('url', INFO.url)
|
||||
root.children().last() + pomConfig
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bintray {
|
||||
user = BINTRAY.userName
|
||||
key = BINTRAY.apiToken
|
||||
publications = ['mavenPublication']
|
||||
dryRun = !DEPLOYMENT // Whether to run this as dry-run, without deploying
|
||||
publish = DEPLOYMENT // Whether version should be auto published after an upload
|
||||
override = false // Whether to override version artifacts already published
|
||||
|
||||
pkg {
|
||||
repo = BINTRAY.repo
|
||||
name = BINTRAY.name
|
||||
userOrg = BINTRAY.organization
|
||||
licenses = ['Apache-2.0']
|
||||
vcsUrl = INFO.repo
|
||||
version {
|
||||
name = getDeploymentVersion()
|
||||
desc = getDeploymentVersion()
|
||||
released = new Date()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user