Skip to content

Commit

Permalink
Format & build
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolai-laevskii committed Sep 4, 2023
1 parent d903b61 commit 67c4cb7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
13 changes: 6 additions & 7 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73086,15 +73086,12 @@ DotnetInstallDir.dirPath = process.env['DOTNET_INSTALL_DIR']
? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR'])
: DotnetInstallDir.default[utils_1.PLATFORM];
class DotnetCoreInstaller {
constructor(version, quality, preferInstalled = false) {
this.version = version;
constructor(dotnetVersion, quality) {
this.dotnetVersion = dotnetVersion;
this.quality = quality;
this.preferInstalled = preferInstalled;
}
installDotnet() {
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
* the latest stable version of dotnet CLI
Expand Down Expand Up @@ -73122,7 +73119,7 @@ class DotnetCoreInstaller {
// Don't overwrite CLI because it should be already installed
.useArguments(utils_1.IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files')
// Use version provided by user
.useVersion(dotnetVersion, this.quality)
.useVersion(this.dotnetVersion, this.quality)
.execute();
if (dotnetInstallOutput.exitCode) {
throw new Error(`Failed to install dotnet, exit code: ${dotnetInstallOutput.exitCode}. ${dotnetInstallOutput.stderr}`);
Expand Down Expand Up @@ -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.`);
}
let dotnetInstaller;
let dotnetVersionResolver;
const uniqueVersions = new Set(versions);
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();
installedDotnetVersions.push(installedVersion);
}
Expand Down
2 changes: 1 addition & 1 deletion src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export class DotnetCoreInstaller {

constructor(
private dotnetVersion: DotnetVersion,
private quality: QualityOptions,
private quality: QualityOptions
) {}

public async installDotnet(): Promise<string | null> {
Expand Down
13 changes: 10 additions & 3 deletions src/setup-dotnet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import * as core from '@actions/core';
import {DotnetCoreInstaller, DotnetInstallDir, DotnetVersionResolver} from './installer';
import {
DotnetCoreInstaller,
DotnetInstallDir,
DotnetVersionResolver
} from './installer';
import * as fs from 'fs';
import path from 'path';
import semver from 'semver';
Expand Down Expand Up @@ -72,10 +76,13 @@ export async function run() {

const uniqueVersions = new Set<string>(versions);
for (const version of uniqueVersions) {
dotnetVersionResolver = new DotnetVersionResolver(version, preferInstalled);
dotnetVersionResolver = new DotnetVersionResolver(
version,
preferInstalled
);
dotnetInstaller = new DotnetCoreInstaller(
await dotnetVersionResolver.createDotnetVersion(),
quality,
quality
);
const installedVersion = await dotnetInstaller.installDotnet();
installedDotnetVersions.push(installedVersion);
Expand Down

0 comments on commit 67c4cb7

Please sign in to comment.