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 { arm64, x86, x86_64 } from "../utils/env/arch.js"
|
||||
import { type InstallationInfo, type PackageInfo, setupBin } from "../utils/setup/setupBin.js"
|
||||
|
||||
/** Get the platform name Ninja uses in their download links */
|
||||
function getNinjaPlatform(platform: NodeJS.Platform) {
|
||||
function getNinjaPlatformArch(platform: NodeJS.Platform, arch: string) {
|
||||
switch (platform) {
|
||||
case "win32":
|
||||
return "win"
|
||||
return x86_64.includes(arch)
|
||||
|| x86.includes(arch)
|
||||
? "win"
|
||||
: arm64.includes(arch)
|
||||
? "winarm64"
|
||||
: "win"
|
||||
case "darwin":
|
||||
return "mac"
|
||||
case "linux":
|
||||
return "linux"
|
||||
return x86_64.includes(arch)
|
||||
|| x86.includes(arch)
|
||||
? "linux"
|
||||
: arm64.includes(arch)
|
||||
? "linux-aarch64"
|
||||
: "linux"
|
||||
default:
|
||||
throw new Error(`Unsupported platform '${platform}'`)
|
||||
}
|
||||
}
|
||||
|
||||
/** 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 {
|
||||
const ninjaPlatform = getNinjaPlatform(platform)
|
||||
function getNinjaPackageInfo(version: string, platform: NodeJS.Platform, arch: string): PackageInfo {
|
||||
const ninjaPlatform = getNinjaPlatformArch(platform, arch)
|
||||
return {
|
||||
binRelativeDir: "",
|
||||
binFileName: addExeExt("ninja"),
|
||||
|
|
Loading…
Reference in New Issue