Skip to content

Commit 3c563fe

Browse files
authored
Update DistributionDownloader to support fetching arm64 bundles. (#929) (#934)
Signed-off-by: Marc Handalian <[email protected]>
1 parent 1f7df7a commit 3c563fe

File tree

2 files changed

+29
-10
lines changed

2 files changed

+29
-10
lines changed

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,16 @@ private String dependencyNotation(OpenSearchDistribution distribution) {
234234
extension = distribution.getPlatform() == Platform.WINDOWS ? "zip" : "tar.gz";
235235

236236
if (distroVersion.onOrAfter("1.0.0")) {
237-
classifier = ":" + distribution.getPlatform() + "-x64";
237+
switch (distribution.getArchitecture()) {
238+
case ARM64:
239+
classifier = ":" + distribution.getPlatform() + "-arm64";
240+
break;
241+
case X64:
242+
classifier = ":" + distribution.getPlatform() + "-x64";
243+
break;
244+
default:
245+
throw new IllegalArgumentException("Unsupported architecture: " + distribution.getArchitecture());
246+
}
238247
} else if (distroVersion.onOrAfter("7.0.0")) {
239248
classifier = ":" + distribution.getPlatform() + "-x86_64";
240249
} else {

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

+19-9
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,25 @@ public void testLocalCurrentVersionIntegTestZip() {
142142
public void testLocalCurrentVersionArchives() {
143143
for (Platform platform : Platform.values()) {
144144
for (boolean bundledJdk : new boolean[] { true, false }) {
145-
// create a new project in each iteration, so that we know we are resolving the only additional project being created
146-
Project project = createProject(BWC_MINOR, true);
147-
String projectName = projectName(platform.toString(), bundledJdk);
148-
projectName += (platform == Platform.WINDOWS ? "-zip" : "-tar");
149-
Project archiveProject = ProjectBuilder.builder().withParent(archivesProject).withName(projectName).build();
150-
archiveProject.getConfigurations().create("default");
151-
archiveProject.getArtifacts().add("default", new File("doesnotmatter"));
152-
createDistro(project, "distro", VersionProperties.getOpenSearch(), Type.ARCHIVE, platform, bundledJdk);
153-
checkPlugin(project);
145+
for (Architecture architecture : Architecture.values()) {
146+
// create a new project in each iteration, so that we know we are resolving the only additional project being created
147+
Project project = createProject(BWC_MINOR, true);
148+
String projectName = projectName(platform.toString(), bundledJdk);
149+
projectName += (platform == Platform.WINDOWS ? "-zip" : "-tar");
150+
Project archiveProject = ProjectBuilder.builder().withParent(archivesProject).withName(projectName).build();
151+
archiveProject.getConfigurations().create("default");
152+
archiveProject.getArtifacts().add("default", new File("doesnotmatter"));
153+
final OpenSearchDistribution distro = createDistro(
154+
project,
155+
"distro",
156+
VersionProperties.getOpenSearch(),
157+
Type.ARCHIVE,
158+
platform,
159+
bundledJdk
160+
);
161+
distro.setArchitecture(architecture);
162+
checkPlugin(project);
163+
}
154164
}
155165
}
156166
}

0 commit comments

Comments
 (0)