Format & build

This commit is contained in:
Nikolai Laevskii 2023-09-04 06:14:01 +02:00
parent d903b6184b
commit 67c4cb799b
3 changed files with 17 additions and 11 deletions

13
dist/setup/index.js vendored
View File

@ -73086,15 +73086,12 @@ DotnetInstallDir.dirPath = process.env['DOTNET_INSTALL_DIR']
? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR']) ? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR'])
: DotnetInstallDir.default[utils_1.PLATFORM]; : DotnetInstallDir.default[utils_1.PLATFORM];
class DotnetCoreInstaller { class DotnetCoreInstaller {
constructor(version, quality, preferInstalled = false) { constructor(dotnetVersion, quality) {
this.version = version; this.dotnetVersion = dotnetVersion;
this.quality = quality; this.quality = quality;
this.preferInstalled = preferInstalled;
} }
installDotnet() { installDotnet() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const versionResolver = new DotnetVersionResolver(this.version, this.preferInstalled);
const dotnetVersion = yield versionResolver.createDotnetVersion();
/** /**
* Install dotnet runitme first in order to get * Install dotnet runitme first in order to get
* the latest stable version of dotnet CLI * the latest stable version of dotnet CLI
@ -73122,7 +73119,7 @@ class DotnetCoreInstaller {
// Don't overwrite CLI because it should be already installed // Don't overwrite CLI because it should be already installed
.useArguments(utils_1.IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files') .useArguments(utils_1.IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files')
// Use version provided by user // Use version provided by user
.useVersion(dotnetVersion, this.quality) .useVersion(this.dotnetVersion, this.quality)
.execute(); .execute();
if (dotnetInstallOutput.exitCode) { if (dotnetInstallOutput.exitCode) {
throw new Error(`Failed to install dotnet, exit code: ${dotnetInstallOutput.exitCode}. ${dotnetInstallOutput.stderr}`); throw new Error(`Failed to install dotnet, exit code: ${dotnetInstallOutput.exitCode}. ${dotnetInstallOutput.stderr}`);
@ -73247,9 +73244,11 @@ function run() {
throw new Error(`Value '${quality}' is not supported for the 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`); throw new Error(`Value '${quality}' is not supported for the 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`);
} }
let dotnetInstaller; let dotnetInstaller;
let dotnetVersionResolver;
const uniqueVersions = new Set(versions); const uniqueVersions = new Set(versions);
for (const version of uniqueVersions) { for (const version of uniqueVersions) {
dotnetInstaller = new installer_1.DotnetCoreInstaller(version, quality, preferInstalled); dotnetVersionResolver = new installer_1.DotnetVersionResolver(version, preferInstalled);
dotnetInstaller = new installer_1.DotnetCoreInstaller(yield dotnetVersionResolver.createDotnetVersion(), quality);
const installedVersion = yield dotnetInstaller.installDotnet(); const installedVersion = yield dotnetInstaller.installDotnet();
installedDotnetVersions.push(installedVersion); installedDotnetVersions.push(installedVersion);
} }

View File

@ -275,7 +275,7 @@ export class DotnetCoreInstaller {
constructor( constructor(
private dotnetVersion: DotnetVersion, private dotnetVersion: DotnetVersion,
private quality: QualityOptions, private quality: QualityOptions
) {} ) {}
public async installDotnet(): Promise<string | null> { public async installDotnet(): Promise<string | null> {

View File

@ -1,5 +1,9 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import {DotnetCoreInstaller, DotnetInstallDir, DotnetVersionResolver} from './installer'; import {
DotnetCoreInstaller,
DotnetInstallDir,
DotnetVersionResolver
} from './installer';
import * as fs from 'fs'; import * as fs from 'fs';
import path from 'path'; import path from 'path';
import semver from 'semver'; import semver from 'semver';
@ -72,10 +76,13 @@ export async function run() {
const uniqueVersions = new Set<string>(versions); const uniqueVersions = new Set<string>(versions);
for (const version of uniqueVersions) { for (const version of uniqueVersions) {
dotnetVersionResolver = new DotnetVersionResolver(version, preferInstalled); dotnetVersionResolver = new DotnetVersionResolver(
version,
preferInstalled
);
dotnetInstaller = new DotnetCoreInstaller( dotnetInstaller = new DotnetCoreInstaller(
await dotnetVersionResolver.createDotnetVersion(), await dotnetVersionResolver.createDotnetVersion(),
quality, quality
); );
const installedVersion = await dotnetInstaller.installDotnet(); const installedVersion = await dotnetInstaller.installDotnet();
installedDotnetVersions.push(installedVersion); installedDotnetVersions.push(installedVersion);