mirror of https://github.com/aminya/setup-cpp
fix: remove extension-tools and path in favor of patha
This commit is contained in:
parent
fd00ba5afd
commit
3b6093bb8a
|
@ -58,6 +58,7 @@ words:
|
||||||
- npmrc
|
- npmrc
|
||||||
- Opencppcoverage
|
- Opencppcoverage
|
||||||
- OSSDK
|
- OSSDK
|
||||||
|
- patha
|
||||||
- pnpm
|
- pnpm
|
||||||
- pwsh
|
- pwsh
|
||||||
- pypy
|
- pypy
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -59,11 +59,11 @@
|
||||||
"escape-path-with-spaces": "github:aminya/escape-path-with-spaces#d9f81ee649203ddc55783a2f96ada59df06118e3",
|
"escape-path-with-spaces": "github:aminya/escape-path-with-spaces#d9f81ee649203ddc55783a2f96ada59df06118e3",
|
||||||
"exec-powershell": "workspace:1.0.0",
|
"exec-powershell": "workspace:1.0.0",
|
||||||
"execa": "^5.1.1",
|
"execa": "^5.1.1",
|
||||||
"extension-tools": "workspace:1.0.0",
|
|
||||||
"is-url-online": "^1.5.0",
|
"is-url-online": "^1.5.0",
|
||||||
"mri": "^1.2.0",
|
"mri": "^1.2.0",
|
||||||
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
||||||
"numerous": "1.0.3",
|
"numerous": "1.0.3",
|
||||||
|
"patha": "^0.3.0",
|
||||||
"root-tools": "workspace:1.0.0",
|
"root-tools": "workspace:1.0.0",
|
||||||
"semver": "7.3.7",
|
"semver": "7.3.7",
|
||||||
"setup-python": "github:actions/setup-python#c474c82340438924daab9282d07300bfe7e3692d",
|
"setup-python": "github:actions/setup-python#c474c82340438924daab9282d07300bfe7e3692d",
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
<h1 align="center">extension-tools</h1>
|
|
||||||
<p>
|
|
||||||
<a href="https://www.npmjs.com/package/extension-tools" target="_blank">
|
|
||||||
<img alt="Version" src="https://img.shields.io/npm/v/extension-tools.svg">
|
|
||||||
</a>
|
|
||||||
<a href="#" target="_blank">
|
|
||||||
<img alt="License: Apache--2.0" src="https://img.shields.io/badge/License-Apache--2.0-yellow.svg" />
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
> Tools for working with file extensions such as getting the binary and shell extension on different platforms.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install --save extension-tools
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
<!-- INSERT GENERATED DOCS START -->
|
|
||||||
|
|
||||||
### `addBinExtension` (function)
|
|
||||||
|
|
||||||
Add bin extension to the given binary name.
|
|
||||||
|
|
||||||
**Parameters:**
|
|
||||||
|
|
||||||
- name (`string`) - The name you want to add the shell extension to
|
|
||||||
- win_ext (`string`) - `.exe` on Windows
|
|
||||||
- unix_ext (`string`) - `""` On unix.
|
|
||||||
|
|
||||||
**returns:** string
|
|
||||||
|
|
||||||
### `addShellExtension` (function)
|
|
||||||
|
|
||||||
Add native shell extension to the given name
|
|
||||||
|
|
||||||
**Parameters:**
|
|
||||||
|
|
||||||
- name (`string`) - The name you want to add the shell extension to
|
|
||||||
- win_ext (`string`) - `.bat` on Windows
|
|
||||||
- unix_ext (`string`) - `.sh` On unix.
|
|
||||||
|
|
||||||
**returns:** string
|
|
||||||
|
|
||||||
### `addShellHere` (function)
|
|
||||||
|
|
||||||
Prefix a `./` for unix shell and nothing for the cmd shell
|
|
||||||
|
|
||||||
**Parameters:**
|
|
||||||
|
|
||||||
- name (`string`)
|
|
||||||
|
|
||||||
**returns:** string
|
|
||||||
|
|
||||||
<!-- INSERT GENERATED DOCS END -->
|
|
||||||
|
|
||||||
## 🤝 Contributing
|
|
||||||
|
|
||||||
You can sponsor my work here:
|
|
||||||
|
|
||||||
https://github.com/sponsors/aminya
|
|
||||||
|
|
||||||
Pull requests, issues and feature requests are welcome.
|
|
||||||
See the [Contributing guide](https://github.com/aminya/setup-cpp/blob/master/CONTRIBUTING.md).
|
|
|
@ -1,33 +0,0 @@
|
||||||
{
|
|
||||||
"name": "extension-tools",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "Tools for working with file extensions such as getting the binary and shell extension on different platforms.",
|
|
||||||
"homepage": "https://github.com/aminya/setup-cpp",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"author": "Amin Yahyaabadi",
|
|
||||||
"main": "./dist/index.js",
|
|
||||||
"source": "./src/index.ts",
|
|
||||||
"scripts": {
|
|
||||||
"build": "tsc"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"extension",
|
|
||||||
"shell",
|
|
||||||
"bin",
|
|
||||||
"windows",
|
|
||||||
"sh",
|
|
||||||
"cmd",
|
|
||||||
"bat",
|
|
||||||
"exec",
|
|
||||||
"execa",
|
|
||||||
"spawn",
|
|
||||||
"system",
|
|
||||||
"unix",
|
|
||||||
"linux",
|
|
||||||
"github-actions",
|
|
||||||
"github",
|
|
||||||
"actions",
|
|
||||||
"gitlab",
|
|
||||||
"ci"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
/**
|
|
||||||
* Add bin extension to the given binary name.
|
|
||||||
*
|
|
||||||
* @param name The name you want to add the shell extension to
|
|
||||||
* @param win_ext `.exe` on Windows
|
|
||||||
* @param unix_ext `""` On unix.
|
|
||||||
*/
|
|
||||||
export function addBinExtension(name: string, win_ext = ".exe", unix_ext = "") {
|
|
||||||
if (process.platform === "win32") {
|
|
||||||
return `${name}${win_ext}`
|
|
||||||
}
|
|
||||||
return `${name}${unix_ext}`
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add native shell extension to the given name
|
|
||||||
*
|
|
||||||
* @param name The name you want to add the shell extension to
|
|
||||||
* @param win_ext `.bat` on Windows
|
|
||||||
* @param unix_ext `.sh` On unix.
|
|
||||||
*/
|
|
||||||
export function addShellExtension(name: string, win_ext = ".bat", unix_ext = ".sh") {
|
|
||||||
if (process.platform === "win32") {
|
|
||||||
return `${name}${win_ext}`
|
|
||||||
}
|
|
||||||
return `${name}${unix_ext}`
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Prefix a `./` for unix shell and nothing for the cmd shell */
|
|
||||||
export function addShellHere(name: string) {
|
|
||||||
if (process.platform === "win32") {
|
|
||||||
return name
|
|
||||||
}
|
|
||||||
return `./${name}`
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "../../tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "./dist"
|
|
||||||
},
|
|
||||||
"include": ["./src"]
|
|
||||||
}
|
|
|
@ -33,7 +33,6 @@ importers:
|
||||||
eslint-config-atomic: ^1.18.1
|
eslint-config-atomic: ^1.18.1
|
||||||
exec-powershell: workspace:1.0.0
|
exec-powershell: workspace:1.0.0
|
||||||
execa: ^5.1.1
|
execa: ^5.1.1
|
||||||
extension-tools: workspace:1.0.0
|
|
||||||
gen-readme: ^1.6.0
|
gen-readme: ^1.6.0
|
||||||
is-url-online: ^1.5.0
|
is-url-online: ^1.5.0
|
||||||
jest: ^28.1.3
|
jest: ^28.1.3
|
||||||
|
@ -44,6 +43,7 @@ importers:
|
||||||
npm-run-all2: ^6.0.2
|
npm-run-all2: ^6.0.2
|
||||||
numerous: 1.0.3
|
numerous: 1.0.3
|
||||||
parcel: 2.7.0
|
parcel: 2.7.0
|
||||||
|
patha: ^0.3.0
|
||||||
prettier: 2.7.1
|
prettier: 2.7.1
|
||||||
prettier-config-atomic: ^3.0.10
|
prettier-config-atomic: ^3.0.10
|
||||||
readme-md-generator: ^1.0.0
|
readme-md-generator: ^1.0.0
|
||||||
|
@ -70,11 +70,11 @@ importers:
|
||||||
escape-path-with-spaces: github.com/aminya/escape-path-with-spaces/d9f81ee649203ddc55783a2f96ada59df06118e3
|
escape-path-with-spaces: github.com/aminya/escape-path-with-spaces/d9f81ee649203ddc55783a2f96ada59df06118e3
|
||||||
exec-powershell: link:packages/exec-powershell
|
exec-powershell: link:packages/exec-powershell
|
||||||
execa: 5.1.1
|
execa: 5.1.1
|
||||||
extension-tools: link:packages/extension-tools
|
|
||||||
is-url-online: 1.5.0
|
is-url-online: 1.5.0
|
||||||
mri: 1.2.0
|
mri: 1.2.0
|
||||||
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
|
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
|
||||||
numerous: 1.0.3
|
numerous: 1.0.3
|
||||||
|
patha: 0.3.0
|
||||||
root-tools: link:packages/root-tools
|
root-tools: link:packages/root-tools
|
||||||
semver: 7.3.7
|
semver: 7.3.7
|
||||||
setup-python: github.com/actions/setup-python/c474c82340438924daab9282d07300bfe7e3692d
|
setup-python: github.com/actions/setup-python/c474c82340438924daab9282d07300bfe7e3692d
|
||||||
|
@ -130,9 +130,6 @@ importers:
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@types/which': 2.0.1
|
'@types/which': 2.0.1
|
||||||
|
|
||||||
packages/extension-tools:
|
|
||||||
specifiers: {}
|
|
||||||
|
|
||||||
packages/root-tools:
|
packages/root-tools:
|
||||||
specifiers:
|
specifiers:
|
||||||
'@types/which': ^2.0.1
|
'@types/which': ^2.0.1
|
||||||
|
@ -2473,6 +2470,12 @@ packages:
|
||||||
resolution: {integrity: sha512-RI1L7N4JnW5gQw2spvL7Sllfuf1SaHdrZpCHiBlCXjIlufi1SMNnbu2teze3/QE67Fg2tBlH7W+mi4hVNk4p0A==}
|
resolution: {integrity: sha512-RI1L7N4JnW5gQw2spvL7Sllfuf1SaHdrZpCHiBlCXjIlufi1SMNnbu2teze3/QE67Fg2tBlH7W+mi4hVNk4p0A==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/@types/replace-ext/2.0.0:
|
||||||
|
resolution: {integrity: sha512-9aGCj2qmL1YHLXfqfzwP1h7fDfeB4l0gSXRndq+20lJ+kljS3/ngOpcn1RJGhZCe5C2JzWu07nElCKcJ6iAJbg==}
|
||||||
|
requiresBuild: true
|
||||||
|
dev: false
|
||||||
|
optional: true
|
||||||
|
|
||||||
/@types/responselike/1.0.0:
|
/@types/responselike/1.0.0:
|
||||||
resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==}
|
resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -4189,6 +4192,11 @@ packages:
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/escape-string-regexp/5.0.0:
|
||||||
|
resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/eslint-config-airbnb-base/14.2.1_2iahngt3u2tkbdlu6s4gkur3pu:
|
/eslint-config-airbnb-base/14.2.1_2iahngt3u2tkbdlu6s4gkur3pu:
|
||||||
resolution: {integrity: sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==}
|
resolution: {integrity: sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==}
|
||||||
engines: {node: '>= 6'}
|
engines: {node: '>= 6'}
|
||||||
|
@ -7594,6 +7602,12 @@ packages:
|
||||||
lines-and-columns: 1.2.4
|
lines-and-columns: 1.2.4
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/path-browserify/1.0.1:
|
||||||
|
resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==}
|
||||||
|
requiresBuild: true
|
||||||
|
dev: false
|
||||||
|
optional: true
|
||||||
|
|
||||||
/path-exists/4.0.0:
|
/path-exists/4.0.0:
|
||||||
resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
|
resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -7617,6 +7631,18 @@ packages:
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/patha/0.3.0:
|
||||||
|
resolution: {integrity: sha512-8rE5/pFLwaKXE5D0SBIByEJyd36PyABurJCZNcSV+C2Rp+aiP0CwLZME2cY5XVQg91pctOxHJadzT2sZ0enIMQ==}
|
||||||
|
dependencies:
|
||||||
|
escape-string-regexp: 5.0.0
|
||||||
|
replace-ext: 2.0.0
|
||||||
|
optionalDependencies:
|
||||||
|
'@types/node': 18.7.6
|
||||||
|
'@types/replace-ext': 2.0.0
|
||||||
|
path-browserify: 1.0.1
|
||||||
|
process: 0.11.10
|
||||||
|
dev: false
|
||||||
|
|
||||||
/picocolors/1.0.0:
|
/picocolors/1.0.0:
|
||||||
resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==}
|
resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -8101,6 +8127,11 @@ packages:
|
||||||
engines: {node: '>=0.10'}
|
engines: {node: '>=0.10'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/replace-ext/2.0.0:
|
||||||
|
resolution: {integrity: sha512-UszKE5KVK6JvyD92nzMn9cDapSk6w/CaFZ96CnmDMUqH9oowfxF/ZjRITD25H4DnOQClLA4/j7jLGXXLVKxAug==}
|
||||||
|
engines: {node: '>= 10'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/require-directory/2.1.1:
|
/require-directory/2.1.1:
|
||||||
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
|
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { execFileSync } from "child_process"
|
import { execFileSync } from "child_process"
|
||||||
import { dirname } from "path"
|
import { dirname } from "patha"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
|
|
||||||
let binDir: string | undefined
|
let binDir: string | undefined
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* eslint-disable require-atomic-updates */
|
/* eslint-disable require-atomic-updates */
|
||||||
import execa from "execa"
|
import execa from "execa"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import { dirname } from "path"
|
import { dirname } from "patha"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { addPath } from "../utils/env/addEnv"
|
import { addPath } from "../utils/env/addEnv"
|
||||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
import { InstallationInfo } from "../utils/setup/setupBin"
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { extractTar } from "@actions/tool-cache"
|
||||||
import semverLte from "semver/functions/lte"
|
import semverLte from "semver/functions/lte"
|
||||||
import semverCoerce from "semver/functions/coerce"
|
import semverCoerce from "semver/functions/coerce"
|
||||||
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
|
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
|
||||||
import { addBinExtension } from "extension-tools"
|
import { addExeExt } from "patha"
|
||||||
import { extractZip } from "../utils/setup/extract"
|
import { extractZip } from "../utils/setup/extract"
|
||||||
|
|
||||||
/** Get the platform data for cmake */
|
/** Get the platform data for cmake */
|
||||||
|
@ -20,7 +20,7 @@ function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: s
|
||||||
const folderName = `cmake-${version}-${osArchStr}`
|
const folderName = `cmake-${version}-${osArchStr}`
|
||||||
return {
|
return {
|
||||||
binRelativeDir: "bin/",
|
binRelativeDir: "bin/",
|
||||||
binFileName: addBinExtension("cmake"),
|
binFileName: addExeExt("cmake"),
|
||||||
extractedFolderName: folderName,
|
extractedFolderName: folderName,
|
||||||
extractFunction: extractZip,
|
extractFunction: extractZip,
|
||||||
url: `https://github.com/Kitware/CMake/releases/download/v${version}/${folderName}.zip`,
|
url: `https://github.com/Kitware/CMake/releases/download/v${version}/${folderName}.zip`,
|
||||||
|
@ -32,7 +32,7 @@ function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: s
|
||||||
const folderName = `cmake-${version}-${osArchStr}`
|
const folderName = `cmake-${version}-${osArchStr}`
|
||||||
return {
|
return {
|
||||||
binRelativeDir: "CMake.app/Contents/bin/",
|
binRelativeDir: "CMake.app/Contents/bin/",
|
||||||
binFileName: addBinExtension("cmake"),
|
binFileName: addExeExt("cmake"),
|
||||||
extractedFolderName: folderName,
|
extractedFolderName: folderName,
|
||||||
extractFunction: extractTar,
|
extractFunction: extractTar,
|
||||||
url: `https://github.com/Kitware/CMake/releases/download/v${version}/${folderName}.tar.gz`,
|
url: `https://github.com/Kitware/CMake/releases/download/v${version}/${folderName}.tar.gz`,
|
||||||
|
@ -49,7 +49,7 @@ function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: s
|
||||||
const folderName = `cmake-${version}-${osArchStr}`
|
const folderName = `cmake-${version}-${osArchStr}`
|
||||||
return {
|
return {
|
||||||
binRelativeDir: "bin/",
|
binRelativeDir: "bin/",
|
||||||
binFileName: addBinExtension("cmake"),
|
binFileName: addExeExt("cmake"),
|
||||||
extractedFolderName: folderName,
|
extractedFolderName: folderName,
|
||||||
extractFunction: extractTar,
|
extractFunction: extractTar,
|
||||||
url: `https://github.com/Kitware/CMake/releases/download/v${version}/${folderName}.tar.gz`,
|
url: `https://github.com/Kitware/CMake/releases/download/v${version}/${folderName}.tar.gz`,
|
||||||
|
|
|
@ -4,13 +4,12 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
||||||
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
||||||
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
import { addBinExtension } from "extension-tools"
|
import { addExeExt, join } from "patha"
|
||||||
import { extractTar, extractZip } from "../utils/setup/extract"
|
import { extractTar, extractZip } from "../utils/setup/extract"
|
||||||
import { notice } from "ci-log"
|
import { notice } from "ci-log"
|
||||||
import { setupGraphviz } from "../graphviz/graphviz"
|
import { setupGraphviz } from "../graphviz/graphviz"
|
||||||
import { getVersion } from "../default_versions"
|
import { getVersion } from "../default_versions"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import { join } from "path"
|
|
||||||
import { isArch } from "../utils/env/isArch"
|
import { isArch } from "../utils/env/isArch"
|
||||||
import { hasDnf } from "../utils/env/hasDnf"
|
import { hasDnf } from "../utils/env/hasDnf"
|
||||||
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
||||||
|
@ -24,7 +23,7 @@ function getDoxygenPackageInfo(version: string, platform: NodeJS.Platform, _arch
|
||||||
const folderName = `doxygen-${version}`
|
const folderName = `doxygen-${version}`
|
||||||
return {
|
return {
|
||||||
binRelativeDir: "bin/",
|
binRelativeDir: "bin/",
|
||||||
binFileName: addBinExtension("doxygen"),
|
binFileName: addExeExt("doxygen"),
|
||||||
extractedFolderName: folderName,
|
extractedFolderName: folderName,
|
||||||
extractFunction: extractTar,
|
extractFunction: extractTar,
|
||||||
url: `https://www.doxygen.nl/files/${folderName}.linux.bin.tar.gz`,
|
url: `https://www.doxygen.nl/files/${folderName}.linux.bin.tar.gz`,
|
||||||
|
@ -34,7 +33,7 @@ function getDoxygenPackageInfo(version: string, platform: NodeJS.Platform, _arch
|
||||||
const folderName = `doxygen-${version}`
|
const folderName = `doxygen-${version}`
|
||||||
return {
|
return {
|
||||||
binRelativeDir: "",
|
binRelativeDir: "",
|
||||||
binFileName: addBinExtension("doxygen"),
|
binFileName: addExeExt("doxygen"),
|
||||||
extractedFolderName: folderName,
|
extractedFolderName: folderName,
|
||||||
extractFunction: extractZip,
|
extractFunction: extractZip,
|
||||||
url: `https://www.doxygen.nl/files/${folderName}.windows.x64.bin.zip`,
|
url: `https://www.doxygen.nl/files/${folderName}.windows.x64.bin.zip`,
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import { setupGcc } from "../gcc"
|
import { setupGcc } from "../gcc"
|
||||||
import { getVersion } from "../../default_versions"
|
import { getVersion } from "../../default_versions"
|
||||||
import path from "path"
|
import { join, addExeExt } from "patha"
|
||||||
import execa from "execa"
|
import execa from "execa"
|
||||||
import { addBinExtension } from "extension-tools"
|
|
||||||
import { chmodSync } from "fs"
|
import { chmodSync } from "fs"
|
||||||
|
|
||||||
jest.setTimeout(3000000)
|
jest.setTimeout(3000000)
|
||||||
|
@ -27,8 +26,8 @@ describe("setup-gcc", () => {
|
||||||
expect(process.env.CXX?.includes("g++")).toBeTruthy()
|
expect(process.env.CXX?.includes("g++")).toBeTruthy()
|
||||||
|
|
||||||
// test compilation
|
// test compilation
|
||||||
const file = path.join(__dirname, "main.cpp")
|
const file = join(__dirname, "main.cpp")
|
||||||
const main_exe = path.join(__dirname, addBinExtension("main"))
|
const main_exe = join(__dirname, addExeExt("main"))
|
||||||
execa.sync("g++", [file, "-o", main_exe], { cwd: __dirname })
|
execa.sync("g++", [file, "-o", main_exe], { cwd: __dirname })
|
||||||
if (process.platform !== "win32") {
|
if (process.platform !== "win32") {
|
||||||
chmodSync(main_exe, "755")
|
chmodSync(main_exe, "755")
|
||||||
|
|
|
@ -7,10 +7,9 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
import semverMajor from "semver/functions/major"
|
import semverMajor from "semver/functions/major"
|
||||||
import semverCoerce from "semver/functions/coerce"
|
import semverCoerce from "semver/functions/coerce"
|
||||||
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
||||||
import path from "path"
|
import { join, addExeExt } from "patha"
|
||||||
import { warning, info } from "ci-log"
|
import { warning, info } from "ci-log"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import ciDetect from "@npmcli/ci-detect"
|
||||||
import { addBinExtension } from "extension-tools"
|
|
||||||
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
||||||
import { extract7Zip } from "../utils/setup/extract"
|
import { extract7Zip } from "../utils/setup/extract"
|
||||||
import { isArch } from "../utils/env/isArch"
|
import { isArch } from "../utils/env/isArch"
|
||||||
|
@ -54,7 +53,7 @@ function getGccPackageInfo(version: string, platform: NodeJS.Platform, arch: str
|
||||||
const exceptionModel: "seh" | "dwarf" = "seh" // SEH is native windows exception model https://github.com/brechtsanders/winlibs_mingw/issues/4#issuecomment-599296483
|
const exceptionModel: "seh" | "dwarf" = "seh" // SEH is native windows exception model https://github.com/brechtsanders/winlibs_mingw/issues/4#issuecomment-599296483
|
||||||
return {
|
return {
|
||||||
binRelativeDir: "bin/",
|
binRelativeDir: "bin/",
|
||||||
binFileName: addBinExtension("g++"),
|
binFileName: addExeExt("g++"),
|
||||||
extractedFolderName: "mingw64",
|
extractedFolderName: "mingw64",
|
||||||
extractFunction: extract7Zip,
|
extractFunction: extract7Zip,
|
||||||
url: `https://github.com/brechtsanders/winlibs_mingw/releases/download/${mingwInfo.releaseName}/winlibs-${mingwArch}-posix-${exceptionModel}-gcc-${mingwInfo.fileSuffix}.7z`,
|
url: `https://github.com/brechtsanders/winlibs_mingw/releases/download/${mingwInfo.releaseName}/winlibs-${mingwArch}-posix-${exceptionModel}-gcc-${mingwInfo.fileSuffix}.7z`,
|
||||||
|
@ -163,7 +162,7 @@ async function activateGcc(version: string, binDir: string) {
|
||||||
// )
|
// )
|
||||||
|
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
promises.push(addEnv("CC", addBinExtension(`${binDir}/gcc`)), addEnv("CXX", addBinExtension(`${binDir}/g++`)))
|
promises.push(addEnv("CC", addExeExt(`${binDir}/gcc`)), addEnv("CXX", addExeExt(`${binDir}/g++`)))
|
||||||
} else {
|
} else {
|
||||||
const majorVersion = semverMajor(semverCoerce(version) ?? version)
|
const majorVersion = semverMajor(semverCoerce(version) ?? version)
|
||||||
if (majorVersion >= 5) {
|
if (majorVersion >= 5) {
|
||||||
|
@ -197,7 +196,7 @@ async function activateGcc(version: string, binDir: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addGccLoggingMatcher() {
|
function addGccLoggingMatcher() {
|
||||||
const matcherPath = path.join(__dirname, "gcc_matcher.json")
|
const matcherPath = join(__dirname, "gcc_matcher.json")
|
||||||
if (!existsSync(matcherPath)) {
|
if (!existsSync(matcherPath)) {
|
||||||
return warning("the gcc_matcher.json file does not exist in the same folder as setup_cpp.js")
|
return warning("the gcc_matcher.json file does not exist in the same folder as setup_cpp.js")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import execa from "execa"
|
import execa from "execa"
|
||||||
import { join } from "path"
|
import { join, addExeExt } from "patha"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { setupCmake } from "../cmake/cmake"
|
import { setupCmake } from "../cmake/cmake"
|
||||||
import { getVersion } from "../default_versions"
|
import { getVersion } from "../default_versions"
|
||||||
import { addBinExtension } from "extension-tools"
|
|
||||||
import { extractTarByExe } from "../utils/setup/extract"
|
import { extractTarByExe } from "../utils/setup/extract"
|
||||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
||||||
|
@ -22,7 +21,7 @@ function getDownloadKcovPackageInfo(version: string): PackageInfo {
|
||||||
url: `https://github.com/SimonKagstrom/kcov/releases/download/${version}/kcov-amd64.tar.gz`,
|
url: `https://github.com/SimonKagstrom/kcov/releases/download/${version}/kcov-amd64.tar.gz`,
|
||||||
extractedFolderName: "",
|
extractedFolderName: "",
|
||||||
binRelativeDir: "usr/local/bin",
|
binRelativeDir: "usr/local/bin",
|
||||||
binFileName: addBinExtension("kcov"),
|
binFileName: addExeExt("kcov"),
|
||||||
extractFunction: extractTarByExe,
|
extractFunction: extractTarByExe,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +31,7 @@ function getBuildKcovPackageInfo(version: string): PackageInfo {
|
||||||
url: `https://github.com/SimonKagstrom/kcov/archive/refs/tags/${version}.tar.gz`,
|
url: `https://github.com/SimonKagstrom/kcov/archive/refs/tags/${version}.tar.gz`,
|
||||||
extractedFolderName: "",
|
extractedFolderName: "",
|
||||||
binRelativeDir: "build/src",
|
binRelativeDir: "build/src",
|
||||||
binFileName: addBinExtension("kcov"),
|
binFileName: addExeExt("kcov"),
|
||||||
extractFunction: buildKcov,
|
extractFunction: buildKcov,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,7 @@ import { isUrlOnline } from "is-url-online"
|
||||||
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import ciDetect from "@npmcli/ci-detect"
|
||||||
import execa from "execa"
|
import execa from "execa"
|
||||||
import path from "path"
|
import path, { addExeExt } from "patha"
|
||||||
import { addBinExtension } from "extension-tools"
|
|
||||||
import { chmodSync } from "fs"
|
import { chmodSync } from "fs"
|
||||||
import { getVersion } from "../../default_versions"
|
import { getVersion } from "../../default_versions"
|
||||||
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
||||||
|
@ -88,7 +87,7 @@ describe("setup-llvm", () => {
|
||||||
|
|
||||||
// test compilation
|
// test compilation
|
||||||
const file = path.join(__dirname, "main.cpp")
|
const file = path.join(__dirname, "main.cpp")
|
||||||
const main_exe = path.join(__dirname, addBinExtension("main"))
|
const main_exe = path.join(__dirname, addExeExt("main"))
|
||||||
execa.sync("clang++", [file, "-o", main_exe], { cwd: __dirname })
|
execa.sync("clang++", [file, "-o", main_exe], { cwd: __dirname })
|
||||||
if (process.platform !== "win32") {
|
if (process.platform !== "win32") {
|
||||||
chmodSync(main_exe, "755")
|
chmodSync(main_exe, "755")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as path from "path"
|
import { join, delimiter, addExeExt } from "patha"
|
||||||
import semverLte from "semver/functions/lte"
|
import semverLte from "semver/functions/lte"
|
||||||
import semverMajor from "semver/functions/major"
|
import semverMajor from "semver/functions/major"
|
||||||
import { isUrlOnline } from "is-url-online"
|
import { isUrlOnline } from "is-url-online"
|
||||||
|
@ -11,7 +11,6 @@ import {
|
||||||
semverCoerceIfInvalid,
|
semverCoerceIfInvalid,
|
||||||
} from "../utils/setup/version"
|
} from "../utils/setup/version"
|
||||||
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
||||||
import { addBinExtension } from "extension-tools"
|
|
||||||
import { addEnv } from "../utils/env/addEnv"
|
import { addEnv } from "../utils/env/addEnv"
|
||||||
import { setOutput } from "@actions/core"
|
import { setOutput } from "@actions/core"
|
||||||
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
|
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
|
||||||
|
@ -267,7 +266,7 @@ async function getLLVMPackageInfo(version: string, platform: NodeJS.Platform, _a
|
||||||
url,
|
url,
|
||||||
extractedFolderName: "",
|
extractedFolderName: "",
|
||||||
binRelativeDir: "bin",
|
binRelativeDir: "bin",
|
||||||
binFileName: addBinExtension("clang"),
|
binFileName: addExeExt("clang"),
|
||||||
extractFunction:
|
extractFunction:
|
||||||
platform === "win32"
|
platform === "win32"
|
||||||
? extractExe
|
? extractExe
|
||||||
|
@ -306,7 +305,7 @@ async function _setupLLVM(version: string, setupDir: string, arch: string) {
|
||||||
export async function activateLLVM(directory: string, versionGiven: string) {
|
export async function activateLLVM(directory: string, versionGiven: string) {
|
||||||
const version = semverCoerceIfInvalid(versionGiven)
|
const version = semverCoerceIfInvalid(versionGiven)
|
||||||
|
|
||||||
const lib = path.join(directory, "lib")
|
const lib = join(directory, "lib")
|
||||||
|
|
||||||
const ld = process.env.LD_LIBRARY_PATH ?? ""
|
const ld = process.env.LD_LIBRARY_PATH ?? ""
|
||||||
const dyld = process.env.DYLD_LIBRARY_PATH ?? ""
|
const dyld = process.env.DYLD_LIBRARY_PATH ?? ""
|
||||||
|
@ -316,16 +315,16 @@ export async function activateLLVM(directory: string, versionGiven: string) {
|
||||||
addEnv("LLVM_PATH", directory),
|
addEnv("LLVM_PATH", directory),
|
||||||
|
|
||||||
// Setup LLVM as the compiler
|
// Setup LLVM as the compiler
|
||||||
addEnv("LD_LIBRARY_PATH", `${lib}${path.delimiter}${ld}`),
|
addEnv("LD_LIBRARY_PATH", `${lib}${delimiter}${ld}`),
|
||||||
addEnv("DYLD_LIBRARY_PATH", `${lib}${path.delimiter}${dyld}`),
|
addEnv("DYLD_LIBRARY_PATH", `${lib}${delimiter}${dyld}`),
|
||||||
|
|
||||||
// compiler flags
|
// compiler flags
|
||||||
addEnv("LDFLAGS", `-L"${directory}/lib"`),
|
addEnv("LDFLAGS", `-L"${directory}/lib"`),
|
||||||
addEnv("CPPFLAGS", `-I"${directory}/include"`),
|
addEnv("CPPFLAGS", `-I"${directory}/include"`),
|
||||||
|
|
||||||
// compiler paths
|
// compiler paths
|
||||||
addEnv("CC", addBinExtension(`${directory}/bin/clang`)),
|
addEnv("CC", addExeExt(`${directory}/bin/clang`)),
|
||||||
addEnv("CXX", addBinExtension(`${directory}/bin/clang++`)),
|
addEnv("CXX", addExeExt(`${directory}/bin/clang++`)),
|
||||||
|
|
||||||
addEnv("LIBRARY_PATH", `${directory}/lib`),
|
addEnv("LIBRARY_PATH", `${directory}/lib`),
|
||||||
|
|
||||||
|
@ -369,7 +368,7 @@ export function setupClangTools(version: string, setupDir: string, arch: string)
|
||||||
}
|
}
|
||||||
|
|
||||||
function addLLVMLoggingMatcher() {
|
function addLLVMLoggingMatcher() {
|
||||||
const matcherPath = path.join(__dirname, "llvm_matcher.json")
|
const matcherPath = join(__dirname, "llvm_matcher.json")
|
||||||
if (!existsSync(matcherPath)) {
|
if (!existsSync(matcherPath)) {
|
||||||
return warning("the llvm_matcher.json file does not exist in the same folder as setup_cpp.js")
|
return warning("the llvm_matcher.json file does not exist in the same folder as setup_cpp.js")
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ import { setupGcc } from "./gcc/gcc"
|
||||||
import { InstallationInfo } from "./utils/setup/setupBin"
|
import { InstallationInfo } from "./utils/setup/setupBin"
|
||||||
import { error, info, success, warning } from "ci-log"
|
import { error, info, success, warning } from "ci-log"
|
||||||
import { setupVcpkg } from "./vcpkg/vcpkg"
|
import { setupVcpkg } from "./vcpkg/vcpkg"
|
||||||
import { join } from "path"
|
import { join } from "patha"
|
||||||
import { setupVCVarsall } from "./vcvarsall/vcvarsall"
|
import { setupVCVarsall } from "./vcvarsall/vcvarsall"
|
||||||
import { setupKcov } from "./kcov/kcov"
|
import { setupKcov } from "./kcov/kcov"
|
||||||
import { addEnv } from "./utils/env/addEnv"
|
import { addEnv } from "./utils/env/addEnv"
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { setupVCVarsall } from "../vcvarsall/vcvarsall"
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { vsversion_to_versionnumber, findVcvarsall } from "msvc-dev-cmd/lib.js"
|
import { vsversion_to_versionnumber, findVcvarsall } from "msvc-dev-cmd/lib.js"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import ciDetect from "@npmcli/ci-detect"
|
||||||
import path from "path"
|
import { join } from "patha"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import { error, info, warning } from "ci-log"
|
import { error, info, warning } from "ci-log"
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ export async function setupMSVC(
|
||||||
}
|
}
|
||||||
|
|
||||||
function addMSVCLoggingMatcher() {
|
function addMSVCLoggingMatcher() {
|
||||||
const matcherPath = path.join(__dirname, "msvc_matcher.json")
|
const matcherPath = join(__dirname, "msvc_matcher.json")
|
||||||
if (!existsSync(matcherPath)) {
|
if (!existsSync(matcherPath)) {
|
||||||
return warning("the msvc_matcher.json file does not exist in the same folder as setup_cpp.js")
|
return warning("the msvc_matcher.json file does not exist in the same folder as setup_cpp.js")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { dirname } from "path"
|
import { dirname } from "patha"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { isUbuntu } from "../utils/env/isUbuntu"
|
import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
import { execRootSync } from "root-tools"
|
import { execRootSync } from "root-tools"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { addBinExtension } from "extension-tools"
|
import { addExeExt } from "patha"
|
||||||
import { extractZip } from "../utils/setup/extract"
|
import { extractZip } from "../utils/setup/extract"
|
||||||
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
|
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ function getNinjaPackageInfo(version: string, platform: NodeJS.Platform, _arch:
|
||||||
const ninjaPlatform = getNinjaPlatform(platform)
|
const ninjaPlatform = getNinjaPlatform(platform)
|
||||||
return {
|
return {
|
||||||
binRelativeDir: "",
|
binRelativeDir: "",
|
||||||
binFileName: addBinExtension("ninja"),
|
binFileName: addExeExt("ninja"),
|
||||||
extractedFolderName: "",
|
extractedFolderName: "",
|
||||||
extractFunction: extractZip,
|
extractFunction: extractZip,
|
||||||
url: `https://github.com/ninja-build/ninja/releases/download/v${version}/ninja-${ninjaPlatform}.zip`,
|
url: `https://github.com/ninja-build/ninja/releases/download/v${version}/ninja-${ninjaPlatform}.zip`,
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { findPyPyVersion } from "setup-python/src/find-pypy"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import { info, warning } from "ci-log"
|
import { info, warning } from "ci-log"
|
||||||
import { debug } from "@actions/core"
|
import { debug } from "@actions/core"
|
||||||
import path from "path"
|
import { join } from "patha"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import ciDetect from "@npmcli/ci-detect"
|
||||||
import { isCacheFeatureAvailable, IS_LINUX, IS_WINDOWS } from "setup-python/src/utils"
|
import { isCacheFeatureAvailable, IS_LINUX, IS_WINDOWS } from "setup-python/src/utils"
|
||||||
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
|
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
|
||||||
|
@ -80,7 +80,7 @@ export async function setupActionsPython(version: string, _setupDir: string, arc
|
||||||
}
|
}
|
||||||
|
|
||||||
function addPythonLoggingMatcher() {
|
function addPythonLoggingMatcher() {
|
||||||
const matcherPath = path.join(__dirname, "python_matcher.json")
|
const matcherPath = join(__dirname, "python_matcher.json")
|
||||||
if (!existsSync(matcherPath)) {
|
if (!existsSync(matcherPath)) {
|
||||||
return warning("the python_matcher.json file does not exist in the same folder as setup_cpp.js")
|
return warning("the python_matcher.json file does not exist in the same folder as setup_cpp.js")
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { warning, info } from "ci-log"
|
||||||
import { isArch } from "../utils/env/isArch"
|
import { isArch } from "../utils/env/isArch"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
import { InstallationInfo } from "../utils/setup/setupBin"
|
||||||
import { dirname, join } from "path"
|
import { dirname, join } from "patha"
|
||||||
import { hasDnf } from "../utils/env/hasDnf"
|
import { hasDnf } from "../utils/env/hasDnf"
|
||||||
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
||||||
import { isUbuntu } from "../utils/env/isUbuntu"
|
import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { addBinExtension } from "extension-tools"
|
import { addExeExt } from "patha"
|
||||||
import { extractTarByExe, extractZip } from "../utils/setup/extract"
|
import { extractTarByExe, extractZip } from "../utils/setup/extract"
|
||||||
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
|
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ function getTaskPackageInfo(version: string, platform: NodeJS.Platform, arch: st
|
||||||
const extension = isZip ? "zip" : "tar.gz"
|
const extension = isZip ? "zip" : "tar.gz"
|
||||||
return {
|
return {
|
||||||
binRelativeDir: "",
|
binRelativeDir: "",
|
||||||
binFileName: addBinExtension("task"),
|
binFileName: addExeExt("task"),
|
||||||
extractedFolderName: "",
|
extractedFolderName: "",
|
||||||
extractFunction: isZip ? extractZip : extractTarByExe,
|
extractFunction: isZip ? extractZip : extractTarByExe,
|
||||||
url: `https://github.com/go-task/task/releases/download/v${version}/task_${taskPlatform}_${taskArch}.${extension}`,
|
url: `https://github.com/go-task/task/releases/download/v${version}/task_${taskPlatform}_${taskArch}.${extension}`,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { untildifyUser } from "untildify-user"
|
||||||
import { appendFileSync, existsSync, readFileSync } from "fs"
|
import { appendFileSync, existsSync, readFileSync } from "fs"
|
||||||
import { error, warning } from "ci-log"
|
import { error, warning } from "ci-log"
|
||||||
import { execPowershell } from "exec-powershell"
|
import { execPowershell } from "exec-powershell"
|
||||||
import { delimiter } from "path"
|
import { delimiter } from "patha"
|
||||||
import escapeSpace from "escape-path-with-spaces"
|
import escapeSpace from "escape-path-with-spaces"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,7 +85,7 @@ async function addPathSystem(path: string) {
|
||||||
case "win32": {
|
case "win32": {
|
||||||
// We do not use `execa.sync(`setx PATH "${path};%PATH%"`)` because of its character limit and also because %PATH% is different for user and system
|
// We do not use `execa.sync(`setx PATH "${path};%PATH%"`)` because of its character limit and also because %PATH% is different for user and system
|
||||||
await execPowershell(
|
await execPowershell(
|
||||||
`$USER_PATH=([Environment]::GetEnvironmentVariable("PATH", "User")); [Environment]::SetEnvironmentVariable("PATH", "${path};$USER_PATH", "User")`
|
`$USER_PATH=([Environment]::GetEnvironmentVariable("patha", "User")); [Environment]::SetEnvironmentVariable("patha", "${path};$USER_PATH", "User")`
|
||||||
)
|
)
|
||||||
info(`"${path}" was added to the PATH.`)
|
info(`"${path}" was added to the PATH.`)
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { find, downloadTool, cacheDir } from "@actions/tool-cache"
|
import { find, downloadTool, cacheDir } from "@actions/tool-cache"
|
||||||
import { info } from "@actions/core"
|
import { info } from "@actions/core"
|
||||||
import { addPath } from "../env/addEnv"
|
import { addPath } from "../env/addEnv"
|
||||||
import { join } from "path"
|
import { join } from "patha"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import { tmpdir } from "os"
|
import { tmpdir } from "os"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import ciDetect from "@npmcli/ci-detect"
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { info } from "@actions/core"
|
||||||
import { addPath } from "../env/addEnv"
|
import { addPath } from "../env/addEnv"
|
||||||
import { setupPython } from "../../python/python"
|
import { setupPython } from "../../python/python"
|
||||||
import { isBinUptoDate } from "./version"
|
import { isBinUptoDate } from "./version"
|
||||||
import { join } from "path"
|
import { join } from "patha"
|
||||||
import { getVersion } from "../../default_versions"
|
import { getVersion } from "../../default_versions"
|
||||||
import { InstallationInfo } from "./setupBin"
|
import { InstallationInfo } from "./setupBin"
|
||||||
import { setupAptPack } from "./setupAptPack"
|
import { setupAptPack } from "./setupAptPack"
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import * as io from "@actions/io"
|
import * as io from "@actions/io"
|
||||||
import { tmpdir } from "os"
|
import { tmpdir } from "os"
|
||||||
import * as path from "path"
|
import * as path from "patha"
|
||||||
import { addBinExtension } from "extension-tools"
|
import { addExeExt, join } from "patha"
|
||||||
import { join } from "path"
|
|
||||||
import spawn from "cross-spawn"
|
import spawn from "cross-spawn"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
|
|
||||||
|
@ -41,7 +40,7 @@ export async function testBin(
|
||||||
expect(binDir).toBeDefined()
|
expect(binDir).toBeDefined()
|
||||||
expect(binDir).not.toHaveLength(0)
|
expect(binDir).not.toHaveLength(0)
|
||||||
expect(existsSync(binDir)).toBeTruthy()
|
expect(existsSync(binDir)).toBeTruthy()
|
||||||
bin = join(binDir, addBinExtension(name))
|
bin = join(binDir, addExeExt(name))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args !== null) {
|
if (args !== null) {
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import execa from "execa"
|
import execa from "execa"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import { dirname, join } from "path"
|
import { dirname, join, addShExt, addShRelativePrefix } from "patha"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { addPath } from "../utils/env/addEnv"
|
import { addPath } from "../utils/env/addEnv"
|
||||||
import { addShellExtension, addShellHere } from "extension-tools"
|
|
||||||
import { notice } from "ci-log"
|
import { notice } from "ci-log"
|
||||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
||||||
|
@ -45,13 +44,13 @@ export async function setupVcpkg(_version: string, setupDir: string, _arch: stri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!existsSync(join(setupDir, addShellExtension("bootstrap-vcpkg")))) {
|
if (!existsSync(join(setupDir, addShExt("bootstrap-vcpkg")))) {
|
||||||
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir), stdio: "inherit" })
|
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir), stdio: "inherit" })
|
||||||
} else {
|
} else {
|
||||||
notice(`Vcpkg folder already exists at ${setupDir}. This might mean that ~/vcpkg is restored from the cache.`)
|
notice(`Vcpkg folder already exists at ${setupDir}. This might mean that ~/vcpkg is restored from the cache.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
execa.sync(addShellExtension(addShellHere("bootstrap-vcpkg")), { cwd: setupDir, shell: true, stdio: "inherit" })
|
execa.sync(addShExt(addShRelativePrefix("bootstrap-vcpkg")), { cwd: setupDir, shell: true, stdio: "inherit" })
|
||||||
|
|
||||||
giveUserAccess(setupDir)
|
giveUserAccess(setupDir)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue