Skip to content

Commit

Permalink
Allow searches with specific reader contexts (#53989)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnhatn authored Mar 26, 2020
1 parent 2bcee88 commit 8913369
Show file tree
Hide file tree
Showing 1,046 changed files with 32,535 additions and 8,907 deletions.
1 change: 1 addition & 0 deletions .ci/bwcVersions
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ BWC_VERSION:
- "7.6.1"
- "7.6.2"
- "7.7.0"
- "7.8.0"
- "8.0.0"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ out/
# include shared intellij config
!.idea/scopes/x_pack.xml
!.idea/inspectionProfiles/Project_Default.xml
!.idea/runConfigurations/Debug_Elasticsearch.xml

# These files are generated in the main tree by IntelliJ
benchmarks/src/main/generated/*
Expand Down
11 changes: 11 additions & 0 deletions .idea/runConfigurations/Debug_Elasticsearch.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ be used to test against other JDKs as well, this is not only limited to JDK 11.
> Note: It is also required to have `JAVA8_HOME`, `JAVA9_HOME`, `JAVA10_HOME`
and `JAVA11_HOME`, and `JAVA12_HOME` available so that the tests can pass.

> Warning: do not use `sdkman` for Java installations which do not have proper
`jrunscript` for jdk distributions.

Elasticsearch uses the Gradle wrapper for its build. You can execute Gradle
using the wrapper via the `gradlew` script on Unix systems or `gradlew.bat`
script on Windows in the root of the repository. The examples below show the
Expand All @@ -125,10 +122,13 @@ You can access Elasticsearch with:

### Importing the project into IntelliJ IDEA

Elasticsearch builds using Java 13. Before importing into IntelliJ you will need
Elasticsearch builds using Java 13. When importing into IntelliJ you will need
to define an appropriate SDK. The convention is that **this SDK should be named
"13"** so that the project import will detect it automatically. For more details
on defining an SDK in IntelliJ please refer to [their documentation](https://www.jetbrains.com/help/idea/sdk.html#define-sdk).
SDK definitions are global, so you can add the JDK from any project, or after
project import. Importing with a missing JDK will still work, IntelliJ will
simply report a problem and will refuse to build until resolved.

You can import the Elasticsearch project into IntelliJ IDEA via:

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder
import org.gradle.util.DistributionLocator
import org.gradle.util.GradleVersion

import static org.elasticsearch.gradle.tool.Boilerplate.maybeConfigure
import static org.elasticsearch.gradle.util.GradleUtils.maybeConfigure

plugins {
id 'lifecycle-base'
Expand Down Expand Up @@ -222,8 +222,8 @@ task verifyVersions {
* after the backport of the backcompat code is complete.
*/

boolean bwc_tests_enabled = true
final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */
boolean bwc_tests_enabled = false
final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/53989" /* place a PR link here when committing bwc changes */
if (bwc_tests_enabled == false) {
if (bwc_tests_disabled_issue.isEmpty()) {
throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import org.elasticsearch.gradle.precommit.PrecommitTasks
import org.elasticsearch.gradle.test.ErrorReportingTestListener
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster
import org.elasticsearch.gradle.testclusters.TestClustersPlugin
import org.elasticsearch.gradle.tool.Boilerplate
import org.elasticsearch.gradle.util.GradleUtils
import org.gradle.api.Action
import org.gradle.api.GradleException
import org.gradle.api.InvalidUserDataException
Expand Down Expand Up @@ -82,7 +82,7 @@ import org.gradle.util.GradleVersion
import java.nio.charset.StandardCharsets
import java.nio.file.Files

import static org.elasticsearch.gradle.tool.Boilerplate.maybeConfigure
import static org.elasticsearch.gradle.util.GradleUtils.maybeConfigure

/**
* Encapsulates build configuration for elasticsearch projects.
Expand Down Expand Up @@ -148,7 +148,7 @@ class BuildPlugin implements Plugin<Project> {
File securityPolicy = buildResources.copy("fips_java.policy")
File bcfksKeystore = buildResources.copy("cacerts.bcfks")
// This configuration can be removed once system modules are available
Boilerplate.maybeCreate(project.configurations, 'extraJars') {
GradleUtils.maybeCreate(project.configurations, 'extraJars') {
project.dependencies.add('extraJars', "org.bouncycastle:bc-fips:1.0.1")
project.dependencies.add('extraJars', "org.bouncycastle:bctls-fips:1.0.9")
}
Expand Down Expand Up @@ -235,7 +235,7 @@ class BuildPlugin implements Plugin<Project> {
static String getJavaHome(final Task task, final int version) {
requireJavaHome(task, version)
JavaHome java = BuildParams.javaVersions.find { it.version == version }
return java == null ? null : java.javaHome.absolutePath
return java == null ? null : java.javaHome.get().absolutePath
}

/**
Expand Down Expand Up @@ -453,7 +453,9 @@ class BuildPlugin implements Plugin<Project> {

project.pluginManager.withPlugin('com.github.johnrengelman.shadow') {
// Ensure that when we are compiling against the "original" JAR that we also include any "shadow" dependencies on the compile classpath
project.configurations.getByName(JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME).extendsFrom(project.configurations.getByName(ShadowBasePlugin.CONFIGURATION_NAME))
project.configurations.getByName(ShadowBasePlugin.CONFIGURATION_NAME).dependencies.all { Dependency dependency ->
project.configurations.getByName(JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME).dependencies.add(dependency)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,13 @@ class PrecommitTasks {
ExportElasticsearchBuildResourcesTask buildResources = project.tasks.getByName('buildResources')
project.tasks.withType(CheckForbiddenApis).configureEach {
dependsOn(buildResources)
doFirst {
// we need to defer this configuration since we don't know the runtime java version until execution time
targetCompatibility = BuildParams.runtimeJavaVersion.majorVersion
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_13) {
project.logger.warn(
"Forbidden APIs does not support Java versions past 13. Will use the signatures from 13 for {}.",
BuildParams.runtimeJavaVersion
)
targetCompatibility = JavaVersion.VERSION_13.majorVersion
}
targetCompatibility = BuildParams.runtimeJavaVersion.majorVersion
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_13) {
project.logger.warn(
"Forbidden APIs does not support Java versions past 13. Will use the signatures from 13 for {}.",
BuildParams.runtimeJavaVersion
)
targetCompatibility = JavaVersion.VERSION_13.majorVersion
}
bundledSignatures = [
"jdk-unsafe", "jdk-deprecated", "jdk-non-portable", "jdk-system-out"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ import org.gradle.api.InvalidUserDataException
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.plugins.ExtraPropertiesExtension
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.testing.Test
import org.gradle.plugins.ide.eclipse.model.EclipseModel
import org.gradle.plugins.ide.idea.model.IdeaModel
Expand Down Expand Up @@ -67,8 +65,8 @@ class StandaloneRestTestPlugin implements Plugin<Project> {
BuildPlugin.configureTestTasks(project)
BuildPlugin.configureInputNormalization(project)
BuildPlugin.configureFips140(project)
BuildPlugin.configureCompile(project)

ExtraPropertiesExtension ext = project.extensions.getByType(ExtraPropertiesExtension)
project.extensions.getByType(JavaPluginExtension).sourceCompatibility = BuildParams.minimumRuntimeVersion
project.extensions.getByType(JavaPluginExtension).targetCompatibility = BuildParams.minimumRuntimeVersion

Expand Down Expand Up @@ -96,13 +94,6 @@ class StandaloneRestTestPlugin implements Plugin<Project> {
idea.module.scopes.put('TEST', [plus: [project.configurations.getByName(JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME)]] as Map<String, Collection<Configuration>>)

PrecommitTasks.create(project, false)
project.tasks.getByName('check').dependsOn(project.tasks.getByName('precommit'))

project.tasks.withType(JavaCompile) { JavaCompile task ->
// This will be the default in Gradle 5.0
if (task.options.compilerArgs.contains("-processor") == false) {
task.options.compilerArgs << '-proc:none'
}
}
project.tasks.named('check').configure { it.dependsOn(project.tasks.named('precommit')) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.elasticsearch.gradle.docker.DockerSupportService;
import org.elasticsearch.gradle.info.BuildParams;
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin;
import org.elasticsearch.gradle.tool.Boilerplate;
import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.GradleException;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Plugin;
Expand All @@ -52,7 +52,7 @@
import java.util.concurrent.Callable;
import java.util.function.Supplier;

import static org.elasticsearch.gradle.Util.capitalize;
import static org.elasticsearch.gradle.util.Util.capitalize;

/**
* A plugin to manage getting and extracting distributions of Elasticsearch.
Expand All @@ -77,7 +77,7 @@ public void apply(Project project) {
project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class);
project.getRootProject().getPluginManager().apply(DockerSupportPlugin.class);

Provider<DockerSupportService> dockerSupport = Boilerplate.getBuildService(
Provider<DockerSupportService> dockerSupport = GradleUtils.getBuildService(
project.getGradle().getSharedServices(),
DockerSupportPlugin.DOCKER_SUPPORT_SERVICE_NAME
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
import java.util.concurrent.Callable;
import java.util.stream.StreamSupport;

import static org.elasticsearch.gradle.tool.Boilerplate.findByName;
import static org.elasticsearch.gradle.tool.Boilerplate.maybeCreate;
import static org.elasticsearch.gradle.util.GradleUtils.findByName;
import static org.elasticsearch.gradle.util.GradleUtils.maybeCreate;

public class JdkDownloadPlugin implements Plugin<Project> {

Expand Down
Loading

0 comments on commit 8913369

Please sign in to comment.