2015-10-29 14:40:19 -04:00
|
|
|
/*
|
2017-01-05 11:15:34 -05:00
|
|
|
* Licensed to Elasticsearch under one or more contributor
|
2015-10-29 14:40:19 -04:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2017-12-26 04:51:47 -05:00
|
|
|
import org.elasticsearch.gradle.ConcatFilesTask
|
2015-12-18 15:43:47 -05:00
|
|
|
import org.elasticsearch.gradle.MavenFilteringHack
|
2017-02-15 12:40:16 -05:00
|
|
|
import org.elasticsearch.gradle.NoticeTask
|
2015-11-16 19:02:44 -05:00
|
|
|
import org.elasticsearch.gradle.test.RunTask
|
2018-04-24 12:10:51 -04:00
|
|
|
|
|
|
|
import java.nio.file.Path
|
2015-10-29 14:40:19 -04:00
|
|
|
|
2018-02-14 01:49:53 -05:00
|
|
|
Collection distributions = project('archives').subprojects + project('packages').subprojects
|
2017-02-15 16:55:19 -05:00
|
|
|
|
2017-12-26 04:51:47 -05:00
|
|
|
/*****************************************************************************
|
|
|
|
* Third party dependencies report *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
// Concatenates the dependencies CSV files into a single file
|
|
|
|
task generateDependenciesReport(type: ConcatFilesTask) {
|
|
|
|
files = fileTree(dir: project.rootDir, include: '**/dependencies.csv' )
|
|
|
|
headerLine = "name,version,url,license"
|
2018-06-09 09:50:36 -04:00
|
|
|
target = new File(System.getProperty('csv')?: "${project.buildDir}/reports/dependencies/es-dependencies.csv")
|
2017-12-26 04:51:47 -05:00
|
|
|
}
|
|
|
|
|
2017-02-15 12:40:16 -05:00
|
|
|
/*****************************************************************************
|
|
|
|
* Notice file *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2018-01-11 13:30:43 -05:00
|
|
|
// integ test zip only uses server, so a different notice file is needed there
|
2018-02-23 11:03:17 -05:00
|
|
|
task buildServerNotice(type: NoticeTask) {
|
2018-01-11 13:30:43 -05:00
|
|
|
licensesDir new File(project(':server').projectDir, 'licenses')
|
2017-02-15 12:40:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// other distributions include notices from modules as well, which are added below later
|
2018-02-23 11:03:17 -05:00
|
|
|
task buildDefaultNotice(type: NoticeTask) {
|
|
|
|
licensesDir new File(project(':server').projectDir, 'licenses')
|
|
|
|
}
|
|
|
|
|
|
|
|
// other distributions include notices from modules as well, which are added below later
|
|
|
|
task buildOssNotice(type: NoticeTask) {
|
2018-01-11 13:30:43 -05:00
|
|
|
licensesDir new File(project(':server').projectDir, 'licenses')
|
2017-02-15 12:40:16 -05:00
|
|
|
}
|
|
|
|
|
2015-12-03 17:18:26 -05:00
|
|
|
/*****************************************************************************
|
|
|
|
* Modules *
|
|
|
|
*****************************************************************************/
|
2018-02-23 11:03:17 -05:00
|
|
|
String ossOutputs = 'build/outputs/oss'
|
|
|
|
String defaultOutputs = 'build/outputs/default'
|
|
|
|
String transportOutputs = 'build/outputs/transport-only'
|
|
|
|
|
|
|
|
task processOssOutputs(type: Sync) {
|
|
|
|
into ossOutputs
|
|
|
|
}
|
|
|
|
|
|
|
|
task processDefaultOutputs(type: Sync) {
|
|
|
|
into defaultOutputs
|
|
|
|
from processOssOutputs
|
|
|
|
}
|
|
|
|
|
|
|
|
// Integ tests work over the rest http layer, so we need a transport included with the integ test zip.
|
|
|
|
// All transport modules are included so that they may be randomized for testing
|
|
|
|
task processTransportOutputs(type: Sync) {
|
|
|
|
into transportOutputs
|
|
|
|
}
|
|
|
|
|
|
|
|
// these are dummy tasks that can be used to depend on the relevant sub output dir
|
|
|
|
task buildOssModules {
|
|
|
|
dependsOn processOssOutputs
|
|
|
|
outputs.dir "${ossOutputs}/modules"
|
|
|
|
}
|
|
|
|
task buildOssBin {
|
|
|
|
dependsOn processOssOutputs
|
|
|
|
outputs.dir "${ossOutputs}/bin"
|
|
|
|
}
|
|
|
|
task buildOssConfig {
|
|
|
|
dependsOn processOssOutputs
|
|
|
|
outputs.dir "${ossOutputs}/config"
|
|
|
|
}
|
|
|
|
task buildDefaultModules {
|
|
|
|
dependsOn processDefaultOutputs
|
|
|
|
outputs.dir "${defaultOutputs}/modules"
|
|
|
|
}
|
|
|
|
task buildDefaultBin {
|
|
|
|
dependsOn processDefaultOutputs
|
|
|
|
outputs.dir "${defaultOutputs}/bin"
|
|
|
|
}
|
|
|
|
task buildDefaultConfig {
|
|
|
|
dependsOn processDefaultOutputs
|
|
|
|
outputs.dir "${defaultOutputs}/config"
|
|
|
|
}
|
|
|
|
task buildTransportModules {
|
|
|
|
dependsOn processTransportOutputs
|
|
|
|
outputs.dir "${transportOutputs}/modules"
|
|
|
|
}
|
|
|
|
|
|
|
|
void copyModule(Sync copyTask, Project module) {
|
|
|
|
copyTask.configure {
|
|
|
|
dependsOn { module.bundlePlugin }
|
|
|
|
from({ zipTree(module.bundlePlugin.outputs.files.singleFile) }) {
|
|
|
|
includeEmptyDirs false
|
|
|
|
|
|
|
|
// these are handled separately in the log4j config tasks below
|
|
|
|
exclude '*/config/log4j2.properties'
|
|
|
|
exclude 'config/log4j2.properties'
|
|
|
|
|
|
|
|
eachFile { details ->
|
|
|
|
String name = module.plugins.hasPlugin('elasticsearch.esplugin') ? module.esplugin.name : module.es_meta_plugin.name
|
|
|
|
// Copy all non config/bin files
|
|
|
|
// Note these might be unde a subdirectory in the case of a meta plugin
|
|
|
|
if ((details.relativePath.pathString ==~ /([^\/]+\/)?(config|bin)\/.*/) == false) {
|
|
|
|
details.relativePath = details.relativePath.prepend('modules', name)
|
|
|
|
} else if ((details.relativePath.pathString ==~ /([^\/]+\/)(config|bin)\/.*/)) {
|
|
|
|
// this is the meta plugin case, in which we need to remove the intermediate dir
|
|
|
|
String[] segments = details.relativePath.segments
|
|
|
|
details.relativePath = new RelativePath(true, segments.takeRight(segments.length - 1))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-12-03 17:18:26 -05:00
|
|
|
|
2018-02-23 11:03:17 -05:00
|
|
|
// log4j config could be contained in modules, so we must join it together using these tasks
|
|
|
|
task buildOssLog4jConfig {
|
|
|
|
dependsOn processOssOutputs
|
|
|
|
ext.contents = []
|
|
|
|
ext.log4jFile = file("${ossOutputs}/log4j2.properties")
|
|
|
|
outputs.file log4jFile
|
|
|
|
}
|
|
|
|
task buildDefaultLog4jConfig {
|
|
|
|
dependsOn processDefaultOutputs
|
|
|
|
ext.contents = []
|
|
|
|
ext.log4jFile = file("${defaultOutputs}/log4j2.properties")
|
|
|
|
outputs.file log4jFile
|
|
|
|
}
|
|
|
|
|
|
|
|
Closure writeLog4jProperties = {
|
|
|
|
String mainLog4jProperties = file('src/config/log4j2.properties').getText('UTF-8')
|
|
|
|
it.log4jFile.setText(mainLog4jProperties, 'UTF-8')
|
|
|
|
for (String moduleLog4jProperties : it.contents.reverse()) {
|
|
|
|
it.log4jFile.append(moduleLog4jProperties, 'UTF-8')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
buildOssLog4jConfig.doLast(writeLog4jProperties)
|
|
|
|
buildDefaultLog4jConfig.doLast(writeLog4jProperties)
|
|
|
|
|
|
|
|
// copy log4j2.properties from modules that have it
|
|
|
|
void copyLog4jProperties(Task buildTask, Project module) {
|
|
|
|
buildTask.doFirst {
|
|
|
|
FileTree tree = zipTree(module.bundlePlugin.outputs.files.singleFile)
|
|
|
|
FileTree filtered = tree.matching {
|
|
|
|
include 'config/log4j2.properties'
|
|
|
|
include '*/config/log4j2.properties' // could be in a bundled plugin
|
|
|
|
}
|
|
|
|
if (filtered.isEmpty() == false) {
|
|
|
|
buildTask.contents.add('\n\n' + filtered.singleFile.getText('UTF-8'))
|
|
|
|
}
|
|
|
|
}
|
2016-07-11 16:00:45 -04:00
|
|
|
}
|
|
|
|
|
2015-12-04 16:38:09 -05:00
|
|
|
ext.restTestExpansions = [
|
|
|
|
'expected.modules.count': 0,
|
|
|
|
]
|
2018-02-23 11:03:17 -05:00
|
|
|
// we create the buildOssModules task above but fill it here so we can do a single
|
2015-12-10 19:16:49 -05:00
|
|
|
// loop over modules to also setup cross task dependencies and increment our modules counter
|
2018-01-18 22:16:26 -05:00
|
|
|
project.rootProject.subprojects.findAll { it.parent.path == ':modules' }.each { Project module ->
|
2018-02-23 11:03:17 -05:00
|
|
|
File licenses = new File(module.projectDir, 'licenses')
|
|
|
|
if (licenses.exists()) {
|
|
|
|
buildDefaultNotice.licensesDir licenses
|
|
|
|
buildOssNotice.licensesDir licenses
|
2017-02-15 12:40:16 -05:00
|
|
|
}
|
2018-02-23 11:03:17 -05:00
|
|
|
|
|
|
|
copyModule(processOssOutputs, module)
|
|
|
|
if (module.name.startsWith('transport-')) {
|
|
|
|
copyModule(processTransportOutputs, module)
|
2015-10-29 14:40:19 -04:00
|
|
|
}
|
2018-02-23 11:03:17 -05:00
|
|
|
|
|
|
|
copyLog4jProperties(buildOssLog4jConfig, module)
|
|
|
|
copyLog4jProperties(buildDefaultLog4jConfig, module)
|
|
|
|
|
2018-02-21 20:46:40 -05:00
|
|
|
// make sure the module's integration tests run after the integ-test-zip (ie rest tests)
|
2015-12-10 19:16:49 -05:00
|
|
|
module.afterEvaluate({
|
2018-02-14 01:49:53 -05:00
|
|
|
module.integTest.mustRunAfter(':distribution:archives:integ-test-zip:integTest')
|
2015-12-10 19:16:49 -05:00
|
|
|
})
|
|
|
|
restTestExpansions['expected.modules.count'] += 1
|
2015-10-29 14:40:19 -04:00
|
|
|
}
|
|
|
|
|
2018-02-23 11:03:17 -05:00
|
|
|
// use licenses from each of the bundled xpack plugins
|
|
|
|
Project xpack = project(':x-pack:plugin')
|
2018-05-16 18:35:57 -04:00
|
|
|
xpack.subprojects.findAll { it.parent == xpack }.each { Project xpackModule ->
|
|
|
|
File licenses = new File(xpackModule.projectDir, 'licenses')
|
2018-02-23 11:03:17 -05:00
|
|
|
if (licenses.exists()) {
|
|
|
|
buildDefaultNotice.licensesDir licenses
|
2016-07-12 15:13:52 -04:00
|
|
|
}
|
2018-05-16 18:35:57 -04:00
|
|
|
copyModule(processDefaultOutputs, xpackModule)
|
|
|
|
copyLog4jProperties(buildDefaultLog4jConfig, xpackModule)
|
2016-07-12 15:13:52 -04:00
|
|
|
}
|
2016-07-11 16:00:45 -04:00
|
|
|
|
2015-12-03 17:18:26 -05:00
|
|
|
// make sure we have a clean task since we aren't a java project, but we have tasks that
|
|
|
|
// put stuff in the build dir
|
|
|
|
task clean(type: Delete) {
|
|
|
|
delete 'build'
|
|
|
|
}
|
|
|
|
|
2018-02-21 20:46:40 -05:00
|
|
|
configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
|
2015-10-29 14:40:19 -04:00
|
|
|
// TODO: the map needs to be an input of the tasks, so that when it changes, the task will re-run...
|
|
|
|
/*****************************************************************************
|
|
|
|
* Properties to expand when copying packaging files *
|
|
|
|
*****************************************************************************/
|
|
|
|
project.ext {
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* Common files in all distributions *
|
|
|
|
*****************************************************************************/
|
|
|
|
libFiles = copySpec {
|
2018-05-25 07:56:35 -04:00
|
|
|
// delay by using closures, since they have not yet been configured, so no jar task exists yet
|
2018-01-11 13:30:43 -05:00
|
|
|
from { project(':server').jar }
|
|
|
|
from { project(':server').configurations.runtime }
|
2018-01-03 14:12:43 -05:00
|
|
|
from { project(':libs:plugin-classloader').jar }
|
2018-06-10 20:03:21 -04:00
|
|
|
from { project(':distribution:tools:java-version-checker').jar }
|
2017-12-06 18:03:13 -05:00
|
|
|
from { project(':distribution:tools:launchers').jar }
|
2018-05-25 07:56:35 -04:00
|
|
|
into('tools/plugin-cli') {
|
|
|
|
from { project(':distribution:tools:plugin-cli').jar }
|
|
|
|
from { project(':distribution:tools:plugin-cli').configurations.runtime }
|
|
|
|
}
|
2015-12-03 17:18:26 -05:00
|
|
|
}
|
|
|
|
|
2018-02-23 11:03:17 -05:00
|
|
|
modulesFiles = { oss ->
|
|
|
|
copySpec {
|
|
|
|
eachFile {
|
|
|
|
if (it.relativePath.segments[-2] == 'bin') {
|
|
|
|
// bin files, wherever they are within modules (eg platform specific) should be executable
|
|
|
|
it.mode = 0755
|
2018-05-23 23:15:19 -04:00
|
|
|
} else {
|
|
|
|
it.mode = 0644
|
2018-02-23 11:03:17 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (oss) {
|
|
|
|
from project(':distribution').buildOssModules
|
|
|
|
} else {
|
|
|
|
from project(':distribution').buildDefaultModules
|
|
|
|
}
|
|
|
|
}
|
2015-10-29 14:40:19 -04:00
|
|
|
}
|
|
|
|
|
2016-07-12 15:13:52 -04:00
|
|
|
transportModulesFiles = copySpec {
|
|
|
|
from project(':distribution').buildTransportModules
|
2016-07-11 16:00:45 -04:00
|
|
|
}
|
2016-07-12 15:13:52 -04:00
|
|
|
|
2018-02-23 11:03:17 -05:00
|
|
|
configFiles = { distributionType, oss ->
|
2018-02-21 20:46:40 -05:00
|
|
|
copySpec {
|
2018-02-23 11:03:17 -05:00
|
|
|
with copySpec {
|
|
|
|
// main config files, processed with distribution specific substitutions
|
|
|
|
from '../src/config'
|
|
|
|
exclude 'log4j2.properties' // this is handled separately below
|
2018-03-19 15:13:31 -04:00
|
|
|
MavenFilteringHack.filter(it, expansionsForDistribution(distributionType, oss))
|
2018-02-23 11:03:17 -05:00
|
|
|
}
|
|
|
|
if (oss) {
|
|
|
|
from project(':distribution').buildOssLog4jConfig
|
|
|
|
from project(':distribution').buildOssConfig
|
|
|
|
} else {
|
|
|
|
from project(':distribution').buildDefaultLog4jConfig
|
|
|
|
from project(':distribution').buildDefaultConfig
|
|
|
|
}
|
2018-02-21 20:46:40 -05:00
|
|
|
}
|
2015-10-29 14:40:19 -04:00
|
|
|
}
|
|
|
|
|
2018-02-23 11:03:17 -05:00
|
|
|
binFiles = { distributionType, oss ->
|
2018-02-21 20:46:40 -05:00
|
|
|
copySpec {
|
2018-02-23 11:03:17 -05:00
|
|
|
with copySpec {
|
|
|
|
// main bin files, processed with distribution specific substitutions
|
|
|
|
// everything except windows files
|
|
|
|
from '../src/bin'
|
|
|
|
exclude '*.exe'
|
|
|
|
exclude '*.bat'
|
|
|
|
eachFile { it.setMode(0755) }
|
2018-03-19 15:13:31 -04:00
|
|
|
MavenFilteringHack.filter(it, expansionsForDistribution(distributionType, oss))
|
2018-02-23 11:03:17 -05:00
|
|
|
}
|
|
|
|
with copySpec {
|
|
|
|
eachFile { it.setMode(0755) }
|
|
|
|
if (oss) {
|
|
|
|
from project(':distribution').buildOssBin
|
|
|
|
} else {
|
|
|
|
from project(':distribution').buildDefaultBin
|
|
|
|
}
|
|
|
|
}
|
2018-02-21 20:46:40 -05:00
|
|
|
}
|
2015-10-29 14:40:19 -04:00
|
|
|
}
|
2016-05-26 12:19:38 -04:00
|
|
|
|
2017-02-15 12:40:16 -05:00
|
|
|
noticeFile = copySpec {
|
|
|
|
if (project.name == 'integ-test-zip') {
|
2018-02-23 11:03:17 -05:00
|
|
|
from buildServerNotice
|
2017-02-15 12:40:16 -05:00
|
|
|
} else {
|
2018-02-23 11:03:17 -05:00
|
|
|
from buildDefaultNotice
|
2017-02-15 12:40:16 -05:00
|
|
|
}
|
|
|
|
}
|
2015-10-29 14:40:19 -04:00
|
|
|
}
|
2016-05-05 20:53:01 -04:00
|
|
|
|
2015-10-29 14:40:19 -04:00
|
|
|
}
|
|
|
|
|
2016-05-13 19:36:26 -04:00
|
|
|
task run(type: RunTask) {
|
2018-02-23 11:03:17 -05:00
|
|
|
distribution = System.getProperty('run.distribution', 'zip')
|
2018-05-09 21:46:14 -04:00
|
|
|
if (distribution == 'zip') {
|
2018-05-18 08:11:11 -04:00
|
|
|
String licenseType = System.getProperty("run.license_type", "basic")
|
2018-05-09 21:46:14 -04:00
|
|
|
if (licenseType == 'trial') {
|
|
|
|
setting 'xpack.ml.enabled', 'true'
|
|
|
|
setting 'xpack.graph.enabled', 'true'
|
|
|
|
setting 'xpack.watcher.enabled', 'true'
|
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
2018-05-18 08:11:11 -04:00
|
|
|
setupCommand 'setupTestAdmin',
|
|
|
|
'bin/elasticsearch-users', 'useradd', 'elastic-admin', '-p', 'elastic-password', '-r', 'superuser'
|
2018-05-09 21:46:14 -04:00
|
|
|
} else if (licenseType != 'basic') {
|
|
|
|
throw new IllegalArgumentException("Unsupported self-generated license type: [" + licenseType + "[basic] or [trial].")
|
|
|
|
}
|
|
|
|
setting 'xpack.security.enabled', 'true'
|
|
|
|
setting 'xpack.monitoring.enabled', 'true'
|
|
|
|
setting 'xpack.sql.enabled', 'true'
|
|
|
|
setting 'xpack.rollup.enabled', 'true'
|
|
|
|
keystoreSetting 'bootstrap.password', 'password'
|
|
|
|
}
|
2016-05-13 19:36:26 -04:00
|
|
|
}
|
2015-11-16 19:02:44 -05:00
|
|
|
|
2015-11-05 15:47:54 -05:00
|
|
|
/**
|
|
|
|
* Build some variables that are replaced in the packages. This includes both
|
2016-02-04 10:00:55 -05:00
|
|
|
* scripts like bin/elasticsearch and bin/elasticsearch-plugin that a user might run and also
|
2015-11-05 15:47:54 -05:00
|
|
|
* scripts like postinst which are run as part of the installation.
|
|
|
|
*
|
|
|
|
* <dl>
|
|
|
|
* <dt>package.name</dt>
|
|
|
|
* <dd>The name of the project. Its sprinkled throughout the scripts.</dd>
|
|
|
|
* <dt>package.version</dt>
|
|
|
|
* <dd>The version of the project. Its mostly used to find the exact jar name.
|
|
|
|
* </dt>
|
|
|
|
* <dt>path.conf</dt>
|
|
|
|
* <dd>The default directory from which to load configuration. This is used in
|
|
|
|
* the packaging scripts, but in that context it is always
|
2016-02-04 10:00:55 -05:00
|
|
|
* /etc/elasticsearch. Its also used in bin/elasticsearch-plugin, where it is
|
2015-11-05 15:47:54 -05:00
|
|
|
* /etc/elasticsearch for the os packages but $ESHOME/config otherwise.</dd>
|
|
|
|
* <dt>path.env</dt>
|
|
|
|
* <dd>The env file sourced before bin/elasticsearch to set environment
|
|
|
|
* variables. Think /etc/defaults/elasticsearch.</dd>
|
|
|
|
* <dt>heap.min and heap.max</dt>
|
|
|
|
* <dd>Default min and max heap</dd>
|
|
|
|
* <dt>scripts.footer</dt>
|
|
|
|
* <dd>Footer appended to control scripts embedded in the distribution that is
|
|
|
|
* (almost) entirely there for cosmetic reasons.</dd>
|
|
|
|
* <dt>stopping.timeout</dt>
|
|
|
|
* <dd>RPM's init script needs to wait for elasticsearch to stop before
|
|
|
|
* returning from stop and it needs a maximum time to wait. This is it. One
|
|
|
|
* day. DEB retries forever.</dd>
|
|
|
|
* </dl>
|
|
|
|
*/
|
2018-02-21 20:46:40 -05:00
|
|
|
subprojects {
|
2018-03-19 15:13:31 -04:00
|
|
|
ext.expansionsForDistribution = { distributionType, oss ->
|
2018-02-21 20:46:40 -05:00
|
|
|
final String defaultHeapSize = "1g"
|
|
|
|
final String packagingPathData = "path.data: /var/lib/elasticsearch"
|
|
|
|
final String pathLogs = "/var/log/elasticsearch"
|
|
|
|
final String packagingPathLogs = "path.logs: ${pathLogs}"
|
|
|
|
final String packagingLoggc = "${pathLogs}/gc.log"
|
|
|
|
|
2018-04-09 18:20:01 -04:00
|
|
|
String licenseText
|
|
|
|
if (oss) {
|
2018-04-10 16:58:49 -04:00
|
|
|
licenseText = rootProject.file('licenses/APACHE-LICENSE-2.0.txt').getText('UTF-8')
|
2018-04-09 18:20:01 -04:00
|
|
|
} else {
|
2018-04-10 16:58:49 -04:00
|
|
|
licenseText = rootProject.file('licenses/ELASTIC-LICENSE.txt').getText('UTF-8')
|
2018-04-09 18:20:01 -04:00
|
|
|
}
|
|
|
|
// license text needs to be indented with a single space
|
|
|
|
licenseText = ' ' + licenseText.replace('\n', '\n ')
|
|
|
|
|
2018-02-21 20:46:40 -05:00
|
|
|
String footer = "# Built for ${project.name}-${project.version} " +
|
|
|
|
"(${distributionType})"
|
|
|
|
Map<String, Object> expansions = [
|
|
|
|
'project.name': project.name,
|
|
|
|
'project.version': version,
|
|
|
|
|
|
|
|
'path.conf': [
|
|
|
|
'deb': '/etc/elasticsearch',
|
|
|
|
'rpm': '/etc/elasticsearch',
|
|
|
|
'def': '"$ES_HOME"/config'
|
|
|
|
],
|
|
|
|
'path.data': [
|
|
|
|
'deb': packagingPathData,
|
|
|
|
'rpm': packagingPathData,
|
|
|
|
'def': '#path.data: /path/to/data'
|
|
|
|
],
|
|
|
|
'path.env': [
|
|
|
|
'deb': '/etc/default/elasticsearch',
|
|
|
|
'rpm': '/etc/sysconfig/elasticsearch',
|
|
|
|
/* There isn't one of these files for tar or zip but its important to
|
|
|
|
make an empty string here so the script can properly skip it. */
|
|
|
|
'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; done',
|
|
|
|
],
|
|
|
|
'source.path.env': [
|
|
|
|
'deb': 'source /etc/default/elasticsearch',
|
|
|
|
'rpm': 'source /etc/sysconfig/elasticsearch',
|
|
|
|
'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; fi',
|
|
|
|
],
|
|
|
|
'path.logs': [
|
|
|
|
'deb': packagingPathLogs,
|
|
|
|
'rpm': packagingPathLogs,
|
|
|
|
'def': '#path.logs: /path/to/logs'
|
|
|
|
],
|
|
|
|
'loggc': [
|
|
|
|
'deb': packagingLoggc,
|
|
|
|
'rpm': packagingLoggc,
|
|
|
|
'def': 'logs/gc.log'
|
|
|
|
],
|
|
|
|
|
|
|
|
'heap.min': defaultHeapSize,
|
|
|
|
'heap.max': defaultHeapSize,
|
|
|
|
|
|
|
|
'heap.dump.path': [
|
|
|
|
'deb': "-XX:HeapDumpPath=/var/lib/elasticsearch",
|
|
|
|
'rpm': "-XX:HeapDumpPath=/var/lib/elasticsearch",
|
2018-03-18 15:32:37 -04:00
|
|
|
'def': "-XX:HeapDumpPath=data"
|
2018-02-21 20:46:40 -05:00
|
|
|
],
|
|
|
|
|
2018-03-13 16:32:16 -04:00
|
|
|
'error.file': [
|
|
|
|
'deb': "-XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log",
|
|
|
|
'rpm': "-XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log",
|
2018-03-18 15:33:17 -04:00
|
|
|
'def': "-XX:ErrorFile=logs/hs_err_pid%p.log"
|
2018-03-13 16:32:16 -04:00
|
|
|
],
|
|
|
|
|
2018-02-21 20:46:40 -05:00
|
|
|
'stopping.timeout': [
|
|
|
|
'rpm': 86400,
|
|
|
|
],
|
|
|
|
|
|
|
|
'scripts.footer': [
|
|
|
|
/* Debian needs exit 0 on these scripts so we add it here and preserve
|
|
|
|
the pretty footer. */
|
|
|
|
'deb': "exit 0\n${footer}",
|
|
|
|
'def': footer
|
|
|
|
],
|
2018-03-19 15:13:31 -04:00
|
|
|
|
|
|
|
'es.distribution.flavor': [
|
|
|
|
'def': oss ? 'oss' : 'default'
|
2018-04-09 18:20:01 -04:00
|
|
|
],
|
|
|
|
|
2018-04-11 22:37:59 -04:00
|
|
|
|
|
|
|
'es.distribution.type': [
|
|
|
|
'deb': 'deb',
|
|
|
|
'rpm': 'rpm',
|
|
|
|
'tar': 'tar',
|
|
|
|
'zip': 'zip'
|
|
|
|
],
|
|
|
|
|
2018-04-09 18:20:01 -04:00
|
|
|
'license.name': [
|
|
|
|
'deb': oss ? 'ASL-2.0' : 'Elastic-License'
|
|
|
|
],
|
|
|
|
|
|
|
|
'license.text': [
|
|
|
|
'deb': licenseText,
|
|
|
|
],
|
2018-02-21 20:46:40 -05:00
|
|
|
]
|
|
|
|
Map<String, String> result = [:]
|
|
|
|
expansions = expansions.each { key, value ->
|
|
|
|
if (value instanceof Map) {
|
|
|
|
// 'def' is for default but its three characters like 'rpm' and 'deb'
|
|
|
|
value = value[distributionType] ?: value['def']
|
|
|
|
if (value == null) {
|
|
|
|
return
|
|
|
|
}
|
2015-11-05 15:47:54 -05:00
|
|
|
}
|
2018-02-21 20:46:40 -05:00
|
|
|
result[key] = value
|
2015-11-05 15:47:54 -05:00
|
|
|
}
|
2018-02-21 20:46:40 -05:00
|
|
|
return result
|
2015-11-05 15:47:54 -05:00
|
|
|
}
|
|
|
|
}
|