Fix errors + Update generated files

This commit is contained in:
Kevin Gosse 2022-10-21 16:29:07 +02:00
parent 2f8de776e1
commit 70a19cc0ab
4 changed files with 26 additions and 10 deletions

View File

@ -296,7 +296,7 @@ function normalizeFileContents(contents: string): string {
async function getDotnet( async function getDotnet(
version: string, version: string,
quality: string = '' quality: string = '',
architecture: string = '' architecture: string = ''
): Promise<string> { ): Promise<string> {
const dotnetInstaller = new installer.DotnetCoreInstaller( const dotnetInstaller = new installer.DotnetCoreInstaller(

12
dist/index.js vendored
View File

@ -275,9 +275,10 @@ class DotnetVersionResolver {
exports.DotnetVersionResolver = DotnetVersionResolver; exports.DotnetVersionResolver = DotnetVersionResolver;
DotnetVersionResolver.DotNetCoreIndexUrl = 'https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json'; DotnetVersionResolver.DotNetCoreIndexUrl = 'https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json';
class DotnetCoreInstaller { class DotnetCoreInstaller {
constructor(version, quality) { constructor(version, quality, architecture = '') {
this.version = version; this.version = version;
this.quality = quality; this.quality = quality;
this.architecture = architecture;
} }
static convertInstallPathToAbsolute(installDir) { static convertInstallPathToAbsolute(installDir) {
let transformedPath; let transformedPath;
@ -352,6 +353,9 @@ class DotnetCoreInstaller {
if (this.quality) { if (this.quality) {
this.setQuality(dotnetVersion, scriptArguments); this.setQuality(dotnetVersion, scriptArguments);
} }
if (this.architecture != '') {
scriptArguments.push('--architecture', this.architecture);
}
} }
// process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
const getExecOutputOptions = { const getExecOutputOptions = {
@ -471,6 +475,10 @@ function run() {
// //
const versions = core.getMultilineInput('dotnet-version'); const versions = core.getMultilineInput('dotnet-version');
const installedDotnetVersions = []; const installedDotnetVersions = [];
let architecture = core.getInput('architecture');
if (!architecture) {
architecture = '';
}
const globalJsonFileInput = core.getInput('global-json-file'); const globalJsonFileInput = core.getInput('global-json-file');
if (globalJsonFileInput) { if (globalJsonFileInput) {
const globalJsonPath = path_1.default.join(process.cwd(), globalJsonFileInput); const globalJsonPath = path_1.default.join(process.cwd(), globalJsonFileInput);
@ -495,7 +503,7 @@ function run() {
let dotnetInstaller; let dotnetInstaller;
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); dotnetInstaller = new installer_1.DotnetCoreInstaller(version, quality, architecture);
const installedVersion = yield dotnetInstaller.installDotnet(); const installedVersion = yield dotnetInstaller.installDotnet();
installedDotnetVersions.push(installedVersion); installedDotnetVersions.push(installedVersion);
} }

View File

@ -20,11 +20,9 @@ export interface DotnetVersion {
export class DotnetVersionResolver { export class DotnetVersionResolver {
private inputVersion: string; private inputVersion: string;
private resolvedArgument: DotnetVersion; private resolvedArgument: DotnetVersion;
private architecture: string;
constructor(version: string, architecture: string = '') { constructor(version: string) {
this.inputVersion = version.trim(); this.inputVersion = version.trim();
this.architecture = architecture;
this.resolvedArgument = {type: '', value: '', qualityFlag: false}; this.resolvedArgument = {type: '', value: '', qualityFlag: false};
} }
@ -115,6 +113,7 @@ export class DotnetVersionResolver {
export class DotnetCoreInstaller { export class DotnetCoreInstaller {
private version: string; private version: string;
private quality: QualityOptions; private quality: QualityOptions;
private architecture: string;
static { static {
const installationDirectoryWindows = path.join( const installationDirectoryWindows = path.join(
@ -142,9 +141,14 @@ export class DotnetCoreInstaller {
} }
} }
constructor(version: string, quality: QualityOptions) { constructor(
version: string,
quality: QualityOptions,
architecture: string = ''
) {
this.version = version; this.version = version;
this.quality = quality; this.quality = quality;
this.architecture = architecture;
} }
private static convertInstallPathToAbsolute(installDir: string): string { private static convertInstallPathToAbsolute(installDir: string): string {

View File

@ -66,7 +66,11 @@ export async function run() {
let dotnetInstaller: DotnetCoreInstaller; let dotnetInstaller: DotnetCoreInstaller;
const uniqueVersions = new Set<string>(versions); const uniqueVersions = new Set<string>(versions);
for (const version of uniqueVersions) { for (const version of uniqueVersions) {
dotnetInstaller = new DotnetCoreInstaller(version, quality, architecture); dotnetInstaller = new DotnetCoreInstaller(
version,
quality,
architecture
);
const installedVersion = await dotnetInstaller.installDotnet(); const installedVersion = await dotnetInstaller.installDotnet();
installedDotnetVersions.push(installedVersion); installedDotnetVersions.push(installedVersion);
} }