import { hasApk, installApkPack } from "setup-alpine" import { hasAptGet, installAptPack } from "setup-apt" import { installBrewPack } from "setup-brew" import { hasDnf, setupDnfPack } from "setup-dnf" import { isArch, setupPacmanPack } from "setup-pacman" import type { SetupOptions } from "../setup-options.js" import { setupChocoPack } from "../utils/setup-choco.js" export async function setupCcache({ version }: Partial> = {}) { switch (process.platform) { case "win32": { return setupChocoPack("ccache", version) } case "darwin": { return installBrewPack("ccache", version) } case "linux": { if (isArch()) { return setupPacmanPack("ccache", version) } else if (hasDnf()) { return setupDnfPack([{ name: "ccache", version }]) } else if (hasAptGet()) { return installAptPack([{ name: "ccache", version }]) } else if (await hasApk()) { return installApkPack([{ name: "ccache", version }]) } throw new Error("Unsupported linux distribution") } default: { throw new Error("Unsupported platform") } } }