Skip to content

Commit aa9e541

Browse files
committed
Merge remote-tracking branch 'origin/master' into feature-internal-idp
2 parents 3f32f5d + 10b7ffa commit aa9e541

File tree

513 files changed

+7131
-4326
lines changed

Some content is hidden

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

513 files changed

+7131
-4326
lines changed

.ci/dockerOnLinuxExclusions

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
# Docker tests to be skipped on that OS. If /etc/os-release doesn't exist
55
# (as is the case on centos-6, for example) then that OS will again be
66
# excluded.
7-
centos-6
87
debian-8
98
opensuse-15-1
10-
ol-6.10
119
ol-7.7
1210
sles-12

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/AntFixture.groovy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ import org.elasticsearch.gradle.LoggedExec
2525
import org.gradle.api.GradleException
2626
import org.gradle.api.Task
2727
import org.gradle.api.tasks.Exec
28-
import org.gradle.api.tasks.Input
2928
import org.gradle.api.tasks.Internal
30-
3129
/**
3230
* A fixture for integration tests which runs in a separate process launched by Ant.
3331
*/

buildSrc/src/main/java/org/elasticsearch/gradle/DistributionDownloadPlugin.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
import java.util.concurrent.Callable;
4949
import java.util.function.Supplier;
5050

51+
import static org.elasticsearch.gradle.Util.capitalize;
52+
5153
/**
5254
* A plugin to manage getting and extracting distributions of Elasticsearch.
5355
*
@@ -309,10 +311,6 @@ private static String configName(String prefix, ElasticsearchDistribution distri
309311
);
310312
}
311313

312-
private static String capitalize(String s) {
313-
return s.substring(0, 1).toUpperCase(Locale.ROOT) + s.substring(1);
314-
}
315-
316314
private static String extractTaskName(ElasticsearchDistribution distribution) {
317315
String taskName = "extractElasticsearch";
318316
if (distribution.getType() != Type.INTEG_TEST_ZIP) {

buildSrc/src/main/java/org/elasticsearch/gradle/Jdk.java

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,41 @@
2020
package org.elasticsearch.gradle;
2121

2222
import org.gradle.api.Buildable;
23-
import org.gradle.api.Project;
2423
import org.gradle.api.artifacts.Configuration;
24+
import org.gradle.api.model.ObjectFactory;
2525
import org.gradle.api.provider.Property;
2626
import org.gradle.api.tasks.TaskDependency;
2727

2828
import java.io.File;
29-
import java.util.Arrays;
30-
import java.util.Collections;
3129
import java.util.Iterator;
3230
import java.util.List;
31+
import java.util.regex.Matcher;
3332
import java.util.regex.Pattern;
3433

3534
public class Jdk implements Buildable, Iterable<File> {
3635

3736
private static final List<String> ALLOWED_VENDORS = List.of("adoptopenjdk", "openjdk");
38-
static final Pattern VERSION_PATTERN = Pattern.compile("(\\d+)(\\.\\d+\\.\\d+)?\\+(\\d+(?:\\.\\d+)?)(@([a-f0-9]{32}))?");
39-
private static final List<String> ALLOWED_PLATFORMS = Collections.unmodifiableList(Arrays.asList("darwin", "linux", "windows", "mac"));
37+
private static final List<String> ALLOWED_PLATFORMS = List.of("darwin", "linux", "windows", "mac");
38+
private static final Pattern VERSION_PATTERN = Pattern.compile("(\\d+)(\\.\\d+\\.\\d+)?\\+(\\d+(?:\\.\\d+)?)(@([a-f0-9]{32}))?");
39+
private static final Pattern LEGACY_VERSION_PATTERN = Pattern.compile("(\\d)(u\\d+)\\+(b\\d+?)(@([a-f0-9]{32}))?");
4040

4141
private final String name;
4242
private final Configuration configuration;
4343

4444
private final Property<String> vendor;
4545
private final Property<String> version;
4646
private final Property<String> platform;
47+
private String baseVersion;
48+
private String major;
49+
private String build;
50+
private String hash;
4751

48-
Jdk(String name, Project project) {
52+
Jdk(String name, Configuration configuration, ObjectFactory objectFactory) {
4953
this.name = name;
50-
this.configuration = project.getConfigurations().create("jdk_" + name);
51-
this.vendor = project.getObjects().property(String.class);
52-
this.version = project.getObjects().property(String.class);
53-
this.platform = project.getObjects().property(String.class);
54+
this.configuration = configuration;
55+
this.vendor = objectFactory.property(String.class);
56+
this.version = objectFactory.property(String.class);
57+
this.platform = objectFactory.property(String.class);
5458
}
5559

5660
public String getName() {
@@ -73,9 +77,10 @@ public String getVersion() {
7377
}
7478

7579
public void setVersion(String version) {
76-
if (VERSION_PATTERN.matcher(version).matches() == false) {
80+
if (VERSION_PATTERN.matcher(version).matches() == false && LEGACY_VERSION_PATTERN.matcher(version).matches() == false) {
7781
throw new IllegalArgumentException("malformed version [" + version + "] for jdk [" + name + "]");
7882
}
83+
parseVersion(version);
7984
this.version.set(version);
8085
}
8186

@@ -92,15 +97,30 @@ public void setPlatform(String platform) {
9297
this.platform.set(platform);
9398
}
9499

95-
// pkg private, for internal use
96-
Configuration getConfiguration() {
97-
return configuration;
100+
public String getBaseVersion() {
101+
return baseVersion;
102+
}
103+
104+
public String getMajor() {
105+
return major;
106+
}
107+
108+
public String getBuild() {
109+
return build;
110+
}
111+
112+
public String getHash() {
113+
return hash;
98114
}
99115

100116
public String getPath() {
101117
return configuration.getSingleFile().toString();
102118
}
103119

120+
public String getConfigurationName() {
121+
return configuration.getName();
122+
}
123+
104124
@Override
105125
public String toString() {
106126
return getPath();
@@ -143,4 +163,23 @@ public Iterator<File> iterator() {
143163
return configuration.iterator();
144164
}
145165

166+
private void parseVersion(String version) {
167+
// decompose the bundled jdk version, broken into elements as: [feature, interim, update, build]
168+
// Note the "patch" version is not yet handled here, as it has not yet been used by java.
169+
Matcher jdkVersionMatcher = VERSION_PATTERN.matcher(version);
170+
if (jdkVersionMatcher.matches() == false) {
171+
// Try again with the pre-Java9 version format
172+
jdkVersionMatcher = LEGACY_VERSION_PATTERN.matcher(version);
173+
174+
if (jdkVersionMatcher.matches() == false) {
175+
throw new IllegalArgumentException("Malformed jdk version [" + version + "]");
176+
}
177+
}
178+
179+
baseVersion = jdkVersionMatcher.group(1) + (jdkVersionMatcher.group(2) != null ? (jdkVersionMatcher.group(2)) : "");
180+
major = jdkVersionMatcher.group(1);
181+
build = jdkVersionMatcher.group(3);
182+
hash = jdkVersionMatcher.group(5);
183+
}
184+
146185
}

0 commit comments

Comments
 (0)