Skip to content

Commit d782250

Browse files
authored
Merge pull request #136 from mathworks/apple_silicon_final
Apple silicon final
2 parents 8dcdf43 + 142bcda commit d782250

File tree

5 files changed

+39
-25
lines changed

5 files changed

+39
-25
lines changed

package-lock.json

Lines changed: 14 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tasks/install-matlab/v0/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tasks/install-matlab/v1/src/matlab.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,15 @@ export async function setupBatch(platform: string, architecture: string) {
144144
} catch (err: any) {
145145
throw new Error("Failed to add MATLAB to system path.");
146146
}
147-
const exitCode = await taskLib.exec("chmod", ["+x", path.join(matlabBatchPath, "matlab-batch" + matlabBatchExt)]);
148-
if (exitCode !== 0) {
149-
return Promise.reject(Error("Unable to add execute permissions to matlab-batch binary."));
147+
if (platform !== "win32") {
148+
const exitCode = await taskLib.exec(
149+
"chmod",
150+
["+x", path.join(matlabBatchPath, "matlab-batch" + matlabBatchExt)],
151+
);
152+
if (exitCode !== 0) {
153+
return Promise.reject(Error("Unable to add execute permissions to matlab-batch binary."));
154+
}
150155
}
151-
return;
152156
}
153157

154158
export async function installSystemDependencies(platform: string, architecture: string, release: string) {

tasks/run-matlab-command/v1/matlab.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ export async function runCommand(command: string, platform: string, architecture
3737
}
3838

3939
export async function getRunMATLABCommandPath(platform: string, architecture: string): Promise<string> {
40-
if (architecture !== "x64") {
41-
return Promise.reject(
42-
`This task is not supported on ${platform} runners using the ${architecture} architecture.`,
43-
);
40+
if (architecture !== "x64" && !(platform === "darwin" && architecture === "arm64")) {
41+
const msg = `This task is not supported on ${platform} runners using the ${architecture} architecture.`;
42+
return Promise.reject(Error(msg));
4443
}
4544
let ext;
4645
let platformDir;
@@ -51,16 +50,19 @@ export async function getRunMATLABCommandPath(platform: string, architecture: st
5150
break;
5251
case "darwin":
5352
ext = "";
54-
platformDir = "maci64";
53+
if (architecture === "x64") {
54+
platformDir = "maci64";
55+
} else {
56+
platformDir = "maca64";
57+
}
5558
break;
5659
case "linux":
5760
ext = "";
5861
platformDir = "glnxa64";
5962
break;
6063
default:
61-
return Promise.reject(
62-
`This task is not supported on ${platform} runners using the ${architecture} architecture.`,
63-
);
64+
const msg = `This task is not supported on ${platform} runners using the ${architecture} architecture.`;
65+
return Promise.reject(Error(msg));
6466
}
6567

6668
const binDir = path.join(__dirname, "bin", platformDir);

tasks/run-matlab-command/v1/test/matlab.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,8 @@ export default function suite() {
130130
stubExtractZip.restore();
131131
});
132132

133-
const testBin = (platform: string, subdirectory: string, ext: string) => {
134-
it(`considers the appropriate rmc bin on ${platform}`, async () => {
135-
const architecture = "x64";
133+
const testBin = (platform: string, architecture: string, subdirectory: string, ext: string) => {
134+
it(`considers the appropriate rmc bin on ${platform} ${architecture}`, async () => {
136135
const p = await matlab.getRunMATLABCommandPath(platform, architecture);
137136
// unzips run-matlab-command binary
138137
assert(stubExtractZip.callCount === 1);
@@ -141,9 +140,10 @@ export default function suite() {
141140
});
142141
};
143142

144-
testBin("linux", "glnxa64", "");
145-
testBin("win32", "win64", ".exe");
146-
testBin("darwin", "maci64", "");
143+
testBin("linux", "x64", "glnxa64", "");
144+
testBin("win32", "x64", "win64", ".exe");
145+
testBin("darwin", "x64", "maci64", "");
146+
testBin("darwin", "arm64", "maca64", "");
147147

148148
it("errors on unsupported platform", () => {
149149
assert.rejects(async () => await matlab.getRunMATLABCommandPath("sunos", "x64"));

0 commit comments

Comments
 (0)