Skip to content

Commit a8c9524

Browse files
committed
Add vcpkg tools to Path
1 parent 8cefd68 commit a8c9524

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

dist/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,7 @@ const core = __webpack_require__(276)
17391739

17401740
const { execSync, getInput } = __webpack_require__(498)
17411741

1742-
let mingw = getInput('mingw')
1742+
let mingw = getInput('mingw') // only parsed for openssl
17431743
let mswin = getInput('mswin')
17441744
let choco = getInput('choco')
17451745
let vcpkg = getInput('vcpkg')
@@ -1755,23 +1755,25 @@ const run = async () => {
17551755
}
17561756

17571757
if (mingw.includes('openssl')) {
1758-
execSync(`choco install --no-progress openssl`)
1759-
fs.renameSync('C:\\Program Files\\OpenSSL-Win64', 'C:\\openssl-win')
1760-
core.exportVariable('SSL_DIR', '--with-openssl-dir=C:/openssl-win')
1761-
choco = choco.replace(/openssl/gi, '').trim()
1758+
if (!choco.includes('openssl')) { choco += ' openssl' }
17621759
}
17631760

17641761
if (choco !== '') {
17651762
execSync(`choco install --no-progress ${choco}`)
17661763
if (choco.includes('openssl')) {
17671764
fs.renameSync('C:\\Program Files\\OpenSSL-Win64', 'C:\\openssl-win')
1768-
core.exportVariable('SSL_DIR', '--with-openssl-dir=C:/openssl-win')
1765+
core.exportVariable('SSL_DIR', '--with-openssl-dir=C:\\openssl-win')
17691766
}
17701767
}
17711768

17721769
if (vcpkg !== '') {
17731770
execSync(`vcpkg --triplet x64-windows install ${vcpkg}`)
1774-
core.exportVariable('OPT_DIR', `--with-opt-dir=${process.env.VCPKG_INSTALLATION_ROOT}/installed/x64-windows`)
1771+
core.exportVariable('OPT_DIR', `--with-opt-dir=${process.env.VCPKG_INSTALLATION_ROOT}\\installed\\x64-windows`)
1772+
const vcpkgTools = `${process.env.VCPKG_INSTALLATION_ROOT}\\installed\\x64-windows\\tools`
1773+
if (fs.existsSync(vcpkgTools) && fs.readdirSync(vcpkgTools).length >= 0) {
1774+
core.addPath(vcpkgTools)
1775+
console.log(`Added to Path: ${vcpkgTools}`)
1776+
}
17751777
}
17761778

17771779
} catch (error) {

mswin.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const core = require('@actions/core')
55

66
const { execSync, getInput } = require('./common')
77

8-
let mingw = getInput('mingw')
8+
let mingw = getInput('mingw') // only parsed for openssl
99
let mswin = getInput('mswin')
1010
let choco = getInput('choco')
1111
let vcpkg = getInput('vcpkg')
@@ -21,23 +21,25 @@ export const run = async () => {
2121
}
2222

2323
if (mingw.includes('openssl')) {
24-
execSync(`choco install --no-progress openssl`)
25-
fs.renameSync('C:\\Program Files\\OpenSSL-Win64', 'C:\\openssl-win')
26-
core.exportVariable('SSL_DIR', '--with-openssl-dir=C:/openssl-win')
27-
choco = choco.replace(/openssl/gi, '').trim()
24+
if (!choco.includes('openssl')) { choco += ' openssl' }
2825
}
2926

3027
if (choco !== '') {
3128
execSync(`choco install --no-progress ${choco}`)
3229
if (choco.includes('openssl')) {
3330
fs.renameSync('C:\\Program Files\\OpenSSL-Win64', 'C:\\openssl-win')
34-
core.exportVariable('SSL_DIR', '--with-openssl-dir=C:/openssl-win')
31+
core.exportVariable('SSL_DIR', '--with-openssl-dir=C:\\openssl-win')
3532
}
3633
}
3734

3835
if (vcpkg !== '') {
3936
execSync(`vcpkg --triplet x64-windows install ${vcpkg}`)
40-
core.exportVariable('OPT_DIR', `--with-opt-dir=${process.env.VCPKG_INSTALLATION_ROOT}/installed/x64-windows`)
37+
core.exportVariable('OPT_DIR', `--with-opt-dir=${process.env.VCPKG_INSTALLATION_ROOT}\\installed\\x64-windows`)
38+
const vcpkgTools = `${process.env.VCPKG_INSTALLATION_ROOT}\\installed\\x64-windows\\tools`
39+
if (fs.existsSync(vcpkgTools) && fs.readdirSync(vcpkgTools).length >= 0) {
40+
core.addPath(vcpkgTools)
41+
console.log(`Added to Path: ${vcpkgTools}`)
42+
}
4143
}
4244

4345
} catch (error) {

0 commit comments

Comments
 (0)