mirror of https://github.com/aminya/setup-cpp
fix: support ninja on Windows/Linux arm
This commit is contained in:
parent
6003b39332
commit
d95a1c182b
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,24 +1,34 @@
|
||||||
import { addExeExt } from "patha"
|
import { addExeExt } from "patha"
|
||||||
|
import { arm64, x86, x86_64 } from "../utils/env/arch.js"
|
||||||
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin.js"
|
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin.js"
|
||||||
|
|
||||||
/** Get the platform name Ninja uses in their download links */
|
/** Get the platform name Ninja uses in their download links */
|
||||||
function getNinjaPlatform(platform: NodeJS.Platform) {
|
function getNinjaPlatformArch(platform: NodeJS.Platform, arch: string) {
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case "win32":
|
case "win32":
|
||||||
return "win"
|
return x86_64.includes(arch)
|
||||||
|
|| x86.includes(arch)
|
||||||
|
? "win"
|
||||||
|
: arm64.includes(arch)
|
||||||
|
? "winarm64"
|
||||||
|
: "win"
|
||||||
case "darwin":
|
case "darwin":
|
||||||
return "mac"
|
return "mac"
|
||||||
case "linux":
|
case "linux":
|
||||||
return "linux"
|
return x86_64.includes(arch)
|
||||||
|
|| x86.includes(arch)
|
||||||
|
? "linux"
|
||||||
|
: arm64.includes(arch)
|
||||||
|
? "linux-aarch64"
|
||||||
|
: "linux"
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unsupported platform '${platform}'`)
|
throw new Error(`Unsupported platform '${platform}'`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the platform data for ninja */
|
/** Get the platform data for ninja */
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
function getNinjaPackageInfo(version: string, platform: NodeJS.Platform, arch: string): PackageInfo {
|
||||||
function getNinjaPackageInfo(version: string, platform: NodeJS.Platform, _arch: string): PackageInfo {
|
const ninjaPlatform = getNinjaPlatformArch(platform, arch)
|
||||||
const ninjaPlatform = getNinjaPlatform(platform)
|
|
||||||
return {
|
return {
|
||||||
binRelativeDir: "",
|
binRelativeDir: "",
|
||||||
binFileName: addExeExt("ninja"),
|
binFileName: addExeExt("ninja"),
|
||||||
|
|
Loading…
Reference in New Issue