Skip to content

Commit

Permalink
latest jmad-core. Deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
andreacalia committed May 16, 2018
1 parent 8712db9 commit 41a6e7b
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 1 deletion.
45 changes: 44 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,49 @@
buildscript {
project.ext.DEPLOYMENT = System.getProperty('deployment') ?: false
project.ext.VCS_TAG = System.getProperty('TRAVIS_TAG') ?: System.getenv('TRAVIS_TAG')
project.ext.POM = [
groupId : 'jmad',
artifactId : 'jmad-modelpack-service',
description: 'Service to retrieve JMad model packages from different sources.'
]
project.ext.INFO = [
repo : 'https://github.com/jmad/jmad-modelpack-service.git',
url : 'https://jmad.github.io/',
github : 'https://github.com/jmad/jmad-modelpack-service',
githubIssues : 'https://github.com/jmad/jmad-modelpack-service/issues',
licenseNameShort: 'Apache-2.0',
licenseName : 'The Apache License, Version 2.0',
licenseUrl : 'http://www.apache.org/licenses/LICENSE-2.0.txt'
]
project.ext.BINTRAY = [
repo : 'jmad-repo',
name : 'jmad-modelpack-service',
organization: 'jmad',
userName : System.getProperty('BINTRAY_USER') ?: System.getenv('BINTRAY_USER'),
apiToken : System.getProperty('BINTRAY_API_TOKEN') ?: System.getenv('BINTRAY_API_TOKEN')
]

repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}

}

plugins {
id 'java'
id 'jacoco'
id 'maven-publish'
id 'com.jfrog.bintray' version '1.7.3'
}

sourceCompatibility = JavaVersion.VERSION_1_8

if (DEPLOYMENT) {
println 'Applying deployment scripts'
apply from: './scripts/bintray-deploy.gradle'
}

repositories {
Expand All @@ -9,7 +52,7 @@ repositories {
}

dependencies {
compile group: 'jmad', name: 'jmad-core', version: '0.1.1'
compile group: 'jmad', name: 'jmad-core', version: '0.1.2'

compile group: 'org.springframework', name: 'spring-core', version: '5.0.6.RELEASE'
compile group: 'org.springframework', name: 'spring-context', version: '5.0.6.RELEASE'
Expand Down
77 changes: 77 additions & 0 deletions scripts/bintray-deploy.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
project.ext.getDeploymentVersion = {
if(VCS_TAG == null) {
throw new RuntimeException("VCS_TAG is not set. Cannot detect deployment version")
}
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}"
}

bintray {
user = "${BINTRAY.userName}"
key = "${BINTRAY.apiToken}"

publications = ['CustomMavenPublication']
// When uploading Maven-based publication files. Nebula is because we're using the netflix plugins and they use nebula as default name for a publication
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}"
websiteUrl = "${INFO.github}"
issueTrackerUrl = "${INFO.githubIssues}"
vcsUrl = "${INFO.repo}"
licenses = [INFO.licenseNameShort]

version {
name = getDeploymentVersion()
released = new Date()
vcsTag = VCS_TAG
gpg { sign = true }
}
}
}

def pomExtraInfo = {
url INFO.url
scm {
connection "scm:git:${INFO.repo}"
developerConnection "scm:git:${INFO.repo}"
url INFO.repo
}
licenses {
license {
name INFO.licenseName
url INFO.licenseUrl
}
}
}

publishing {
publications {
CustomMavenPublication(MavenPublication) {
groupId POM.groupId
artifactId POM.artifactId
version getDeploymentVersion()

artifact sourcesJar
artifact javadocJar

pom.withXml {
asNode().appendNode('description', POM.description)
asNode().children().last() + pomExtraInfo
}

from components.java
}
}
}

0 comments on commit 41a6e7b

Please sign in to comment.