Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
134 lines (117 sloc) 3.23 KB
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'project-report'
apply plugin: 'maven'
apply plugin: 'code-quality'
apply plugin: 'jetty'
flavor = hasProperty('switch') ? 'hudson' : 'jenkins'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.linkedin:org.linkedin.gradle-plugins:1.5.0'
}
}
apply plugin: 'org.linkedin.userConfig'
apply plugin: 'org.linkedin.spec'
repositories {
mavenRepo urls: ['http://repo.jenkins-ci.org/repo/']
mavenLocal()
mavenCentral()
}
configurations {
jenkins
hudson
}
dependencies {
compile gradleApi()
compile spec.libraries.ivy
compile spec.libraries.httpBuilder
compile spec.libraries["${flavor}Cli".toString()]
runtime 'commons-cli:commons-cli:1.2'
testCompile spec.libraries.spock
testCompile spec.libraries.junit
groovy spec.libraries.groovy
jenkins spec.libraries.jenkins
hudson spec.libraries.hudson
}
group = spec.group
version = spec.version
System.properties['HUDSON_HOME'] = "$buildDir/$flavor".toString() //force Jenkins/Hudson to run within the build workspace
test {
dependsOn jettyRunWar
//takes a while to startup and otherwise tests run while still initializing
doFirst {
boolean keepGoing = true
int tries = 0
final int maxTries = 30
final long sleep = 5000
while (keepGoing && tries < maxTries)
{
try
{
keepGoing = 'http://localhost:8080/'.toURL().text.contains('Please wait')
}
catch (e)
{
//logger.warn("Exception thrown: $e")
}
logger.warn("Waiting for $flavor ${++tries} ($sleep ms)")
Thread.sleep(sleep)
}
}
/**
* Definitely some differences here in terms of both functionality(missing who-am-i method for instance)
* and in content of returned values.
*/
if(flavor == 'hudson')
{
exclude '**/HudsonCliApiTest.class'
}
}
jar.enabled = true
[jettyRun, jettyRunWar]*.daemon = true
/**
* Use the jetty plugin to run the build server.
*/
jettyRunWar {
httpPort = 9001
dependsOn configurations."$flavor"
webApp = configurations."$flavor".resolve().find {it.name.endsWith('war')}
contextPath = ''
}
task wrapper(type: Wrapper) {
gradleVersion = '1.2'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: groovydoc) {
classifier = 'javadoc'
from groovydoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
idea{
project {
jdkName = '1.6'
languageLevel = '1.6'
ipr {
withXml { provider ->
def root = provider.asNode()
root.component.find { it.@name == 'VcsDirectoryMappings' }.mapping[0].@vcs = 'Git'
// Set gradle home
def gradleSettings = root.appendNode('component', [name: 'GradleSettings'])
gradleSettings.appendNode('option', [name: 'SDK_HOME', value: gradle.gradleHomeDir.absolutePath])
}
}
}
module {
downloadJavadoc = true
downloadSources = true
}
}