2020-03-19 14:43:33 -04:00
|
|
|
import org.jetbrains.gradle.ext.Remote
|
|
|
|
import org.jetbrains.gradle.ext.JUnit
|
|
|
|
|
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
url "https://plugins.gradle.org/m2/"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
classpath "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.7"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
apply plugin: org.jetbrains.gradle.ext.IdeaExtPlugin
|
|
|
|
|
|
|
|
allprojects {
|
|
|
|
apply plugin: 'idea'
|
|
|
|
|
|
|
|
tasks.named('idea') {
|
|
|
|
doFirst { throw new GradleException("Use of the 'idea' task has been deprecated. For details on importing into IntelliJ see CONTRIBUTING.md.") }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register('configureIdeaGradleJvm') {
|
|
|
|
group = 'ide'
|
|
|
|
description = 'Configures the appropriate JVM for Gradle'
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
modifyXml('.idea/gradle.xml') { xml ->
|
|
|
|
def gradleSettings = xml.component.find { it.'@name' == 'GradleSettings' }.option[0].GradleProjectSettings
|
|
|
|
// Remove configured JVM option to force IntelliJ to use the project JDK for Gradle
|
|
|
|
gradleSettings.option.findAll { it.'@name' == 'gradleJvm' }.each { it.parent().remove(it) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
idea {
|
|
|
|
project {
|
|
|
|
vcs = 'Git'
|
|
|
|
jdkName = '13'
|
|
|
|
|
|
|
|
settings {
|
|
|
|
delegateActions {
|
|
|
|
delegateBuildRunToGradle = false
|
|
|
|
testRunner = 'choose_per_test'
|
|
|
|
}
|
|
|
|
taskTriggers {
|
2020-03-24 00:31:04 -04:00
|
|
|
afterSync tasks.named('configureIdeaGradleJvm')
|
2020-03-19 14:43:33 -04:00
|
|
|
}
|
|
|
|
codeStyle {
|
|
|
|
java {
|
|
|
|
classCountToUseImportOnDemand = 999
|
|
|
|
}
|
|
|
|
}
|
|
|
|
encodings {
|
|
|
|
encoding = 'UTF-8'
|
|
|
|
}
|
|
|
|
compiler {
|
|
|
|
parallelCompilation = true
|
|
|
|
javac {
|
|
|
|
generateDeprecationWarnings = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
runConfigurations {
|
|
|
|
'Debug Elasticsearch'(Remote) {
|
|
|
|
mode = 'listen'
|
|
|
|
host = 'localhost'
|
|
|
|
port = 5005
|
|
|
|
}
|
|
|
|
defaults(JUnit) {
|
2020-03-19 18:09:02 -04:00
|
|
|
vmParameters = '-ea -Djava.locale.providers=SPI,COMPAT'
|
2020-03-19 14:43:33 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
copyright {
|
|
|
|
useDefault = 'Apache'
|
|
|
|
scopes = ['x-pack': 'Elastic']
|
|
|
|
profiles {
|
|
|
|
Apache {
|
|
|
|
keyword = 'Licensed to Elasticsearch under one or more contributor'
|
|
|
|
notice = '''\
|
|
|
|
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
|
|
|
|
|
2020-03-23 18:30:10 -04:00
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
2020-03-19 14:43:33 -04:00
|
|
|
|
|
|
|
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.'''.stripIndent()
|
|
|
|
}
|
|
|
|
Elastic {
|
|
|
|
keyword = 'Licensed under the Elastic License'
|
|
|
|
notice = '''\
|
|
|
|
Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
|
|
or more contributor license agreements. Licensed under the Elastic License;
|
|
|
|
you may not use this file except in compliance with the Elastic License.'''.stripIndent()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Parses a given XML file, applies a set of changes, and writes those changes back to the original file.
|
|
|
|
*
|
|
|
|
* @param path Path to existing XML file
|
|
|
|
* @param action Action to perform on parsed XML document
|
|
|
|
*/
|
|
|
|
void modifyXml(Object path, Action<? super Node> action) {
|
|
|
|
File xmlFile = project.file(path)
|
|
|
|
Node xml = new XmlParser().parse(xmlFile)
|
|
|
|
action.execute(xml)
|
|
|
|
|
|
|
|
xmlFile.withPrintWriter { writer ->
|
|
|
|
new XmlNodePrinter(writer).print(xml)
|
|
|
|
}
|
|
|
|
}
|