forked from apache/geode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·152 lines (132 loc) · 5.12 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
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://dl.bintray.com/palantir/releases" }
jcenter()
maven { url "http://geode-maven.s3-website-us-west-2.amazonaws.com" }
}
dependencies {
classpath "org.ajoberstar:gradle-git:1.3.2"
classpath "gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.2.0"
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2'
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.10.0"
classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.7"
classpath "com.pedjak.gradle.plugins:dockerized-test:0.5.6.2-SNAPSHOT"
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
classpath "com.netflix.nebula:nebula-project-plugin:4.0.1"
}
}
apply plugin: 'wrapper'
apply plugin: 'nebula.facet'
wrapper {
gradleVersion = minimumGradleVersion
}
// Load all properties in dependency-version.properties as project properties, so all projects can read them
Properties dependencyVersions = new Properties()
dependencyVersions.load(new FileInputStream("${project.projectDir}/gradle/dependency-versions.properties"))
dependencyVersions.keys().each{ k -> project.ext[k] = dependencyVersions[k]}
allprojects {
version = versionNumber + releaseQualifier + releaseType
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
// We want to see all test results. This is equivalent to setting --continue
// on the command line.
gradle.startParameter.continueOnFailure = true
repositories {
mavenCentral()
maven { url "http://repo.spring.io/release" }
}
group = "org.apache.geode"
buildRoot = buildRoot.trim()
if (!buildRoot.isEmpty()) {
buildDir = buildRoot + project.path.replace(":", "/") + "/build"
}
}
// allow external projects to override include location
if (name == 'geode') {
ext.scriptDir = 'gradle'
}
// utilities.gradle MUST be read before publish.gradle for reasons
apply from: "${scriptDir}/utilities.gradle"
apply from: "${scriptDir}/java.gradle"
apply from: "${scriptDir}/ide.gradle"
apply from: "${scriptDir}/dependency-resolution.gradle"
apply from: "${scriptDir}/test.gradle"
apply from: "${scriptDir}/test-by-category.gradle"
apply from: "${scriptDir}/publish.gradle"
apply from: "${scriptDir}/code-analysis.gradle"
apply from: "${scriptDir}/sonar.gradle"
apply from: "${scriptDir}/rat.gradle"
apply from: "${scriptDir}/docker.gradle"
apply from: "${scriptDir}/spotless.gradle"
subprojects {
apply plugin: 'com.github.ben-manes.versions'
}
task devBuild(dependsOn: [":assemble"]) {
description "A convenience target for a typical developer workflow: apply spotless and assemble all classes."
// spotless targets are not available until after evaluation.
subprojects {
afterEvaluate {
this.devBuild.dependsOn(project.spotlessApply)
}
}
}
def readScmInfo() {
// Attempt to read git information, or else return UNKNOWN
try {
def git = org.ajoberstar.grgit.Grgit.open(currentDir: projectDir)
try {
return [
'Source-Repository': git.branch.getCurrent().name,
'Source-Revision' : git.head().id,
'Source-Date' : git.head().getDate().format('yyyy-MM-dd HH:mm:ss Z')
] as Properties
} finally {
git.close()
}
} catch (IllegalArgumentException ignoredDistributionBuild) {
// If we're building from the source distribution, we don't have git.
// Instead, we use the .buildinfo copied to the root directory during the distribution build
// from the writeBuildInfo task below (from build/.buildinfo)
def buildInfo = file "$rootDir/.buildinfo"
if (buildInfo.exists()) {
def props = new Properties()
new FileInputStream(buildInfo).withStream { fis ->
props.load(fis)
}
return props
}
throw new GradleException("Cannot get SCM information when neither git nor source distribution is available")
}
}
task writeBuildInfo {
def buildInfo = file "$buildDir/.buildinfo"
def scmInfo = rootProject.readScmInfo()
inputs.property("Source-Revision", scmInfo.getProperty("Source-Revision"))
outputs.file buildInfo
doLast {
buildInfo.getParentFile().mkdirs()
new FileOutputStream(buildInfo).withStream { fos ->
scmInfo.store(fos, '')
}
}
}
task generate() {
group = 'Build'
description = "Top-level target for all source generation. Helps IDE integration"
}