diff --git a/build.gradle b/build.gradle
index c538c0cb898..395e1f600c9 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,6 +19,7 @@
import org.apache.tools.ant.taskdefs.condition.Os
+import org.apache.tools.ant.filters.ReplaceTokens
import org.elasticsearch.gradle.BuildPlugin
import org.elasticsearch.gradle.LoggedExec
import org.elasticsearch.gradle.Version
@@ -406,10 +407,19 @@ allprojects {
}
}
}
+
+ File licenseHeaderFile;
+ if (eclipse.project.name.startsWith(':x-pack')) {
+ licenseHeaderFile = new File(project.rootDir, 'buildSrc/src/main/resources/license-headers/elastic-license-header.txt')
+ } else {
+ licenseHeaderFile = new File(project.rootDir, 'buildSrc/src/main/resources/license-headers/oss-license-header.txt')
+ }
+ String licenseHeader = licenseHeaderFile.getText('UTF-8').replace('\n', '\\\\n')
task copyEclipseSettings(type: Copy) {
// TODO: "package this up" for external builds
from new File(project.rootDir, 'buildSrc/src/main/resources/eclipse.settings')
into '.settings'
+ filter{ it.replaceAll('@@LICENSE_HEADER_TEXT@@', licenseHeader)}
}
// otherwise .settings is not nuked entirely
task wipeEclipseSettings(type: Delete) {
diff --git a/buildSrc/src/main/resources/eclipse.settings/org.eclipse.jdt.ui.prefs b/buildSrc/src/main/resources/eclipse.settings/org.eclipse.jdt.ui.prefs
index 391a8715868..827a41bf634 100644
--- a/buildSrc/src/main/resources/eclipse.settings/org.eclipse.jdt.ui.prefs
+++ b/buildSrc/src/main/resources/eclipse.settings/org.eclipse.jdt.ui.prefs
@@ -3,4 +3,4 @@ formatter_settings_version=12
# Intellij IDEA import order
org.eclipse.jdt.ui.importorder=;com;org;java;javax;\#;
# License header
-org.eclipse.jdt.ui.text.custom_code_templates=/**\n *\n *//**\n *\n *//**\n * ${tags}\n *//**\n *\n *//**\n *\n *//**\n *\n *//**\n * ${tags}\n *//*\n *\n *//**\n * ${tags}\n * ${see_to_target}\n */${filecomment}\n/*\n * Licensed to Elasticsearch under one or more contributor\n * license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright\n * ownership. Elasticsearch licenses this file to you under\n * the Apache License, Version 2.0 (the "License"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n\n\n\nthrow new RuntimeException(${exception_var});${body_statement}${body_statement}return ${field};${field} \= ${param};
+org.eclipse.jdt.ui.text.custom_code_templates=/**\n *\n *//**\n *\n *//**\n * ${tags}\n *//**\n *\n *//**\n *\n *//**\n *\n *//**\n * ${tags}\n *//*\n *\n *//**\n * ${tags}\n * ${see_to_target}\n */${filecomment}\n@@LICENSE_HEADER_TEXT@@\n\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n\n\n\nthrow new RuntimeException(${exception_var});${body_statement}${body_statement}return ${field};${field} \= ${param};
diff --git a/buildSrc/src/main/resources/license-headers/elastic-license-header.txt b/buildSrc/src/main/resources/license-headers/elastic-license-header.txt
new file mode 100644
index 00000000000..30371a1ef54
--- /dev/null
+++ b/buildSrc/src/main/resources/license-headers/elastic-license-header.txt
@@ -0,0 +1,5 @@
+/*
+ * 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.
+ */
\ No newline at end of file
diff --git a/buildSrc/src/main/resources/license-headers/oss-license-header.txt b/buildSrc/src/main/resources/license-headers/oss-license-header.txt
new file mode 100644
index 00000000000..d85645a12ef
--- /dev/null
+++ b/buildSrc/src/main/resources/license-headers/oss-license-header.txt
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
\ No newline at end of file