forked from jenkinsci/gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
165 lines (132 loc) · 4.26 KB
/
build.gradle
File metadata and controls
165 lines (132 loc) · 4.26 KB
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
162
163
164
165
import java.util.zip.ZipFile
plugins {
id 'org.gradle.test-retry' version '1.0.0'
id 'org.jenkins-ci.jpi' version '0.39.0'
id 'ru.vyarus.animalsniffer' version '1.5.0'
id 'com.github.spotbugs' version '3.0.0'
id 'codenarc'
}
group = 'org.jenkins-ci.plugins'
description = 'This plugin adds Gradle support to Jenkins'
ext {
coreBaseVersion = '2.138'
corePatchVersion = '4'
coreBomVersion = '3'
}
jenkinsPlugin {
// Version of Jenkins core this plugin depends on.
coreVersion = "${coreBaseVersion}.${corePatchVersion}"
// Human-readable name of plugin.
displayName = 'Gradle Plugin'
// URL for plugin on Jenkins wiki or elsewhere.
url = 'https://github.com/jenkinsci/gradle-plugin'
// Plugin URL on GitHub. Optional.
gitHubUrl = 'https://github.com/jenkinsci/gradle-plugin'
// Plugin ID, defaults to the project name without trailing '-plugin'
shortName = 'gradle'
compatibleSinceVersion = '1.0'
developers {
developer {
id = 'wolfs'
name = 'Stefan Wolf'
}
}
licenses {
license {
name = 'MIT License'
distribution = 'repo'
url = 'https://opensource.org/licenses/MIT'
}
}
disabledTestInjection = false
}
java {
sourceCompatibility = 'VERSION_1_8'
}
dependencies {
api platform("io.jenkins.tools.bom:bom-${coreBaseVersion}.x:${coreBomVersion}")
implementation 'org.jenkins-ci.plugins:structs'
implementation 'org.jenkins-ci.plugins.workflow:workflow-api'
implementation 'org.jenkins-ci.plugins.workflow:workflow-cps'
implementation 'org.jenkins-ci.plugins.workflow:workflow-job'
implementation 'org.jenkins-ci.plugins.workflow:workflow-basic-steps'
implementation 'org.jenkins-ci.plugins.workflow:workflow-durable-task-step'
implementation 'org.jenkins-ci.plugins.workflow:workflow-step-api'
signature 'org.codehaus.mojo.signature:java18:1.0@signature'
testImplementation 'org.jenkins-ci.main:jenkins-test-harness:2.56'
testImplementation 'org.jenkins-ci.main:jenkins-test-harness-tools:2.2'
testImplementation 'io.jenkins:configuration-as-code:1.4'
testImplementation 'org.jenkins-ci.plugins:timestamper:1.8.10'
testImplementation 'org.jenkins-ci.plugins:pipeline-stage-step:2.3'
testImplementation 'org.spockframework:spock-core:1.2-groovy-2.4'
jenkinsServer 'org.jenkins-ci.plugins:git'
}
if (project.hasProperty('maxParallelForks')) {
project.maxParallelForks = Integer.valueOf(project.maxParallelForks, 10)
} else {
ext.maxParallelForks = 3
}
animalsniffer {
toolVersion = '1.18'
sourceSets = [sourceSets.main]
// We need to exclude this dependency from animalsniffer since it contains an invalid class
excludeJars 'icu4j-*'
}
spotbugs {
toolVersion '3.1.12'
// This prevents logging some errors when SpotBugs tries to open files as jar files.
// See https://github.com/gradle/gradle/issues/1094.
sourceSets = [sourceSets.main]
}
tasks.named("spotbugsMain", com.github.spotbugs.SpotBugsTask) {
classpath = sourceSets.main.compileClasspath
}
spotbugsMain {
classes = sourceSets.main.output
}
codenarc {
toolVersion '1.5'
sourceSets = [sourceSets.test]
}
test {
systemProperties['hudson.model.DownloadService.noSignatureCheck'] = 'true'
ignoreFailures = gradle.ciBuild
maxParallelForks = project.maxParallelForks
retry {
maxRetries = 1
maxFailures = 10
}
}
def checkArchiveManifest(File archive) {
new ZipFile(archive).withCloseable { archiveZip ->
archiveZip.getInputStream(archiveZip.getEntry('META-INF/MANIFEST.MF')).withStream {
assert it.text.contains("Plugin-Version: ${project.version}"): "Wrong metadate in file ${archive} - run a clean build"
}
}
}
tasks.withType(AbstractArchiveTask) {
inputs.property('pluginVersion') {
project.version
}
}
task checkArchiveManifests {
dependsOn jar, jpi
doLast {
checkArchiveManifest(jar.archiveFile.get().asFile)
checkArchiveManifest(jpi.archiveFile.get().asFile)
}
}
tasks.withType(AbstractPublishToMaven) {
dependsOn checkArchiveManifests
}
defaultTasks.add 'test'
defaultTasks.add 'jpi'
task createWrapperZip(type: Zip) {
archiveFileName = 'wrapper.zip'
destinationDirectory = new File(sourceSets.test.output.resourcesDir, 'gradle')
from(project.rootDir) {
include('gradle/**')
include('gradlew*')
}
}
processTestResources.dependsOn(createWrapperZip)