Update DistributionDownloader to support fetching arm64 bundles. (#929) (#934)

Signed-off-by: Marc Handalian <handalm@amazon.com>
This commit is contained in:
Marc Handalian 2021-07-02 15:02:47 -07:00 committed by GitHub
parent 1f7df7adac
commit 3c563fedd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 10 deletions

View File

@ -234,7 +234,16 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
extension = distribution.getPlatform() == Platform.WINDOWS ? "zip" : "tar.gz";
if (distroVersion.onOrAfter("1.0.0")) {
classifier = ":" + distribution.getPlatform() + "-x64";
switch (distribution.getArchitecture()) {
case ARM64:
classifier = ":" + distribution.getPlatform() + "-arm64";
break;
case X64:
classifier = ":" + distribution.getPlatform() + "-x64";
break;
default:
throw new IllegalArgumentException("Unsupported architecture: " + distribution.getArchitecture());
}
} else if (distroVersion.onOrAfter("7.0.0")) {
classifier = ":" + distribution.getPlatform() + "-x86_64";
} else {

View File

@ -142,15 +142,25 @@ public class DistributionDownloadPluginTests extends GradleUnitTestCase {
public void testLocalCurrentVersionArchives() {
for (Platform platform : Platform.values()) {
for (boolean bundledJdk : new boolean[] { true, false }) {
// create a new project in each iteration, so that we know we are resolving the only additional project being created
Project project = createProject(BWC_MINOR, true);
String projectName = projectName(platform.toString(), bundledJdk);
projectName += (platform == Platform.WINDOWS ? "-zip" : "-tar");
Project archiveProject = ProjectBuilder.builder().withParent(archivesProject).withName(projectName).build();
archiveProject.getConfigurations().create("default");
archiveProject.getArtifacts().add("default", new File("doesnotmatter"));
createDistro(project, "distro", VersionProperties.getOpenSearch(), Type.ARCHIVE, platform, bundledJdk);
checkPlugin(project);
for (Architecture architecture : Architecture.values()) {
// create a new project in each iteration, so that we know we are resolving the only additional project being created
Project project = createProject(BWC_MINOR, true);
String projectName = projectName(platform.toString(), bundledJdk);
projectName += (platform == Platform.WINDOWS ? "-zip" : "-tar");
Project archiveProject = ProjectBuilder.builder().withParent(archivesProject).withName(projectName).build();
archiveProject.getConfigurations().create("default");
archiveProject.getArtifacts().add("default", new File("doesnotmatter"));
final OpenSearchDistribution distro = createDistro(
project,
"distro",
VersionProperties.getOpenSearch(),
Type.ARCHIVE,
platform,
bundledJdk
);
distro.setArchitecture(architecture);
checkPlugin(project);
}
}
}
}