Skip to content

Commit

Permalink
set explicit modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Jul 9, 2024
1 parent 7dd0f4e commit 8d59d2c
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 29 deletions.
6 changes: 3 additions & 3 deletions src/agents/azure/build-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -36,7 +36,7 @@ class BuildAgent implements IBuildAgent {
return Promise.resolve(taskLib.getVariable('Agent.TempDirectory'))
}

removeDirectory(dir: string): Promise<void> {
public removeDirectory(dir: string): Promise<void> {
taskLib.rmRF(dir)
return Promise.resolve()
}
Expand Down Expand Up @@ -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)))
}

Expand Down
2 changes: 1 addition & 1 deletion src/agents/common/build-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>

Expand Down
6 changes: 3 additions & 3 deletions src/agents/github/build-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -99,7 +99,7 @@ class BuildAgent implements IBuildAgent {
return dest
}

removeDirectory(dir: string): Promise<void> {
public removeDirectory(dir: string): Promise<void> {
return io.rmRF(dir)
}

Expand Down Expand Up @@ -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)))
}

Expand Down
6 changes: 3 additions & 3 deletions src/agents/local/build-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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'
}
Expand Down Expand Up @@ -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)))
}

Expand Down
12 changes: 6 additions & 6 deletions src/tools/common/dotnet-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ export abstract class DotnetTool implements IDotnetTool {
this.buildAgent.setVariable('DOTNET_NOLOGO', 'true')
}

public execute(cmd: string, args: string[]): Promise<ExecResult> {
this.buildAgent.info(`Command: ${cmd} ${args.join(' ')}`)
return this.buildAgent.exec(cmd, args)
}

public async install(): Promise<string> {
const dotnetExePath = await this.buildAgent.which('dotnet', true)
this.buildAgent.debug(`whichPath: ${dotnetExePath}`)
Expand Down Expand Up @@ -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}.`)
Expand Down Expand Up @@ -149,6 +144,11 @@ export abstract class DotnetTool implements IDotnetTool {
return workDir.replace(/\\/g, '/')
}

protected execute(cmd: string, args: string[]): Promise<ExecResult> {
this.buildAgent.info(`Command: ${cmd} ${args.join(' ')}`)
return this.buildAgent.exec(cmd, args)
}

private async queryLatestMatch(toolName: string, versionSpec: string, includePrerelease: boolean): Promise<string | null> {
this.buildAgent.info(
`Querying tool versions for ${toolName}${versionSpec ? `@${versionSpec}` : ''} ${includePrerelease ? 'including pre-releases' : ''}`
Expand Down
2 changes: 1 addition & 1 deletion src/tools/common/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/tools/gitreleasemanager/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Runner {
this.gitReleaseManagerTool = gitReleaseManagerTool
}

async run(command: Commands): Promise<number> {
public async run(command: Commands): Promise<number> {
switch (command) {
case 'setup':
return await this.setup()
Expand Down
16 changes: 7 additions & 9 deletions src/tools/gitreleasemanager/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export interface IGitReleaseManagerSettingsProvider extends ISettingsProvider {
getPublishSettings(): GitReleaseManagerPublishSettings

getAddAssetSettings(): GitReleaseManagerAddAssetSettings

getCommonSettings(): GitReleaseManagerSettings
}

@injectable()
Expand All @@ -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)
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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)

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/tools/gitversion/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Runner {
this.gitVersionTool = gitVersionTool
}

async run(command: Commands): Promise<number> {
public async run(command: Commands): Promise<number> {
switch (command) {
case 'setup':
return await this.setup()
Expand Down
2 changes: 1 addition & 1 deletion src/tools/gitversion/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8d59d2c

Please sign in to comment.