Skip to content

Commit

Permalink
Properly install sys deps for Apple silicon
Browse files Browse the repository at this point in the history
  • Loading branch information
mcafaro committed May 7, 2024
1 parent 3238073 commit be3d7f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,34 @@ export async function install(platform: string, architecture: string, release: s
if (releaseInfo.name < "r2020b") {
return Promise.reject(Error(`Release '${releaseInfo.name}' is not supported. Use 'R2020b' or a later release.`));
}
if (platform === "darwin" && architecture === "arm64" && releaseInfo.name < "r2023b") {
architecture = "x64";
}

await core.group("Preparing system for MATLAB", async () =>
matlab.installSystemDependencies(platform, architecture, releaseInfo.name)
);

await core.group("Setting up MATLAB", async () => {
let matlabArch = architecture;
if (platform === "darwin" && architecture === "arm64" && releaseInfo.name < "r2023b") {
matlabArch = "x64";
}

let [destination, alreadyExists]: [string, boolean] = await matlab.getToolcacheDir(platform, releaseInfo);
let cacheHit = false;

if (useCache) {
const supportFilesDir = matlab.getSupportPackagesPath(platform, releaseInfo.name);
cacheHit = await cache.restoreMATLAB(releaseInfo, platform, architecture, products, destination, supportFilesDir);
cacheHit = await cache.restoreMATLAB(releaseInfo, platform, matlabArch, products, destination, supportFilesDir);
}

if (!alreadyExists && !cacheHit) {
const mpmPath: string = await mpm.setup(platform, architecture);
const mpmPath: string = await mpm.setup(platform, matlabArch);
await mpm.install(mpmPath, releaseInfo, products, destination);
}

core.addPath(path.join(destination, "bin"));
core.setOutput('matlabroot', destination);

await matlab.setupBatch(platform, architecture);
await matlab.setupBatch(platform, matlabArch);
});

return;
Expand Down
4 changes: 2 additions & 2 deletions src/install.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ describe("install procedure", () => {
version: "9.14.0",
updateNumber: "latest"
});
await expect(install.install("darwin", "arm64", "r2023a", products, useCache)).resolves.toBeUndefined();
expect(matlabInstallSystemDependenciesMock).toHaveBeenCalledWith("darwin","x64","r2023a");
await expect(install.install("darwin", "arm64", "r2023a", products, true)).resolves.toBeUndefined();
expect(matlabInstallSystemDependenciesMock).toHaveBeenCalledWith("darwin","arm64","r2023a");
expect(matlabSetupBatchMock).toHaveBeenCalledWith("darwin","x64");
expect(mpmSetupMock).toHaveBeenCalledWith("darwin","x64");
});
Expand Down

0 comments on commit be3d7f8

Please sign in to comment.