forked from jenkinsci/gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
128 lines (99 loc) · 3.04 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
import java.util.zip.ZipFile
plugins {
id "org.jenkins-ci.jpi" version "0.22.0"
id 'ru.vyarus.animalsniffer' version '1.3.0'
id 'findbugs'
id 'codenarc'
}
group = "org.jenkins-ci.plugins"
description = "This plugin adds Gradle support to Jenkins"
ext.ciBuild = System.getenv()['JENKINS_URL'] ? true : false
if (ciBuild) {
println 'This build is running on CI'
}
jenkinsPlugin {
// Version of Jenkins core this plugin depends on.
coreVersion = "1.642.1"
// Human-readable name of plugin.
displayName = "Gradle Plugin"
// URL for plugin on Jenkins wiki or elsewhere.
url = "http://wiki.jenkins-ci.org/display/JENKINS/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'
}
}
disabledTestInjection = false
}
sourceCompatibility = '1.7'
dependencies {
compile 'org.jenkins-ci.lib:dry-run-lib:0.1'
compileOnly 'org.jenkins-ci:symbol-annotation:1.3'
jenkinsPlugins 'org.jenkins-ci.plugins:structs:1.3@jar'
signature 'org.codehaus.mojo.signature:java17:1.0@signature'
testCompile 'org.spockframework:spock-core:0.7-groovy-1.8'
jenkinsTest 'org.jenkins-ci.main:jenkins-test-harness:2.8@jar'
}
if (project.hasProperty("maxParallelForks")) {
project.maxParallelForks = Integer.valueOf(project.maxParallelForks, 10)
} else {
ext.maxParallelForks = 3
}
animalsniffer {
sourceSets = [sourceSets.main]
}
configurations {
animalsnifferCompileClasspath.extendsFrom compile
// We need to exclude this dependency from animalsniffer since contains an invalid class
animalsnifferCompileClasspath.exclude group: 'com.ibm.icu', module: 'icu4j'
}
findbugs {
toolVersion '3.0.1'
// This prevents logging some errors when Findbugs tries to open files as jar files.
// See https://github.com/gradle/gradle/issues/1094.
sourceSets = [sourceSets.main]
}
findbugsMain {
classes = sourceSets.main.output
}
animalsnifferMain {
classpath = configurations.animalsnifferCompileClasspath
}
codenarc {
toolVersion '0.27.0'
sourceSets = [sourceSets.test]
}
test {
systemProperties["hudson.model.DownloadService.noSignatureCheck"] = "true"
ignoreFailures = ciBuild
maxParallelForks = project.maxParallelForks
}
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, war
doLast {
checkArchiveManifest(jar.archivePath)
checkArchiveManifest(war.archivePath)
}
}
tasks.withType(AbstractPublishToMaven) {
dependsOn checkArchiveManifests
}
defaultTasks 'test', 'jpi'