forked from quenteum/ods-jenkins-shared-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
161 lines (149 loc) · 6.81 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
plugins {
id 'jacoco'
id 'groovy'
id 'codenarc'
}
group "org.ods"
version = '0.0.1-SNAPSHOT'
ext {
nexus_url = project.findProperty('nexus_url') ?: System.getenv('NEXUS_URL') ?: System.getenv('NEXUS_HOST')
nexus_user = project.findProperty('nexus_user') ?: System.getenv('NEXUS_USERNAME')
nexus_pw = project.findProperty('nexus_pw') ?: System.getenv('NEXUS_PASSWORD')
no_nexus = (project.findProperty('no_nexus') ?: System.getenv('NO_NEXUS') ?: false).toBoolean()
}
repositories {
if (no_nexus) {
println("using repositories 'jcenter' and 'mavenCentral'")
mavenLocal()
// deprecated: jcenter()
mavenCentral()
maven {
url "https://repo1.maven.org/maven2/"
mavenContent {
releasesOnly()
}
}
maven {
url "https://repo.jenkins-ci.org/releases/"
mavenContent {
releasesOnly()
}
}
} else {
println("using nexus repositories")
if (!nexus_url) {
throw new GradleException('Nexus URL not specified!')
}
def nexusMaven = { repoUrl ->
maven {
credentials {
username = "${nexus_user}"
password = "${nexus_pw}"
}
url repoUrl
}
}
// deprecated: nexusMaven("${nexus_url}/repository/jcenter/")
nexusMaven("${nexus_url}/repository/maven-public/")
nexusMaven("${nexus_url}/repository/atlassian_public/")
nexusMaven("${nexus_url}/repository/jenkins-ci-releases/")
}
}
dependencies {
// When dependencies are added here, they need to be preloaded in
// https://github.com/opendevstack/ods-core/blob/master/jenkins/master/configuration/init.groovy.d/ods-jenkins-shared-library.groovy.
// Otherwise we might run into a race condition when parallel compilation happens,
// e.g. because two pipelines are started in parallel.
// See https://github.com/opendevstack/ods-jenkins-shared-library/issues/422.
implementation "com.cloudbees:groovy-cps:1.29"
implementation "org.codehaus.groovy:groovy-all:2.4.21"
implementation "org.jenkins-ci.main:jenkins-core:2.46.3"
implementation group: 'org.jenkins-ci.plugins.workflow', name: 'workflow-api', version: '2.36', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins.workflow', name: 'workflow-step-api', version: '2.13', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins.workflow', name: 'workflow-cps', version: '2.41', ext: 'jar'
implementation 'org.slf4j:jcl-over-slf4j:1.7.30'
implementation 'ch.qos.logback:logback-classic:1.2.3'
implementation "com.konghq:unirest-java:2.4.03:standalone"
implementation "fr.opensagres.xdocreport:fr.opensagres.poi.xwpf.converter.core:2.0.2"
implementation "fr.opensagres.xdocreport:fr.opensagres.poi.xwpf.converter.pdf:2.0.2"
implementation "net.lingala.zip4j:zip4j:2.1.1"
implementation "org.apache.ivy:ivy:2.2.0"
implementation "org.apache.pdfbox:pdfbox:2.0.23"
implementation "org.apache.poi:poi:4.0.1"
implementation "org.yaml:snakeyaml:1.24"
implementation 'com.vladsch.flexmark:flexmark-all:0.60.2' // for markdown to pdf conversion (sonarqube reports)
implementation 'com.xlson.groovycsv:groovycsv:1.3'
testImplementation "org.spockframework:spock-core:1.3-groovy-2.4"
testImplementation ("com.athaydes:spock-reports:1.6.3") { transitive = false }
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.21.0'
testImplementation group: 'commons-io', name: 'commons-io', version: '2.8.0'
testImplementation group: 'com.lesfurets', name: 'jenkins-pipeline-unit', version: '1.9' // "com.lesfurets:jenkins-pipeline-unit:1.9"
testImplementation "net.bytebuddy:byte-buddy:1.10.8"
testImplementation "org.objenesis:objenesis:3.1"
testImplementation "cglib:cglib-nodep:3.3.0" // for mocking classes
testImplementation "com.github.stefanbirkner:system-rules:1.19.0" // for managing environment variables
testImplementation "com.github.tomakehurst:wiremock:2.27.2" // for mocking HTTP server responses
testImplementation "com.github.tomakehurst:wiremock-jre8:2.32.0" // for mocking HTTP server responses
testImplementation "org.hamcrest:hamcrest:2.1"
testImplementation "org.skyscreamer:jsonassert:1.5.0" // JSON Asserts
}
sourceSets {
main {
groovy {
srcDirs = ["src", "vars"]
}
}
test {
groovy {
srcDirs = ['test/groovy']
}
resources {
srcDir 'test/resources'
}
}
}
compileGroovy {
groovyOptions.configurationScript = file("gradle/config.groovy")
}
test {
testLogging {
showStandardStreams = true
}
systemProperty 'com.athaydes.spockframework.report.projectName', 'ods-jenkins-shared-library'
systemProperty 'com.athaydes.spockframework.report.projectVersion', version
maxHeapSize = "2048m"
jvmArgs "-XX:MaxPermSize=256m"
systemProperty "testRecordMode", project.findProperty('testRecordMode')?: false
systemProperty "generateExpectedPdfFiles", project.findProperty('generateExpectedPdfFiles')?: false
systemProperty "nexusURL", project.findProperty('nexusURL')?: "http://nexus.odsbox.lan:7990"
systemProperty "sonarQuURL", project.findProperty('sonarQuURL')?: "http://sonar.odsbox.lan:7990"
systemProperty "bitbucketURL", project.findProperty('bitbucketURL')?: "http://bitbucket.odsbox.lan:7990"
systemProperty "docGenURL", project.findProperty('docGenURL')?: "http://docgen.odsbox.lan:8080"
systemProperty "jiraURL", project.findProperty('jiraURL')?: "http://jira.odsbox.lan:8080"
systemProperty "domainUser", project.findProperty('domainUser')?: "openshift"
systemProperty "domainPassword", project.findProperty('domainPassword')?: "openshift"
systemProperty "nexusUser", project.findProperty('nexusUser')?: "openshift"
systemProperty "nexusPassword", project.findProperty('nexusPassword')?: "openshift"
systemProperty "wiremock.textToReplace", project.findProperty('wiremock.textToReplace')?: ""
}
codenarc {
toolVersion = '1.5'
configFile = file('codenarc.groovy')
maxPriority1Violations = 0
maxPriority2Violations = 1
maxPriority3Violations = 300
reportFormat = 'html'
}
/**
The CodeNarc plugin adds the following tasks to the project:
- codenarcMain — Runs CodeNarc against the production Groovy source files.
- codenarcTest — Runs CodeNarc against the test Groovy source files.
- codenarcSourceSet — Runs CodeNarc against the given source set’s Groovy source files.
Run locally by executing e.g. 'gradle codenarcMain', the report can be found in ./build/reports/codenarc.
*/
codenarcTest {
ignoreFailures = true
}
jacoco {
toolVersion = "0.8.6"
}