-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'es/master' into ccr
* es/master: (38 commits) Build: Add pom generation to meta plugins (#28321) Add 6.3 version constant to master Minor improvements to translog docs (#28237) [Docs] Remove typo in painless-getting-started.asciidoc Build: Fix meta plugin usage in integ test clusters (#28307) Painless: Add spi jar that will be published for extending whitelists (#28302) mistyping in one of the highlighting examples comment -> content (#28139) Documents applicability of term query to range type (#28166) Build: Omit dependency licenses check for elasticsearch deps (#28304) Clean up commits when global checkpoint advanced (#28140) Implement socket and server ChannelContexts (#28275) Plugins: Fix meta plugins to install bundled plugins with their real name (#28285) Build: Fix meta plugin integ test installation (#28286) Modify Abstract transport tests to use impls (#28270) Fork Groovy compiler onto compile Java home [Docs] Update tophits-aggregation.asciidoc (#28273) Docs: match between snippet to its description (#28296) [TEST] fix RequestTests#testSearch in case search source is not set REST high-level client: remove index suffix from indices client method names (#28263) Fix simple_query_string on invalid input (#28219) ...
- Loading branch information
Showing
111 changed files
with
2,599 additions
and
1,490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/MetaPluginBuildPlugin.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch 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. | ||
*/ | ||
|
||
package org.elasticsearch.gradle.plugin | ||
|
||
import org.elasticsearch.gradle.BuildPlugin | ||
import org.elasticsearch.gradle.test.RestTestPlugin | ||
import org.elasticsearch.gradle.test.RunTask | ||
import org.elasticsearch.gradle.test.StandaloneRestTestPlugin | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.file.FileCopyDetails | ||
import org.gradle.api.file.RelativePath | ||
import org.gradle.api.tasks.bundling.Zip | ||
|
||
class MetaPluginBuildPlugin implements Plugin<Project> { | ||
|
||
@Override | ||
void apply(Project project) { | ||
project.plugins.apply(StandaloneRestTestPlugin) | ||
project.plugins.apply(RestTestPlugin) | ||
|
||
createBundleTask(project) | ||
|
||
project.integTestCluster { | ||
dependsOn(project.bundlePlugin) | ||
plugin(project.path) | ||
} | ||
BuildPlugin.configurePomGeneration(project) | ||
project.afterEvaluate { | ||
PluginBuildPlugin.addZipPomGeneration(project) | ||
} | ||
|
||
RunTask run = project.tasks.create('run', RunTask) | ||
run.dependsOn(project.bundlePlugin) | ||
run.clusterConfig.plugin(project.path) | ||
} | ||
|
||
private static void createBundleTask(Project project) { | ||
|
||
MetaPluginPropertiesTask buildProperties = project.tasks.create('pluginProperties', MetaPluginPropertiesTask.class) | ||
|
||
// create the actual bundle task, which zips up all the files for the plugin | ||
Zip bundle = project.tasks.create(name: 'bundlePlugin', type: Zip, dependsOn: [buildProperties]) { | ||
into('elasticsearch') { | ||
from(buildProperties.descriptorOutput.parentFile) { | ||
// plugin properties file | ||
include(buildProperties.descriptorOutput.name) | ||
} | ||
} | ||
// due to how the renames work for each bundled plugin, we must exclude empty dirs or every subdir | ||
// within bundled plugin zips will show up at the root as an empty dir | ||
includeEmptyDirs = false | ||
|
||
} | ||
project.assemble.dependsOn(bundle) | ||
|
||
// also make the zip available as a configuration (used when depending on this project) | ||
project.configurations.create('zip') | ||
project.artifacts.add('zip', bundle) | ||
|
||
// a super hacky way to inject code to run at the end of each of the bundled plugin's configuration | ||
// to add itself back to this meta plugin zip | ||
project.afterEvaluate { | ||
buildProperties.extension.plugins.each { String bundledPluginProjectName -> | ||
Project bundledPluginProject = project.project(bundledPluginProjectName) | ||
bundledPluginProject.afterEvaluate { | ||
bundle.configure { | ||
dependsOn bundledPluginProject.bundlePlugin | ||
from(project.zipTree(bundledPluginProject.bundlePlugin.outputs.files.singleFile)) { | ||
eachFile { FileCopyDetails details -> | ||
// paths in the individual plugins begin with elasticsearch, and we want to add in the | ||
// bundled plugin name between that and each filename | ||
details.relativePath = new RelativePath(true, 'elasticsearch', bundledPluginProjectName, | ||
details.relativePath.toString().replace('elasticsearch/', '')) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/MetaPluginPropertiesTask.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch 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. | ||
*/ | ||
|
||
package org.elasticsearch.gradle.plugin | ||
|
||
import org.gradle.api.InvalidUserDataException | ||
import org.gradle.api.Task | ||
import org.gradle.api.tasks.Copy | ||
import org.gradle.api.tasks.OutputFile | ||
|
||
class MetaPluginPropertiesTask extends Copy { | ||
|
||
MetaPluginPropertiesExtension extension | ||
|
||
@OutputFile | ||
File descriptorOutput = new File(project.buildDir, 'generated-resources/meta-plugin-descriptor.properties') | ||
|
||
MetaPluginPropertiesTask() { | ||
File templateFile = new File(project.buildDir, "templates/${descriptorOutput.name}") | ||
Task copyPluginPropertiesTemplate = project.tasks.create('copyPluginPropertiesTemplate') { | ||
doLast { | ||
InputStream resourceTemplate = PluginPropertiesTask.getResourceAsStream("/${descriptorOutput.name}") | ||
templateFile.parentFile.mkdirs() | ||
templateFile.setText(resourceTemplate.getText('UTF-8'), 'UTF-8') | ||
} | ||
} | ||
|
||
dependsOn(copyPluginPropertiesTemplate) | ||
extension = project.extensions.create('es_meta_plugin', MetaPluginPropertiesExtension, project) | ||
project.afterEvaluate { | ||
// check require properties are set | ||
if (extension.name == null) { | ||
throw new InvalidUserDataException('name is a required setting for es_meta_plugin') | ||
} | ||
if (extension.description == null) { | ||
throw new InvalidUserDataException('description is a required setting for es_meta_plugin') | ||
} | ||
// configure property substitution | ||
from(templateFile.parentFile).include(descriptorOutput.name) | ||
into(descriptorOutput.parentFile) | ||
Map<String, String> properties = generateSubstitutions() | ||
expand(properties) | ||
inputs.properties(properties) | ||
} | ||
} | ||
|
||
Map<String, String> generateSubstitutions() { | ||
return ['name': extension.name, | ||
'description': extension.description | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
buildSrc/src/main/resources/META-INF/gradle-plugins/elasticsearch.es-meta-plugin.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Licensed to Elasticsearch under one or more contributor | ||
# license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright | ||
# ownership. Elasticsearch 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. | ||
# | ||
|
||
implementation-class=org.elasticsearch.gradle.plugin.MetaPluginBuildPlugin |
Oops, something went wrong.