forked from spinnaker/spinnaker-dependencies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
111 lines (91 loc) · 3.25 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
buildscript {
repositories {
jcenter()
maven { url "http://spinnaker.bintray.com/gradle" }
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.netflix.nebula:nebula-release-plugin:8.0.3'
classpath 'com.netflix.spinnaker.gradle:spinnaker-dependency-bump-plugin:5.2.1'
}
}
apply plugin: 'idea'
apply plugin: 'nebula.nebula-release'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
apply plugin: 'maven'
group = 'com.netflix.spinnaker'
description = 'Common dependencies for Spinnaker'
release {
defaultVersionStrategy = nebula.plugin.release.NetflixOssStrategies.SNAPSHOT
}
publishing {
publications {
spinnakerDependencies(MavenPublication) {
artifact 'src/spinnaker-dependencies.yml'
}
}
}
def prop = { String name ->
project.hasProperty(name) ? project.property(name) : ''
}
bintray {
user = prop('bintrayUser')
key = prop('bintrayKey')
publications = ['spinnakerDependencies']
publish = true
dryRun = false
pkg {
userOrg = 'spinnaker'
repo = 'spinnaker'
name = project.name
desc = prop('description')
licenses = ['Apache-2.0']
websiteUrl = 'https://github.com/spinnaker/spinnaker-dependencies'
vcsUrl = 'https://github.com/spinnaker/spinnaker-dependencies.git'
issueTrackerUrl = 'https://github.com/spinnaker/spinnaker/issues'
attributes = [:]
version {
name = project.version
vcsTag = "v${project.version}"
attributes = [:]
}
}
}
project.gradle.taskGraph.whenReady { graph ->
bintrayUpload.onlyIf {
graph.hasTask(':final') || graph.hasTask(':candidate')
}
}
task('updateDependencies', description: "Rebuilds spinnaker-dependencies.yml based on Spring's platform BOM.") << {
/*
* Use http://platform.spring.io/platform/ as the basis for making suggested changes to spinnaker-dependencies.yml
*/
def platformVersion = 'Brussels-SR14'
def repo = (platformVersion.endsWith('-BUILD-SNAPSHOT')) ?
'https://repo.spring.io/snapshot' :
(platformVersion.contains('-RC') || platformVersion.contains('-M')) ?
'https://repo.spring.io/milestone' :
'https://repo.spring.io/release'
def group = "io.spring.platform".replaceAll('\\.', '/')
def artifact = "platform-bom"
def path = "${repo}/${group}/${artifact}/${platformVersion}/${artifact}-${platformVersion}.properties"
println "Fetching ${platformVersion} platform from ${path}..."
Properties props = new Properties()
path.toURL().openStream().withStream { propertyStream ->
props.load(propertyStream)
}
def updatedListOfDeps = new File('src/spinnaker-dependencies.template').text
println "Updating version settings based on ${platformVersion}..."
props.keySet().each { lib ->
updatedListOfDeps = updatedListOfDeps.replaceAll('\\{\\{' + lib + '}}', props.getProperty(lib))
}
new File('src/spinnaker-dependencies.yml').withWriter { writer ->
writer.write(updatedListOfDeps)
}
}
tasks.build.dependsOn(updateDependencies)
tasks.bintrayUpload.dependsOn(build)
tasks.publishToMavenLocal.dependsOn(build)
tasks.release.dependsOn(updateDependencies, bintrayUpload)
apply plugin: com.netflix.spinnaker.gradle.dependency.SpinnakerDependencyBumpPlugin