Skip to content

Commit ae5447a

Browse files
Support macos-aarch64 as a platform keyword (#60)
StyLua produces macOS M1 binaries using the macos-aarch64 name, rather than macos-arm64. We add in macos-aarch64 as a platform keyword so it doesn't fall back to the Rosetta x86_64 binary
1 parent 0d7ec34 commit ae5447a

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- Support `macos-aarch64` as an artifact name for Apple Silicon (arm64) binaries ([#60](https://github.com/Roblox/foreman/pull/60))
56
- Take into account architecture when downloading binaries for linux ([#59](https://github.com/Roblox/foreman/pull/59))
67

78
## 1.0.4 (2022-05-13)

src/artifact_choosing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ static PLATFORM_KEYWORDS: &[&str] = &["macos-x86_64", "darwin-x86_64", "macos",
88
static PLATFORM_KEYWORDS: &[&str] = &[
99
"macos-arm64",
1010
"darwin-arm64",
11-
"macos-x86_64",
12-
"darwin-x86_64",
11+
"macos-aarch64",
12+
"darwin-aarch64",
1313
"macos",
1414
"darwin",
1515
];

src/tool_cache.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,42 @@ mod test {
295295
assert_eq!(choose_asset(&release, &["linux"]), Some(0));
296296
}
297297

298+
#[test]
299+
fn select_correct_asset_macos() {
300+
let release = Release {
301+
prerelease: false,
302+
tag_name: "v0.5.2".to_string(),
303+
assets: vec![
304+
ReleaseAsset {
305+
name: "tool-linux.zip".to_string(),
306+
url: "https://example.com/some/repo/releases/assets/1".to_string(),
307+
},
308+
ReleaseAsset {
309+
name: "tool-macos-x86_64.zip".to_string(),
310+
url: "https://example.com/some/repo/releases/assets/2".to_string(),
311+
},
312+
ReleaseAsset {
313+
name: "tool-macos-aarch64.zip".to_string(),
314+
url: "https://example.com/some/repo/releases/assets/3".to_string(),
315+
},
316+
],
317+
};
318+
assert_eq!(
319+
choose_asset(
320+
&release,
321+
&[
322+
"macos-arm64",
323+
"darwin-arm64",
324+
"macos-aarch64",
325+
"darwin-aarch64",
326+
"macos",
327+
"darwin",
328+
]
329+
),
330+
Some(2)
331+
);
332+
}
333+
298334
#[test]
299335
fn select_correct_asset_linux() {
300336
let release = Release {

0 commit comments

Comments
 (0)