Skip to content

Instantly share code, notes, and snippets.

@cvvs cvvs/gradle.build Secret
Created Sep 2, 2016

Embed
What would you like to do?
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'idea'
ext {
jobDslVersion = '1.48'
jenkinsVersion = '1.658'
}
sourceSets {
jobs {
groovy {
srcDirs 'jobs'
}
}
}
repositories {
jcenter()
maven {
url 'https://repo.jenkins-ci.org/public/'
}
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "http://repo.jenkins-ci.org/releases/" }
}
configurations {
testPlugins {}
jenkinsPlugins {}
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.11'
testCompile('org.spockframework:spock-core:0.7-groovy-2.0')
{
exclude module: 'groovy-all'
}
// Jenkins test harness dependencies
testCompile 'org.jenkins-ci.main:jenkins-test-harness:2.8'
testCompile "org.jenkins-ci.main:jenkins-war:${jenkinsVersion}"
testCompile "org.jenkins-ci.main:jenkins-war:${jenkinsVersion}:war-for-test@jar"
testCompile 'com.github.cfpb:jenkins-automation:-SNAPSHOT'
// Job DSL plugin including plugin dependencies
testCompile "org.jenkins-ci.plugins:job-dsl:${jobDslVersion}"
testCompile "org.jenkins-ci.plugins:job-dsl:${jobDslVersion}@jar"
testCompile 'org.jenkins-ci.plugins:structs:1.2@jar'
// Test Plugins
testPlugins 'org.jenkins-ci.plugins:slack:2.0.1'
}
task resolveTestPlugins(type: Copy) {
from configurations.testPlugins
into new File(sourceSets.test.output.resourcesDir, 'test-dependencies')
include '*.hpi'
include '*.jpi'
doLast {
def baseNames = source.collect { it.name[0..it.name.lastIndexOf('.')-1] }
new File(destinationDir, 'index').setText(baseNames.join('\n'), 'UTF-8')
}
}
test {
dependsOn tasks.resolveTestPlugins
inputs.files sourceSets.jobs.groovy.srcDirs
// set build directory for Jenkins test harness, JENKINS-26331
systemProperty 'buildDirectory', project.buildDir.absolutePath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.