Skip to content

Commit f2e0bf8

Browse files
committed
Optionally start in MSYS mode
Under certain circumstances it is really useful to start Git for Windows' SDK in the `MSYS` mode, i.e. `MSYSTEM=MSYS`. This can be used e.g. to build MSYS packages. Let's support that via a new option. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 9bc92e9 commit f2e0bf8

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ inputs:
1313
required: false
1414
description: 'The architecture of the SDK: x86_64 or i686'
1515
default: 'x86_64'
16+
msys:
17+
required: false
18+
description: 'Whether to start in MSYS mode (defaults to false)'
19+
default: 'false'
1620
path:
1721
required: false
1822
description: 'Where to write the SDK files'

main.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ async function run(): Promise<void> {
1414
const flavor = core.getInput('flavor')
1515
const architecture = core.getInput('architecture')
1616
const verbose = core.getInput('verbose')
17+
const msysMode = core.getInput('msys') === 'true'
1718

1819
const {artifactName, download, id} = await get(flavor, architecture)
1920
const outputDirectory = core.getInput('path') || `C:/${artifactName}`
@@ -58,11 +59,19 @@ async function run(): Promise<void> {
5859
}
5960
}
6061

61-
// Set up PATH so that Git for Windows' SDK's `bash.exe`, `prove` and `gcc` are found
62-
core.addPath(`${outputDirectory}/usr/bin/core_perl`)
63-
core.addPath(`${outputDirectory}/usr/bin`)
64-
const msystem = architecture === 'i686' ? 'MINGW32' : 'MINGW64'
65-
core.addPath(`${outputDirectory}/${msystem.toLocaleLowerCase()}/bin`)
62+
const mingw = architecture === 'i686' ? 'MINGW32' : 'MINGW64'
63+
const msystem = msysMode ? 'MSYS' : mingw
64+
65+
const binPaths = [
66+
// Set up PATH so that Git for Windows' SDK's `bash.exe`, `prove` and `gcc` are found
67+
'/usr/bin/core_perl',
68+
'/usr/bin',
69+
`/${mingw.toLocaleLowerCase()}/bin`
70+
]
71+
for (const binPath of msysMode ? binPaths.reverse() : binPaths) {
72+
core.addPath(`${outputDirectory}${binPath}`)
73+
}
74+
6675
core.exportVariable('MSYSTEM', msystem)
6776
if (
6877
!('LANG' in process.env) &&

0 commit comments

Comments
 (0)