Skip to content

Commit

Permalink
fix: fix mingw version satisfaction check
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Sep 23, 2024
1 parent ed3b715 commit 0bec4ef
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 26 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.mjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/gcc/gccMatcher.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { info, warning } from "ci-log"
import { pathExists } from "path-exists"
import { join } from "path/posix"
import { join } from "path"
import { dirname } from "./gcc.ts"

export async function addGccLoggingMatcher() {
Expand Down
20 changes: 5 additions & 15 deletions src/gcc/mingw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ export async function getMinGWPackageInfo(
ia32: "i386",
} as Record<string, string | undefined>

// extract the base version by coercing the version
const versionCoerce = semverCoerce(version)
if (versionCoerce === null) {
throw new Error(`Invalid MinGW version requested '${version}'`)
}

const runtime = extractMinGWRuntime(version)
const threadModel = extractMinGWThreadModel(version)
const exceptionModel = extractMingwExceptionModel(version)
Expand All @@ -122,15 +116,11 @@ export async function getMinGWPackageInfo(
mingwArchMap[arch] ?? arch,
],
filterName: (assetName) => {
const assetRuntime = extractMinGWRuntime(assetName)
const assetThreadModel = extractMinGWThreadModel(assetName)
const assetExceptionModel = extractMingwExceptionModel(assetName)

return (runtime === undefined || runtime === assetRuntime)
&& (threadModel === undefined || threadModel === assetThreadModel)
&& (assetExceptionModel === undefined || assetExceptionModel === exceptionModel)
return (runtime === undefined || runtime === extractMinGWRuntime(assetName))
&& (threadModel === undefined || threadModel === extractMinGWThreadModel(assetName))
&& (exceptionModel === undefined || exceptionModel === extractMingwExceptionModel(assetName))
},
versionSatisfies: (assetVersion, _version) => {
versionSatisfies: (assetVersion, versionRange) => {
// extract the base version by coercing the version
const assetCoerce = semverCoerce(assetVersion)
if (assetCoerce === null) {
Expand All @@ -139,7 +129,7 @@ export async function getMinGWPackageInfo(

// if the asset version is satisfied by the version
// and the runtime and thread model match or not specified
return semverSatisfies(assetCoerce, `^${versionCoerce}`)
return semverSatisfies(assetCoerce, versionRange)
&& (runtime === undefined || runtime === extractMinGWRuntime(assetVersion))
&& (threadModel === undefined || threadModel === extractMinGWThreadModel(assetVersion))
},
Expand Down

0 comments on commit 0bec4ef

Please sign in to comment.