-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.gradle
109 lines (98 loc) · 2.99 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
buildscript {
repositories {
jcenter()
}
}
repositories {
jcenter()
maven { url 'https://repo.spring.io/plugins-release' }
}
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'codenarc'
apply plugin: 'maven'
codenarc {
configFile = file('codenarc_rules.groovy')
toolVersion = '1.4'
}
task codenarcConsoleReport {
doLast {
println file("${codenarc.reportsDir}/main.txt").text
}
}
codenarcMain {
finalizedBy codenarcConsoleReport
reports {
html.enabled = true
text.enabled = true
}
}
// On autorise les erreurs de linter dans les tests:
codenarcTest.ignoreFailures = true
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.7'
compile 'com.cloudbees:groovy-cps:1.31'
compile 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.2'
testCompile "org.spockframework:spock-core:1.3-groovy-2.4"
testCompile "org.slf4j:slf4j-simple:1.7.30"
// The following deps are needed in order for CodeNarc to parse JenkinsHTTRequester.groovy:
compile 'org.jenkins-ci.main:jenkins-core:2.85'
compile 'org.jenkins-ci.plugins.workflow:workflow-step-api:2.13@jar'
}
sourceSets {
main {
groovy {
srcDirs = ['src', 'vars']
}
}
test {
groovy {
srcDirs = ['test']
}
}
}
test {
testLogging {
showStandardStreams = true
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
jar {
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it).matching{exclude{it.path.contains('META-INF')}} }
}
}
def env = System.env
uploadArchives {
repositories {
mavenDeployer {
pom.version = '1.1.25'
pom.artifactId = 'hesperides-jenkins-lib'
pom.groupId = 'com.vsct.dt.hesperides'
def artifactRepoUrl = env.get('ARTIFACT_REPO_URL')
if (artifactRepoUrl && artifactRepoUrl[0] == '"') {
artifactRepoUrl = artifactRepoUrl[1..-2] // in case Windows
}
def artifactRepoUsername = env.get('ARTIFACT_REPO_USERNAME')
if (artifactRepoUsername && artifactRepoUsername[0] == '"') {
artifactRepoUsername = artifactRepoUsername[1..-2] // in case Windows
}
def artifactRepoPassword = env.get('ARTIFACT_REPO_PASSWORD')
if (artifactRepoPassword && artifactRepoPassword[0] == '"') {
artifactRepoPassword = artifactRepoPassword[1..-2] // in case Windows
}
repository(url: artifactRepoUrl) {
authentication(userName: artifactRepoUsername, password: artifactRepoPassword)
}
}
}
}
test.doFirst {
if (!env.HESPERIDES_HOST) {
throw new GradleException('The environment variables $HESPERIDES_HOST is required')
}
systemProperty 'HESPERIDES_HOST', env.HESPERIDES_HOST
systemProperty 'HESPERIDES_PORT', env.HESPERIDES_PORT ?: '80'
systemProperty 'HESPERIDES_AUTH', env.HESPERIDES_AUTH
}