Skip to content

Commit be8ce3b

Browse files
committed
Merge remote-tracking branch 'elastic/master' into allowed-index-store-types
* elastic/master: (89 commits) Fix assertion in AbstractSimpleTransportTestCase (elastic#32991) [DOC] Splits role mapping APIs into separate pages (elastic#32797) HLRC: ML Close Job (elastic#32943) Generalize remote license checker (elastic#32971) Trim translog when safe commit advanced (elastic#32967) Fix an inaccuracy in the dynamic templates documentation. (elastic#32890) Logging: Use settings when building daemon threads (elastic#32751) All Translog inner closes should happen after tragedy exception is set (elastic#32674) HLREST: AwaitsFix ML Test Pass DiscoveryNode to initiateChannel (elastic#32958) Add mzn and dz to unsupported locales (elastic#32957) Use settings from the context in BootstrapChecks (elastic#32908) Update docs for node specifications (elastic#30468) HLRC: Forbid all Elasticsearch logging infra (elastic#32784) Only configure publishing if it's applied externally (elastic#32351) Fixes libs:dissect when in eclipse Protect ScriptedMetricIT test cases against failures on 0-doc shards (elastic#32959) (elastic#32968) [Kerberos] Add documentation for Kerberos realm (elastic#32662) Watcher: Properly find next valid date in cron expressions (elastic#32734) Fix some small issues in the getting started docs (elastic#30346) ...
2 parents 6d36f73 + cd83ddc commit be8ce3b

File tree

552 files changed

+16167
-6016
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

552 files changed

+16167
-6016
lines changed

build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,15 @@ subprojects {
8787
}
8888
}
8989
}
90+
repositories {
91+
maven {
92+
name = 'localTest'
93+
url = "${rootProject.buildDir}/local-test-repo"
94+
}
95+
}
9096
}
9197
}
98+
9299
plugins.withType(BuildPlugin).whenPluginAdded {
93100
project.licenseFile = project.rootProject.file('licenses/APACHE-LICENSE-2.0.txt')
94101
project.noticeFile = project.rootProject.file('NOTICE.txt')
@@ -228,6 +235,7 @@ subprojects {
228235
"org.elasticsearch.client:elasticsearch-rest-high-level-client:${version}": ':client:rest-high-level',
229236
"org.elasticsearch.client:test:${version}": ':client:test',
230237
"org.elasticsearch.client:transport:${version}": ':client:transport',
238+
"org.elasticsearch.plugin:elasticsearch-scripting-painless-spi:${version}": ':modules:lang-painless:spi',
231239
"org.elasticsearch.test:framework:${version}": ':test:framework',
232240
"org.elasticsearch.distribution.integ-test-zip:elasticsearch:${version}": ':distribution:archives:integ-test-zip',
233241
"org.elasticsearch.distribution.zip:elasticsearch:${version}": ':distribution:archives:zip',

buildSrc/build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,24 @@ if (project != rootProject) {
162162
// it's fine as we run them as part of :buildSrc
163163
test.enabled = false
164164
task integTest(type: Test) {
165+
// integration test requires the local testing repo for example plugin builds
166+
dependsOn project.rootProject.allprojects.collect {
167+
it.tasks.matching { it.name == 'publishNebulaPublicationToLocalTestRepository'}
168+
}
165169
exclude "**/*Tests.class"
166170
include "**/*IT.class"
167171
testClassesDirs = sourceSets.test.output.classesDirs
168172
classpath = sourceSets.test.runtimeClasspath
169173
inputs.dir(file("src/testKit"))
174+
// tell BuildExamplePluginsIT where to find the example plugins
175+
systemProperty (
176+
'test.build-tools.plugin.examples',
177+
files(
178+
project(':example-plugins').subprojects.collect { it.projectDir }
179+
).asPath,
180+
)
181+
systemProperty 'test.local-test-repo-path', "${rootProject.buildDir}/local-test-repo"
182+
systemProperty 'test.lucene-snapshot-revision', (versions.lucene =~ /\w+-snapshot-([a-z0-9]+)/)[0][1]
170183
}
171184
check.dependsOn(integTest)
172185

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,11 +528,12 @@ class BuildPlugin implements Plugin<Project> {
528528
project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom generatePOMTask ->
529529
// The GenerateMavenPom task is aggressive about setting the destination, instead of fighting it,
530530
// just make a copy.
531+
generatePOMTask.ext.pomFileName = "${project.archivesBaseName}-${project.version}.pom"
531532
doLast {
532533
project.copy {
533534
from generatePOMTask.destination
534535
into "${project.buildDir}/distributions"
535-
rename { "${project.archivesBaseName}-${project.version}.pom" }
536+
rename { generatePOMTask.ext.pomFileName }
536537
}
537538
}
538539
// build poms with assemble (if the assemble task exists)
@@ -554,7 +555,7 @@ class BuildPlugin implements Plugin<Project> {
554555
project.publishing {
555556
publications {
556557
nebula(MavenPublication) {
557-
artifact project.tasks.shadowJar
558+
artifacts = [ project.tasks.shadowJar ]
558559
artifactId = project.archivesBaseName
559560
/*
560561
* Configure the pom to include the "shadow" as compile dependencies
@@ -584,7 +585,6 @@ class BuildPlugin implements Plugin<Project> {
584585
}
585586
}
586587
}
587-
588588
}
589589

590590
/** Adds compiler settings to the project */
@@ -799,6 +799,8 @@ class BuildPlugin implements Plugin<Project> {
799799
systemProperty 'tests.task', path
800800
systemProperty 'tests.security.manager', 'true'
801801
systemProperty 'jna.nosys', 'true'
802+
// TODO: remove this deprecation compatibility setting for 7.0
803+
systemProperty 'es.aggregations.enable_scripted_metric_agg_param', 'false'
802804
systemProperty 'compiler.java', project.ext.compilerJavaVersion.getMajorVersion()
803805
if (project.ext.inFipsJvm) {
804806
systemProperty 'runtime.java', project.ext.runtimeJavaVersion.getMajorVersion() + "FIPS"

buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy

Lines changed: 35 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,21 @@
1919
package org.elasticsearch.gradle.plugin
2020

2121
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
22-
import nebula.plugin.info.scm.ScmInfoPlugin
22+
import nebula.plugin.publishing.maven.MavenScmPlugin
2323
import org.elasticsearch.gradle.BuildPlugin
2424
import org.elasticsearch.gradle.NoticeTask
2525
import org.elasticsearch.gradle.test.RestIntegTestTask
2626
import org.elasticsearch.gradle.test.RunTask
27-
import org.gradle.api.InvalidUserDataException
28-
import org.gradle.api.JavaVersion
2927
import org.gradle.api.Project
30-
import org.gradle.api.Task
31-
import org.gradle.api.XmlProvider
3228
import org.gradle.api.publish.maven.MavenPublication
3329
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
30+
import org.gradle.api.publish.maven.tasks.GenerateMavenPom
3431
import org.gradle.api.tasks.SourceSet
3532
import org.gradle.api.tasks.bundling.Zip
33+
import org.gradle.jvm.tasks.Jar
3634

37-
import java.nio.file.Files
38-
import java.nio.file.Path
39-
import java.nio.file.StandardCopyOption
4035
import java.util.regex.Matcher
4136
import java.util.regex.Pattern
42-
4337
/**
4438
* Encapsulates build configuration for an Elasticsearch plugin.
4539
*/
@@ -57,16 +51,10 @@ public class PluginBuildPlugin extends BuildPlugin {
5751
String name = project.pluginProperties.extension.name
5852
project.archivesBaseName = name
5953

60-
if (project.pluginProperties.extension.hasClientJar) {
61-
// for plugins which work with the transport client, we copy the jar
62-
// file to a new name, copy the nebula generated pom to the same name,
63-
// and generate a different pom for the zip
64-
addClientJarPomGeneration(project)
65-
addClientJarTask(project)
66-
}
67-
// while the jar isn't normally published, we still at least build a pom of deps
68-
// in case it is published, for instance when other plugins extend this plugin
69-
configureJarPom(project)
54+
// set teh project description so it will be picked up by publishing
55+
project.description = project.pluginProperties.extension.description
56+
57+
configurePublishing(project)
7058

7159
project.integTestCluster.dependsOn(project.bundlePlugin)
7260
project.tasks.run.dependsOn(project.bundlePlugin)
@@ -96,6 +84,32 @@ public class PluginBuildPlugin extends BuildPlugin {
9684
project.tasks.create('run', RunTask) // allow running ES with this plugin in the foreground of a build
9785
}
9886

87+
private void configurePublishing(Project project) {
88+
// Only configure publishing if applied externally
89+
if (project.pluginProperties.extension.hasClientJar) {
90+
project.plugins.apply(MavenScmPlugin.class)
91+
// Only change Jar tasks, we don't want a -client zip so we can't change archivesBaseName
92+
project.tasks.withType(Jar) {
93+
baseName = baseName + "-client"
94+
}
95+
// always configure publishing for client jars
96+
project.plugins.apply(MavenScmPlugin.class)
97+
project.publishing.publications.nebula(MavenPublication).artifactId(
98+
project.pluginProperties.extension.name + "-client"
99+
)
100+
project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom generatePOMTask ->
101+
generatePOMTask.ext.pomFileName = "${project.archivesBaseName}-client-${project.version}.pom"
102+
}
103+
} else {
104+
project.plugins.withType(MavenPublishPlugin).whenPluginAdded {
105+
project.publishing.publications.nebula(MavenPublication).artifactId(
106+
project.pluginProperties.extension.name
107+
)
108+
}
109+
110+
}
111+
}
112+
99113
private static void configureDependencies(Project project) {
100114
project.dependencies {
101115
compileOnly "org.elasticsearch:elasticsearch:${project.versions.elasticsearch}"
@@ -163,33 +177,6 @@ public class PluginBuildPlugin extends BuildPlugin {
163177
}
164178

165179
/** Adds a task to move jar and associated files to a "-client" name. */
166-
protected static void addClientJarTask(Project project) {
167-
Task clientJar = project.tasks.create('clientJar')
168-
clientJar.dependsOn(project.jar, project.tasks.generatePomFileForClientJarPublication, project.javadocJar, project.sourcesJar)
169-
clientJar.doFirst {
170-
Path jarFile = project.jar.outputs.files.singleFile.toPath()
171-
String clientFileName = jarFile.fileName.toString().replace(project.version, "client-${project.version}")
172-
Files.copy(jarFile, jarFile.resolveSibling(clientFileName), StandardCopyOption.REPLACE_EXISTING)
173-
174-
String clientPomFileName = clientFileName.replace('.jar', '.pom')
175-
Files.copy(
176-
project.tasks.generatePomFileForClientJarPublication.outputs.files.singleFile.toPath(),
177-
jarFile.resolveSibling(clientPomFileName),
178-
StandardCopyOption.REPLACE_EXISTING
179-
)
180-
181-
String sourcesFileName = jarFile.fileName.toString().replace('.jar', '-sources.jar')
182-
String clientSourcesFileName = clientFileName.replace('.jar', '-sources.jar')
183-
Files.copy(jarFile.resolveSibling(sourcesFileName), jarFile.resolveSibling(clientSourcesFileName),
184-
StandardCopyOption.REPLACE_EXISTING)
185-
186-
String javadocFileName = jarFile.fileName.toString().replace('.jar', '-javadoc.jar')
187-
String clientJavadocFileName = clientFileName.replace('.jar', '-javadoc.jar')
188-
Files.copy(jarFile.resolveSibling(javadocFileName), jarFile.resolveSibling(clientJavadocFileName),
189-
StandardCopyOption.REPLACE_EXISTING)
190-
}
191-
project.assemble.dependsOn(clientJar)
192-
}
193180

194181
static final Pattern GIT_PATTERN = Pattern.compile(/git@([^:]+):([^\.]+)\.git/)
195182

@@ -211,39 +198,11 @@ public class PluginBuildPlugin extends BuildPlugin {
211198

212199
/** Adds nebula publishing task to generate a pom file for the plugin. */
213200
protected static void addClientJarPomGeneration(Project project) {
214-
project.plugins.apply(MavenPublishPlugin.class)
215-
216-
project.publishing {
217-
publications {
218-
clientJar(MavenPublication) {
219-
from project.components.java
220-
artifactId = project.pluginProperties.extension.name + '-client'
221-
pom.withXml { XmlProvider xml ->
222-
Node root = xml.asNode()
223-
root.appendNode('name', project.pluginProperties.extension.name)
224-
root.appendNode('description', project.pluginProperties.extension.description)
225-
root.appendNode('url', urlFromOrigin(project.scminfo.origin))
226-
Node scmNode = root.appendNode('scm')
227-
scmNode.appendNode('url', project.scminfo.origin)
228-
}
229-
}
230-
}
231-
}
201+
project.plugins.apply(MavenScmPlugin.class)
202+
project.description = project.pluginProperties.extension.description
232203
}
233204

234205
/** Configure the pom for the main jar of this plugin */
235-
protected static void configureJarPom(Project project) {
236-
project.plugins.apply(ScmInfoPlugin.class)
237-
project.plugins.apply(MavenPublishPlugin.class)
238-
239-
project.publishing {
240-
publications {
241-
nebula(MavenPublication) {
242-
artifactId project.pluginProperties.extension.name
243-
}
244-
}
245-
}
246-
}
247206

248207
protected void addNoticeGeneration(Project project) {
249208
File licenseFile = project.pluginProperties.extension.licenseFile

buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginPropertiesExtension.groovy

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package org.elasticsearch.gradle.plugin
2020

2121
import org.gradle.api.Project
2222
import org.gradle.api.tasks.Input
23+
import org.gradle.api.tasks.InputFile
2324

2425
/**
2526
* A container for plugin properties that will be written to the plugin descriptor, for easy
@@ -55,18 +56,39 @@ class PluginPropertiesExtension {
5556
boolean requiresKeystore = false
5657

5758
/** A license file that should be included in the built plugin zip. */
58-
@Input
59-
File licenseFile = null
59+
private File licenseFile = null
6060

6161
/**
6262
* A notice file that should be included in the built plugin zip. This will be
6363
* extended with notices from the {@code licenses/} directory.
6464
*/
65-
@Input
66-
File noticeFile = null
65+
private File noticeFile = null
66+
67+
Project project = null
6768

6869
PluginPropertiesExtension(Project project) {
6970
name = project.name
7071
version = project.version
72+
this.project = project
73+
}
74+
75+
@InputFile
76+
File getLicenseFile() {
77+
return licenseFile
78+
}
79+
80+
void setLicenseFile(File licenseFile) {
81+
project.ext.licenseFile = licenseFile
82+
this.licenseFile = licenseFile
83+
}
84+
85+
@InputFile
86+
File getNoticeFile() {
87+
return noticeFile
88+
}
89+
90+
void setNoticeFile(File noticeFile) {
91+
project.ext.noticeFile = noticeFile
92+
this.noticeFile = noticeFile
7193
}
7294
}

buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginPropertiesTask.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import org.gradle.api.InvalidUserDataException
2323
import org.gradle.api.Task
2424
import org.gradle.api.tasks.Copy
2525
import org.gradle.api.tasks.OutputFile
26-
2726
/**
2827
* Creates a plugin descriptor.
2928
*/

buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package org.elasticsearch.gradle.precommit
2121
import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis
2222
import de.thetaphi.forbiddenapis.gradle.ForbiddenApisPlugin
2323
import org.elasticsearch.gradle.ExportElasticsearchBuildResourcesTask
24+
import org.gradle.api.JavaVersion
2425
import org.gradle.api.Project
2526
import org.gradle.api.Task
2627
import org.gradle.api.file.FileCollection
@@ -101,6 +102,11 @@ class PrecommitTasks {
101102
signaturesURLs = project.forbiddenApis.signaturesURLs +
102103
[ getClass().getResource('/forbidden/es-server-signatures.txt') ]
103104
}
105+
// forbidden apis doesn't support Java 11, so stop at 10
106+
String targetMajorVersion = (project.compilerJavaVersion.compareTo(JavaVersion.VERSION_1_10) > 0 ?
107+
JavaVersion.VERSION_1_10 :
108+
project.compilerJavaVersion).getMajorVersion()
109+
targetCompatibility = Integer.parseInt(targetMajorVersion) >= 9 ?targetMajorVersion : "1.${targetMajorVersion}"
104110
}
105111
Task forbiddenApis = project.tasks.findByName('forbiddenApis')
106112
forbiddenApis.group = "" // clear group, so this does not show up under verification tasks

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ class NodeInfo {
177177
javaVersion = 8
178178
} else if (nodeVersion.onOrAfter("6.2.0") && nodeVersion.before("6.3.0")) {
179179
javaVersion = 9
180+
} else if (project.inFipsJvm && nodeVersion.onOrAfter("6.3.0") && nodeVersion.before("6.4.0")) {
181+
/*
182+
* Elasticsearch versions before 6.4.0 cannot be run in a FIPS-140 JVM. If we're running
183+
* bwc tests in a FIPS-140 JVM, ensure that the pre v6.4.0 nodes use a Java 10 JVM instead.
184+
*/
185+
javaVersion = 10
180186
}
181187

182188
args.addAll("-E", "node.portsfile=true")

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import org.gradle.api.provider.Provider
3131
import org.gradle.api.tasks.Copy
3232
import org.gradle.api.tasks.Input
3333
import org.gradle.api.tasks.TaskState
34+
import org.gradle.plugins.ide.idea.IdeaPlugin
3435

3536
import java.nio.charset.StandardCharsets
3637
import java.nio.file.Files
@@ -243,10 +244,12 @@ public class RestIntegTestTask extends DefaultTask {
243244
}
244245
}
245246
}
246-
project.idea {
247-
module {
248-
if (scopes.TEST != null) {
249-
scopes.TEST.plus.add(project.configurations.restSpec)
247+
if (project.plugins.hasPlugin(IdeaPlugin)) {
248+
project.idea {
249+
module {
250+
if (scopes.TEST != null) {
251+
scopes.TEST.plus.add(project.configurations.restSpec)
252+
}
250253
}
251254
}
252255
}

0 commit comments

Comments
 (0)