Skip to content

Commit

Permalink
Fix macOS 14 2024.X installation (#146)
Browse files Browse the repository at this point in the history
* Debug file download

* Remove redundant debug

* Log `process.arch`

* Remove `arm64` download option
  • Loading branch information
HarrisonGrodin authored Sep 1, 2024
1 parent 87fd339 commit ad079db
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
- ubuntu-latest
- macos-12
- macos-13
- macos-14
smlnj-version:
- 2024.1
- 2024.2
Expand Down
9 changes: 4 additions & 5 deletions lib/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ function acquireNJ(version) {
function defaultBits(version) {
return semver.satisfies(format(version), ">=110.98") ? 64 : 32;
}
function getArchitecture(version, armAllowed = false) {
function getArchitecture(version) {
switch (process.platform) {
case "darwin":
return defaultBits(version) == 32 ? "x86" :
armAllowed && process.arch.startsWith("arm") ? "arm64" : "amd64";
return defaultBits(version) == 32 ? "x86" : "amd64";
case "linux":
return "amd64";
default:
Expand All @@ -70,9 +69,9 @@ function getArchitecture(version, armAllowed = false) {
function acquireNJGitHub(version) {
return __awaiter(this, void 0, void 0, function* () {
yield exec.exec("git", ["clone", "--depth", "1", "--branch", "v" + version, "--recurse-submodules", "https://github.com/smlnj/smlnj.git"]);
let filename = util.format("boot.%s-unix.tgz", getArchitecture(version, true));
let filename = util.format("boot.%s-unix.tgz", getArchitecture(version));
let downloadUrl = util.format("https://smlnj.org/dist/working/%s/%s", version, filename);
core.debug("Downloading SML/NJ from: " + downloadUrl);
core.debug(`Downloading SML/NJ from: ${downloadUrl}`);
try {
yield tc.downloadTool(downloadUrl, path.join("smlnj", filename));
}
Expand Down
9 changes: 4 additions & 5 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ function defaultBits(version: string): 32 | 64 {
return semver.satisfies(format(version), ">=110.98") ? 64 : 32;
}

function getArchitecture(version: string, armAllowed: boolean = false): string {
function getArchitecture(version: string): string {
switch (process.platform) {
case "darwin":
return defaultBits(version) == 32 ? "x86" :
armAllowed && process.arch.startsWith("arm") ? "arm64" : "amd64";
return defaultBits(version) == 32 ? "x86" : "amd64";
case "linux":
return "amd64";
default:
Expand All @@ -58,15 +57,15 @@ function getArchitecture(version: string, armAllowed: boolean = false): string {
async function acquireNJGitHub(version: string): Promise<string> {
await exec.exec("git", ["clone", "--depth", "1", "--branch", "v" + version, "--recurse-submodules", "https://github.com/smlnj/smlnj.git"]);

let filename: string = util.format("boot.%s-unix.tgz", getArchitecture(version, true))
let filename: string = util.format("boot.%s-unix.tgz", getArchitecture(version))

let downloadUrl: string = util.format(
"https://smlnj.org/dist/working/%s/%s",
version,
filename
);

core.debug("Downloading SML/NJ from: " + downloadUrl);
core.debug(`Downloading SML/NJ from: ${downloadUrl}`);

try {
await tc.downloadTool(downloadUrl, path.join("smlnj", filename));
Expand Down

0 comments on commit ad079db

Please sign in to comment.