199 lines
5.1 KiB
Groovy
199 lines
5.1 KiB
Groovy
buildscript {
|
|
repositories {
|
|
jcenter()
|
|
|
|
maven {
|
|
url "https://plugins.gradle.org/m2/"
|
|
}
|
|
}
|
|
dependencies {
|
|
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1"
|
|
classpath "com.gradle.publish:plugin-publish-plugin:0.9.0"
|
|
classpath 'org.ysb33r.gradle:gradletest:0.5.3'
|
|
classpath "com.netflix.nebula:nebula-project-plugin:2.2.1"
|
|
}
|
|
}
|
|
|
|
apply plugin: 'codenarc'
|
|
apply plugin: 'groovy'
|
|
apply plugin: 'maven'
|
|
apply plugin: 'idea'
|
|
apply plugin: "com.jfrog.bintray"
|
|
apply plugin: "com.gradle.plugin-publish"
|
|
apply plugin: 'org.ysb33r.gradletest'
|
|
apply plugin: 'nebula.nebula-integtest'
|
|
|
|
version = '0.4.0'
|
|
group = 'com.github.lookout'
|
|
description = 'Gradle plugin for building a prim and proper Lookout service artifact'
|
|
|
|
|
|
// Dependency management
|
|
////////////////////////
|
|
configurations {
|
|
gradleTest.extendsFrom compile
|
|
}
|
|
|
|
repositories {
|
|
jcenter()
|
|
|
|
maven {
|
|
url "https://plugins.gradle.org/m2/"
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compile gradleApi()
|
|
compile localGroovy()
|
|
|
|
/* Git Gradle plugin (base components) */
|
|
compile "org.ajoberstar:grgit:1.1.0+"
|
|
|
|
/* asciidoctor gradle plugin */
|
|
compile "org.asciidoctor:asciidoctor-gradle-plugin:1.5.2"
|
|
|
|
/* dependency lock plugin */
|
|
compile "com.netflix.nebula:gradle-dependency-lock-plugin:2.2.3+"
|
|
|
|
/* JRuby related plugins */
|
|
['jruby-gradle-plugin', 'jruby-gradle-jar-plugin'].each {
|
|
compile "com.github.jruby-gradle:${it}:0.3.2"
|
|
}
|
|
|
|
/* Shadow jar plugin for building self-contained (Scala) jar artifacts */
|
|
compile "com.github.jengelman.gradle.plugins:shadow:1.2.1+"
|
|
|
|
|
|
/* Required for generating the YAML-based etc/metadata.conf for a service
|
|
* artifact
|
|
*/
|
|
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.5.4'
|
|
compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.4'
|
|
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.4'
|
|
|
|
testCompile('org.spockframework:spock-core:1.0-groovy-2.3') {
|
|
exclude module: 'groovy-all'
|
|
}
|
|
testCompile 'cglib:cglib-nodep:2.2.+'
|
|
|
|
|
|
integTestCompile('com.netflix.nebula:nebula-test:2.2.2+') {
|
|
/* the nebula-test dependency pulls in a conflicting version of Groovy
|
|
* so let's use the one we already have sitting around
|
|
*/
|
|
exclude module: 'groovy-all'
|
|
}
|
|
}
|
|
////////////////////////
|
|
|
|
|
|
// Tasks
|
|
////////
|
|
test {
|
|
maxParallelForks 2
|
|
testLogging {
|
|
/* we want more test failure information, see:
|
|
* <http://mrhaki.blogspot.com/2013/05/gradle-goodness-show-more-information.html>
|
|
*/
|
|
exceptionFormat = 'full'
|
|
events "passed", "skipped", "failed", "standardOut", "standardError"
|
|
}
|
|
}
|
|
|
|
/* Whenever we're building an artifact, we should run the tests */
|
|
assemble.dependsOn check
|
|
jar.dependsOn check
|
|
|
|
gradleTest {
|
|
/*
|
|
* according to ysb33r there's not enough of a difference in APIs between
|
|
* version 2.0->2.2 and 2.2->2.4 to be worth testing
|
|
*/
|
|
versions '2.0', '2.2', '2.4'
|
|
dependsOn jar
|
|
}
|
|
|
|
integrationTest.testLogging {
|
|
/* we want more test failure information, see:
|
|
* <http://mrhaki.blogspot.com/2013/05/gradle-goodness-show-more-information.html>
|
|
*/
|
|
exceptionFormat = 'full'
|
|
events "passed", "skipped", "failed", "standardOut", "standardError"
|
|
}
|
|
check.dependsOn integrationTest
|
|
|
|
codenarc {
|
|
sourceSets = [sourceSets.main]
|
|
configFile = file('gradle/codenarc.xml')
|
|
}
|
|
assemble.dependsOn codenarcMain
|
|
////////
|
|
|
|
|
|
|
|
// Release/publication
|
|
//////////////////////
|
|
/* Add the sources jar to the list of artifacts to publish */
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
classifier = 'sources'
|
|
from sourceSets.main.allSource
|
|
}
|
|
task groovydocJar(type: Jar, dependsOn: groovydoc) {
|
|
classifier = 'groovydoc'
|
|
from groovydoc.destinationDir
|
|
}
|
|
|
|
artifacts {
|
|
archives sourcesJar
|
|
archives groovydocJar
|
|
}
|
|
|
|
bintray {
|
|
user = project.bintrayUser
|
|
key = project.bintrayKey
|
|
publish = true
|
|
dryRun = false
|
|
configurations = ['archives']
|
|
|
|
pkg {
|
|
userOrg = 'lookout'
|
|
repo = 'systems'
|
|
name = 'service-artifact-plugin'
|
|
labels = ['gradle', 'jruby', 'git', 'microservice']
|
|
|
|
version {
|
|
name = project.version
|
|
vcsTag = "v${project.version}"
|
|
desc = project.description
|
|
attributes = ['gradle-plugin' : 'com.github.lookout.service-artifact:com.github.lookout:service-artifact-plugin']
|
|
}
|
|
}
|
|
}
|
|
bintrayUpload.dependsOn assemble
|
|
|
|
pluginBundle {
|
|
website = 'https://github.com/lookout/service-artifact-gradle-plugin'
|
|
vcsUrl = 'https://github.com/lookout/service-artifact-gradle-plugin'
|
|
description = project.description
|
|
tags = ['jruby', 'microservice', 'service']
|
|
|
|
plugins {
|
|
serviceArtifactPlugin {
|
|
id = 'com.github.lookout.service-artifact'
|
|
displayName = 'Service Artifact Plugin'
|
|
}
|
|
}
|
|
}
|
|
|
|
task publish(type: Exec) {
|
|
group 'Publishing'
|
|
description "Tag and publish the plugin"
|
|
dependsOn bintrayUpload, publishPlugins
|
|
commandLine 'git', 'tag', "v${project.version}"
|
|
}
|
|
|
|
//////////////////////
|
|
|
|
|
|
defaultTasks 'check', 'assemble', 'gradleTest'
|