From 8d59d2cd13f320fdf40102104acfbb3add55bf56 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Sun, 30 Jun 2024 19:29:19 +0200 Subject: [PATCH] set explicit modifiers --- src/agents/azure/build-agent.ts | 6 +++--- src/agents/common/build-agent.ts | 2 +- src/agents/github/build-agent.ts | 6 +++--- src/agents/local/build-agent.ts | 6 +++--- src/tools/common/dotnet-tool.ts | 12 ++++++------ src/tools/common/settings.ts | 2 +- src/tools/gitreleasemanager/runner.ts | 2 +- src/tools/gitreleasemanager/settings.ts | 16 +++++++--------- src/tools/gitversion/runner.ts | 2 +- src/tools/gitversion/settings.ts | 2 +- 10 files changed, 27 insertions(+), 29 deletions(-) diff --git a/src/agents/azure/build-agent.ts b/src/agents/azure/build-agent.ts index a8cc068e9..f0b357162 100644 --- a/src/agents/azure/build-agent.ts +++ b/src/agents/azure/build-agent.ts @@ -24,7 +24,7 @@ class BuildAgent implements IBuildAgent { } } - public find(toolName: string, versionSpec: string, arch?: string): string { + public findLocalTool(toolName: string, versionSpec: string, arch?: string): string { return toolLib.findLocalTool(toolName, versionSpec, arch) } @@ -36,7 +36,7 @@ class BuildAgent implements IBuildAgent { return Promise.resolve(taskLib.getVariable('Agent.TempDirectory')) } - removeDirectory(dir: string): Promise { + public removeDirectory(dir: string): Promise { taskLib.rmRF(dir) return Promise.resolve() } @@ -69,7 +69,7 @@ class BuildAgent implements IBuildAgent { return taskLib.getVariable(name) } - getVariableAsPath(name: string): string { + public getVariableAsPath(name: string): string { return path.resolve(path.normalize(this.getVariable(name))) } diff --git a/src/agents/common/build-agent.ts b/src/agents/common/build-agent.ts index 89da54eea..d44a5204c 100644 --- a/src/agents/common/build-agent.ts +++ b/src/agents/common/build-agent.ts @@ -6,7 +6,7 @@ export interface IBuildAgent { proxyConfiguration(url: string): IRequestOptions - find(toolName: string, versionSpec: string, arch?: string): string + findLocalTool(toolName: string, versionSpec: string, arch?: string): string cacheToolDirectory(sourceDir: string, tool: string, version: string, arch?: string): Promise diff --git a/src/agents/github/build-agent.ts b/src/agents/github/build-agent.ts index 22972e2fd..9a6e97118 100644 --- a/src/agents/github/build-agent.ts +++ b/src/agents/github/build-agent.ts @@ -21,7 +21,7 @@ class BuildAgent implements IBuildAgent { return 'GitHub Actions' } - public find(toolName: string, versionSpec: string, arch?: string): string { + public findLocalTool(toolName: string, versionSpec: string, arch?: string): string { return toolCache.find(toolName, versionSpec, arch) } @@ -99,7 +99,7 @@ class BuildAgent implements IBuildAgent { return dest } - removeDirectory(dir: string): Promise { + public removeDirectory(dir: string): Promise { return io.rmRF(dir) } @@ -131,7 +131,7 @@ class BuildAgent implements IBuildAgent { return process.env[name] } - getVariableAsPath(name: string): string { + public getVariableAsPath(name: string): string { return path.resolve(path.normalize(this.getVariable(name))) } diff --git a/src/agents/local/build-agent.ts b/src/agents/local/build-agent.ts index 23aca23c8..652dd9460 100644 --- a/src/agents/local/build-agent.ts +++ b/src/agents/local/build-agent.ts @@ -9,7 +9,7 @@ import { IBuildAgent } from '../common/build-agent' @injectable() class BuildAgent implements IBuildAgent { - proxyConfiguration(url: string): IRequestOptions { + public proxyConfiguration(url: string): IRequestOptions { console.log('proxyConfiguration') return undefined } @@ -18,7 +18,7 @@ class BuildAgent implements IBuildAgent { return 'Local' } - public find(toolName: string, versionSpec: string, arch?: string): string { + public findLocalTool(toolName: string, versionSpec: string, arch?: string): string { console.log('find') return 'find' } @@ -66,7 +66,7 @@ class BuildAgent implements IBuildAgent { return 'getVariable' } - getVariableAsPath(name: string): string { + public getVariableAsPath(name: string): string { return path.resolve(path.normalize(this.getVariable(name))) } diff --git a/src/tools/common/dotnet-tool.ts b/src/tools/common/dotnet-tool.ts index a5633c432..b437d1b58 100644 --- a/src/tools/common/dotnet-tool.ts +++ b/src/tools/common/dotnet-tool.ts @@ -50,11 +50,6 @@ export abstract class DotnetTool implements IDotnetTool { this.buildAgent.setVariable('DOTNET_NOLOGO', 'true') } - public execute(cmd: string, args: string[]): Promise { - this.buildAgent.info(`Command: ${cmd} ${args.join(' ')}`) - return this.buildAgent.exec(cmd, args) - } - public async install(): Promise { const dotnetExePath = await this.buildAgent.which('dotnet', true) this.buildAgent.debug(`whichPath: ${dotnetExePath}`) @@ -84,7 +79,7 @@ export abstract class DotnetTool implements IDotnetTool { let toolPath: string | null = null if (!setupSettings.preferLatestVersion) { // Let's try and resolve the version locally first - toolPath = this.buildAgent.find(this.packageName, version) + toolPath = this.buildAgent.findLocalTool(this.packageName, version) if (toolPath) { this.buildAgent.info('--------------------------') this.buildAgent.info(`${this.packageName} version: ${version} found in local cache at ${toolPath}.`) @@ -149,6 +144,11 @@ export abstract class DotnetTool implements IDotnetTool { return workDir.replace(/\\/g, '/') } + protected execute(cmd: string, args: string[]): Promise { + this.buildAgent.info(`Command: ${cmd} ${args.join(' ')}`) + return this.buildAgent.exec(cmd, args) + } + private async queryLatestMatch(toolName: string, versionSpec: string, includePrerelease: boolean): Promise { this.buildAgent.info( `Querying tool versions for ${toolName}${versionSpec ? `@${versionSpec}` : ''} ${includePrerelease ? 'including pre-releases' : ''}` diff --git a/src/tools/common/settings.ts b/src/tools/common/settings.ts index 2be25485e..5120ebf8c 100644 --- a/src/tools/common/settings.ts +++ b/src/tools/common/settings.ts @@ -11,7 +11,7 @@ export interface ISettingsProvider { export class SettingsProvider implements ISettingsProvider { constructor(protected buildAgent: IBuildAgent) {} - getSetupSettings(): SetupSettings { + public getSetupSettings(): SetupSettings { const versionSpec = this.buildAgent.getInput(SetupFields.versionSpec) const includePrerelease = this.buildAgent.getBooleanInput(SetupFields.includePrerelease) const ignoreFailedSources = this.buildAgent.getBooleanInput(SetupFields.ignoreFailedSources) diff --git a/src/tools/gitreleasemanager/runner.ts b/src/tools/gitreleasemanager/runner.ts index 72a490943..c0fdca696 100644 --- a/src/tools/gitreleasemanager/runner.ts +++ b/src/tools/gitreleasemanager/runner.ts @@ -19,7 +19,7 @@ export class Runner { this.gitReleaseManagerTool = gitReleaseManagerTool } - async run(command: Commands): Promise { + public async run(command: Commands): Promise { switch (command) { case 'setup': return await this.setup() diff --git a/src/tools/gitreleasemanager/settings.ts b/src/tools/gitreleasemanager/settings.ts index dcedf757e..f76d52a2c 100644 --- a/src/tools/gitreleasemanager/settings.ts +++ b/src/tools/gitreleasemanager/settings.ts @@ -31,8 +31,6 @@ export interface IGitReleaseManagerSettingsProvider extends ISettingsProvider { getPublishSettings(): GitReleaseManagerPublishSettings getAddAssetSettings(): GitReleaseManagerAddAssetSettings - - getCommonSettings(): GitReleaseManagerSettings } @injectable() @@ -41,7 +39,7 @@ export class GitReleaseManagerSettingsProvider extends SettingsProvider implemen super(buildAgent) } - getCreateSettings(): GitReleaseManagerCreateSettings { + public getCreateSettings(): GitReleaseManagerCreateSettings { const milestone = this.buildAgent.getInput(CreateFields.milestone) const name = this.buildAgent.getInput(CreateFields.name) const inputFileName = this.buildAgent.getInput(CreateFields.inputFileName) @@ -61,7 +59,7 @@ export class GitReleaseManagerSettingsProvider extends SettingsProvider implemen } } - getDiscardSettings(): GitReleaseManagerDiscardSettings { + public getDiscardSettings(): GitReleaseManagerDiscardSettings { const milestone = this.buildAgent.getInput(DiscardFields.milestone) const commonSettings = this.getCommonSettings() @@ -71,7 +69,7 @@ export class GitReleaseManagerSettingsProvider extends SettingsProvider implemen } } - getCloseSettings(): GitReleaseManagerCloseSettings { + public getCloseSettings(): GitReleaseManagerCloseSettings { const milestone = this.buildAgent.getInput(CloseFields.milestone) const commonSettings = this.getCommonSettings() @@ -81,7 +79,7 @@ export class GitReleaseManagerSettingsProvider extends SettingsProvider implemen } } - getOpenSettings(): GitReleaseManagerOpenSettings { + public getOpenSettings(): GitReleaseManagerOpenSettings { const milestone = this.buildAgent.getInput(OpenFields.milestone) const commonSettings = this.getCommonSettings() @@ -91,7 +89,7 @@ export class GitReleaseManagerSettingsProvider extends SettingsProvider implemen } } - getPublishSettings(): GitReleaseManagerPublishSettings { + public getPublishSettings(): GitReleaseManagerPublishSettings { const tagName = this.buildAgent.getInput(PublishFields.tagName) const commonSettings = this.getCommonSettings() @@ -101,7 +99,7 @@ export class GitReleaseManagerSettingsProvider extends SettingsProvider implemen } } - getAddAssetSettings(): GitReleaseManagerAddAssetSettings { + public getAddAssetSettings(): GitReleaseManagerAddAssetSettings { const tagName = this.buildAgent.getInput(AddAssetFields.tagName) const assets = this.buildAgent.getListInput(AddAssetFields.assets) @@ -113,7 +111,7 @@ export class GitReleaseManagerSettingsProvider extends SettingsProvider implemen } } - getCommonSettings(): GitReleaseManagerSettings { + private getCommonSettings(): GitReleaseManagerSettings { const owner = this.buildAgent.getInput(CommonFields.owner, true) const repository = this.buildAgent.getInput(CommonFields.repository, true) const token = this.buildAgent.getInput(CommonFields.token, true) diff --git a/src/tools/gitversion/runner.ts b/src/tools/gitversion/runner.ts index a1d55897a..2554334ee 100644 --- a/src/tools/gitversion/runner.ts +++ b/src/tools/gitversion/runner.ts @@ -19,7 +19,7 @@ export class Runner { this.gitVersionTool = gitVersionTool } - async run(command: Commands): Promise { + public async run(command: Commands): Promise { switch (command) { case 'setup': return await this.setup() diff --git a/src/tools/gitversion/settings.ts b/src/tools/gitversion/settings.ts index 3c33a8ba4..e19fbfdb9 100644 --- a/src/tools/gitversion/settings.ts +++ b/src/tools/gitversion/settings.ts @@ -14,7 +14,7 @@ export class GitVersionSettingsProvider extends SettingsProvider implements IGit super(buildAgent) } - getGitVersionSettings(): GitVersionSettings { + public getGitVersionSettings(): GitVersionSettings { const targetPath = this.buildAgent.getInput(ExecuteFields.targetPath) const disableCache = this.buildAgent.getBooleanInput(ExecuteFields.disableCache)