mirror of
https://github.com/actions/setup-dotnet.git
synced 2024-11-25 04:51:07 +07:00
Fix review points, rebuild solution
This commit is contained in:
parent
38b49fb717
commit
b05a3f26b3
@ -59,7 +59,7 @@ describe('setup-dotnet tests', () => {
|
||||
|
||||
const expectedDebugMessage =
|
||||
'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();
|
||||
|
||||
|
18
dist/index.js
vendored
18
dist/index.js
vendored
@ -242,11 +242,8 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||
const os_1 = __importDefault(__nccwpck_require__(2037));
|
||||
const semver_1 = __importDefault(__nccwpck_require__(5911));
|
||||
const utils_1 = __nccwpck_require__(918);
|
||||
var DotnetInstallerLimits;
|
||||
(function (DotnetInstallerLimits) {
|
||||
DotnetInstallerLimits[DotnetInstallerLimits["QualityInputMinimalMajorTag"] = 6] = "QualityInputMinimalMajorTag";
|
||||
DotnetInstallerLimits[DotnetInstallerLimits["LatestPatchSyntaxMinimalMajorTag"] = 5] = "LatestPatchSyntaxMinimalMajorTag";
|
||||
})(DotnetInstallerLimits || (DotnetInstallerLimits = {}));
|
||||
const QUALITY_INPUT_MINIMAL_MAJOR_TAG = 6;
|
||||
const LATEST_PATCH_SYNTAX_MINIMAL_MAJOR_TAG = 5;
|
||||
class DotnetVersionResolver {
|
||||
constructor(version) {
|
||||
this.inputVersion = version.trim();
|
||||
@ -272,8 +269,7 @@ class DotnetVersionResolver {
|
||||
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;
|
||||
if (majorTag &&
|
||||
parseInt(majorTag) <
|
||||
DotnetInstallerLimits.LatestPatchSyntaxMinimalMajorTag) {
|
||||
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.`);
|
||||
}
|
||||
return majorTag ? true : false;
|
||||
@ -300,9 +296,7 @@ class DotnetVersionResolver {
|
||||
this.resolvedArgument.value = 'LTS';
|
||||
}
|
||||
this.resolvedArgument.qualityFlag =
|
||||
parseInt(major) >= DotnetInstallerLimits.QualityInputMinimalMajorTag
|
||||
? true
|
||||
: false;
|
||||
parseInt(major) >= QUALITY_INPUT_MINIMAL_MAJOR_TAG ? true : false;
|
||||
});
|
||||
}
|
||||
createDotNetVersion() {
|
||||
@ -556,7 +550,7 @@ function run() {
|
||||
versions.push(getVersionFromGlobalJson(globalJsonPath));
|
||||
}
|
||||
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) {
|
||||
@ -613,7 +607,7 @@ function outputInstalledVersion(installedVersions, globalJsonFileInput) {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
@ -16,11 +16,8 @@ export interface DotnetVersion {
|
||||
qualityFlag: boolean;
|
||||
}
|
||||
|
||||
enum DotnetInstallerLimits {
|
||||
QualityInputMinimalMajorTag = 6,
|
||||
LatestPatchSyntaxMinimalMajorTag = 5
|
||||
}
|
||||
|
||||
const QUALITY_INPUT_MINIMAL_MAJOR_TAG = 6;
|
||||
const LATEST_PATCH_SYNTAX_MINIMAL_MAJOR_TAG = 5;
|
||||
export class DotnetVersionResolver {
|
||||
private inputVersion: string;
|
||||
private resolvedArgument: DotnetVersion;
|
||||
@ -53,8 +50,7 @@ export class DotnetVersionResolver {
|
||||
)?.groups?.majorTag;
|
||||
if (
|
||||
majorTag &&
|
||||
parseInt(majorTag) <
|
||||
DotnetInstallerLimits.LatestPatchSyntaxMinimalMajorTag
|
||||
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.`
|
||||
@ -82,9 +78,7 @@ export class DotnetVersionResolver {
|
||||
this.resolvedArgument.value = 'LTS';
|
||||
}
|
||||
this.resolvedArgument.qualityFlag =
|
||||
parseInt(major) >= DotnetInstallerLimits.QualityInputMinimalMajorTag
|
||||
? true
|
||||
: false;
|
||||
parseInt(major) >= QUALITY_INPUT_MINIMAL_MAJOR_TAG ? true : false;
|
||||
}
|
||||
|
||||
public async createDotNetVersion(): Promise<DotnetVersion> {
|
||||
|
@ -48,7 +48,7 @@ export async function run() {
|
||||
versions.push(getVersionFromGlobalJson(globalJsonPath));
|
||||
} else {
|
||||
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) {
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user