Skip to content

Commit ae24e96

Browse files
committed
fix: fix powershell/mingw installation on alpine
1 parent 8a0c8a7 commit ae24e96

File tree

7 files changed

+15
-6
lines changed

7 files changed

+15
-6
lines changed

dev/docker/ci/alpine-mingw.dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM aminya/setup-cpp-alpine:latest AS setup-cpp-alpine-mingw
22

3+
COPY "./dist/modern" "/usr/lib/setup-cpp/"
4+
35
# install mingw/powershell
46
RUN node --enable-source-maps /usr/lib/setup-cpp/setup-cpp.mjs \
57
--compiler mingw \

dist/legacy/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/modern/setup-cpp.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gcc/mingw.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ export async function setupMingw(version: string, setupDir: string, arch: string
4747
} else if (isUbuntu()) {
4848
installationInfo = await installAptPack([{ name: "mingw-w64", version }])
4949
} else if (await hasApk()) {
50-
installationInfo = await installApkPack([{ name: "mingw-w64", version }])
50+
installationInfo = await installApkPack([
51+
{ name: "mingw-w64-gcc", version },
52+
{ name: "mingw-w64-crt", version },
53+
])
5154
} else {
5255
throw new Error(`Unsupported Linux distro for ${arch}`)
5356
}

src/powershell/powershell.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ function getPowershellUrl(
6363
// eslint-disable-next-line @typescript-eslint/no-unused-vars
6464
export async function setupPowershell(version: string, setupDir: string, arch: string) {
6565
try {
66+
if (await hasApk()) {
67+
return setupPowershellSystem(version, setupDir, arch)
68+
}
69+
6670
return await setupBin("pwsh", version, getPowerShellPackageInfo, setupDir, arch)
6771
} catch (err) {
6872
error(`Failed to setup pwsh via download: ${err}. Trying package managers...`)
@@ -115,7 +119,7 @@ export async function setupPowershellSystem(version: string | undefined, _setupD
115119

116120
return installAptPack([{ name: "powershell", version }], true)
117121
} else if (await hasApk()) {
118-
return installApkPack([{ name: "powershell", version }])
122+
return installApkPack([{ name: "powershell", version: undefined }])
119123
}
120124
throw new Error("Unsupported linux distribution")
121125
}

0 commit comments

Comments
 (0)