Fix review points, rebuild solution
This commit is contained in:
parent
38b49fb717
commit
b05a3f26b3
|
@ -59,7 +59,7 @@ describe('setup-dotnet tests', () => {
|
||||||
|
|
||||||
const expectedDebugMessage =
|
const expectedDebugMessage =
|
||||||
'No version found, trying to find version from global.json';
|
'No version found, trying to find version from global.json';
|
||||||
const expectedInfoMessage = `A global.json wasn't found in the root directory. No .NET version will be installed.`;
|
const expectedInfoMessage = `The global.json wasn't found in the root directory. No .NET version will be installed.`;
|
||||||
|
|
||||||
await setup.run();
|
await setup.run();
|
||||||
|
|
||||||
|
|
|
@ -242,11 +242,8 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
const os_1 = __importDefault(__nccwpck_require__(2037));
|
const os_1 = __importDefault(__nccwpck_require__(2037));
|
||||||
const semver_1 = __importDefault(__nccwpck_require__(5911));
|
const semver_1 = __importDefault(__nccwpck_require__(5911));
|
||||||
const utils_1 = __nccwpck_require__(918);
|
const utils_1 = __nccwpck_require__(918);
|
||||||
var DotnetInstallerLimits;
|
const QUALITY_INPUT_MINIMAL_MAJOR_TAG = 6;
|
||||||
(function (DotnetInstallerLimits) {
|
const LATEST_PATCH_SYNTAX_MINIMAL_MAJOR_TAG = 5;
|
||||||
DotnetInstallerLimits[DotnetInstallerLimits["QualityInputMinimalMajorTag"] = 6] = "QualityInputMinimalMajorTag";
|
|
||||||
DotnetInstallerLimits[DotnetInstallerLimits["LatestPatchSyntaxMinimalMajorTag"] = 5] = "LatestPatchSyntaxMinimalMajorTag";
|
|
||||||
})(DotnetInstallerLimits || (DotnetInstallerLimits = {}));
|
|
||||||
class DotnetVersionResolver {
|
class DotnetVersionResolver {
|
||||||
constructor(version) {
|
constructor(version) {
|
||||||
this.inputVersion = version.trim();
|
this.inputVersion = version.trim();
|
||||||
|
@ -272,8 +269,7 @@ class DotnetVersionResolver {
|
||||||
var _b, _c;
|
var _b, _c;
|
||||||
const majorTag = (_c = (_b = this.inputVersion.match(/^(?<majorTag>\d+)\.\d+\.\d{1}x{2}$/)) === null || _b === void 0 ? void 0 : _b.groups) === null || _c === void 0 ? void 0 : _c.majorTag;
|
const majorTag = (_c = (_b = this.inputVersion.match(/^(?<majorTag>\d+)\.\d+\.\d{1}x{2}$/)) === null || _b === void 0 ? void 0 : _b.groups) === null || _c === void 0 ? void 0 : _c.majorTag;
|
||||||
if (majorTag &&
|
if (majorTag &&
|
||||||
parseInt(majorTag) <
|
parseInt(majorTag) < LATEST_PATCH_SYNTAX_MINIMAL_MAJOR_TAG) {
|
||||||
DotnetInstallerLimits.LatestPatchSyntaxMinimalMajorTag) {
|
|
||||||
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.`);
|
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.`);
|
||||||
}
|
}
|
||||||
return majorTag ? true : false;
|
return majorTag ? true : false;
|
||||||
|
@ -300,9 +296,7 @@ class DotnetVersionResolver {
|
||||||
this.resolvedArgument.value = 'LTS';
|
this.resolvedArgument.value = 'LTS';
|
||||||
}
|
}
|
||||||
this.resolvedArgument.qualityFlag =
|
this.resolvedArgument.qualityFlag =
|
||||||
parseInt(major) >= DotnetInstallerLimits.QualityInputMinimalMajorTag
|
parseInt(major) >= QUALITY_INPUT_MINIMAL_MAJOR_TAG ? true : false;
|
||||||
? true
|
|
||||||
: false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
createDotNetVersion() {
|
createDotNetVersion() {
|
||||||
|
@ -556,7 +550,7 @@ function run() {
|
||||||
versions.push(getVersionFromGlobalJson(globalJsonPath));
|
versions.push(getVersionFromGlobalJson(globalJsonPath));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info(`A global.json wasn't found in the root directory. No .NET version will be installed.`);
|
core.info(`The global.json wasn't found in the root directory. No .NET version will be installed.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (versions.length) {
|
if (versions.length) {
|
||||||
|
@ -613,7 +607,7 @@ function outputInstalledVersion(installedVersions, globalJsonFileInput) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (globalJsonFileInput) {
|
if (globalJsonFileInput) {
|
||||||
const versionToOutput = installedVersions.at(-1);
|
const versionToOutput = installedVersions.at(-1); // .NET SDK version parsed from the global.json file is installed last
|
||||||
core.setOutput('dotnet-version', versionToOutput);
|
core.setOutput('dotnet-version', versionToOutput);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,8 @@ export interface DotnetVersion {
|
||||||
qualityFlag: boolean;
|
qualityFlag: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum DotnetInstallerLimits {
|
const QUALITY_INPUT_MINIMAL_MAJOR_TAG = 6;
|
||||||
QualityInputMinimalMajorTag = 6,
|
const LATEST_PATCH_SYNTAX_MINIMAL_MAJOR_TAG = 5;
|
||||||
LatestPatchSyntaxMinimalMajorTag = 5
|
|
||||||
}
|
|
||||||
|
|
||||||
export class DotnetVersionResolver {
|
export class DotnetVersionResolver {
|
||||||
private inputVersion: string;
|
private inputVersion: string;
|
||||||
private resolvedArgument: DotnetVersion;
|
private resolvedArgument: DotnetVersion;
|
||||||
|
@ -53,8 +50,7 @@ export class DotnetVersionResolver {
|
||||||
)?.groups?.majorTag;
|
)?.groups?.majorTag;
|
||||||
if (
|
if (
|
||||||
majorTag &&
|
majorTag &&
|
||||||
parseInt(majorTag) <
|
parseInt(majorTag) < LATEST_PATCH_SYNTAX_MINIMAL_MAJOR_TAG
|
||||||
DotnetInstallerLimits.LatestPatchSyntaxMinimalMajorTag
|
|
||||||
) {
|
) {
|
||||||
throw new Error(
|
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.`
|
`The 'dotnet-version' was supplied in invalid format: ${this.inputVersion}! The A.B.Cxx syntax is available since the .NET 5.0 release.`
|
||||||
|
@ -82,9 +78,7 @@ export class DotnetVersionResolver {
|
||||||
this.resolvedArgument.value = 'LTS';
|
this.resolvedArgument.value = 'LTS';
|
||||||
}
|
}
|
||||||
this.resolvedArgument.qualityFlag =
|
this.resolvedArgument.qualityFlag =
|
||||||
parseInt(major) >= DotnetInstallerLimits.QualityInputMinimalMajorTag
|
parseInt(major) >= QUALITY_INPUT_MINIMAL_MAJOR_TAG ? true : false;
|
||||||
? true
|
|
||||||
: false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createDotNetVersion(): Promise<DotnetVersion> {
|
public async createDotNetVersion(): Promise<DotnetVersion> {
|
||||||
|
|
|
@ -48,7 +48,7 @@ export async function run() {
|
||||||
versions.push(getVersionFromGlobalJson(globalJsonPath));
|
versions.push(getVersionFromGlobalJson(globalJsonPath));
|
||||||
} else {
|
} else {
|
||||||
core.info(
|
core.info(
|
||||||
`A global.json wasn't found in the root directory. No .NET version will be installed.`
|
`The global.json wasn't found in the root directory. No .NET version will be installed.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ function outputInstalledVersion(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (globalJsonFileInput) {
|
if (globalJsonFileInput) {
|
||||||
const versionToOutput = installedVersions.at(-1);
|
const versionToOutput = installedVersions.at(-1); // .NET SDK version parsed from the global.json file is installed last
|
||||||
core.setOutput('dotnet-version', versionToOutput);
|
core.setOutput('dotnet-version', versionToOutput);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue