-
Notifications
You must be signed in to change notification settings - Fork 25.1k
/
Copy pathsettings.gradle
81 lines (76 loc) · 4.19 KB
/
settings.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
plugins {
id "com.gradle.develocity" version "3.19.2"
}
// Include all subdirectories as example projects
rootDir.listFiles().findAll { it.directory && new File(it, 'build.gradle').exists() }.each { subDir ->
include ":${subDir.name}"
}
gradle.rootProject {
ext {
// Fetch Elasticsearch version from outer build
new File(rootDir.parentFile.parentFile, 'build-tools-internal/version.properties').withInputStream { is ->
def props = new Properties()
props.load(is)
elasticsearchVersion = "${props.get('elasticsearch')}-SNAPSHOT"
// for example plugins the pluginApiVersion is the same as ES version, but for real plugins it only has to match a major
pluginApiVersion = "${props.get('elasticsearch')}-SNAPSHOT"
log4jVersion = props.get('log4j')
luceneVersion = props.get('lucene')
}
}
}
gradle.projectsEvaluated {
if (gradle.includedBuilds) {
gradle.allprojects {
configurations.all {
resolutionStrategy.dependencySubstitution {
// When using composite builds we need to tell Gradle to use the project names since we rename the published artifacts
substitute module('org.elasticsearch.plugin:elasticsearch-plugin-api') using module("org.elasticsearch.plugin:plugin-api:${elasticsearchVersion}")
substitute module('org.elasticsearch.plugin:elasticsearch-plugin-analysis-api') using module("org.elasticsearch.plugin:plugin-analysis-api:${elasticsearchVersion}")
substitute module('org.elasticsearch:elasticsearch-plugin-scanner') using module("org.elasticsearch:plugin-scanner:${elasticsearchVersion}")
substitute module('org.elasticsearch:elasticsearch-core') using module("org.elasticsearch:core:${elasticsearchVersion}")
substitute module('org.elasticsearch:elasticsearch') using module("org.elasticsearch:server:${elasticsearchVersion}")
substitute module('org.elasticsearch.client:elasticsearch-rest-client') using module("org.elasticsearch.client:rest:${elasticsearchVersion}")
substitute module('org.elasticsearch.plugin:x-pack-core') using module("org.elasticsearch.plugin:core:${elasticsearchVersion}")
substitute module('org.elasticsearch.plugin:elasticsearch-scripting-painless-spi') using module("org.elasticsearch.plugin:spi:${elasticsearchVersion}")
substitute module('org.elasticsearch.distribution.integ-test-zip:elasticsearch') using variant(module("org.elasticsearch.distribution.integ-test-zip:integ-test-zip:${elasticsearchVersion}")) {
attributes {
attribute(Attribute.of("composite", Boolean.class), true)
}
}
substitute module('elasticsearch-distribution-snapshot:elasticsearch') using variant(module("org.elasticsearch.distribution.default:${getDefaultDistroProjectName()}:${elasticsearchVersion}")) {
attributes {
attribute(Attribute.of("composite", Boolean.class), true)
}
}
}
}
}
}
}
/*
* Determine which :distribution:archives project to use when resolving as part of a composite build.
* We have to duplicate this somewhat, since the example plugins can't use InternalDistributionDownloadPlugin (this is intentional) which is where
* that resolution logic lives.
*/
static def getDefaultDistroProjectName() {
String os = System.getProperty("os.name", "")
boolean isArm = System.getProperty("os.arch", "") == 'aarch64'
if (os.startsWith("Windows")) {
return 'windows-zip'
} else if (os.startsWith("Linux") || os.startsWith("LINUX")) {
return isArm ? 'linux-aarch64-tar' : 'linux-tar'
} else if (os.startsWith("Mac")) {
return isArm ? 'darwin-aarch64-tar' : 'darwin-tar'
} else {
throw new GradleException("Unable to determine system platform type.")
}
}