-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
127 lines (110 loc) · 3.58 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
import com.thoughtworks.go.build.DownloadFile
import com.thoughtworks.go.build.GithubArtifact
import com.thoughtworks.go.build.VerifyJarTask
import org.apache.commons.codec.digest.DigestUtils
/*
* Copyright 2017 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
configurations {
pluginsZipConfig
}
def dependencies = [
new GithubArtifact(
user: 'gocd',
repo: 'gocd-ldap-authentication-plugin',
tagName: 'v2.0.1-90',
asset: 'gocd-ldap-authentication-plugin-2.0.1-90.jar',
checksum: '53ecb45c2e45570fad585ac7ad4b2a4d9f1ae97e0fb9b81fac2495fe03c18ec0'
),
new GithubArtifact(
user: 'gocd',
repo: 'gocd-filebased-authentication-plugin',
tagName: '2.0.0',
asset: 'gocd-filebased-authentication-plugin-2.0.0-63.jar',
checksum: '0095d3a3db8059e6406ef71269cd0ca29cc1f9411f3583fc73e28aea218110f7'
),
new GithubArtifact(
user: 'gocd',
repo: 'gocd-yum-repository-poller-plugin',
tagName: 'v2.0.5-13',
asset: 'gocd-yum-repo-plugin-2.0.5-13.jar',
checksum: '405c0d3507b1621df517b2b164087615c4355d68935172d07fdd1e12bf4bf7b1'
),
new GithubArtifact(
user: 'tomzo',
repo: 'gocd-yaml-config-plugin',
tagName: '0.12.0',
asset: 'yaml-config-plugin-0.12.0.jar',
checksum: '9eeeec3f90adf8c6e96a72e879558e699da4558960d21ad4ab17a3e3b9a2ec62'
),
new GithubArtifact(
user: 'tomzo',
repo: 'gocd-json-config-plugin',
tagName: '0.5.0',
asset: 'json-config-plugin-0.5.0.jar',
checksum: '645bffcc0ee20ab5689714e28bb81fd34043eb247f3621371f434b4349279a96'
),
new GithubArtifact(
user: 'gocd',
repo: 'gocd-file-based-secrets-plugin',
tagName: 'v1.0.0-33',
asset: 'gocd-file-based-secrets-plugin-1.0.0-33.jar',
checksum: '66207eb56aa9e3df6dbe587b1fd55f681cb3bce61865fae72b824e12a8bf08ff'
)
]
task createVersionFile {
def file = file("${project.buildDir}/version.txt")
inputs.property('version', rootProject.version)
inputs.property('gitRevision', rootProject.gitRevision)
outputs.file file
doLast {
file.getParentFile().mkdirs()
file.withWriter { out ->
out.write("${rootProject.version} (${rootProject.gitRevision})")
}
}
}
task downloadPlugins {
}
task pluginsZip(type: Zip) {
finalizedBy 'verifyPluginZip'
archiveBaseName = 'plugins'
dependsOn createVersionFile
from(createVersionFile)
from(dependencies.collect { dep -> destFile(dep) })
}
task verifyPluginZip(type: VerifyJarTask) {
jarTask = pluginsZip
expectedJars = [
'/': dependencies.collect { dep -> "${dep.repo}.jar".toString() }
]
}
artifacts {
pluginsZipConfig pluginsZip
}
dependencies.each { dep ->
task "download-${dep.repo}"(type: DownloadFile) { downloadTask ->
pluginsZip.dependsOn downloadTask
downloadPlugins.dependsOn downloadTask
downloadTask.src dep.downloadUrl
downloadTask.dest destFile(dep)
downloadTask.checksum dep.checksum
}
pluginsZip.from(destFile(dep))
}
private File destFile(GithubArtifact dep) {
new File(gradle.gradleUserHomeDir, "download-cache/${DigestUtils.md5Hex(dep.downloadUrl)}/${dep.repo}.jar")
}
task prepare(dependsOn: pluginsZip)