Skip to content

Commit 2b3eb26

Browse files
authored
Add support for linux riscv64 platform (#18156)
Close #2341 Signed-off-by: Levi Zim <rsworktech@outlook.com>
1 parent 0cbd848 commit 2b3eb26

File tree

16 files changed

+90
-7
lines changed

16 files changed

+90
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55

66
## [Unreleased 3.x]
77
### Added
8+
- Add support for linux riscv64 platform ([#18156](https://github.com/opensearch-project/OpenSearch/pull/18156))
89
- [Rule based auto-tagging] Add get rule API ([#17336](https://github.com/opensearch-project/OpenSearch/pull/17336))
910
- Implement parallel shard refresh behind cluster settings ([#17782](https://github.com/opensearch-project/OpenSearch/pull/17782))
1011
- Bump OpenSearch Core main branch to 3.0.0 ([#18039](https://github.com/opensearch-project/OpenSearch/pull/18039))

buildSrc/src/main/java/org/opensearch/gradle/Architecture.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public enum Architecture {
3737
X64,
3838
ARM64,
3939
S390X,
40-
PPC64LE;
40+
PPC64LE,
41+
RISCV64;
4142

4243
public static Architecture current() {
4344
final String architecture = System.getProperty("os.arch", "");
@@ -51,6 +52,8 @@ public static Architecture current() {
5152
return S390X;
5253
case "ppc64le":
5354
return PPC64LE;
55+
case "riscv64":
56+
return RISCV64;
5457
default:
5558
throw new IllegalArgumentException("can not determine architecture from [" + architecture + "]");
5659
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ private String dependencyNotation(OpenSearchDistribution distribution) {
244244
case PPC64LE:
245245
classifier = ":" + distribution.getPlatform() + "-ppc64le";
246246
break;
247+
case RISCV64:
248+
classifier = ":" + distribution.getPlatform() + "-riscv64";
249+
break;
247250
default:
248251
throw new IllegalArgumentException("Unsupported architecture: " + distribution.getArchitecture());
249252
}

buildSrc/src/main/java/org/opensearch/gradle/JavaVariant.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
abstract class JavaVariant implements Buildable, Iterable<File> {
2626

2727
private static final List<String> ALLOWED_ARCHITECTURES = Collections.unmodifiableList(
28-
Arrays.asList("aarch64", "x64", "s390x", "ppc64le")
28+
Arrays.asList("aarch64", "x64", "s390x", "ppc64le", "riscv64")
2929
);
3030
private static final List<String> ALLOWED_VENDORS = Collections.unmodifiableList(Arrays.asList("adoptium", "adoptopenjdk", "openjdk"));
3131
private static final List<String> ALLOWED_PLATFORMS = Collections.unmodifiableList(

buildSrc/src/main/java/org/opensearch/gradle/VersionProperties.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public static Map<String, String> getVersions() {
9898
private static final String bundledJdkLinux_x64;
9999
private static final String bundledJdkLinux_s390x;
100100
private static final String bundledJdkLinux_ppc64le;
101+
private static final String bundledJdkLinux_riscv64;
101102
private static final String bundledJdkVendor;
102103
private static final Map<String, String> versions = new HashMap<String, String>();
103104

@@ -117,6 +118,7 @@ public static Map<String, String> getVersions() {
117118
bundledJdkLinux_x64 = props.getProperty("bundled_jdk_linux_x64", bundledJdkLinux);
118119
bundledJdkLinux_s390x = props.getProperty("bundled_jdk_linux_s390x", bundledJdkLinux);
119120
bundledJdkLinux_ppc64le = props.getProperty("bundled_jdk_linux_ppc64le", bundledJdkLinux);
121+
bundledJdkLinux_riscv64 = props.getProperty("bundled_jdk_linux_riscv64", bundledJdkLinux);
120122

121123
for (String property : props.stringPropertyNames()) {
122124
versions.put(property, props.getProperty(property));
@@ -155,6 +157,8 @@ private static String getBundledJdkLinux(String arch) {
155157
return bundledJdkLinux_s390x;
156158
case "ppc64le":
157159
return bundledJdkLinux_ppc64le;
160+
case "riscv64":
161+
return bundledJdkLinux_riscv64;
158162
default:
159163
throw new IllegalArgumentException("unknown platform [" + arch + "] for 'linux' platform");
160164
}

buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ private static List<DistributionProject> resolveArchiveProjects(File checkoutDir
166166
"linux-arm64-tar",
167167
"linux-ppc64le-tar",
168168
"linux-s390x-tar",
169+
"linux-riscv64-tar",
169170
"windows-zip"
170171
)
171172
);

buildSrc/src/test/java/org/opensearch/gradle/ArchitectureTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public void testCurrentArchitecture() {
2020
assertEquals(Architecture.ARM64, currentArchitecture("aarch64"));
2121
assertEquals(Architecture.S390X, currentArchitecture("s390x"));
2222
assertEquals(Architecture.PPC64LE, currentArchitecture("ppc64le"));
23+
assertEquals(Architecture.RISCV64, currentArchitecture("riscv64"));
2324
}
2425

2526
public void testInvalidCurrentArchitecture() {

buildSrc/src/test/java/org/opensearch/gradle/JdkDownloadPluginTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void testUnknownArchitecture() {
110110
"11.0.2+33",
111111
"linux",
112112
"unknown",
113-
"unknown architecture [unknown] for jdk [testjdk], must be one of [aarch64, x64, s390x, ppc64le]"
113+
"unknown architecture [unknown] for jdk [testjdk], must be one of [aarch64, x64, s390x, ppc64le, riscv64]"
114114
);
115115
}
116116

distribution/archives/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,20 @@ distribution_archives {
208208
}
209209
}
210210

211+
linuxRiscv64Tar {
212+
archiveClassifier = 'linux-riscv64'
213+
content {
214+
archiveFiles(modulesFiles('linux-riscv64'), 'tar', 'linux', 'riscv64', JavaPackageType.JDK)
215+
}
216+
}
217+
218+
noJdkLinuxRiscv64Tar {
219+
archiveClassifier = 'no-jdk-linux-riscv64'
220+
content {
221+
archiveFiles(modulesFiles('linux-riscv64'), 'tar', 'linux', 'riscv64', JavaPackageType.NONE)
222+
}
223+
}
224+
211225
windowsZip {
212226
archiveClassifier = 'windows-x64'
213227
content {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*
8+
* Modifications Copyright OpenSearch Contributors. See
9+
* GitHub history for details.
10+
*/
11+
12+
// This file is intentionally blank. All configuration of the
13+
// distribution is done in the parent project.
14+
15+
// See please https://docs.gradle.org/8.5/userguide/upgrading_version_8.html#deprecated_missing_project_directory

0 commit comments

Comments
 (0)