From dd32dd730ca6e64ab361d4cbabd8c3ae66c112eb Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Fri, 12 May 2023 13:35:45 +0200 Subject: [PATCH 01/19] Update installers --- externals/install-dotnet.ps1 | 459 ++++++++++++++++++----------------- externals/install-dotnet.sh | 14 +- 2 files changed, 245 insertions(+), 228 deletions(-) diff --git a/externals/install-dotnet.ps1 b/externals/install-dotnet.ps1 index b0b131a..c9a30cb 100644 --- a/externals/install-dotnet.ps1 +++ b/externals/install-dotnet.ps1 @@ -9,6 +9,12 @@ .DESCRIPTION Installs dotnet cli. If dotnet installation already exists in the given directory it will update it only if the requested version differs from the one already installed. + + Note that the intended use of this script is for Continuous Integration (CI) scenarios, where: + - The SDK needs to be installed without user interaction and without admin rights. + - The SDK installation doesn't need to persist across multiple CI runs. + To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer. + .PARAMETER Channel Default: LTS Download from the Channel specified. Possible values: @@ -164,6 +170,12 @@ function Say-Verbose($str) { } } +function Measure-Action($name, $block) { + $time = Measure-Command $block + $totalSeconds = $time.TotalSeconds + Say-Verbose "⏱ Action '$name' took $totalSeconds seconds" +} + function Say-Invocation($Invocation) { $command = $Invocation.MyCommand; $args = (($Invocation.BoundParameters.Keys | foreach { "-$_ `"$($Invocation.BoundParameters[$_])`"" }) -join " ") @@ -1104,10 +1116,10 @@ function Prepare-Install-Directory { } } -Say "Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:" -Say "- The SDK needs to be installed without user interaction and without admin rights." -Say "- The SDK installation doesn't need to persist across multiple CI runs." -Say "To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.`r`n" +Say-Verbose "Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:" +Say-Verbose "- The SDK needs to be installed without user interaction and without admin rights." +Say-Verbose "- The SDK installation doesn't need to persist across multiple CI runs." +Say-Verbose "To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.`r`n" if ($SharedRuntime -and (-not $Runtime)) { $Runtime = "dotnet" @@ -1115,14 +1127,16 @@ if ($SharedRuntime -and (-not $Runtime)) { $OverrideNonVersionedFiles = !$SkipNonVersionedFiles -$CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture -$NormalizedQuality = Get-NormalizedQuality $Quality -Say-Verbose "Normalized quality: '$NormalizedQuality'" -$NormalizedChannel = Get-NormalizedChannel $Channel -Say-Verbose "Normalized channel: '$NormalizedChannel'" -$NormalizedProduct = Get-NormalizedProduct $Runtime -Say-Verbose "Normalized product: '$NormalizedProduct'" -$FeedCredential = ValidateFeedCredential $FeedCredential +Measure-Action "Product discovery" { + $script:CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture + $script:NormalizedQuality = Get-NormalizedQuality $Quality + Say-Verbose "Normalized quality: '$NormalizedQuality'" + $script:NormalizedChannel = Get-NormalizedChannel $Channel + Say-Verbose "Normalized channel: '$NormalizedChannel'" + $script:NormalizedProduct = Get-NormalizedProduct $Runtime + Say-Verbose "Normalized product: '$NormalizedProduct'" + $script:FeedCredential = ValidateFeedCredential $FeedCredential +} $InstallRoot = Resolve-Installation-Path $InstallDir Say-Verbose "InstallRoot: $InstallRoot" @@ -1200,7 +1214,7 @@ if ($DryRun) { return } -Prepare-Install-Directory +Measure-Action "Installation directory preparation" { Prepare-Install-Directory } $ZipPath = [System.IO.Path]::combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName()) Say-Verbose "Zip path: $ZipPath" @@ -1214,7 +1228,7 @@ foreach ($link in $DownloadLinks) Say-Verbose "Downloading `"$($link.type)`" link $($link.downloadLink)" try { - DownloadFile -Source $link.downloadLink -OutPath $ZipPath + Measure-Action "Package download" { DownloadFile -Source $link.downloadLink -OutPath $ZipPath } Say-Verbose "Download succeeded." $DownloadSucceeded = $true $DownloadedLink = $link @@ -1251,7 +1265,7 @@ if (-not $DownloadSucceeded) { } Say "Extracting the archive." -Extract-Dotnet-Package -ZipPath $ZipPath -OutPath $InstallRoot +Measure-Action "Package extraction" { Extract-Dotnet-Package -ZipPath $ZipPath -OutPath $InstallRoot } # Check if the SDK version is installed; if not, fail the installation. $isAssetInstalled = $false @@ -1277,225 +1291,224 @@ if (!$isAssetInstalled) { SafeRemoveFile -Path $ZipPath -Prepend-Sdk-InstallRoot-To-Path -InstallRoot $InstallRoot +Measure-Action "Setting up shell environment" { Prepend-Sdk-InstallRoot-To-Path -InstallRoot $InstallRoot } Say "Note that the script does not resolve dependencies during installation." Say "To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install/windows#dependencies" Say "Installed version is $($DownloadedLink.effectiveVersion)" Say "Installation finished" - # SIG # Begin signature block -# MIInzgYJKoZIhvcNAQcCoIInvzCCJ7sCAQExDzANBglghkgBZQMEAgEFADB5Bgor +# MIInvwYJKoZIhvcNAQcCoIInsDCCJ6wCAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCB7pzZ0nuEMd30h -# n1EcAYUQN+1clltqaLf9611TDrw/laCCDYUwggYDMIID66ADAgECAhMzAAACzfNk -# v/jUTF1RAAAAAALNMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBhfTi3SRn7+vyy +# uCXKPjhiawegWZ493EcaOEycbgkZcKCCDXYwggX0MIID3KADAgECAhMzAAACy7d1 +# OfsCcUI2AAAAAALLMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD # VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy # b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01p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F8QP7Ac1saIe1+gUFNcsYOLaMm/xl8E6kefWwZnm5Rhm606g1AC/ +# N5Wo08aAs0ymTPH91dEbmOURXLbA3vCyG7kbfgnhCs/j7oQHWaFDzEYuXDIA4ICT +# dxPUTltbq3OWdp0PAS8JSEKPQFaOoQEnPa4adrXWxMvOmel8IGqJiQ+BPOaLQG64 +# Qu2tMkH/5szb1fsEnCe8SJmy5ESF+kmpnLBtJ17Y9o+9nJHF5ddFmvzy+LUaIqDN +# cOfH # SIG # End signature block diff --git a/externals/install-dotnet.sh b/externals/install-dotnet.sh index ecb2b6c..bdaa67e 100755 --- a/externals/install-dotnet.sh +++ b/externals/install-dotnet.sh @@ -1617,6 +1617,10 @@ do echo " $script_name -h|-?|--help" echo "" echo "$script_name is a simple command line interface for obtaining dotnet cli." + echo " Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:" + echo " - The SDK needs to be installed without user interaction and without admin rights." + echo " - The SDK installation doesn't need to persist across multiple CI runs." + echo " To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer." echo "" echo "Options:" echo " -c,--channel Download from the channel specified, Defaults to \`$channel\`." @@ -1694,10 +1698,10 @@ do shift done -say "Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:" -say "- The SDK needs to be installed without user interaction and without admin rights." -say "- The SDK installation doesn't need to persist across multiple CI runs." -say "To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.\n" +say_verbose "Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:" +say_verbose "- The SDK needs to be installed without user interaction and without admin rights." +say_verbose "- The SDK installation doesn't need to persist across multiple CI runs." +say_verbose "To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.\n" if [ "$internal" = true ] && [ -z "$(echo $feed_credential)" ]; then message="Provide credentials via --feed-credential parameter." @@ -1731,4 +1735,4 @@ fi say "Note that the script does not resolve dependencies during installation." say "To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section." -say "Installation finished successfully." +say "Installation finished successfully." \ No newline at end of file From 6d92b9bd5393d09715a60dd0726c5b2382cab757 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Fri, 12 May 2023 14:07:46 +0200 Subject: [PATCH 02/19] Refactor install dir computation --- dist/index.js | 37 ++++++++++++++++++------------------- src/installer.ts | 36 ++++++++++++------------------------ src/utils.ts | 5 +++++ 3 files changed, 35 insertions(+), 43 deletions(-) diff --git a/dist/index.js b/dist/index.js index 8e20d7f..aa4b7a5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -419,24 +419,15 @@ class DotnetCoreInstaller { exports.DotnetCoreInstaller = DotnetCoreInstaller; _a = DotnetCoreInstaller; (() => { - const installationDirectoryWindows = path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet'); - const installationDirectoryLinux = '/usr/share/dotnet'; - const installationDirectoryMac = path_1.default.join(process.env['HOME'] + '', '.dotnet'); - const dotnetInstallDir = process.env['DOTNET_INSTALL_DIR']; - if (dotnetInstallDir) { - process.env['DOTNET_INSTALL_DIR'] = - _a.convertInstallPathToAbsolute(dotnetInstallDir); - } - else { - if (utils_1.IS_WINDOWS) { - process.env['DOTNET_INSTALL_DIR'] = installationDirectoryWindows; - } - else { - process.env['DOTNET_INSTALL_DIR'] = utils_1.IS_LINUX - ? installationDirectoryLinux - : installationDirectoryMac; - } - } + const dotnetInstallDirDefault = { + linux: '/usr/share/dotnet', + mac: path_1.default.join(process.env['HOME'] + '', '.dotnet'), + windows: path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet') + }[(0, utils_1.getPlatform)()]; + const dotnetInstallDir = process.env['DOTNET_INSTALL_DIR'] + ? _a.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR']) + : dotnetInstallDirDefault; + process.env['DOTNET_INSTALL_DIR'] = dotnetInstallDir; })(); @@ -591,9 +582,17 @@ run(); "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.IS_LINUX = exports.IS_WINDOWS = void 0; +exports.getPlatform = exports.IS_LINUX = exports.IS_WINDOWS = void 0; exports.IS_WINDOWS = process.platform === 'win32'; exports.IS_LINUX = process.platform === 'linux'; +const getPlatform = () => { + if (exports.IS_WINDOWS) + return 'windows'; + if (exports.IS_LINUX) + return 'linux'; + return 'mac'; +}; +exports.getPlatform = getPlatform; /***/ }), diff --git a/src/installer.ts b/src/installer.ts index ef9e993..b2132ef 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -8,7 +8,7 @@ import {readdir} from 'fs/promises'; import path from 'path'; import os from 'os'; import semver from 'semver'; -import {IS_LINUX, IS_WINDOWS} from './utils'; +import {IS_WINDOWS, getPlatform} from './utils'; import {QualityOptions} from './setup-dotnet'; export interface DotnetVersion { @@ -115,29 +115,17 @@ export class DotnetCoreInstaller { private quality: QualityOptions; static { - const installationDirectoryWindows = path.join( - process.env['PROGRAMFILES'] + '', - 'dotnet' - ); - const installationDirectoryLinux = '/usr/share/dotnet'; - const installationDirectoryMac = path.join( - process.env['HOME'] + '', - '.dotnet' - ); - const dotnetInstallDir: string | undefined = - process.env['DOTNET_INSTALL_DIR']; - if (dotnetInstallDir) { - process.env['DOTNET_INSTALL_DIR'] = - this.convertInstallPathToAbsolute(dotnetInstallDir); - } else { - if (IS_WINDOWS) { - process.env['DOTNET_INSTALL_DIR'] = installationDirectoryWindows; - } else { - process.env['DOTNET_INSTALL_DIR'] = IS_LINUX - ? installationDirectoryLinux - : installationDirectoryMac; - } - } + const dotnetInstallDirDefault = { + linux: '/usr/share/dotnet', + mac: path.join(process.env['HOME'] + '', '.dotnet'), + windows: path.join(process.env['PROGRAMFILES'] + '', 'dotnet') + }[getPlatform()]; + + const dotnetInstallDir = process.env['DOTNET_INSTALL_DIR'] + ? this.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR']) + : dotnetInstallDirDefault; + + process.env['DOTNET_INSTALL_DIR'] = dotnetInstallDir; } constructor(version: string, quality: QualityOptions) { diff --git a/src/utils.ts b/src/utils.ts index 77886ce..d671d70 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,2 +1,7 @@ export const IS_WINDOWS = process.platform === 'win32'; export const IS_LINUX = process.platform === 'linux'; +export const getPlatform = (): 'windows' | 'linux' | 'mac' => { + if (IS_WINDOWS) return 'windows'; + if (IS_LINUX) return 'linux'; + return 'mac'; +}; From aa85432603f42dabe849d900c34011b215608e21 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Fri, 12 May 2023 16:28:16 +0200 Subject: [PATCH 03/19] Refactor installer --- __tests__/installer.test.ts | 14 +-- dist/index.js | 174 ++++++++++++++++-------------- src/installer.ts | 206 ++++++++++++++++++++---------------- 3 files changed, 218 insertions(+), 176 deletions(-) diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts index 1a7e024..becedea 100644 --- a/__tests__/installer.test.ts +++ b/__tests__/installer.test.ts @@ -117,7 +117,7 @@ describe('DotnetCoreInstaller tests', () => { it('Throws if no location contains correct dotnet version', async () => { await expect(async () => { - await getDotnet('1000.0.0'); + await getDotnet('1000.0.0') }).rejects.toThrow(); }, 30000); @@ -177,7 +177,7 @@ describe('DotnetVersionResolver tests', () => { const dotnetVersionResolver = new installer.DotnetVersionResolver( version ); - const versionObject = await dotnetVersionResolver.createDotNetVersion(); + const versionObject = await dotnetVersionResolver.createDotnetVersion(); expect(!!versionObject.value).toBe(true); } @@ -216,7 +216,7 @@ describe('DotnetVersionResolver tests', () => { ); await expect( - async () => await dotnetVersionResolver.createDotNetVersion() + async () => await dotnetVersionResolver.createDotnetVersion() ).rejects.toThrow(); } ); @@ -227,7 +227,7 @@ describe('DotnetVersionResolver tests', () => { const dotnetVersionResolver = new installer.DotnetVersionResolver( version ); - const versionObject = await dotnetVersionResolver.createDotNetVersion(); + const versionObject = await dotnetVersionResolver.createDotnetVersion(); expect(versionObject.type.toLowerCase().includes('channel')).toBe(true); } @@ -239,7 +239,7 @@ describe('DotnetVersionResolver tests', () => { const dotnetVersionResolver = new installer.DotnetVersionResolver( version ); - const versionObject = await dotnetVersionResolver.createDotNetVersion(); + const versionObject = await dotnetVersionResolver.createDotnetVersion(); expect(versionObject.type.toLowerCase().includes('channel')).toBe(true); expect(versionObject.qualityFlag).toBe(true); @@ -252,7 +252,7 @@ describe('DotnetVersionResolver tests', () => { const dotnetVersionResolver = new installer.DotnetVersionResolver( version ); - const versionObject = await dotnetVersionResolver.createDotNetVersion(); + const versionObject = await dotnetVersionResolver.createDotnetVersion(); expect(versionObject.type.toLowerCase().includes('version')).toBe(true); expect(versionObject.qualityFlag).toBe(false); @@ -265,7 +265,7 @@ describe('DotnetVersionResolver tests', () => { const dotnetVersionResolver = new installer.DotnetVersionResolver( version ); - const versionObject = await dotnetVersionResolver.createDotNetVersion(); + const versionObject = await dotnetVersionResolver.createDotnetVersion(); const windowsRegEx = new RegExp(/^-[VC]/); const nonWindowsRegEx = new RegExp(/^--[vc]/); diff --git a/dist/index.js b/dist/index.js index aa4b7a5..727b6ca 100644 --- a/dist/index.js +++ b/dist/index.js @@ -229,9 +229,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; -var _a; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.DotnetCoreInstaller = exports.DotnetVersionResolver = void 0; +exports.DotnetCoreInstaller = exports.DotnetInstallDir = exports.DotnetInstallScript = exports.DotnetVersionResolver = void 0; // Load tempDirectory before it gets wiped by tool-cache const core = __importStar(__nccwpck_require__(2186)); const exec = __importStar(__nccwpck_require__(1514)); @@ -279,7 +278,7 @@ class DotnetVersionResolver { isNumericTag(versionTag) { return /^\d+$/.test(versionTag); } - createDotNetVersion() { + createDotnetVersion() { return __awaiter(this, void 0, void 0, function* () { yield this.resolveVersionInput(); if (!this.resolvedArgument.type) { @@ -314,11 +313,77 @@ class DotnetVersionResolver { } exports.DotnetVersionResolver = DotnetVersionResolver; DotnetVersionResolver.DotNetCoreIndexUrl = 'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json'; -class DotnetCoreInstaller { - constructor(version, quality) { - this.version = version; - this.quality = quality; +class DotnetInstallScript { + constructor() { + this.scriptName = utils_1.IS_WINDOWS ? 'install-dotnet.ps1' : 'install-dotnet.sh'; + this.scriptArguments = []; + this.scriptPath = ''; + this.escapedScript = path_1.default + .join(__dirname, '..', 'externals', this.scriptName) + .replace(/'/g, "''"); + this.scriptReady = utils_1.IS_WINDOWS + ? this.setupScriptPowershell() + : this.setupScriptBash(); } + setupScriptPowershell() { + return __awaiter(this, void 0, void 0, function* () { + this.scriptArguments = [ + '-NoLogo', + '-Sta', + '-NoProfile', + '-NonInteractive', + '-ExecutionPolicy', + 'Unrestricted', + '-Command' + ]; + this.scriptArguments.push('&', `'${this.escapedScript}'`); + if (process.env['https_proxy'] != null) { + this.scriptArguments.push(`-ProxyAddress ${process.env['https_proxy']}`); + } + // This is not currently an option + if (process.env['no_proxy'] != null) { + this.scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`); + } + this.scriptPath = (yield io.which('pwsh', false)) || (yield io.which('powershell', true)); + }); + } + setupScriptBash() { + return __awaiter(this, void 0, void 0, function* () { + (0, fs_1.chmodSync)(this.escapedScript, '777'); + this.scriptArguments = []; + this.scriptPath = yield io.which(this.escapedScript, true); + }); + } + useArguments(...args) { + this.scriptArguments.push(...args); + return this; + } + useVersion(dotnetVersion, quality) { + if (dotnetVersion.type) { + this.useArguments(dotnetVersion.type, dotnetVersion.value); + } + if (quality && !dotnetVersion.qualityFlag) { + core.warning(`'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A and A.x formats where the major tag is higher than 5. You specified: ${dotnetVersion.value}. 'dotnet-quality' input is ignored.`); + return this; + } + if (quality) { + this.useArguments(utils_1.IS_WINDOWS ? '-Quality' : '--quality', quality); + } + return this; + } + execute() { + return __awaiter(this, void 0, void 0, function* () { + const getExecOutputOptions = { + ignoreReturnCode: true, + env: process.env + }; + yield this.scriptReady; + return exec.getExecOutput(`"${this.scriptPath}"`, this.scriptArguments, getExecOutputOptions); + }); + } +} +exports.DotnetInstallScript = DotnetInstallScript; +class DotnetInstallDir { static convertInstallPathToAbsolute(installDir) { let transformedPath; if (path_1.default.isAbsolute(installDir)) { @@ -335,70 +400,33 @@ class DotnetCoreInstaller { core.addPath(process.env['DOTNET_INSTALL_DIR']); core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']); } - setQuality(dotnetVersion, scriptArguments) { - const option = utils_1.IS_WINDOWS ? '-Quality' : '--quality'; - if (dotnetVersion.qualityFlag) { - scriptArguments.push(option, this.quality); - } - else { - core.warning(`'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A and A.x formats where the major tag is higher than 5. You specified: ${this.version}. 'dotnet-quality' input is ignored.`); - } + static initialize() { + process.env['DOTNET_INSTALL_DIR'] = DotnetInstallDir.path; } +} +exports.DotnetInstallDir = DotnetInstallDir; +DotnetInstallDir.default = { + linux: '/usr/share/dotnet', + mac: path_1.default.join(process.env['HOME'] + '', '.dotnet'), + windows: path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet') +}; +DotnetInstallDir.path = process.env['DOTNET_INSTALL_DIR'] + ? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR']) + : DotnetInstallDir.default[(0, utils_1.getPlatform)()]; +class DotnetCoreInstaller { + constructor(version, quality) { + this.version = version; + this.quality = quality; + } + ; installDotnet() { return __awaiter(this, void 0, void 0, function* () { - const windowsDefaultOptions = [ - '-NoLogo', - '-Sta', - '-NoProfile', - '-NonInteractive', - '-ExecutionPolicy', - 'Unrestricted', - '-Command' - ]; - const scriptName = utils_1.IS_WINDOWS ? 'install-dotnet.ps1' : 'install-dotnet.sh'; - const escapedScript = path_1.default - .join(__dirname, '..', 'externals', scriptName) - .replace(/'/g, "''"); - let scriptArguments; - let scriptPath = ''; const versionResolver = new DotnetVersionResolver(this.version); - const dotnetVersion = yield versionResolver.createDotNetVersion(); - if (utils_1.IS_WINDOWS) { - scriptArguments = ['&', `'${escapedScript}'`]; - if (dotnetVersion.type) { - scriptArguments.push(dotnetVersion.type, dotnetVersion.value); - } - if (this.quality) { - this.setQuality(dotnetVersion, scriptArguments); - } - if (process.env['https_proxy'] != null) { - scriptArguments.push(`-ProxyAddress ${process.env['https_proxy']}`); - } - // This is not currently an option - if (process.env['no_proxy'] != null) { - scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`); - } - scriptPath = - (yield io.which('pwsh', false)) || (yield io.which('powershell', true)); - scriptArguments = windowsDefaultOptions.concat(scriptArguments); - } - else { - (0, fs_1.chmodSync)(escapedScript, '777'); - scriptPath = yield io.which(escapedScript, true); - scriptArguments = []; - if (dotnetVersion.type) { - scriptArguments.push(dotnetVersion.type, dotnetVersion.value); - } - if (this.quality) { - this.setQuality(dotnetVersion, scriptArguments); - } - } - // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used - const getExecOutputOptions = { - ignoreReturnCode: true, - env: process.env - }; - const { exitCode, stderr } = yield exec.getExecOutput(`"${scriptPath}"`, scriptArguments, getExecOutputOptions); + const dotnetVersion = yield versionResolver.createDotnetVersion(); + const installScript = new DotnetInstallScript() + .useArguments(utils_1.IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files') + .useVersion(dotnetVersion, this.quality); + const { exitCode, stderr } = yield installScript.execute(); if (exitCode) { throw new Error(`Failed to install dotnet, exit code: ${exitCode}. ${stderr}`); } @@ -417,17 +445,9 @@ class DotnetCoreInstaller { } } exports.DotnetCoreInstaller = DotnetCoreInstaller; -_a = DotnetCoreInstaller; +DotnetCoreInstaller.addToPath = DotnetInstallDir.addToPath; (() => { - const dotnetInstallDirDefault = { - linux: '/usr/share/dotnet', - mac: path_1.default.join(process.env['HOME'] + '', '.dotnet'), - windows: path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet') - }[(0, utils_1.getPlatform)()]; - const dotnetInstallDir = process.env['DOTNET_INSTALL_DIR'] - ? _a.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR']) - : dotnetInstallDirDefault; - process.env['DOTNET_INSTALL_DIR'] = dotnetInstallDir; + DotnetInstallDir.initialize; })(); diff --git a/src/installer.ts b/src/installer.ts index b2132ef..31b3532 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -61,7 +61,7 @@ export class DotnetVersionResolver { return /^\d+$/.test(versionTag); } - public async createDotNetVersion(): Promise<{ + public async createDotnetVersion(): Promise<{ type: string; value: string; qualityFlag: boolean; @@ -110,29 +110,106 @@ export class DotnetVersionResolver { 'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json'; } -export class DotnetCoreInstaller { - private version: string; - private quality: QualityOptions; +export class DotnetInstallScript { + private scriptName = IS_WINDOWS ? 'install-dotnet.ps1' : 'install-dotnet.sh'; + private escapedScript: string; + private scriptArguments: string[] = []; + private scriptPath = ''; + private scriptReady: Promise; - static { - const dotnetInstallDirDefault = { - linux: '/usr/share/dotnet', - mac: path.join(process.env['HOME'] + '', '.dotnet'), - windows: path.join(process.env['PROGRAMFILES'] + '', 'dotnet') - }[getPlatform()]; - - const dotnetInstallDir = process.env['DOTNET_INSTALL_DIR'] - ? this.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR']) - : dotnetInstallDirDefault; - - process.env['DOTNET_INSTALL_DIR'] = dotnetInstallDir; + constructor() { + this.escapedScript = path + .join(__dirname, '..', 'externals', this.scriptName) + .replace(/'/g, "''"); + + this.scriptReady = IS_WINDOWS + ? this.setupScriptPowershell() + : this.setupScriptBash(); } - constructor(version: string, quality: QualityOptions) { - this.version = version; - this.quality = quality; + private async setupScriptPowershell() { + this.scriptArguments = [ + '-NoLogo', + '-Sta', + '-NoProfile', + '-NonInteractive', + '-ExecutionPolicy', + 'Unrestricted', + '-Command' + ]; + + this.scriptArguments.push('&', `'${this.escapedScript}'`); + + if (process.env['https_proxy'] != null) { + this.scriptArguments.push(`-ProxyAddress ${process.env['https_proxy']}`); + } + // This is not currently an option + if (process.env['no_proxy'] != null) { + this.scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`); + } + + this.scriptPath = (await io.which('pwsh', false)) || (await io.which('powershell', true)); } + private async setupScriptBash() { + chmodSync(this.escapedScript, '777'); + + this.scriptArguments = []; + + this.scriptPath = await io.which(this.escapedScript, true); + } + + public useArguments(...args: string[]) { + this.scriptArguments.push(...args); + return this; + } + + public useVersion(dotnetVersion: DotnetVersion, quality?: QualityOptions) { + if (dotnetVersion.type) { + this.useArguments(dotnetVersion.type, dotnetVersion.value); + } + + if (quality && !dotnetVersion.qualityFlag) { + core.warning( + `'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A and A.x formats where the major tag is higher than 5. You specified: ${dotnetVersion.value}. 'dotnet-quality' input is ignored.` + ); + return this; + } + + if (quality) { + this.useArguments(IS_WINDOWS ? '-Quality' : '--quality', quality); + } + + return this; + } + + public async execute() { + const getExecOutputOptions = { + ignoreReturnCode: true, + env: process.env as {string: string} + }; + + await this.scriptReady; + + return exec.getExecOutput( + `"${this.scriptPath}"`, + this.scriptArguments, + getExecOutputOptions, + ) + } +} + +export abstract class DotnetInstallDir { + private static readonly default = { + linux: '/usr/share/dotnet', + mac: path.join(process.env['HOME'] + '', '.dotnet'), + windows: path.join(process.env['PROGRAMFILES'] + '', 'dotnet') + } + + public static readonly path = process.env['DOTNET_INSTALL_DIR'] + ? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR']) + : DotnetInstallDir.default[getPlatform()] + private static convertInstallPathToAbsolute(installDir: string): string { let transformedPath; if (path.isAbsolute(installDir)) { @@ -145,90 +222,35 @@ export class DotnetCoreInstaller { return path.normalize(transformedPath); } - static addToPath() { + public static addToPath() { core.addPath(process.env['DOTNET_INSTALL_DIR']!); core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']); } - private setQuality( - dotnetVersion: DotnetVersion, - scriptArguments: string[] - ): void { - const option = IS_WINDOWS ? '-Quality' : '--quality'; - if (dotnetVersion.qualityFlag) { - scriptArguments.push(option, this.quality); - } else { - core.warning( - `'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A and A.x formats where the major tag is higher than 5. You specified: ${this.version}. 'dotnet-quality' input is ignored.` - ); - } + public static initialize() { + process.env['DOTNET_INSTALL_DIR'] = DotnetInstallDir.path; + } +} + +export class DotnetCoreInstaller { + static addToPath = DotnetInstallDir.addToPath; + + static { + DotnetInstallDir.initialize; } + constructor(private version: string, private quality: QualityOptions) {}; + public async installDotnet(): Promise { - const windowsDefaultOptions = [ - '-NoLogo', - '-Sta', - '-NoProfile', - '-NonInteractive', - '-ExecutionPolicy', - 'Unrestricted', - '-Command' - ]; - const scriptName = IS_WINDOWS ? 'install-dotnet.ps1' : 'install-dotnet.sh'; - const escapedScript = path - .join(__dirname, '..', 'externals', scriptName) - .replace(/'/g, "''"); - let scriptArguments: string[]; - let scriptPath = ''; - const versionResolver = new DotnetVersionResolver(this.version); - const dotnetVersion = await versionResolver.createDotNetVersion(); + const dotnetVersion = await versionResolver.createDotnetVersion(); - if (IS_WINDOWS) { - scriptArguments = ['&', `'${escapedScript}'`]; + const installScript = new DotnetInstallScript() + .useArguments(IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files') + .useVersion(dotnetVersion, this.quality); - if (dotnetVersion.type) { - scriptArguments.push(dotnetVersion.type, dotnetVersion.value); - } + const {exitCode, stderr} = await installScript.execute(); - if (this.quality) { - this.setQuality(dotnetVersion, scriptArguments); - } - - if (process.env['https_proxy'] != null) { - scriptArguments.push(`-ProxyAddress ${process.env['https_proxy']}`); - } - // This is not currently an option - if (process.env['no_proxy'] != null) { - scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`); - } - - scriptPath = - (await io.which('pwsh', false)) || (await io.which('powershell', true)); - scriptArguments = windowsDefaultOptions.concat(scriptArguments); - } else { - chmodSync(escapedScript, '777'); - scriptPath = await io.which(escapedScript, true); - scriptArguments = []; - - if (dotnetVersion.type) { - scriptArguments.push(dotnetVersion.type, dotnetVersion.value); - } - - if (this.quality) { - this.setQuality(dotnetVersion, scriptArguments); - } - } - // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used - const getExecOutputOptions = { - ignoreReturnCode: true, - env: process.env as {string: string} - }; - const {exitCode, stderr} = await exec.getExecOutput( - `"${scriptPath}"`, - scriptArguments, - getExecOutputOptions - ); if (exitCode) { throw new Error( `Failed to install dotnet, exit code: ${exitCode}. ${stderr}` From 3dfe2673ebda42a6c89c6d15e77c93263aafbb5d Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Wed, 24 May 2023 15:22:01 +0200 Subject: [PATCH 04/19] Format: Refactor installer --- __tests__/installer.test.ts | 2 +- src/installer.ts | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts index becedea..5e577c9 100644 --- a/__tests__/installer.test.ts +++ b/__tests__/installer.test.ts @@ -117,7 +117,7 @@ describe('DotnetCoreInstaller tests', () => { it('Throws if no location contains correct dotnet version', async () => { await expect(async () => { - await getDotnet('1000.0.0') + await getDotnet('1000.0.0'); }).rejects.toThrow(); }, 30000); diff --git a/src/installer.ts b/src/installer.ts index 31b3532..5389ae8 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -121,7 +121,7 @@ export class DotnetInstallScript { this.escapedScript = path .join(__dirname, '..', 'externals', this.scriptName) .replace(/'/g, "''"); - + this.scriptReady = IS_WINDOWS ? this.setupScriptPowershell() : this.setupScriptBash(); @@ -148,7 +148,8 @@ export class DotnetInstallScript { this.scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`); } - this.scriptPath = (await io.which('pwsh', false)) || (await io.which('powershell', true)); + this.scriptPath = + (await io.which('pwsh', false)) || (await io.which('powershell', true)); } private async setupScriptBash() { @@ -194,8 +195,8 @@ export class DotnetInstallScript { return exec.getExecOutput( `"${this.scriptPath}"`, this.scriptArguments, - getExecOutputOptions, - ) + getExecOutputOptions + ); } } @@ -204,11 +205,13 @@ export abstract class DotnetInstallDir { linux: '/usr/share/dotnet', mac: path.join(process.env['HOME'] + '', '.dotnet'), windows: path.join(process.env['PROGRAMFILES'] + '', 'dotnet') - } + }; public static readonly path = process.env['DOTNET_INSTALL_DIR'] - ? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR']) - : DotnetInstallDir.default[getPlatform()] + ? DotnetInstallDir.convertInstallPathToAbsolute( + process.env['DOTNET_INSTALL_DIR'] + ) + : DotnetInstallDir.default[getPlatform()]; private static convertInstallPathToAbsolute(installDir: string): string { let transformedPath; @@ -239,14 +242,16 @@ export class DotnetCoreInstaller { DotnetInstallDir.initialize; } - constructor(private version: string, private quality: QualityOptions) {}; + constructor(private version: string, private quality: QualityOptions) {} public async installDotnet(): Promise { const versionResolver = new DotnetVersionResolver(this.version); const dotnetVersion = await versionResolver.createDotnetVersion(); const installScript = new DotnetInstallScript() - .useArguments(IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files') + .useArguments( + IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files' + ) .useVersion(dotnetVersion, this.quality); const {exitCode, stderr} = await installScript.execute(); From 7e164d3c3bca3f2b9acc7fc8dd5e56d14026f968 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Fri, 12 May 2023 17:10:53 +0200 Subject: [PATCH 05/19] Fix DOTNET_INSTALL_DIR enviornment variable --- src/installer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer.ts b/src/installer.ts index 5389ae8..e0df8ee 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -239,7 +239,7 @@ export class DotnetCoreInstaller { static addToPath = DotnetInstallDir.addToPath; static { - DotnetInstallDir.initialize; + DotnetInstallDir.initialize(); } constructor(private version: string, private quality: QualityOptions) {} From abf9166e44f12b2a02a2b433a371bc2b4accb12d Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Fri, 12 May 2023 17:11:32 +0200 Subject: [PATCH 06/19] build: Fix DOTNET_INSTALL_DIR enviornment variable --- dist/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 727b6ca..e0bc888 100644 --- a/dist/index.js +++ b/dist/index.js @@ -447,7 +447,7 @@ class DotnetCoreInstaller { exports.DotnetCoreInstaller = DotnetCoreInstaller; DotnetCoreInstaller.addToPath = DotnetInstallDir.addToPath; (() => { - DotnetInstallDir.initialize; + DotnetInstallDir.initialize(); })(); From df506c2d9c47521eb8551b5bcc78d30fbc00edc2 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Fri, 12 May 2023 17:34:18 +0200 Subject: [PATCH 07/19] Refactor convertInstallPathToAbsolute --- dist/index.js | 15 +++++---------- src/installer.ts | 17 ++++++----------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/dist/index.js b/dist/index.js index e0bc888..77d557d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -350,7 +350,6 @@ class DotnetInstallScript { setupScriptBash() { return __awaiter(this, void 0, void 0, function* () { (0, fs_1.chmodSync)(this.escapedScript, '777'); - this.scriptArguments = []; this.scriptPath = yield io.which(this.escapedScript, true); }); } @@ -385,15 +384,11 @@ class DotnetInstallScript { exports.DotnetInstallScript = DotnetInstallScript; class DotnetInstallDir { static convertInstallPathToAbsolute(installDir) { - let transformedPath; - if (path_1.default.isAbsolute(installDir)) { - transformedPath = installDir; - } - else { - transformedPath = installDir.startsWith('~') - ? path_1.default.join(os_1.default.homedir(), installDir.slice(1)) - : (transformedPath = path_1.default.join(process.cwd(), installDir)); - } + if (path_1.default.isAbsolute(installDir)) + return path_1.default.normalize(installDir); + const transformedPath = installDir.startsWith('~') + ? path_1.default.join(os_1.default.homedir(), installDir.slice(1)) + : path_1.default.join(process.cwd(), installDir); return path_1.default.normalize(transformedPath); } static addToPath() { diff --git a/src/installer.ts b/src/installer.ts index e0df8ee..5147df9 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -154,9 +154,6 @@ export class DotnetInstallScript { private async setupScriptBash() { chmodSync(this.escapedScript, '777'); - - this.scriptArguments = []; - this.scriptPath = await io.which(this.escapedScript, true); } @@ -214,14 +211,12 @@ export abstract class DotnetInstallDir { : DotnetInstallDir.default[getPlatform()]; private static convertInstallPathToAbsolute(installDir: string): string { - let transformedPath; - if (path.isAbsolute(installDir)) { - transformedPath = installDir; - } else { - transformedPath = installDir.startsWith('~') - ? path.join(os.homedir(), installDir.slice(1)) - : (transformedPath = path.join(process.cwd(), installDir)); - } + if (path.isAbsolute(installDir)) return path.normalize(installDir); + + const transformedPath = installDir.startsWith('~') + ? path.join(os.homedir(), installDir.slice(1)) + : path.join(process.cwd(), installDir); + return path.normalize(transformedPath); } From b7461a1b69d41c449a803f79712ca7ba9d4c5c99 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Wed, 24 May 2023 16:41:16 +0200 Subject: [PATCH 08/19] Remove excessive whitespace --- src/installer.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/installer.ts b/src/installer.ts index 9f27b4e..264286b 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -142,8 +142,6 @@ export class DotnetInstallScript { : this.setupScriptBash(); } - - private async setupScriptPowershell() { this.scriptArguments = [ '-NoLogo', From 5c7ae4f903bf66132fcb45919c862b391773a04c Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Wed, 24 May 2023 16:59:05 +0200 Subject: [PATCH 09/19] Apply consistent naming --- __tests__/installer.test.ts | 16 ++++++++-------- src/installer.ts | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts index c9f815e..3403c20 100644 --- a/__tests__/installer.test.ts +++ b/__tests__/installer.test.ts @@ -298,7 +298,7 @@ describe('installer tests', () => { }); describe('DotnetVersionResolver tests', () => { - describe('createDotNetVersion() tests', () => { + describe('createDotnetVersion() tests', () => { each([ '3.1', '3.x', @@ -315,7 +315,7 @@ describe('installer tests', () => { version ); const versionObject = - await dotnetVersionResolver.createDotNetVersion(); + await dotnetVersionResolver.createDotnetVersion(); expect(!!versionObject.value).toBe(true); } @@ -354,7 +354,7 @@ describe('installer tests', () => { ); await expect( - async () => await dotnetVersionResolver.createDotNetVersion() + async () => await dotnetVersionResolver.createDotnetVersion() ).rejects.toThrow(); } ); @@ -366,7 +366,7 @@ describe('installer tests', () => { version ); const versionObject = - await dotnetVersionResolver.createDotNetVersion(); + await dotnetVersionResolver.createDotnetVersion(); expect(versionObject.type.toLowerCase().includes('channel')).toBe( true @@ -381,7 +381,7 @@ describe('installer tests', () => { version ); const versionObject = - await dotnetVersionResolver.createDotNetVersion(); + await dotnetVersionResolver.createDotnetVersion(); expect(versionObject.type.toLowerCase().includes('channel')).toBe( true @@ -397,7 +397,7 @@ describe('installer tests', () => { version ); const versionObject = - await dotnetVersionResolver.createDotNetVersion(); + await dotnetVersionResolver.createDotnetVersion(); expect(versionObject.type.toLowerCase().includes('version')).toBe( true @@ -413,7 +413,7 @@ describe('installer tests', () => { version ); const versionObject = - await dotnetVersionResolver.createDotNetVersion(); + await dotnetVersionResolver.createDotnetVersion(); const windowsRegEx = new RegExp(/^-(Version|Channel)/); const nonWindowsRegEx = new RegExp(/^--(version|channel)/); @@ -433,7 +433,7 @@ describe('installer tests', () => { version ); await expect( - async () => await dotnetVersionResolver.createDotNetVersion() + async () => await dotnetVersionResolver.createDotnetVersion() ).rejects.toThrow( `'dotnet-version' was supplied in invalid format: ${version}! The A.B.Cxx syntax is available since the .NET 5.0 release.` ); diff --git a/src/installer.ts b/src/installer.ts index 264286b..f44615c 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -81,7 +81,7 @@ export class DotnetVersionResolver { parseInt(major) >= QUALITY_INPUT_MINIMAL_MAJOR_TAG ? true : false; } - public async createDotNetVersion(): Promise { + public async createDotnetVersion(): Promise { await this.resolveVersionInput(); if (!this.resolvedArgument.type) { return this.resolvedArgument; @@ -102,7 +102,7 @@ export class DotnetVersionResolver { maxRetries: 3 }); const response = await httpClient.getJson( - DotnetVersionResolver.DotNetCoreIndexUrl + DotnetVersionResolver.DotnetCoreIndexUrl ); const result = response.result || {}; const releasesInfo: any[] = result['releases-index']; @@ -114,14 +114,14 @@ export class DotnetVersionResolver { if (!releaseInfo) { throw new Error( - `Could not find info for version with major tag: "${majorTag}" at ${DotnetVersionResolver.DotNetCoreIndexUrl}` + `Could not find info for version with major tag: "${majorTag}" at ${DotnetVersionResolver.DotnetCoreIndexUrl}` ); } return releaseInfo['channel-version']; } - static DotNetCoreIndexUrl = + static DotnetCoreIndexUrl = 'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json'; } @@ -256,7 +256,7 @@ export class DotnetCoreInstaller { public async installDotnet(): Promise { const versionResolver = new DotnetVersionResolver(this.version); - const dotnetVersion = await versionResolver.createDotNetVersion(); + const dotnetVersion = await versionResolver.createDotnetVersion(); const installScript = new DotnetInstallScript() .useArguments( From eb0b7f88520d26eb3ee371cf7ed19e76f0ccd770 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Wed, 24 May 2023 17:11:47 +0200 Subject: [PATCH 10/19] Update build --- dist/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/index.js b/dist/index.js index 85769f4..89f071d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -298,7 +298,7 @@ class DotnetVersionResolver { parseInt(major) >= QUALITY_INPUT_MINIMAL_MAJOR_TAG ? true : false; }); } - createDotNetVersion() { + createDotnetVersion() { return __awaiter(this, void 0, void 0, function* () { yield this.resolveVersionInput(); if (!this.resolvedArgument.type) { @@ -321,7 +321,7 @@ class DotnetVersionResolver { allowRetries: true, maxRetries: 3 }); - const response = yield httpClient.getJson(DotnetVersionResolver.DotNetCoreIndexUrl); + const response = yield httpClient.getJson(DotnetVersionResolver.DotnetCoreIndexUrl); const result = response.result || {}; const releasesInfo = result['releases-index']; const releaseInfo = releasesInfo.find(info => { @@ -329,14 +329,14 @@ class DotnetVersionResolver { return sdkParts[0] === majorTag; }); if (!releaseInfo) { - throw new Error(`Could not find info for version with major tag: "${majorTag}" at ${DotnetVersionResolver.DotNetCoreIndexUrl}`); + throw new Error(`Could not find info for version with major tag: "${majorTag}" at ${DotnetVersionResolver.DotnetCoreIndexUrl}`); } return releaseInfo['channel-version']; }); } } exports.DotnetVersionResolver = DotnetVersionResolver; -DotnetVersionResolver.DotNetCoreIndexUrl = 'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json'; +DotnetVersionResolver.DotnetCoreIndexUrl = 'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json'; class DotnetInstallScript { constructor() { this.scriptName = utils_1.IS_WINDOWS ? 'install-dotnet.ps1' : 'install-dotnet.sh'; @@ -441,7 +441,7 @@ class DotnetCoreInstaller { installDotnet() { return __awaiter(this, void 0, void 0, function* () { const versionResolver = new DotnetVersionResolver(this.version); - const dotnetVersion = yield versionResolver.createDotNetVersion(); + const dotnetVersion = yield versionResolver.createDotnetVersion(); const installScript = new DotnetInstallScript() .useArguments(utils_1.IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files') .useVersion(dotnetVersion, this.quality); From 80a318b8b833bfa38cf668919a9982f268a28f46 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Thu, 25 May 2023 13:11:13 +0200 Subject: [PATCH 11/19] Change PLATFORM to constant instead of function --- src/installer.ts | 4 ++-- src/utils.ts | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/installer.ts b/src/installer.ts index f44615c..a263afb 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -7,7 +7,7 @@ import {chmodSync} from 'fs'; import path from 'path'; import os from 'os'; import semver from 'semver'; -import {IS_WINDOWS, getPlatform} from './utils'; +import {IS_WINDOWS, PLATFORM} from './utils'; import {QualityOptions} from './setup-dotnet'; export interface DotnetVersion { @@ -223,7 +223,7 @@ export abstract class DotnetInstallDir { ? DotnetInstallDir.convertInstallPathToAbsolute( process.env['DOTNET_INSTALL_DIR'] ) - : DotnetInstallDir.default[getPlatform()]; + : DotnetInstallDir.default[PLATFORM]; private static convertInstallPathToAbsolute(installDir: string): string { if (path.isAbsolute(installDir)) return path.normalize(installDir); diff --git a/src/utils.ts b/src/utils.ts index d671d70..1871168 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,7 +1,6 @@ export const IS_WINDOWS = process.platform === 'win32'; -export const IS_LINUX = process.platform === 'linux'; -export const getPlatform = (): 'windows' | 'linux' | 'mac' => { - if (IS_WINDOWS) return 'windows'; - if (IS_LINUX) return 'linux'; +export const PLATFORM = ((): 'windows' | 'linux' | 'mac' => { + if (process.platform === 'win32') return 'windows'; + if (process.platform === 'linux') return 'linux'; return 'mac'; -}; +})(); From 2785e21d5ee45fe0c8c23ca1e3c797f0faee9502 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Thu, 25 May 2023 13:27:30 +0200 Subject: [PATCH 12/19] Update build --- dist/index.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index 89f071d..d582a21 100644 --- a/dist/index.js +++ b/dist/index.js @@ -432,7 +432,7 @@ DotnetInstallDir.default = { }; DotnetInstallDir.path = process.env['DOTNET_INSTALL_DIR'] ? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR']) - : DotnetInstallDir.default[(0, utils_1.getPlatform)()]; + : DotnetInstallDir.default[utils_1.PLATFORM]; class DotnetCoreInstaller { constructor(version, quality) { this.version = version; @@ -633,17 +633,15 @@ run(); "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getPlatform = exports.IS_LINUX = exports.IS_WINDOWS = void 0; +exports.PLATFORM = exports.IS_WINDOWS = void 0; exports.IS_WINDOWS = process.platform === 'win32'; -exports.IS_LINUX = process.platform === 'linux'; -const getPlatform = () => { - if (exports.IS_WINDOWS) +exports.PLATFORM = (() => { + if (process.platform === 'win32') return 'windows'; - if (exports.IS_LINUX) + if (process.platform === 'linux') return 'linux'; return 'mac'; -}; -exports.getPlatform = getPlatform; +})(); /***/ }), From 916aec40c9bb1c77c92f529c6c9a588a1d195775 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Tue, 30 May 2023 12:14:34 +0200 Subject: [PATCH 13/19] Rename DotnetInstallDir.path to DotnetInstallDir.dirPath --- src/installer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/installer.ts b/src/installer.ts index a263afb..a841084 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -219,7 +219,7 @@ export abstract class DotnetInstallDir { windows: path.join(process.env['PROGRAMFILES'] + '', 'dotnet') }; - public static readonly path = process.env['DOTNET_INSTALL_DIR'] + public static readonly dirPath = process.env['DOTNET_INSTALL_DIR'] ? DotnetInstallDir.convertInstallPathToAbsolute( process.env['DOTNET_INSTALL_DIR'] ) @@ -241,7 +241,7 @@ export abstract class DotnetInstallDir { } public static initialize() { - process.env['DOTNET_INSTALL_DIR'] = DotnetInstallDir.path; + process.env['DOTNET_INSTALL_DIR'] = DotnetInstallDir.dirPath; } } From defac2491fa247e2e3580544d0fcc7c89eecc05e Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Tue, 30 May 2023 12:18:10 +0200 Subject: [PATCH 14/19] Rename initialize to setEnvironmentVariable --- dist/index.js | 8 ++++---- src/installer.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index d582a21..c981d8b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -420,8 +420,8 @@ class DotnetInstallDir { core.addPath(process.env['DOTNET_INSTALL_DIR']); core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']); } - static initialize() { - process.env['DOTNET_INSTALL_DIR'] = DotnetInstallDir.path; + static setEnvironmentVariable() { + process.env['DOTNET_INSTALL_DIR'] = DotnetInstallDir.dirPath; } } exports.DotnetInstallDir = DotnetInstallDir; @@ -430,7 +430,7 @@ DotnetInstallDir.default = { mac: path_1.default.join(process.env['HOME'] + '', '.dotnet'), windows: path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet') }; -DotnetInstallDir.path = process.env['DOTNET_INSTALL_DIR'] +DotnetInstallDir.dirPath = process.env['DOTNET_INSTALL_DIR'] ? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR']) : DotnetInstallDir.default[utils_1.PLATFORM]; class DotnetCoreInstaller { @@ -465,7 +465,7 @@ class DotnetCoreInstaller { exports.DotnetCoreInstaller = DotnetCoreInstaller; DotnetCoreInstaller.addToPath = DotnetInstallDir.addToPath; (() => { - DotnetInstallDir.initialize(); + DotnetInstallDir.setEnvironmentVariable(); })(); diff --git a/src/installer.ts b/src/installer.ts index a841084..894d714 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -240,7 +240,7 @@ export abstract class DotnetInstallDir { core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']); } - public static initialize() { + public static setEnvironmentVariable() { process.env['DOTNET_INSTALL_DIR'] = DotnetInstallDir.dirPath; } } @@ -249,7 +249,7 @@ export class DotnetCoreInstaller { static addToPath = DotnetInstallDir.addToPath; static { - DotnetInstallDir.initialize(); + DotnetInstallDir.setEnvironmentVariable(); } constructor(private version: string, private quality: QualityOptions) {} From 89b480a0dff4b7dafb809459daa522455d2c0291 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Tue, 30 May 2023 12:19:28 +0200 Subject: [PATCH 15/19] Call addToPath method on DotnetInstallDir directly --- dist/index.js | 3 +-- src/installer.ts | 2 -- src/setup-dotnet.ts | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index c981d8b..0e88015 100644 --- a/dist/index.js +++ b/dist/index.js @@ -463,7 +463,6 @@ class DotnetCoreInstaller { } } exports.DotnetCoreInstaller = DotnetCoreInstaller; -DotnetCoreInstaller.addToPath = DotnetInstallDir.addToPath; (() => { DotnetInstallDir.setEnvironmentVariable(); })(); @@ -571,7 +570,7 @@ function run() { const installedVersion = yield dotnetInstaller.installDotnet(); installedDotnetVersions.push(installedVersion); } - installer_1.DotnetCoreInstaller.addToPath(); + installer_1.DotnetInstallDir.addToPath(); } const sourceUrl = core.getInput('source-url'); const configFile = core.getInput('config-file'); diff --git a/src/installer.ts b/src/installer.ts index 894d714..ec46528 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -246,8 +246,6 @@ export abstract class DotnetInstallDir { } export class DotnetCoreInstaller { - static addToPath = DotnetInstallDir.addToPath; - static { DotnetInstallDir.setEnvironmentVariable(); } diff --git a/src/setup-dotnet.ts b/src/setup-dotnet.ts index 58de8ef..ec1618b 100644 --- a/src/setup-dotnet.ts +++ b/src/setup-dotnet.ts @@ -1,5 +1,5 @@ import * as core from '@actions/core'; -import {DotnetCoreInstaller} from './installer'; +import {DotnetCoreInstaller, DotnetInstallDir} from './installer'; import * as fs from 'fs'; import path from 'path'; import semver from 'semver'; @@ -69,7 +69,7 @@ export async function run() { const installedVersion = await dotnetInstaller.installDotnet(); installedDotnetVersions.push(installedVersion); } - DotnetCoreInstaller.addToPath(); + DotnetInstallDir.addToPath(); } const sourceUrl: string = core.getInput('source-url'); From 427804d76a764eb9413a2916a9c786ab1fd0a9f1 Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Tue, 30 May 2023 12:45:38 +0200 Subject: [PATCH 16/19] Update tests --- __tests__/installer.test.ts | 4 ++-- __tests__/setup-dotnet.test.ts | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts index 3403c20..3db3547 100644 --- a/__tests__/installer.test.ts +++ b/__tests__/installer.test.ts @@ -283,14 +283,14 @@ describe('installer tests', () => { describe('addToPath() tests', () => { it(`should export DOTNET_ROOT env.var with value from DOTNET_INSTALL_DIR env.var`, async () => { process.env['DOTNET_INSTALL_DIR'] = 'fictitious/dotnet/install/dir'; - installer.DotnetCoreInstaller.addToPath(); + installer.DotnetInstallDir.addToPath(); const dotnet_root = process.env['DOTNET_ROOT']; expect(dotnet_root).toBe(process.env['DOTNET_INSTALL_DIR']); }); it(`should export value from DOTNET_INSTALL_DIR env.var to the PATH`, async () => { process.env['DOTNET_INSTALL_DIR'] = 'fictitious/dotnet/install/dir'; - installer.DotnetCoreInstaller.addToPath(); + installer.DotnetInstallDir.addToPath(); const path = process.env['PATH']; expect(path).toContain(process.env['DOTNET_INSTALL_DIR']); }); diff --git a/__tests__/setup-dotnet.test.ts b/__tests__/setup-dotnet.test.ts index 2a32d63..fcc458f 100644 --- a/__tests__/setup-dotnet.test.ts +++ b/__tests__/setup-dotnet.test.ts @@ -4,7 +4,7 @@ import semver from 'semver'; import * as auth from '../src/authutil'; import * as setup from '../src/setup-dotnet'; -import {DotnetCoreInstaller} from '../src/installer'; +import {DotnetCoreInstaller, DotnetInstallDir} from '../src/installer'; describe('setup-dotnet tests', () => { const inputs = {} as any; @@ -25,17 +25,19 @@ describe('setup-dotnet tests', () => { DotnetCoreInstaller.prototype, 'installDotnet' ); - const addToPathSpy = jest.spyOn(DotnetCoreInstaller, 'addToPath'); const configAuthenticationSpy = jest.spyOn(auth, 'configAuthentication'); + const addToPathOriginal = DotnetInstallDir.addToPath; describe('run() tests', () => { beforeEach(() => { + DotnetInstallDir.addToPath = jest.fn(); getMultilineInputSpy.mockImplementation(input => inputs[input as string]); getInputSpy.mockImplementation(input => inputs[input as string]); }); afterEach(() => { + DotnetInstallDir.addToPath = addToPathOriginal; jest.clearAllMocks(); jest.resetAllMocks(); }); @@ -96,10 +98,9 @@ describe('setup-dotnet tests', () => { inputs['dotnet-quality'] = ''; installDotnetSpy.mockImplementation(() => Promise.resolve('')); - addToPathSpy.mockImplementation(() => {}); await setup.run(); - expect(addToPathSpy).toHaveBeenCalledTimes(1); + expect(DotnetInstallDir.addToPath).toHaveBeenCalledTimes(1); }); it('should call auth.configAuthentication() if source-url input is provided', async () => { @@ -140,10 +141,9 @@ describe('setup-dotnet tests', () => { installDotnetSpy.mockImplementation(() => Promise.resolve(`${inputs['dotnet-version']}`) ); - addToPathSpy.mockImplementation(() => {}); await setup.run(); - expect(setOutputSpy).toHaveBeenCalledTimes(1); + expect(DotnetInstallDir.addToPath).toHaveBeenCalledTimes(1); }); it(`shouldn't call setOutput() if parsing dotnet-installer logs failed`, async () => { @@ -151,7 +151,6 @@ describe('setup-dotnet tests', () => { const warningMessage = `Failed to output the installed version of .NET. The 'dotnet-version' output will not be set.`; installDotnetSpy.mockImplementation(() => Promise.resolve(null)); - addToPathSpy.mockImplementation(() => {}); await setup.run(); expect(warningSpy).toHaveBeenCalledWith(warningMessage); @@ -162,8 +161,6 @@ describe('setup-dotnet tests', () => { inputs['dotnet-version'] = []; const warningMessage = `The 'dotnet-version' output will not be set.`; - addToPathSpy.mockImplementation(() => {}); - await setup.run(); expect(infoSpy).toHaveBeenCalledWith(warningMessage); From 820f30d332fd8d7f12f16446beea1cdbc1edbafa Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Tue, 30 May 2023 12:54:41 +0200 Subject: [PATCH 17/19] Make assigning of the script path intuitive --- dist/index.js | 23 ++++++++++++++--------- src/installer.ts | 27 +++++++++++++++------------ 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/dist/index.js b/dist/index.js index 0e88015..312c5a7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -341,13 +341,14 @@ class DotnetInstallScript { constructor() { this.scriptName = utils_1.IS_WINDOWS ? 'install-dotnet.ps1' : 'install-dotnet.sh'; this.scriptArguments = []; - this.scriptPath = ''; this.escapedScript = path_1.default .join(__dirname, '..', 'externals', this.scriptName) .replace(/'/g, "''"); - this.scriptReady = utils_1.IS_WINDOWS - ? this.setupScriptPowershell() - : this.setupScriptBash(); + if (utils_1.IS_WINDOWS) { + this.setupScriptPowershell(); + return; + } + this.setupScriptBash(); } setupScriptPowershell() { return __awaiter(this, void 0, void 0, function* () { @@ -368,14 +369,19 @@ class DotnetInstallScript { if (process.env['no_proxy'] != null) { this.scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`); } - this.scriptPath = - (yield io.which('pwsh', false)) || (yield io.which('powershell', true)); }); } setupScriptBash() { return __awaiter(this, void 0, void 0, function* () { (0, fs_1.chmodSync)(this.escapedScript, '777'); - this.scriptPath = yield io.which(this.escapedScript, true); + }); + } + getScriptPath() { + return __awaiter(this, void 0, void 0, function* () { + if (utils_1.IS_WINDOWS) { + return (yield io.which('pwsh', false)) || io.which('powershell', true); + } + return io.which(this.escapedScript, true); }); } useArguments(...args) { @@ -401,8 +407,7 @@ class DotnetInstallScript { ignoreReturnCode: true, env: process.env }; - yield this.scriptReady; - return exec.getExecOutput(`"${this.scriptPath}"`, this.scriptArguments, getExecOutputOptions); + return exec.getExecOutput(`"${yield this.getScriptPath()}"`, this.scriptArguments, getExecOutputOptions); }); } } diff --git a/src/installer.ts b/src/installer.ts index ec46528..7aaffcb 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -129,17 +129,18 @@ export class DotnetInstallScript { private scriptName = IS_WINDOWS ? 'install-dotnet.ps1' : 'install-dotnet.sh'; private escapedScript: string; private scriptArguments: string[] = []; - private scriptPath = ''; - private scriptReady: Promise; constructor() { this.escapedScript = path .join(__dirname, '..', 'externals', this.scriptName) .replace(/'/g, "''"); - this.scriptReady = IS_WINDOWS - ? this.setupScriptPowershell() - : this.setupScriptBash(); + if (IS_WINDOWS) { + this.setupScriptPowershell(); + return; + } + + this.setupScriptBash(); } private async setupScriptPowershell() { @@ -162,14 +163,18 @@ export class DotnetInstallScript { if (process.env['no_proxy'] != null) { this.scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`); } - - this.scriptPath = - (await io.which('pwsh', false)) || (await io.which('powershell', true)); } private async setupScriptBash() { chmodSync(this.escapedScript, '777'); - this.scriptPath = await io.which(this.escapedScript, true); + } + + private async getScriptPath() { + if (IS_WINDOWS) { + return (await io.which('pwsh', false)) || io.which('powershell', true); + } + + return io.which(this.escapedScript, true); } public useArguments(...args: string[]) { @@ -202,10 +207,8 @@ export class DotnetInstallScript { env: process.env as {string: string} }; - await this.scriptReady; - return exec.getExecOutput( - `"${this.scriptPath}"`, + `"${await this.getScriptPath()}"`, this.scriptArguments, getExecOutputOptions ); From addb470701d7fb206f016fbc838bd5efadda652e Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Tue, 30 May 2023 13:19:37 +0200 Subject: [PATCH 18/19] Make setup script functions synchronous --- dist/index.js | 40 ++++++++++++++++++---------------------- src/installer.ts | 4 ++-- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/dist/index.js b/dist/index.js index 312c5a7..f46041e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -351,30 +351,26 @@ class DotnetInstallScript { this.setupScriptBash(); } setupScriptPowershell() { - return __awaiter(this, void 0, void 0, function* () { - this.scriptArguments = [ - '-NoLogo', - '-Sta', - '-NoProfile', - '-NonInteractive', - '-ExecutionPolicy', - 'Unrestricted', - '-Command' - ]; - this.scriptArguments.push('&', `'${this.escapedScript}'`); - if (process.env['https_proxy'] != null) { - this.scriptArguments.push(`-ProxyAddress ${process.env['https_proxy']}`); - } - // This is not currently an option - if (process.env['no_proxy'] != null) { - this.scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`); - } - }); + this.scriptArguments = [ + '-NoLogo', + '-Sta', + '-NoProfile', + '-NonInteractive', + '-ExecutionPolicy', + 'Unrestricted', + '-Command' + ]; + this.scriptArguments.push('&', `'${this.escapedScript}'`); + if (process.env['https_proxy'] != null) { + this.scriptArguments.push(`-ProxyAddress ${process.env['https_proxy']}`); + } + // This is not currently an option + if (process.env['no_proxy'] != null) { + this.scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`); + } } setupScriptBash() { - return __awaiter(this, void 0, void 0, function* () { - (0, fs_1.chmodSync)(this.escapedScript, '777'); - }); + (0, fs_1.chmodSync)(this.escapedScript, '777'); } getScriptPath() { return __awaiter(this, void 0, void 0, function* () { diff --git a/src/installer.ts b/src/installer.ts index 7aaffcb..34ceb0c 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -143,7 +143,7 @@ export class DotnetInstallScript { this.setupScriptBash(); } - private async setupScriptPowershell() { + private setupScriptPowershell() { this.scriptArguments = [ '-NoLogo', '-Sta', @@ -165,7 +165,7 @@ export class DotnetInstallScript { } } - private async setupScriptBash() { + private setupScriptBash() { chmodSync(this.escapedScript, '777'); } From 3cdb09485a6a66eaa2550b89614b7b25479c461e Mon Sep 17 00:00:00 2001 From: Nikolai Laevskii Date: Wed, 31 May 2023 11:19:26 +0200 Subject: [PATCH 19/19] Build --- dist/cache-save/index.js | 426 +++++++++++++++++++-------------------- dist/setup/index.js | 218 ++++++++++---------- 2 files changed, 328 insertions(+), 316 deletions(-) diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index 6f80242..060c4ed 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -58476,91 +58476,91 @@ exports["default"] = _default; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.run = void 0; -const core = __importStar(__nccwpck_require__(2186)); -const cache = __importStar(__nccwpck_require__(7799)); -const node_fs_1 = __importDefault(__nccwpck_require__(7561)); -const cache_utils_1 = __nccwpck_require__(1678); -const constants_1 = __nccwpck_require__(9042); -// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in -// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to -// throw an uncaught exception. Instead of failing this action, just warn. -process.on('uncaughtException', e => { - const warningPrefix = '[warning]'; - core.info(`${warningPrefix}${e.message}`); -}); -function run() { - return __awaiter(this, void 0, void 0, function* () { - try { - if (core.getBooleanInput('cache')) { - yield cachePackages(); - } - } - catch (error) { - core.setFailed(error.message); - } - }); -} -exports.run = run; -const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () { - const state = core.getState(constants_1.State.CacheMatchedKey); - const primaryKey = core.getState(constants_1.State.CachePrimaryKey); - if (!primaryKey) { - core.info('Primary key was not generated, not saving cache.'); - return; - } - const { 'global-packages': cachePath } = yield (0, cache_utils_1.getNuGetFolderPath)(); - if (!node_fs_1.default.existsSync(cachePath)) { - throw new Error(`Cache folder path is retrieved for .NET CLI but doesn't exist on disk: ${cachePath}`); - } - if (primaryKey === state) { - core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); - return; - } - const cacheId = yield cache.saveCache([cachePath], primaryKey); - if (cacheId == -1) { - return; - } - core.info(`Cache saved with the key: ${primaryKey}`); -}); -run(); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.run = void 0; +const core = __importStar(__nccwpck_require__(2186)); +const cache = __importStar(__nccwpck_require__(7799)); +const node_fs_1 = __importDefault(__nccwpck_require__(7561)); +const cache_utils_1 = __nccwpck_require__(1678); +const constants_1 = __nccwpck_require__(9042); +// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in +// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to +// throw an uncaught exception. Instead of failing this action, just warn. +process.on('uncaughtException', e => { + const warningPrefix = '[warning]'; + core.info(`${warningPrefix}${e.message}`); +}); +function run() { + return __awaiter(this, void 0, void 0, function* () { + try { + if (core.getBooleanInput('cache')) { + yield cachePackages(); + } + } + catch (error) { + core.setFailed(error.message); + } + }); +} +exports.run = run; +const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () { + const state = core.getState(constants_1.State.CacheMatchedKey); + const primaryKey = core.getState(constants_1.State.CachePrimaryKey); + if (!primaryKey) { + core.info('Primary key was not generated, not saving cache.'); + return; + } + const { 'global-packages': cachePath } = yield (0, cache_utils_1.getNuGetFolderPath)(); + if (!node_fs_1.default.existsSync(cachePath)) { + throw new Error(`Cache folder path is retrieved for .NET CLI but doesn't exist on disk: ${cachePath}`); + } + if (primaryKey === state) { + core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); + return; + } + const cacheId = yield cache.saveCache([cachePath], primaryKey); + if (cacheId == -1) { + return; + } + core.info(`Cache saved with the key: ${primaryKey}`); +}); +run(); /***/ }), @@ -58569,114 +58569,114 @@ run(); /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isCacheFeatureAvailable = exports.getNuGetFolderPath = void 0; -const cache = __importStar(__nccwpck_require__(7799)); -const core = __importStar(__nccwpck_require__(2186)); -const exec = __importStar(__nccwpck_require__(1514)); -const constants_1 = __nccwpck_require__(9042); -/** - * Get NuGet global packages, cache, and temp folders from .NET CLI. - * @returns (Folder Name)-(Path) mappings - * @see https://docs.microsoft.com/nuget/consume-packages/managing-the-global-packages-and-cache-folders - * @example - * Windows - * ```json - * { - * "http-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\v3-cache", - * "global-packages": "C:\\Users\\user1\\.nuget\\packages\\", - * "temp": "C:\\Users\\user1\\AppData\\Local\\Temp\\NuGetScratch", - * "plugins-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\plugins-cache" - * } - * ``` - * - * Mac/Linux - * ```json - * { - * "http-cache": "/home/user1/.local/share/NuGet/v3-cache", - * "global-packages": "/home/user1/.nuget/packages/", - * "temp": "/tmp/NuGetScratch", - * "plugins-cache": "/home/user1/.local/share/NuGet/plugins-cache" - * } - * ``` - */ -const getNuGetFolderPath = () => __awaiter(void 0, void 0, void 0, function* () { - const { stdout, stderr, exitCode } = yield exec.getExecOutput(constants_1.cliCommand, undefined, { ignoreReturnCode: true, silent: true }); - if (exitCode) { - throw new Error(!stderr.trim() - ? `The '${constants_1.cliCommand}' command failed with exit code: ${exitCode}` - : stderr); - } - const result = { - 'http-cache': '', - 'global-packages': '', - temp: '', - 'plugins-cache': '' - }; - const regex = /(?:^|\s)(?[a-z-]+): (?.+[/\\].+)$/gm; - let match; - while ((match = regex.exec(stdout)) !== null) { - const key = match.groups.key; - if (key in result) { - result[key] = match.groups.path; - } - } - return result; -}); -exports.getNuGetFolderPath = getNuGetFolderPath; -function isCacheFeatureAvailable() { - if (cache.isFeatureAvailable()) { - return true; - } - if (isGhes()) { - core.warning('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'); - return false; - } - core.warning('The runner was not able to contact the cache service. Caching will be skipped'); - return false; -} -exports.isCacheFeatureAvailable = isCacheFeatureAvailable; -/** - * Returns this action runs on GitHub Enterprise Server or not. - * (port from https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/cache/src/internal/cacheUtils.ts#L134) - */ -function isGhes() { - const url = process.env['GITHUB_SERVER_URL'] || 'https://github.com'; - return new URL(url).hostname.toUpperCase() !== 'GITHUB.COM'; -} + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isCacheFeatureAvailable = exports.getNuGetFolderPath = void 0; +const cache = __importStar(__nccwpck_require__(7799)); +const core = __importStar(__nccwpck_require__(2186)); +const exec = __importStar(__nccwpck_require__(1514)); +const constants_1 = __nccwpck_require__(9042); +/** + * Get NuGet global packages, cache, and temp folders from .NET CLI. + * @returns (Folder Name)-(Path) mappings + * @see https://docs.microsoft.com/nuget/consume-packages/managing-the-global-packages-and-cache-folders + * @example + * Windows + * ```json + * { + * "http-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\v3-cache", + * "global-packages": "C:\\Users\\user1\\.nuget\\packages\\", + * "temp": "C:\\Users\\user1\\AppData\\Local\\Temp\\NuGetScratch", + * "plugins-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\plugins-cache" + * } + * ``` + * + * Mac/Linux + * ```json + * { + * "http-cache": "/home/user1/.local/share/NuGet/v3-cache", + * "global-packages": "/home/user1/.nuget/packages/", + * "temp": "/tmp/NuGetScratch", + * "plugins-cache": "/home/user1/.local/share/NuGet/plugins-cache" + * } + * ``` + */ +const getNuGetFolderPath = () => __awaiter(void 0, void 0, void 0, function* () { + const { stdout, stderr, exitCode } = yield exec.getExecOutput(constants_1.cliCommand, undefined, { ignoreReturnCode: true, silent: true }); + if (exitCode) { + throw new Error(!stderr.trim() + ? `The '${constants_1.cliCommand}' command failed with exit code: ${exitCode}` + : stderr); + } + const result = { + 'http-cache': '', + 'global-packages': '', + temp: '', + 'plugins-cache': '' + }; + const regex = /(?:^|\s)(?[a-z-]+): (?.+[/\\].+)$/gm; + let match; + while ((match = regex.exec(stdout)) !== null) { + const key = match.groups.key; + if (key in result) { + result[key] = match.groups.path; + } + } + return result; +}); +exports.getNuGetFolderPath = getNuGetFolderPath; +function isCacheFeatureAvailable() { + if (cache.isFeatureAvailable()) { + return true; + } + if (isGhes()) { + core.warning('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'); + return false; + } + core.warning('The runner was not able to contact the cache service. Caching will be skipped'); + return false; +} +exports.isCacheFeatureAvailable = isCacheFeatureAvailable; +/** + * Returns this action runs on GitHub Enterprise Server or not. + * (port from https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/cache/src/internal/cacheUtils.ts#L134) + */ +function isGhes() { + const url = process.env['GITHUB_SERVER_URL'] || 'https://github.com'; + return new URL(url).hostname.toUpperCase() !== 'GITHUB.COM'; +} /***/ }), @@ -58685,26 +58685,26 @@ function isGhes() { /***/ ((__unused_webpack_module, exports) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Outputs = exports.State = exports.cliCommand = exports.lockFilePatterns = void 0; -/** NuGet lock file patterns */ -exports.lockFilePatterns = ['packages.lock.json']; -/** - * .NET CLI command to list local NuGet resources. - * @see https://docs.microsoft.com/dotnet/core/tools/dotnet-nuget-locals - */ -exports.cliCommand = 'dotnet nuget locals all --list --force-english-output'; -var State; -(function (State) { - State["CachePrimaryKey"] = "CACHE_KEY"; - State["CacheMatchedKey"] = "CACHE_RESULT"; -})(State = exports.State || (exports.State = {})); -var Outputs; -(function (Outputs) { - Outputs["CacheHit"] = "cache-hit"; - Outputs["DotnetVersion"] = "dotnet-version"; -})(Outputs = exports.Outputs || (exports.Outputs = {})); + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Outputs = exports.State = exports.cliCommand = exports.lockFilePatterns = void 0; +/** NuGet lock file patterns */ +exports.lockFilePatterns = ['packages.lock.json']; +/** + * .NET CLI command to list local NuGet resources. + * @see https://docs.microsoft.com/dotnet/core/tools/dotnet-nuget-locals + */ +exports.cliCommand = 'dotnet nuget locals all --list --force-english-output'; +var State; +(function (State) { + State["CachePrimaryKey"] = "CACHE_KEY"; + State["CacheMatchedKey"] = "CACHE_RESULT"; +})(State = exports.State || (exports.State = {})); +var Outputs; +(function (Outputs) { + Outputs["CacheHit"] = "cache-hit"; + Outputs["DotnetVersion"] = "dotnet-version"; +})(Outputs = exports.Outputs || (exports.Outputs = {})); /***/ }), diff --git a/dist/setup/index.js b/dist/setup/index.js index 9ce7961..0fed9c1 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -71171,9 +71171,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; -var _a; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.DotnetCoreInstaller = exports.DotnetVersionResolver = void 0; +exports.DotnetCoreInstaller = exports.DotnetInstallDir = exports.DotnetInstallScript = exports.DotnetVersionResolver = void 0; // Load tempDirectory before it gets wiped by tool-cache const core = __importStar(__nccwpck_require__(2186)); const exec = __importStar(__nccwpck_require__(1514)); @@ -71208,8 +71207,8 @@ class DotnetVersionResolver { return /^\d+$/.test(versionTag); } isLatestPatchSyntax() { - var _b, _c; - const majorTag = (_c = (_b = this.inputVersion.match(/^(?\d+)\.\d+\.\d{1}x{2}$/)) === null || _b === void 0 ? void 0 : _b.groups) === null || _c === void 0 ? void 0 : _c.majorTag; + var _a, _b; + const majorTag = (_b = (_a = this.inputVersion.match(/^(?\d+)\.\d+\.\d{1}x{2}$/)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.majorTag; if (majorTag && parseInt(majorTag) < LATEST_PATCH_SYNTAX_MINIMAL_MAJOR_TAG) { throw new Error(`The 'dotnet-version' was supplied in invalid format: ${this.inputVersion}! The A.B.Cxx syntax is available since the .NET 5.0 release.`); @@ -71241,7 +71240,7 @@ class DotnetVersionResolver { parseInt(major) >= QUALITY_INPUT_MINIMAL_MAJOR_TAG ? true : false; }); } - createDotNetVersion() { + createDotnetVersion() { return __awaiter(this, void 0, void 0, function* () { yield this.resolveVersionInput(); if (!this.resolvedArgument.type) { @@ -71264,7 +71263,7 @@ class DotnetVersionResolver { allowRetries: true, maxRetries: 3 }); - const response = yield httpClient.getJson(DotnetVersionResolver.DotNetCoreIndexUrl); + const response = yield httpClient.getJson(DotnetVersionResolver.DotnetCoreIndexUrl); const result = response.result || {}; const releasesInfo = result['releases-index']; const releaseInfo = releasesInfo.find(info => { @@ -71272,99 +71271,124 @@ class DotnetVersionResolver { return sdkParts[0] === majorTag; }); if (!releaseInfo) { - throw new Error(`Could not find info for version with major tag: "${majorTag}" at ${DotnetVersionResolver.DotNetCoreIndexUrl}`); + throw new Error(`Could not find info for version with major tag: "${majorTag}" at ${DotnetVersionResolver.DotnetCoreIndexUrl}`); } return releaseInfo['channel-version']; }); } } exports.DotnetVersionResolver = DotnetVersionResolver; -DotnetVersionResolver.DotNetCoreIndexUrl = 'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json'; -class DotnetCoreInstaller { - constructor(version, quality) { - this.version = version; - this.quality = quality; +DotnetVersionResolver.DotnetCoreIndexUrl = 'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json'; +class DotnetInstallScript { + constructor() { + this.scriptName = utils_1.IS_WINDOWS ? 'install-dotnet.ps1' : 'install-dotnet.sh'; + this.scriptArguments = []; + this.escapedScript = path_1.default + .join(__dirname, '..', '..', 'externals', this.scriptName) + .replace(/'/g, "''"); + if (utils_1.IS_WINDOWS) { + this.setupScriptPowershell(); + return; + } + this.setupScriptBash(); } + setupScriptPowershell() { + this.scriptArguments = [ + '-NoLogo', + '-Sta', + '-NoProfile', + '-NonInteractive', + '-ExecutionPolicy', + 'Unrestricted', + '-Command' + ]; + this.scriptArguments.push('&', `'${this.escapedScript}'`); + if (process.env['https_proxy'] != null) { + this.scriptArguments.push(`-ProxyAddress ${process.env['https_proxy']}`); + } + // This is not currently an option + if (process.env['no_proxy'] != null) { + this.scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`); + } + } + setupScriptBash() { + (0, fs_1.chmodSync)(this.escapedScript, '777'); + } + getScriptPath() { + return __awaiter(this, void 0, void 0, function* () { + if (utils_1.IS_WINDOWS) { + return (yield io.which('pwsh', false)) || io.which('powershell', true); + } + return io.which(this.escapedScript, true); + }); + } + useArguments(...args) { + this.scriptArguments.push(...args); + return this; + } + useVersion(dotnetVersion, quality) { + if (dotnetVersion.type) { + this.useArguments(dotnetVersion.type, dotnetVersion.value); + } + if (quality && !dotnetVersion.qualityFlag) { + core.warning(`The 'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A, A.x and A.B.Cxx formats where the major tag is higher than 5. You specified: ${dotnetVersion.value}. 'dotnet-quality' input is ignored.`); + return this; + } + if (quality) { + this.useArguments(utils_1.IS_WINDOWS ? '-Quality' : '--quality', quality); + } + return this; + } + execute() { + return __awaiter(this, void 0, void 0, function* () { + const getExecOutputOptions = { + ignoreReturnCode: true, + env: process.env + }; + return exec.getExecOutput(`"${yield this.getScriptPath()}"`, this.scriptArguments, getExecOutputOptions); + }); + } +} +exports.DotnetInstallScript = DotnetInstallScript; +class DotnetInstallDir { static convertInstallPathToAbsolute(installDir) { - let transformedPath; - if (path_1.default.isAbsolute(installDir)) { - transformedPath = installDir; - } - else { - transformedPath = installDir.startsWith('~') - ? path_1.default.join(os_1.default.homedir(), installDir.slice(1)) - : (transformedPath = path_1.default.join(process.cwd(), installDir)); - } + if (path_1.default.isAbsolute(installDir)) + return path_1.default.normalize(installDir); + const transformedPath = installDir.startsWith('~') + ? path_1.default.join(os_1.default.homedir(), installDir.slice(1)) + : path_1.default.join(process.cwd(), installDir); return path_1.default.normalize(transformedPath); } static addToPath() { core.addPath(process.env['DOTNET_INSTALL_DIR']); core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']); } - setQuality(dotnetVersion, scriptArguments) { - const option = utils_1.IS_WINDOWS ? '-Quality' : '--quality'; - if (dotnetVersion.qualityFlag) { - scriptArguments.push(option, this.quality); - } - else { - core.warning(`The 'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A, A.x and A.B.Cxx formats where the major tag is higher than 5. You specified: ${this.version}. 'dotnet-quality' input is ignored.`); - } + static setEnvironmentVariable() { + process.env['DOTNET_INSTALL_DIR'] = DotnetInstallDir.dirPath; + } +} +exports.DotnetInstallDir = DotnetInstallDir; +DotnetInstallDir.default = { + linux: '/usr/share/dotnet', + mac: path_1.default.join(process.env['HOME'] + '', '.dotnet'), + windows: path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet') +}; +DotnetInstallDir.dirPath = process.env['DOTNET_INSTALL_DIR'] + ? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR']) + : DotnetInstallDir.default[utils_1.PLATFORM]; +class DotnetCoreInstaller { + constructor(version, quality) { + this.version = version; + this.quality = quality; } installDotnet() { return __awaiter(this, void 0, void 0, function* () { - const windowsDefaultOptions = [ - '-NoLogo', - '-Sta', - '-NoProfile', - '-NonInteractive', - '-ExecutionPolicy', - 'Unrestricted', - '-Command' - ]; - const scriptName = utils_1.IS_WINDOWS ? 'install-dotnet.ps1' : 'install-dotnet.sh'; - const escapedScript = path_1.default - .join(__dirname, '..', '..', 'externals', scriptName) - .replace(/'/g, "''"); - let scriptArguments; - let scriptPath = ''; const versionResolver = new DotnetVersionResolver(this.version); - const dotnetVersion = yield versionResolver.createDotNetVersion(); - if (utils_1.IS_WINDOWS) { - scriptArguments = ['&', `'${escapedScript}'`]; - if (dotnetVersion.type) { - scriptArguments.push(dotnetVersion.type, dotnetVersion.value); - } - if (this.quality) { - this.setQuality(dotnetVersion, scriptArguments); - } - if (process.env['https_proxy'] != null) { - scriptArguments.push(`-ProxyAddress ${process.env['https_proxy']}`); - } - // This is not currently an option - if (process.env['no_proxy'] != null) { - scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`); - } - scriptPath = - (yield io.which('pwsh', false)) || (yield io.which('powershell', true)); - scriptArguments = windowsDefaultOptions.concat(scriptArguments); - } - else { - (0, fs_1.chmodSync)(escapedScript, '777'); - scriptPath = yield io.which(escapedScript, true); - scriptArguments = []; - if (dotnetVersion.type) { - scriptArguments.push(dotnetVersion.type, dotnetVersion.value); - } - if (this.quality) { - this.setQuality(dotnetVersion, scriptArguments); - } - } - // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used - const getExecOutputOptions = { - ignoreReturnCode: true, - env: process.env - }; - const { exitCode, stdout, stderr } = yield exec.getExecOutput(`"${scriptPath}"`, scriptArguments, getExecOutputOptions); + const dotnetVersion = yield versionResolver.createDotnetVersion(); + const installScript = new DotnetInstallScript() + .useArguments(utils_1.IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files') + .useVersion(dotnetVersion, this.quality); + const { exitCode, stderr, stdout } = yield installScript.execute(); if (exitCode) { throw new Error(`Failed to install dotnet, exit code: ${exitCode}. ${stderr}`); } @@ -71382,26 +71406,8 @@ class DotnetCoreInstaller { } } exports.DotnetCoreInstaller = DotnetCoreInstaller; -_a = DotnetCoreInstaller; (() => { - const installationDirectoryWindows = path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet'); - const installationDirectoryLinux = '/usr/share/dotnet'; - const installationDirectoryMac = path_1.default.join(process.env['HOME'] + '', '.dotnet'); - const dotnetInstallDir = process.env['DOTNET_INSTALL_DIR']; - if (dotnetInstallDir) { - process.env['DOTNET_INSTALL_DIR'] = - _a.convertInstallPathToAbsolute(dotnetInstallDir); - } - else { - if (utils_1.IS_WINDOWS) { - process.env['DOTNET_INSTALL_DIR'] = installationDirectoryWindows; - } - else { - process.env['DOTNET_INSTALL_DIR'] = utils_1.IS_LINUX - ? installationDirectoryLinux - : installationDirectoryMac; - } - } + DotnetInstallDir.setEnvironmentVariable(); })(); @@ -71510,7 +71516,7 @@ function run() { const installedVersion = yield dotnetInstaller.installDotnet(); installedDotnetVersions.push(installedVersion); } - installer_1.DotnetCoreInstaller.addToPath(); + installer_1.DotnetInstallDir.addToPath(); } const sourceUrl = core.getInput('source-url'); const configFile = core.getInput('config-file'); @@ -71576,9 +71582,15 @@ run(); "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.IS_LINUX = exports.IS_WINDOWS = void 0; +exports.PLATFORM = exports.IS_WINDOWS = void 0; exports.IS_WINDOWS = process.platform === 'win32'; -exports.IS_LINUX = process.platform === 'linux'; +exports.PLATFORM = (() => { + if (process.platform === 'win32') + return 'windows'; + if (process.platform === 'linux') + return 'linux'; + return 'mac'; +})(); /***/ }),