forked from shivagowda/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
226 lines (202 loc) · 7.62 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import org.elasticsearch.gradle.internal.conventions.VersionPropertiesLoader
plugins {
id 'java-gradle-plugin'
id 'groovy'
id 'java-test-fixtures'
id 'elasticsearch.publish'
id 'elasticsearch.build-tools'
}
description = "The elasticsearch build tools"
// we update the version property to reflect if we are building a snapshot or a release build
// we write this back out below to load it in the Build.java which will be shown in rest main action
// to indicate this being a snapshot build or a release build.
Properties props = VersionPropertiesLoader.loadBuildSrcVersion(project.file('../build-tools-internal/version.properties'), project.getProviders())
def minRuntimeJava = JavaVersion.toVersion(file('../build-tools-internal/src/main/resources/minimumRuntimeVersion').text)
allprojects {
group = "org.elasticsearch.gradle"
version = props.getProperty("elasticsearch")
apply plugin: 'java'
apply plugin: 'elasticsearch.eclipse'
targetCompatibility = minRuntimeJava
sourceCompatibility = minRuntimeJava
}
gradlePlugin {
// We already configure publication and we don't need or want the one that comes
// with the java-gradle-plugin
automatedPublishing = false
plugins {
distributionDownload {
id = 'elasticsearch.distribution-download'
implementationClass = 'org.elasticsearch.gradle.DistributionDownloadPlugin'
}
esPlugin {
id = 'elasticsearch.esplugin'
implementationClass = 'org.elasticsearch.gradle.plugin.PluginBuildPlugin'
}
javaRestTest {
id = 'elasticsearch.java-rest-test'
implementationClass = 'org.elasticsearch.gradle.test.JavaRestTestPlugin'
}
testclusters {
id = 'elasticsearch.testclusters'
implementationClass = 'org.elasticsearch.gradle.testclusters.TestClustersPlugin'
}
reaper {
id = 'elasticsearch.reaper'
implementationClass = 'org.elasticsearch.gradle.ReaperPlugin'
}
testpermissions {
id = 'elasticsearch.test-gradle-policy'
implementationClass = 'org.elasticsearch.gradle.test.GradleTestPolicySetupPlugin'
}
yamlTests {
id = 'elasticsearch.yaml-rest-test'
implementationClass = 'org.elasticsearch.gradle.test.YamlRestTestPlugin'
}
}
}
def generateVersionProperties = tasks.register("generateVersionProperties", WriteProperties) {
outputFile = "${buildDir}/version.properties"
comment = 'Generated version properties'
properties(props)
}
tasks.named("processResources").configure {
from(generateVersionProperties)
into('META-INF') {
from configurations.reaper
}
}
sourceSets {
integTest {
compileClasspath += sourceSets["main"].output + configurations["testRuntimeClasspath"]
runtimeClasspath += output + compileClasspath
}
}
// we do not publish the test fixtures of build-tools
components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }
publishing.publications.named("elastic").configure {
suppressPomMetadataWarningsFor("testFixturesApiElements")
suppressPomMetadataWarningsFor("testFixturesRuntimeElements")
}
configurations {
integTestImplementation.extendsFrom(testFixturesApi)
integTestRuntimeOnly.extendsFrom(testRuntimeOnly)
register("reaper")
}
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
reaper project('reaper')
api localGroovy()
api gradleApi()
api 'org.apache.commons:commons-compress:1.19'
api 'org.apache.ant:ant:1.10.8'
api 'commons-io:commons-io:2.2'
testFixturesApi "junit:junit:${props.getProperty('junit')}"
testFixturesApi "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${props.getProperty('randomizedrunner')}"
testFixturesApi gradleApi()
testFixturesApi gradleTestKit()
testFixturesApi 'com.github.tomakehurst:wiremock-jre8-standalone:2.23.2'
testFixturesApi platform("org.spockframework:spock-bom:2.0-M5-groovy-3.0")
testFixturesApi("org.spockframework:spock-core") {
exclude module: "groovy"
}
integTestImplementation("org.spockframework:spock-junit4") {
because 'required as we rely on junit4 rules'
}
integTestImplementation(platform("org.junit:junit-bom:${props.getProperty('junit5')}"))
integTestImplementation("org.junit.jupiter:junit-jupiter") {
because 'allows to write and run Jupiter tests'
}
integTestRuntimeOnly("org.junit.vintage:junit-vintage-engine") {
because 'allows JUnit 3 and JUnit 4 tests to run'
}
integTestRuntimeOnly("org.junit.platform:junit-platform-launcher") {
because 'allows tests to run from IDEs that bundle older version of launcher'
}
}
tasks.register("integTest", Test) {
inputs.dir(file("src/testKit")).withPropertyName("testkit dir").withPathSensitivity(PathSensitivity.RELATIVE)
systemProperty 'test.version_under_test', version
testClassesDirs = sourceSets.integTest.output.classesDirs
classpath = sourceSets.integTest.runtimeClasspath
useJUnitPlatform()
}
normalization {
runtimeClasspath {
// We already include the reaper jar as part of our runtime classpath. Ignore the copy in META-INF.
ignore('META-INF/reaper.jar')
}
}
tasks.named("check").configure { dependsOn("integTest") }
// TODO These additional conventions will be applied once those plugins have been ported to build-conventions and
//
// apply plugin: 'elasticsearch.build'
//
// // groovydoc succeeds, but has some weird internal exception...
// tasks.named("groovydoc").configure {
// enabled = false
// }
//
// // build-tools is not ready for primetime with these...
// tasks.named("dependencyLicenses").configure { enabled = false }
// tasks.named("dependenciesInfo").configure {enabled = false }
// tasks.named("dependenciesGraph").configure {enabled = false }
// disableTasks('forbiddenApisMain', 'forbiddenApisTest', 'forbiddenApisIntegTest', 'forbiddenApisTestFixtures')
// tasks.named("jarHell").configure {
// enabled = false
// }
// tasks.named("thirdPartyAudit").configure {
// enabled = false
// }
// configurations.register("distribution")
//
//
// tasks.withType(Test).configureEach {
// // Track reaper jar as a test input using runtime classpath normalization strategy
// inputs.files(configurations.reaper).withNormalizer(ClasspathNormalizer)
// useJUnitPlatform()
// }
//
// tasks.named("test").configure {
// include("**/*TestSpec.class")
// }
//
//
// tasks.named("forbiddenPatterns").configure {
// exclude '**/*.wav'
// exclude '**/*.p12'
// exclude '**/*.jks'
// exclude '**/*.crt'
// // the file that actually defines nocommit
// exclude '**/ForbiddenPatternsTask.java'
// exclude '**/*.bcfks'
// }
//
// eclipse {
// classpath {
// plusConfigurations += [configurations.integTestRuntimeClasspath]
// }
// }
//
// tasks.named("testingConventions") {
// naming.clear()
// naming {
// Tests {
// baseClass 'org.elasticsearch.gradle.internal.test.GradleUnitTestCase'
// }
// TestSpec {
// baseClass 'spock.lang.Specification'
// }
// }
// }