Skip to content

Commit 3a3e5f6

Browse files
authored
Apply 2-space indent to all gradle scripts (#48849)
Closes #48724. Update `.editorconfig` to make the Java settings the default for all files, and then apply a 2-space indent to all `*.gradle` files. Then reformat all the files.
1 parent fbaf8c4 commit 3a3e5f6

File tree

184 files changed

+4217
-4215
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+4217
-4215
lines changed

.ci/init.gradle

+77-77
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,114 @@
1-
import com.bettercloud.vault.VaultConfig;
2-
import com.bettercloud.vault.Vault;
1+
import com.bettercloud.vault.VaultConfig
2+
import com.bettercloud.vault.Vault
33

44
initscript {
5-
repositories {
6-
mavenCentral()
7-
}
8-
dependencies {
9-
classpath 'com.bettercloud:vault-java-driver:4.1.0'
10-
}
5+
repositories {
6+
mavenCentral()
7+
}
8+
dependencies {
9+
classpath 'com.bettercloud:vault-java-driver:4.1.0'
10+
}
1111
}
1212

13-
boolean USE_ARTIFACTORY=false
13+
boolean USE_ARTIFACTORY = false
1414

1515
if (System.getenv('VAULT_ADDR') == null) {
16-
throw new GradleException("You must set the VAULT_ADDR environment variable to use this init script.")
16+
throw new GradleException("You must set the VAULT_ADDR environment variable to use this init script.")
1717
}
1818

1919
if (System.getenv('VAULT_ROLE_ID') == null && System.getenv('VAULT_SECRET_ID') == null && System.getenv('VAULT_TOKEN') == null) {
20-
throw new GradleException("You must set either the VAULT_ROLE_ID and VAULT_SECRET_ID environment variables, " +
21-
"or the VAULT_TOKEN environment variable to use this init script.")
20+
throw new GradleException("You must set either the VAULT_ROLE_ID and VAULT_SECRET_ID environment variables, " +
21+
"or the VAULT_TOKEN environment variable to use this init script.")
2222
}
2323

2424
final String vaultToken = System.getenv('VAULT_TOKEN') ?: new Vault(
25-
new VaultConfig()
26-
.address(System.env.VAULT_ADDR)
27-
.engineVersion(1)
28-
.build()
29-
)
30-
.withRetries(5, 1000)
31-
.auth()
32-
.loginByAppRole("approle", System.env.VAULT_ROLE_ID, System.env.VAULT_SECRET_ID)
33-
.getAuthClientToken();
25+
new VaultConfig()
26+
.address(System.env.VAULT_ADDR)
27+
.engineVersion(1)
28+
.build()
29+
)
30+
.withRetries(5, 1000)
31+
.auth()
32+
.loginByAppRole("approle", System.env.VAULT_ROLE_ID, System.env.VAULT_SECRET_ID)
33+
.getAuthClientToken()
3434

3535
final Vault vault = new Vault(
36-
new VaultConfig()
37-
.address(System.env.VAULT_ADDR)
38-
.engineVersion(1)
39-
.token(vaultToken)
40-
.build()
36+
new VaultConfig()
37+
.address(System.env.VAULT_ADDR)
38+
.engineVersion(1)
39+
.token(vaultToken)
40+
.build()
4141
)
42-
.withRetries(5, 1000)
42+
.withRetries(5, 1000)
4343

4444

4545
if (USE_ARTIFACTORY) {
46-
final Map<String,String> artifactoryCredentials = vault.logical()
47-
.read("secret/elasticsearch-ci/artifactory.elstc.co")
48-
.getData();
49-
logger.info("Using elastic artifactory repos")
50-
Closure configCache = {
51-
return {
52-
name "artifactory-gradle-release"
53-
url "https://artifactory.elstc.co/artifactory/gradle-release"
54-
credentials {
55-
username artifactoryCredentials.get("username")
56-
password artifactoryCredentials.get("token")
57-
}
58-
}
46+
final Map<String, String> artifactoryCredentials = vault.logical()
47+
.read("secret/elasticsearch-ci/artifactory.elstc.co")
48+
.getData()
49+
logger.info("Using elastic artifactory repos")
50+
Closure configCache = {
51+
return {
52+
name "artifactory-gradle-release"
53+
url "https://artifactory.elstc.co/artifactory/gradle-release"
54+
credentials {
55+
username artifactoryCredentials.get("username")
56+
password artifactoryCredentials.get("token")
57+
}
5958
}
60-
settingsEvaluated { settings ->
61-
settings.pluginManagement {
62-
repositories {
63-
maven configCache()
64-
}
65-
}
59+
}
60+
settingsEvaluated { settings ->
61+
settings.pluginManagement {
62+
repositories {
63+
maven configCache()
64+
}
6665
}
67-
projectsLoaded {
68-
allprojects {
69-
buildscript {
70-
repositories {
71-
maven configCache()
72-
}
73-
}
74-
repositories {
75-
maven configCache()
76-
}
66+
}
67+
projectsLoaded {
68+
allprojects {
69+
buildscript {
70+
repositories {
71+
maven configCache()
7772
}
73+
}
74+
repositories {
75+
maven configCache()
76+
}
7877
}
78+
}
7979
}
8080

8181
projectsLoaded {
82-
rootProject {
83-
project.pluginManager.withPlugin('com.gradle.build-scan') {
84-
buildScan.server = 'https://gradle-enterprise.elastic.co'
85-
}
82+
rootProject {
83+
project.pluginManager.withPlugin('com.gradle.build-scan') {
84+
buildScan.server = 'https://gradle-enterprise.elastic.co'
8685
}
86+
}
8787
}
8888

8989

9090
final String buildCacheUrl = System.getProperty('org.elasticsearch.build.cache.url')
9191
final boolean buildCachePush = Boolean.valueOf(System.getProperty('org.elasticsearch.build.cache.push', 'false'))
9292

9393
if (buildCacheUrl) {
94-
final Map<String,String> buildCacheCredentials = vault.logical()
95-
.read("secret/elasticsearch-ci/gradle-build-cache")
96-
.getData();
97-
gradle.settingsEvaluated { settings ->
98-
settings.buildCache {
99-
local {
100-
// Disable the local build cache in CI since we use ephemeral workers and it incurs an IO penalty
101-
enabled = false
102-
}
103-
remote(HttpBuildCache) {
104-
url = buildCacheUrl
105-
push = buildCachePush
106-
credentials {
107-
username = buildCacheCredentials.get("username")
108-
password = buildCacheCredentials.get("password")
109-
}
110-
}
94+
final Map<String, String> buildCacheCredentials = vault.logical()
95+
.read("secret/elasticsearch-ci/gradle-build-cache")
96+
.getData()
97+
gradle.settingsEvaluated { settings ->
98+
settings.buildCache {
99+
local {
100+
// Disable the local build cache in CI since we use ephemeral workers and it incurs an IO penalty
101+
enabled = false
102+
}
103+
remote(HttpBuildCache) {
104+
url = buildCacheUrl
105+
push = buildCachePush
106+
credentials {
107+
username = buildCacheCredentials.get("username")
108+
password = buildCacheCredentials.get("password")
111109
}
110+
}
112111
}
112+
}
113113
}
114114

.editorconfig

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
root = true
44

5-
[*.java]
5+
[*]
66
charset = utf-8
7-
indent_style = space
8-
indent_size = 4
97
trim_trailing_whitespace = true
108
insert_final_newline = true
9+
indent_style = space
10+
indent_size = 4
1111

1212
[*.bat]
1313
indent_size = 2
14+
15+
[*.gradle]
16+
indent_size = 2

benchmarks/build.gradle

+19-19
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ archivesBaseName = 'elasticsearch-benchmarks'
2929
test.enabled = false
3030

3131
dependencies {
32-
compile(project(":server")) {
33-
// JMH ships with the conflicting version 4.6. This prevents us from using jopt-simple in benchmarks (which should be ok) but allows
34-
// us to invoke the JMH uberjar as usual.
35-
exclude group: 'net.sf.jopt-simple', module: 'jopt-simple'
36-
}
37-
compile "org.openjdk.jmh:jmh-core:$versions.jmh"
38-
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh"
39-
// Dependencies of JMH
40-
runtime 'net.sf.jopt-simple:jopt-simple:4.6'
41-
runtime 'org.apache.commons:commons-math3:3.2'
32+
compile(project(":server")) {
33+
// JMH ships with the conflicting version 4.6. This prevents us from using jopt-simple in benchmarks (which should be ok) but allows
34+
// us to invoke the JMH uberjar as usual.
35+
exclude group: 'net.sf.jopt-simple', module: 'jopt-simple'
36+
}
37+
compile "org.openjdk.jmh:jmh-core:$versions.jmh"
38+
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh"
39+
// Dependencies of JMH
40+
runtime 'net.sf.jopt-simple:jopt-simple:4.6'
41+
runtime 'org.apache.commons:commons-math3:3.2'
4242
}
4343

4444
compileJava.options.compilerArgs << "-Xlint:-cast,-rawtypes,-unchecked,-processing"
@@ -55,13 +55,13 @@ forbiddenApisMain.enabled = false
5555
dependencyLicenses.enabled = false
5656
dependenciesInfo.enabled = false
5757

58-
thirdPartyAudit.ignoreViolations (
59-
// these classes intentionally use JDK internal API (and this is ok since the project is maintained by Oracle employees)
60-
'org.openjdk.jmh.profile.AbstractHotspotProfiler',
61-
'org.openjdk.jmh.profile.HotspotThreadProfiler',
62-
'org.openjdk.jmh.profile.HotspotClassloadingProfiler',
63-
'org.openjdk.jmh.profile.HotspotCompilationProfiler',
64-
'org.openjdk.jmh.profile.HotspotMemoryProfiler',
65-
'org.openjdk.jmh.profile.HotspotRuntimeProfiler',
66-
'org.openjdk.jmh.util.Utils'
58+
thirdPartyAudit.ignoreViolations(
59+
// these classes intentionally use JDK internal API (and this is ok since the project is maintained by Oracle employees)
60+
'org.openjdk.jmh.profile.AbstractHotspotProfiler',
61+
'org.openjdk.jmh.profile.HotspotThreadProfiler',
62+
'org.openjdk.jmh.profile.HotspotClassloadingProfiler',
63+
'org.openjdk.jmh.profile.HotspotCompilationProfiler',
64+
'org.openjdk.jmh.profile.HotspotMemoryProfiler',
65+
'org.openjdk.jmh.profile.HotspotRuntimeProfiler',
66+
'org.openjdk.jmh.util.Utils'
6767
)

0 commit comments

Comments
 (0)