From a9a4d49a1fb7e587f59f9cd10112636878666621 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 10 Dec 2024 01:22:15 +0000 Subject: [PATCH] dist update --- dist/tools/libs/gitreleasemanager.mjs | 134 +++------------------- dist/tools/libs/gitreleasemanager.mjs.map | 2 +- dist/tools/libs/gitversion.mjs | 128 +++++---------------- dist/tools/libs/gitversion.mjs.map | 2 +- dist/tools/libs/tools.mjs | 52 ++++++++- dist/tools/libs/tools.mjs.map | 2 +- 6 files changed, 95 insertions(+), 225 deletions(-) diff --git a/dist/tools/libs/gitreleasemanager.mjs b/dist/tools/libs/gitreleasemanager.mjs index 9ac8ca557..581b0d054 100644 --- a/dist/tools/libs/gitreleasemanager.mjs +++ b/dist/tools/libs/gitreleasemanager.mjs @@ -1,5 +1,5 @@ import * as path from 'path'; -import { S as SettingsProvider, D as DotnetTool } from './tools.mjs'; +import { S as SettingsProvider, D as DotnetTool, R as RunnerBase } from './tools.mjs'; import 'node:crypto'; import 'node:fs/promises'; import 'node:os'; @@ -204,12 +204,13 @@ class GitReleaseManagerTool extends DotnetTool { } } -class Runner { +class Runner extends RunnerBase { constructor(buildAgent) { + super(buildAgent); this.buildAgent = buildAgent; - this.gitReleaseManagerTool = new GitReleaseManagerTool(this.buildAgent); + this.tool = new GitReleaseManagerTool(this.buildAgent); } - gitReleaseManagerTool; + tool; async run(command) { switch (command) { case "setup": @@ -229,133 +230,28 @@ class Runner { } } async setup() { - try { - this.disableTelemetry(); - this.buildAgent.debug("Installing GitReleaseManager"); - const toolPath = await this.gitReleaseManagerTool.install(); - const pathVariable = this.gitReleaseManagerTool.toolPathVariable; - this.buildAgent.info(`Set ${pathVariable} to ${toolPath}`); - this.buildAgent.setVariable(pathVariable, toolPath); - this.buildAgent.setSucceeded("GitReleaseManager installed successfully", true); - return { - code: 0 - }; - } catch (error) { - if (error instanceof Error) { - this.buildAgent.setFailed(error.message, true); - } - return { - code: -1, - error - }; - } + return this.safeExecute(async () => { + await this.tool.install(); + return { code: 0 }; + }, "GitReleaseManager setup successfully"); } async create() { - try { - this.disableTelemetry(); - this.buildAgent.debug("Creating release"); - const result = await this.gitReleaseManagerTool.create(); - this.buildAgent.setSucceeded("GitReleaseManager created release successfully", true); - return result; - } catch (error) { - if (error instanceof Error) { - this.buildAgent.setFailed(error.message, true); - } - return { - code: -1, - error - }; - } + return this.safeExecute(async () => await this.tool.create(), "GitReleaseManager created release successfully"); } async discard() { - try { - this.disableTelemetry(); - this.buildAgent.debug("Discarding release"); - const result = await this.gitReleaseManagerTool.discard(); - this.buildAgent.setSucceeded("GitReleaseManager discarded release successfully", true); - return result; - } catch (error) { - if (error instanceof Error) { - this.buildAgent.setFailed(error.message, true); - } - return { - code: -1, - error - }; - } + return this.safeExecute(async () => await this.tool.discard(), "GitReleaseManager discarded release successfully"); } async close() { - try { - this.disableTelemetry(); - this.buildAgent.debug("Closing release"); - const result = await this.gitReleaseManagerTool.close(); - this.buildAgent.setSucceeded("GitReleaseManager closed release successfully", true); - return result; - } catch (error) { - if (error instanceof Error) { - this.buildAgent.setFailed(error.message, true); - } - return { - code: -1, - error - }; - } + return this.safeExecute(async () => await this.tool.close(), "GitReleaseManager closed release successfully"); } async open() { - try { - this.disableTelemetry(); - this.buildAgent.debug("Opening release"); - const result = await this.gitReleaseManagerTool.open(); - this.buildAgent.setSucceeded("GitReleaseManager opened release successfully", true); - return result; - } catch (error) { - if (error instanceof Error) { - this.buildAgent.setFailed(error.message, true); - } - return { - code: -1, - error - }; - } + return this.safeExecute(async () => await this.tool.open(), "GitReleaseManager opened release successfully"); } async publish() { - try { - this.disableTelemetry(); - this.buildAgent.debug("Publishing release"); - const result = await this.gitReleaseManagerTool.publish(); - this.buildAgent.setSucceeded("GitReleaseManager published release successfully", true); - return result; - } catch (error) { - if (error instanceof Error) { - this.buildAgent.setFailed(error.message, true); - } - return { - code: -1, - error - }; - } + return this.safeExecute(async () => await this.tool.publish(), "GitReleaseManager published release successfully"); } async addAsset() { - try { - this.disableTelemetry(); - this.buildAgent.debug("Adding asset to release"); - const result = await this.gitReleaseManagerTool.addAsset(); - this.buildAgent.setSucceeded("GitReleaseManager added assets to release successfully", true); - return result; - } catch (error) { - if (error instanceof Error) { - this.buildAgent.setFailed(error.message, true); - } - return { - code: -1, - error - }; - } - } - disableTelemetry() { - this.buildAgent.info(`Running on: '${this.buildAgent.agentName}'`); - this.buildAgent.debug("Disabling telemetry"); - this.gitReleaseManagerTool.disableTelemetry(); + return this.safeExecute(async () => await this.tool.addAsset(), "GitReleaseManager added assets to release successfully"); } } diff --git a/dist/tools/libs/gitreleasemanager.mjs.map b/dist/tools/libs/gitreleasemanager.mjs.map index d38f7df5e..1c2514296 100644 --- a/dist/tools/libs/gitreleasemanager.mjs.map +++ b/dist/tools/libs/gitreleasemanager.mjs.map @@ -1 +1 @@ -{"version":3,"file":"gitreleasemanager.mjs","sources":["../../../src/tools/gitreleasemanager/settings.ts","../../../src/tools/gitreleasemanager/tool.ts","../../../src/tools/gitreleasemanager/runner.ts"],"sourcesContent":["import { type ISettingsProvider, SettingsProvider } from '@tools/common'\nimport {\n type AddAssetSettings,\n type CloseSettings,\n type CreateSettings,\n type DiscardSettings,\n type OpenSettings,\n type PublishSettings,\n type CommonSettings\n} from './models'\nexport interface IGitReleaseManagerSettingsProvider extends ISettingsProvider {\n getCreateSettings(): CreateSettings\n\n getDiscardSettings(): DiscardSettings\n\n getCloseSettings(): CloseSettings\n\n getOpenSettings(): OpenSettings\n\n getPublishSettings(): PublishSettings\n\n getAddAssetSettings(): AddAssetSettings\n\n getCommonSettings(): CommonSettings\n}\n\nexport class GitReleaseManagerSettingsProvider extends SettingsProvider implements IGitReleaseManagerSettingsProvider {\n getCreateSettings(): CreateSettings {\n const name = this.buildAgent.getInput('name')\n const inputFileName = this.buildAgent.getInput('inputFileName')\n const isPreRelease = this.buildAgent.getBooleanInput('isPreRelease')\n const commit = this.buildAgent.getInput('commit')\n const assets = this.buildAgent.getListInput('assets')\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n name,\n inputFileName,\n isPreRelease,\n commit,\n assets\n }\n }\n\n getDiscardSettings(): DiscardSettings {\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings\n }\n }\n\n getCloseSettings(): CloseSettings {\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings\n }\n }\n\n getOpenSettings(): OpenSettings {\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings\n }\n }\n\n getPublishSettings(): PublishSettings {\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings\n }\n }\n\n getAddAssetSettings(): AddAssetSettings {\n const assets = this.buildAgent.getListInput('assets')\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n assets\n }\n }\n\n getCommonSettings(): CommonSettings {\n const milestone = this.buildAgent.getInput('milestone')\n const owner = this.buildAgent.getInput('owner')\n const repository = this.buildAgent.getInput('repository')\n const token = this.buildAgent.getInput('token')\n const targetDirectory = this.buildAgent.getInput('targetDirectory')\n const logFilePath = this.buildAgent.getInput('logFilePath')\n\n return {\n owner,\n repository,\n token,\n targetDirectory,\n milestone,\n logFilePath\n }\n }\n}\n","import * as path from 'path'\n\nimport { DotnetTool } from '@tools/common'\nimport { type ExecResult } from '@agents/common'\n\nimport {\n type AddAssetSettings,\n type CloseSettings,\n type CreateSettings,\n type DiscardSettings,\n type OpenSettings,\n type PublishSettings,\n type CommonSettings\n} from './models'\nimport { GitReleaseManagerSettingsProvider, IGitReleaseManagerSettingsProvider } from './settings'\n\nexport class GitReleaseManagerTool extends DotnetTool {\n get packageName(): string {\n return 'GitReleaseManager.Tool'\n }\n\n get toolName(): string {\n return 'dotnet-gitreleasemanager'\n }\n\n get toolPathVariable(): string {\n return 'GITRELEASEMANAGER_PATH'\n }\n\n get versionRange(): string | null {\n return '>=0.10.0 <0.20.0'\n }\n\n get settingsProvider(): IGitReleaseManagerSettingsProvider {\n return new GitReleaseManagerSettingsProvider(this.buildAgent)\n }\n\n async create(): Promise {\n const settings = this.settingsProvider.getCreateSettings()\n const args = await this.getCreateArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async discard(): Promise {\n const settings = this.settingsProvider.getDiscardSettings()\n const args = await this.getDiscardArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async close(): Promise {\n const settings = this.settingsProvider.getCloseSettings()\n const args = await this.getCloseArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async open(): Promise {\n const settings = this.settingsProvider.getOpenSettings()\n const args = await this.getOpenArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async publish(): Promise {\n const settings = this.settingsProvider.getPublishSettings()\n const args = await this.getPublishArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async addAsset(): Promise {\n const settings = this.settingsProvider.getAddAssetSettings()\n const args = await this.getAddAssetArguments(settings)\n\n return await this.executeTool(args)\n }\n\n protected async getCommonArguments(settings: CommonSettings): Promise {\n const args: string[] = []\n\n args.push('--owner', settings.owner)\n args.push('--repository', settings.repository)\n args.push('--token', settings.token)\n\n settings.targetDirectory = await this.getRepoDir(settings)\n\n args.push('--targetDirectory', settings.targetDirectory)\n args.push('--logFilePath', settings.logFilePath)\n\n return args\n }\n\n protected async getCreateArguments(settings: CreateSettings): Promise {\n const args: string[] = ['create', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n if (settings.name) {\n args.push('--name', settings.name)\n }\n if (settings.commit) {\n args.push('--targetcommitish', settings.commit)\n }\n\n if (settings.inputFileName) {\n if (await this.buildAgent.fileExists(settings.inputFileName)) {\n args.push('--inputFilePath', settings.inputFileName)\n } else {\n throw new Error(`GitReleaseManager inputFilePath not found at ${settings.inputFileName}`)\n }\n }\n if (settings.isPreRelease) {\n args.push('--pre')\n }\n if (settings.assets && settings.assets.length > 0) {\n settings.assets = settings.assets.map(asset => {\n return path.join(settings.targetDirectory, asset)\n })\n\n args.push('--assets', settings.assets.join(','))\n }\n\n return args\n }\n\n protected async getDiscardArguments(settings: DiscardSettings): Promise {\n const args: string[] = ['discard', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n\n return args\n }\n\n protected async getCloseArguments(settings: CloseSettings): Promise {\n const args: string[] = ['close', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n\n return args\n }\n\n protected async getOpenArguments(settings: OpenSettings): Promise {\n const args: string[] = ['open', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n\n return args\n }\n\n protected async getPublishArguments(settings: PublishSettings): Promise {\n const args: string[] = ['publish', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--tagName', settings.milestone)\n }\n\n return args\n }\n\n protected async getAddAssetArguments(settings: AddAssetSettings): Promise {\n const args: string[] = ['addasset', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--tagName', settings.milestone)\n }\n if (settings.assets && settings.assets.length > 0) {\n settings.assets = settings.assets.map(asset => {\n return path.join(settings.targetDirectory, asset)\n })\n\n args.push('--assets', settings.assets.join(','))\n }\n\n return args\n }\n\n protected async getRepoDir(settings: CommonSettings): Promise {\n return await this.getRepoPath(settings.targetDirectory)\n }\n}\n","import { type ExecResult, type IBuildAgent } from '@agents/common'\nimport { type IRunner } from '@tools/common'\nimport { type Commands } from './models'\nimport { GitReleaseManagerTool } from './tool'\n\nexport class Runner implements IRunner {\n private readonly gitReleaseManagerTool: GitReleaseManagerTool\n\n constructor(private readonly buildAgent: IBuildAgent) {\n this.gitReleaseManagerTool = new GitReleaseManagerTool(this.buildAgent)\n }\n\n async run(command: Commands): Promise {\n switch (command) {\n case 'setup':\n return await this.setup()\n case 'addasset':\n return await this.addAsset()\n case 'open':\n return await this.open()\n case 'close':\n return await this.close()\n case 'create':\n return await this.create()\n case 'discard':\n return await this.discard()\n case 'publish':\n return await this.publish()\n }\n }\n\n private async setup(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Installing GitReleaseManager')\n const toolPath = await this.gitReleaseManagerTool.install()\n\n const pathVariable = this.gitReleaseManagerTool.toolPathVariable\n this.buildAgent.info(`Set ${pathVariable} to ${toolPath}`)\n this.buildAgent.setVariable(pathVariable, toolPath)\n\n this.buildAgent.setSucceeded('GitReleaseManager installed successfully', true)\n return {\n code: 0\n }\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error: error as Error\n }\n }\n }\n\n private async create(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Creating release')\n\n const result = await this.gitReleaseManagerTool.create()\n\n this.buildAgent.setSucceeded('GitReleaseManager created release successfully', true)\n return result\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error: error as Error\n }\n }\n }\n\n private async discard(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Discarding release')\n\n const result = await this.gitReleaseManagerTool.discard()\n\n this.buildAgent.setSucceeded('GitReleaseManager discarded release successfully', true)\n return result\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error: error as Error\n }\n }\n }\n\n private async close(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Closing release')\n\n const result = await this.gitReleaseManagerTool.close()\n\n this.buildAgent.setSucceeded('GitReleaseManager closed release successfully', true)\n return result\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error: error as Error\n }\n }\n }\n\n private async open(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Opening release')\n\n const result = await this.gitReleaseManagerTool.open()\n\n this.buildAgent.setSucceeded('GitReleaseManager opened release successfully', true)\n return result\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error: error as Error\n }\n }\n }\n\n private async publish(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Publishing release')\n\n const result = await this.gitReleaseManagerTool.publish()\n\n this.buildAgent.setSucceeded('GitReleaseManager published release successfully', true)\n return result\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error: error as Error\n }\n }\n }\n\n private async addAsset(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Adding asset to release')\n\n const result = await this.gitReleaseManagerTool.addAsset()\n\n this.buildAgent.setSucceeded('GitReleaseManager added assets to release successfully', true)\n return result\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error: error as Error\n }\n }\n }\n\n private disableTelemetry(): void {\n this.buildAgent.info(`Running on: '${this.buildAgent.agentName}'`)\n this.buildAgent.debug('Disabling telemetry')\n this.gitReleaseManagerTool.disableTelemetry()\n }\n}\n"],"names":[],"mappings":";;;;;;;;AA0BO,MAAM,0CAA0C,gBAA+D,CAAA;AAAA,EAClH,iBAAoC,GAAA;AAChC,IAAA,MAAM,IAAO,GAAA,IAAA,CAAK,UAAW,CAAA,QAAA,CAAyB,MAAM,CAAA;AAC5D,IAAA,MAAM,aAAgB,GAAA,IAAA,CAAK,UAAW,CAAA,QAAA,CAAyB,eAAe,CAAA;AAC9E,IAAA,MAAM,YAAe,GAAA,IAAA,CAAK,UAAW,CAAA,eAAA,CAAgC,cAAc,CAAA;AACnF,IAAA,MAAM,MAAS,GAAA,IAAA,CAAK,UAAW,CAAA,QAAA,CAAyB,QAAQ,CAAA;AAChE,IAAA,MAAM,MAAS,GAAA,IAAA,CAAK,UAAW,CAAA,YAAA,CAA6B,QAAQ,CAAA;AAEpE,IAAM,MAAA,cAAA,GAAiB,KAAK,iBAAkB,EAAA;AAC9C,IAAO,OAAA;AAAA,MACH,GAAG,cAAA;AAAA,MACH,IAAA;AAAA,MACA,aAAA;AAAA,MACA,YAAA;AAAA,M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sBAAsB,gBAAiB,EAAA;AAAA;AAEpD;;;;"} \ No newline at end of file +{"version":3,"file":"gitreleasemanager.mjs","sources":["../../../src/tools/gitreleasemanager/settings.ts","../../../src/tools/gitreleasemanager/tool.ts","../../../src/tools/gitreleasemanager/runner.ts"],"sourcesContent":["import { type ISettingsProvider, SettingsProvider } from '@tools/common'\nimport {\n type AddAssetSettings,\n type CloseSettings,\n type CreateSettings,\n type DiscardSettings,\n type OpenSettings,\n type PublishSettings,\n type CommonSettings\n} from './models'\nexport interface IGitReleaseManagerSettingsProvider extends ISettingsProvider {\n getCreateSettings(): CreateSettings\n\n getDiscardSettings(): DiscardSettings\n\n getCloseSettings(): CloseSettings\n\n getOpenSettings(): OpenSettings\n\n getPublishSettings(): PublishSettings\n\n getAddAssetSettings(): AddAssetSettings\n\n getCommonSettings(): CommonSettings\n}\n\nexport class GitReleaseManagerSettingsProvider extends SettingsProvider implements IGitReleaseManagerSettingsProvider {\n getCreateSettings(): CreateSettings {\n const name = this.buildAgent.getInput('name')\n const inputFileName = this.buildAgent.getInput('inputFileName')\n const isPreRelease = this.buildAgent.getBooleanInput('isPreRelease')\n const commit = this.buildAgent.getInput('commit')\n const assets = this.buildAgent.getListInput('assets')\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n name,\n inputFileName,\n isPreRelease,\n commit,\n assets\n }\n }\n\n getDiscardSettings(): DiscardSettings {\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings\n }\n }\n\n getCloseSettings(): CloseSettings {\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings\n }\n }\n\n getOpenSettings(): OpenSettings {\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings\n }\n }\n\n getPublishSettings(): PublishSettings {\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings\n }\n }\n\n getAddAssetSettings(): AddAssetSettings {\n const assets = this.buildAgent.getListInput('assets')\n\n const commonSettings = this.getCommonSettings()\n return {\n ...commonSettings,\n assets\n }\n }\n\n getCommonSettings(): CommonSettings {\n const milestone = this.buildAgent.getInput('milestone')\n const owner = this.buildAgent.getInput('owner')\n const repository = this.buildAgent.getInput('repository')\n const token = this.buildAgent.getInput('token')\n const targetDirectory = this.buildAgent.getInput('targetDirectory')\n const logFilePath = this.buildAgent.getInput('logFilePath')\n\n return {\n owner,\n repository,\n token,\n targetDirectory,\n milestone,\n logFilePath\n }\n }\n}\n","import * as path from 'path'\n\nimport { DotnetTool } from '@tools/common'\nimport { type ExecResult } from '@agents/common'\n\nimport {\n type AddAssetSettings,\n type CloseSettings,\n type CreateSettings,\n type DiscardSettings,\n type OpenSettings,\n type PublishSettings,\n type CommonSettings\n} from './models'\nimport { GitReleaseManagerSettingsProvider, IGitReleaseManagerSettingsProvider } from './settings'\n\nexport class GitReleaseManagerTool extends DotnetTool {\n get packageName(): string {\n return 'GitReleaseManager.Tool'\n }\n\n get toolName(): string {\n return 'dotnet-gitreleasemanager'\n }\n\n get toolPathVariable(): string {\n return 'GITRELEASEMANAGER_PATH'\n }\n\n get versionRange(): string | null {\n return '>=0.10.0 <0.20.0'\n }\n\n get settingsProvider(): IGitReleaseManagerSettingsProvider {\n return new GitReleaseManagerSettingsProvider(this.buildAgent)\n }\n\n async create(): Promise {\n const settings = this.settingsProvider.getCreateSettings()\n const args = await this.getCreateArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async discard(): Promise {\n const settings = this.settingsProvider.getDiscardSettings()\n const args = await this.getDiscardArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async close(): Promise {\n const settings = this.settingsProvider.getCloseSettings()\n const args = await this.getCloseArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async open(): Promise {\n const settings = this.settingsProvider.getOpenSettings()\n const args = await this.getOpenArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async publish(): Promise {\n const settings = this.settingsProvider.getPublishSettings()\n const args = await this.getPublishArguments(settings)\n\n return await this.executeTool(args)\n }\n\n async addAsset(): Promise {\n const settings = this.settingsProvider.getAddAssetSettings()\n const args = await this.getAddAssetArguments(settings)\n\n return await this.executeTool(args)\n }\n\n protected async getCommonArguments(settings: CommonSettings): Promise {\n const args: string[] = []\n\n args.push('--owner', settings.owner)\n args.push('--repository', settings.repository)\n args.push('--token', settings.token)\n\n settings.targetDirectory = await this.getRepoDir(settings)\n\n args.push('--targetDirectory', settings.targetDirectory)\n args.push('--logFilePath', settings.logFilePath)\n\n return args\n }\n\n protected async getCreateArguments(settings: CreateSettings): Promise {\n const args: string[] = ['create', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n if (settings.name) {\n args.push('--name', settings.name)\n }\n if (settings.commit) {\n args.push('--targetcommitish', settings.commit)\n }\n\n if (settings.inputFileName) {\n if (await this.buildAgent.fileExists(settings.inputFileName)) {\n args.push('--inputFilePath', settings.inputFileName)\n } else {\n throw new Error(`GitReleaseManager inputFilePath not found at ${settings.inputFileName}`)\n }\n }\n if (settings.isPreRelease) {\n args.push('--pre')\n }\n if (settings.assets && settings.assets.length > 0) {\n settings.assets = settings.assets.map(asset => {\n return path.join(settings.targetDirectory, asset)\n })\n\n args.push('--assets', settings.assets.join(','))\n }\n\n return args\n }\n\n protected async getDiscardArguments(settings: DiscardSettings): Promise {\n const args: string[] = ['discard', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n\n return args\n }\n\n protected async getCloseArguments(settings: CloseSettings): Promise {\n const args: string[] = ['close', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n\n return args\n }\n\n protected async getOpenArguments(settings: OpenSettings): Promise {\n const args: string[] = ['open', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--milestone', settings.milestone)\n }\n\n return args\n }\n\n protected async getPublishArguments(settings: PublishSettings): Promise {\n const args: string[] = ['publish', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--tagName', settings.milestone)\n }\n\n return args\n }\n\n protected async getAddAssetArguments(settings: AddAssetSettings): Promise {\n const args: string[] = ['addasset', ...(await this.getCommonArguments(settings))]\n\n if (settings.milestone) {\n args.push('--tagName', settings.milestone)\n }\n if (settings.assets && settings.assets.length > 0) {\n settings.assets = settings.assets.map(asset => {\n return path.join(settings.targetDirectory, asset)\n })\n\n args.push('--assets', settings.assets.join(','))\n }\n\n return args\n }\n\n protected async getRepoDir(settings: CommonSettings): Promise {\n return await this.getRepoPath(settings.targetDirectory)\n }\n}\n","import { type ExecResult, type IBuildAgent } from '@agents/common'\nimport { type Commands } from './models'\nimport { GitReleaseManagerTool } from './tool'\nimport { RunnerBase } from '../common/runner'\n\nexport class Runner extends RunnerBase {\n protected readonly tool: GitReleaseManagerTool\n\n constructor(protected readonly buildAgent: IBuildAgent) {\n super(buildAgent)\n this.tool = new GitReleaseManagerTool(this.buildAgent)\n }\n\n async run(command: Commands): Promise {\n switch (command) {\n case 'setup':\n return await this.setup()\n case 'addasset':\n return await this.addAsset()\n case 'open':\n return await this.open()\n case 'close':\n return await this.close()\n case 'create':\n return await this.create()\n case 'discard':\n return await this.discard()\n case 'publish':\n return await this.publish()\n }\n }\n\n private async setup(): Promise {\n return this.safeExecute(async () => {\n await this.tool.install()\n return { code: 0 }\n }, 'GitReleaseManager setup successfully')\n }\n\n private async create(): Promise {\n return this.safeExecute(async () => await this.tool.create(), 'GitReleaseManager created release successfully')\n }\n\n private async discard(): Promise {\n return this.safeExecute(async () => await this.tool.discard(), 'GitReleaseManager discarded release successfully')\n }\n\n private async close(): Promise {\n return this.safeExecute(async () => await this.tool.close(), 'GitReleaseManager closed release successfully')\n }\n\n private async open(): Promise {\n return this.safeExecute(async () => await this.tool.open(), 'GitReleaseManager opened release successfully')\n }\n\n private async publish(): Promise {\n return this.safeExecute(async () => await this.tool.publish(), 'GitReleaseManager published release successfully')\n }\n\n private async addAsset(): Promise {\n return this.safeExecute(async () => await this.tool.addAsset(), 'GitReleaseManager added ass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;AACvC,IAAO,OAAA,IAAA,CAAK,YAAY,YAAY;AAChC,MAAM,MAAA,IAAA,CAAK,KAAK,OAAQ,EAAA;AACxB,MAAO,OAAA,EAAE,MAAM,CAAE,EAAA;AAAA,OAClB,sCAAsC,CAAA;AAAA;AAC7C,EAEA,MAAc,MAA8B,GAAA;AACxC,IAAO,OAAA,IAAA,CAAK,YAAY,YAAY,MAAM,KAAK,IAAK,CAAA,MAAA,IAAU,gDAAgD,CAAA;AAAA;AAClH,EAEA,MAAc,OAA+B,GAAA;AACzC,IAAO,OAAA,IAAA,CAAK,YAAY,YAAY,MAAM,KAAK,IAAK,CAAA,OAAA,IAAW,kDAAkD,CAAA;AAAA;AACrH,EAEA,MAAc,KAA6B,GAAA;AACvC,IAAO,OAAA,IAAA,CAAK,YAAY,YAAY,MAAM,KAAK,IAAK,CAAA,KAAA,IAAS,+CAA+C,CAAA;AAAA;AAChH,EAEA,MAAc,IAA4B,GAAA;AACtC,IAAO,OAAA,IAAA,CAAK,YAAY,YAAY,MAAM,KAAK,IAAK,CAAA,IAAA,IAAQ,+CAA+C,CAAA;AAAA;AAC/G,EAEA,MAAc,OAA+B,GAAA;AACzC,IAAO,OAAA,IAAA,CAAK,YAAY,YAAY,MAAM,KAAK,IAAK,CAAA,OAAA,IAAW,kDAAkD,CAAA;AAAA;AACrH,EAEA,MAAc,QAAgC,GAAA;AAC1C,IAAO,OAAA,IAAA,CAAK,YAAY,YAAY,MAAM,KAAK,IAAK,CAAA,QAAA,IAAY,wDAAwD,CAAA;AAAA;AAEhI;;;;"} \ No newline at end of file diff --git a/dist/tools/libs/gitversion.mjs b/dist/tools/libs/gitversion.mjs index adc549199..7adbea1a8 100644 --- a/dist/tools/libs/gitversion.mjs +++ b/dist/tools/libs/gitversion.mjs @@ -1,4 +1,4 @@ -import { S as SettingsProvider, D as DotnetTool, k as keysOf } from './tools.mjs'; +import { S as SettingsProvider, D as DotnetTool, k as keysOf, R as RunnerBase } from './tools.mjs'; import 'node:crypto'; import 'node:fs/promises'; import 'node:os'; @@ -93,7 +93,7 @@ class GitVersionTool extends DotnetTool { return await super.getRepoPath(settings.targetPath); } async getExecuteArguments(workDir, options) { - const args = [workDir, "/output", "json"]; + const args = [workDir, "/output", "json", "/l", "console"]; const { useConfigFile, disableCache, @@ -211,12 +211,13 @@ class GitVersionTool extends DotnetTool { } } -class Runner { +class Runner extends RunnerBase { constructor(buildAgent) { + super(buildAgent); this.buildAgent = buildAgent; - this.gitVersionTool = new GitVersionTool(this.buildAgent); + this.tool = new GitVersionTool(this.buildAgent); } - gitVersionTool; + tool; async run(command) { switch (command) { case "setup": @@ -228,109 +229,38 @@ class Runner { } } async setup() { - try { - this.disableTelemetry(); - this.buildAgent.debug("Installing GitVersion"); - const toolPath = await this.gitVersionTool.install(); - const pathVariable = this.gitVersionTool.toolPathVariable; - this.buildAgent.info(`Set ${pathVariable} to ${toolPath}`); - this.buildAgent.setVariable(pathVariable, toolPath); - this.buildAgent.setSucceeded("GitVersion installed successfully", true); - return { - code: 0 - }; - } catch (error) { - if (error instanceof Error) { - this.buildAgent.setFailed(error.message, true); - } - return { - code: -1, - error - }; - } + return this.safeExecute(async () => { + await this.tool.install(); + return { code: 0 }; + }, "GitVersion setup successfully"); } async execute() { - try { - this.disableTelemetry(); - this.buildAgent.info("Executing GitVersion"); - const result = await this.gitVersionTool.executeJson(); - if (result.code === 0) { - this.buildAgent.info("GitVersion executed successfully"); - const stdout = result.stdout; - this.buildAgent.info("GitVersion output:"); - this.buildAgent.info("-------------------"); - this.buildAgent.info(stdout); - this.buildAgent.info("-------------------"); - this.buildAgent.debug("Parsing GitVersion output"); - if (stdout.lastIndexOf("{") === -1 || stdout.lastIndexOf("}") === -1) { - this.buildAgent.debug("GitVersion output is not valid JSON"); - this.buildAgent.setFailed("GitVersion output is not valid JSON", true); - return { - code: -1, - error: new Error("GitVersion output is not valid JSON") - }; - } else { - const jsonOutput = stdout.substring(stdout.lastIndexOf("{"), stdout.lastIndexOf("}") + 1); - const gitVersionOutput = JSON.parse(jsonOutput); - this.gitVersionTool.writeGitVersionToAgent(gitVersionOutput); - this.buildAgent.setSucceeded("GitVersion executed successfully", true); - return result; - } - } else { - this.buildAgent.debug("GitVersion failed"); - const error = result.error; - if (error instanceof Error) { - this.buildAgent.setFailed(error.message, true); - } - return result; - } - } catch (error) { - if (error instanceof Error) { - this.buildAgent.setFailed(error.message, true); - } - return { - code: -1, - error - }; - } + return this.safeExecute(async () => { + const result = await this.tool.executeJson(); + this.buildAgent.debug("Parsing GitVersion output"); + return this.processGitVersionOutput(result); + }, "GitVersion executed successfully"); } async command() { - try { - this.disableTelemetry(); - this.buildAgent.info("Executing GitVersion"); - const result = await this.gitVersionTool.executeCommand(); - if (result.code === 0) { - this.buildAgent.info("GitVersion executed successfully"); - const stdout = result.stdout; - this.buildAgent.info("GitVersion output:"); - this.buildAgent.info("-------------------"); - this.buildAgent.info(stdout); - this.buildAgent.info("-------------------"); - this.buildAgent.setSucceeded("GitVersion executed successfully", true); - return result; - } else { - this.buildAgent.debug("GitVersion failed"); - const error = result.error; - if (error instanceof Error) { - this.buildAgent.setFailed(error.message, true); - } - return result; - } - } catch (error) { - if (error instanceof Error) { - this.buildAgent.setFailed(error.message, true); - } + return this.safeExecute(async () => await this.tool.executeCommand(), "GitVersion executed successfully"); + } + processGitVersionOutput(result) { + const stdout = result.stdout; + if (stdout.lastIndexOf("{") === -1 || stdout.lastIndexOf("}") === -1) { + this.buildAgent.debug("GitVersion output is not valid JSON"); + this.buildAgent.setFailed("GitVersion output is not valid JSON", true); return { code: -1, - error + error: new Error("GitVersion output is not valid JSON") }; + } else { + const jsonOutput = stdout.substring(stdout.lastIndexOf("{"), stdout.lastIndexOf("}") + 1); + const gitVersionOutput = JSON.parse(jsonOutput); + this.tool.writeGitVersionToAgent(gitVersionOutput); + this.buildAgent.setSucceeded("GitVersion executed successfully", true); + return result; } } - disableTelemetry() { - this.buildAgent.info(`Running on: '${this.buildAgent.agentName}'`); - this.buildAgent.debug("Disabling telemetry"); - this.gitVersionTool.disableTelemetry(); - } } export { Runner }; diff --git a/dist/tools/libs/gitversion.mjs.map b/dist/tools/libs/gitversion.mjs.map index 92e4cdc2e..d4561bbf5 100644 --- a/dist/tools/libs/gitversion.mjs.map +++ b/dist/tools/libs/gitversion.mjs.map @@ -1 +1 @@ -{"version":3,"file":"gitversion.mjs","sources":["../../../src/tools/gitversion/settings.ts","../../../src/tools/gitversion/tool.ts","../../../src/tools/gitversion/runner.ts"],"sourcesContent":["import { type ISettingsProvider, SettingsProvider } from '@tools/common'\nimport { type CommandSettings, type ExecuteSettings } from './models'\n\nexport interface IGitVersionSettingsProvider extends ISettingsProvider {\n getExecuteSettings(): ExecuteSettings\n\n getCommandSettings(): CommandSettings\n}\n\nexport class GitVersionSettingsProvider extends SettingsProvider implements IGitVersionSettingsProvider {\n getExecuteSettings(): ExecuteSettings {\n const targetPath = this.buildAgent.getInput('targetPath')\n\n const disableCache = this.buildAgent.getBooleanInput('disableCache')\n const disableNormalization = this.buildAgent.getBooleanInput('disableNormalization')\n const disableShallowCloneCheck = this.buildAgent.getBooleanInput('disableShallowCloneCheck')\n\n const useConfigFile = this.buildAgent.getBooleanInput('useConfigFile')\n const configFilePath = this.buildAgent.getInput('configFilePath')\n const overrideConfig = this.buildAgent.getListInput('overrideConfig')\n\n const updateAssemblyInfo = this.buildAgent.getBooleanInput('updateAssemblyInfo')\n const updateAssemblyInfoFilename = this.buildAgent.getInput('updateAssemblyInfoFilename')\n\n return {\n targetPath,\n disableCache,\n disableNormalization,\n disableShallowCloneCheck,\n useConfigFile,\n configFilePath,\n overrideConfig,\n updateAssemblyInfo,\n updateAssemblyInfoFilename\n }\n }\n\n getCommandSettings(): CommandSettings {\n const targetPath = this.buildAgent.getInput('targetPath')\n const disableShallowCloneCheck = this.buildAgent.getBooleanInput('disableShallowCloneCheck')\n const args = this.buildAgent.getInput('arguments')\n\n return {\n targetPath,\n disableShallowCloneCheck,\n arguments: args\n }\n }\n}\n","import { type ExecResult } from '@agents/common'\nimport { DotnetTool, keysOf } from '@tools/common'\nimport { type CommandSettings, type ExecuteSettings, type GitVersionOutput } from './models'\nimport { GitVersionSettingsProvider, type IGitVersionSettingsProvider } from './settings'\n\nexport class GitVersionTool extends DotnetTool {\n get packageName(): string {\n return 'GitVersion.Tool'\n }\n\n get toolName(): string {\n return 'dotnet-gitversion'\n }\n\n get toolPathVariable(): string {\n return 'GITVERSION_PATH'\n }\n\n get versionRange(): string | null {\n return '>=5.2.0 <6.1.0'\n }\n\n get settingsProvider(): IGitVersionSettingsProvider {\n return new GitVersionSettingsProvider(this.buildAgent)\n }\n\n async executeJson(): Promise {\n const settings = this.settingsProvider.getExecuteSettings()\n const workDir = await this.getRepoDir(settings)\n\n await this.checkShallowClone(settings, workDir)\n\n const args = await this.getExecuteArguments(workDir, settings)\n\n await this.setDotnetRoot()\n return await this.executeTool(args)\n }\n\n async executeCommand(): Promise {\n const settings = this.settingsProvider.getCommandSettings()\n const workDir = await this.getRepoDir(settings)\n\n await this.checkShallowClone(settings, workDir)\n\n const args = this.getCommandArguments(workDir, settings)\n\n await this.setDotnetRoot()\n return await this.executeTool(args)\n }\n\n writeGitVersionToAgent(output: GitVersionOutput): void {\n for (const property of keysOf(output)) {\n const name = this.toCamelCase(property)\n try {\n let value = output[property]?.toString()\n if (value === '0') {\n value = '0'\n }\n this.buildAgent.setOutput(name, value)\n this.buildAgent.setOutput(`GitVersion_${property}`, value)\n this.buildAgent.setVariable(name, value)\n this.buildAgent.setVariable(`GitVersion_${property}`, value)\n } catch (_error) {\n this.buildAgent.error(`Unable to set output/variable for ${property}`)\n }\n }\n }\n\n protected async getRepoDir(settings: ExecuteSettings | CommandSettings): Promise {\n return await super.getRepoPath(settings.targetPath)\n }\n\n protected async getExecuteArguments(workDir: string, options: ExecuteSettings): Promise {\n const args = [workDir, '/output', 'json']\n\n const {\n useConfigFile,\n disableCache,\n disableNormalization,\n configFilePath,\n overrideConfig,\n updateAssemblyInfo,\n updateAssemblyInfoFilename\n //\n } = options\n\n if (disableCache) {\n args.push('/nocache')\n }\n\n if (disableNormalization) {\n args.push('/nonormalize')\n }\n\n if (useConfigFile) {\n if (await this.isValidInputFile('configFilePath', configFilePath)) {\n args.push('/config', configFilePath)\n } else {\n throw new Error(`GitVersion configuration file not found at ${configFilePath}`)\n }\n }\n\n if (overrideConfig) {\n for (let config of overrideConfig) {\n config = config.trim()\n if (config.match(/([a-zA-Z0-9]+(-[a-zA-Z]+)*=[a-zA-Z0-9\\- :.']*)/)) {\n args.push('/overrideconfig', config)\n }\n }\n }\n\n if (updateAssemblyInfo) {\n args.push('/updateassemblyinfo')\n\n // You can specify 'updateAssemblyInfo' without 'updateAssemblyInfoFilename'.\n if (updateAssemblyInfoFilename?.length > 0) {\n if (await this.isValidInputFile('updateAssemblyInfoFilename', updateAssemblyInfoFilename)) {\n args.push(updateAssemblyInfoFilename)\n } else {\n throw new Error(`AssemblyInfoFilename file not found at ${updateAssemblyInfoFilename}`)\n }\n }\n }\n\n return args\n }\n\n protected getCommandArguments(workDir: string, options: CommandSettings): string[] {\n let args = [workDir]\n\n if (options.arguments) {\n args = args.concat(this.argStringToArray(options.arguments))\n }\n return args\n }\n\n private argStringToArray(argString: string): string[] {\n const args: string[] = []\n\n let inQuotes = false\n let escaped = false\n let lastCharWasSpace = true\n let arg = ''\n\n const append = (c: string): void => {\n // we only escape double quotes.\n if (escaped && c !== '\"') {\n arg += '\\\\'\n }\n\n arg += c\n escaped = false\n }\n\n for (let i = 0; i < argString.length; i++) {\n const c = argString.charAt(i)\n\n if (c === ' ' && !inQuotes) {\n if (!lastCharWasSpace) {\n args.push(arg)\n arg = ''\n }\n lastCharWasSpace = true\n continue\n } else {\n lastCharWasSpace = false\n }\n\n if (c === '\"') {\n if (!escaped) {\n inQuotes = !inQuotes\n } else {\n append(c)\n }\n continue\n }\n\n if (c === '\\\\' && escaped) {\n append(c)\n continue\n }\n\n if (c === '\\\\' && inQuotes) {\n escaped = true\n continue\n }\n\n append(c)\n lastCharWasSpace = false\n }\n\n if (!lastCharWasSpace) {\n args.push(arg.trim())\n }\n\n return args\n }\n\n private async checkShallowClone(settings: ExecuteSettings | CommandSettings, workDir: string): Promise {\n if (!settings.disableShallowCloneCheck) {\n const isShallowResult = await this.execute('git', ['-C', workDir, 'rev-parse', '--is-shallow-repository'])\n if (isShallowResult.code === 0 && isShallowResult.stdout?.trim() === 'true') {\n throw new Error(\n 'The repository is shallow. Consider disabling shallow clones. See https://github.com/GitTools/actions/blob/main/docs/cloning.md for more information.'\n )\n }\n }\n }\n\n private toCamelCase(input: string): string {\n return input.replace(/^\\w|[A-Z]|\\b\\w|\\s+/g, function (match, index) {\n if (+match === 0) return '' // or if (/\\s+/.test(match)) for white spaces\n return index === 0 ? match.toLowerCase() : match.toUpperCase()\n })\n }\n}\n","import { type ExecResult, type IBuildAgent } from '@agents/common'\nimport { type IRunner } from '@tools/common'\nimport { type Commands, type GitVersionOutput } from './models'\nimport { GitVersionTool } from './tool'\n\nexport class Runner implements IRunner {\n private readonly gitVersionTool: GitVersionTool\n\n constructor(private readonly buildAgent: IBuildAgent) {\n this.gitVersionTool = new GitVersionTool(this.buildAgent)\n }\n\n async run(command: Commands): Promise {\n switch (command) {\n case 'setup':\n return await this.setup()\n case 'execute':\n return await this.execute()\n case 'command':\n return await this.command()\n }\n }\n\n private async setup(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.debug('Installing GitVersion')\n const toolPath = await this.gitVersionTool.install()\n\n const pathVariable = this.gitVersionTool.toolPathVariable\n this.buildAgent.info(`Set ${pathVariable} to ${toolPath}`)\n this.buildAgent.setVariable(pathVariable, toolPath)\n\n this.buildAgent.setSucceeded('GitVersion installed successfully', true)\n return {\n code: 0\n }\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error: error as Error\n }\n }\n }\n\n private async execute(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.info('Executing GitVersion')\n\n const result = await this.gitVersionTool.executeJson()\n\n if (result.code === 0) {\n this.buildAgent.info('GitVersion executed successfully')\n const stdout: string = result.stdout as string\n\n this.buildAgent.info('GitVersion output:')\n this.buildAgent.info('-------------------')\n this.buildAgent.info(stdout)\n this.buildAgent.info('-------------------')\n this.buildAgent.debug('Parsing GitVersion output')\n\n if (stdout.lastIndexOf('{') === -1 || stdout.lastIndexOf('}') === -1) {\n this.buildAgent.debug('GitVersion output is not valid JSON')\n this.buildAgent.setFailed('GitVersion output is not valid JSON', true)\n return {\n code: -1,\n error: new Error('GitVersion output is not valid JSON')\n }\n } else {\n const jsonOutput = stdout.substring(stdout.lastIndexOf('{'), stdout.lastIndexOf('}') + 1)\n\n const gitVersionOutput = JSON.parse(jsonOutput) as GitVersionOutput\n this.gitVersionTool.writeGitVersionToAgent(gitVersionOutput)\n this.buildAgent.setSucceeded('GitVersion executed successfully', true)\n return result\n }\n } else {\n this.buildAgent.debug('GitVersion failed')\n const error = result.error\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return result\n }\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error: error as Error\n }\n }\n }\n\n private async command(): Promise {\n try {\n this.disableTelemetry()\n\n this.buildAgent.info('Executing GitVersion')\n\n const result = await this.gitVersionTool.executeCommand()\n\n if (result.code === 0) {\n this.buildAgent.info('GitVersion executed successfully')\n const stdout = result.stdout as string\n\n this.buildAgent.info('GitVersion output:')\n this.buildAgent.info('-------------------')\n this.buildAgent.info(stdout)\n this.buildAgent.info('-------------------')\n\n this.buildAgent.setSucceeded('GitVersion executed successfully', true)\n return result\n } else {\n this.buildAgent.debug('GitVersion failed')\n const error = result.error\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return result\n }\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error: error as Error\n }\n }\n }\n\n private disableTelemetry(): void {\n this.buildAgent.info(`Running on: '${this.buildAgent.agentName}'`)\n this.buildAgent.debug('Disabling telemetry')\n this.gitVersionTool.disableTelemetry()\n }\n}\n"],"names":[],"mappings":";;;;;;;AASO,MAAM,mCAAmC,gBAAwD,CAAA;AAAA,EACpG,kBAAsC,GAAA;AAClC,IAAA,MAAM,UAAa,GAAA,IAAA,CAAK,UAAW,CAAA,QAAA,CAA0B,YAAY,CAAA;AAEzE,IAAA,MAAM,YAAe,GAAA,IAAA,CAAK,UAAW,CAAA,eAAA,CAAiC,cAAc,CAAA;AACpF,IAAA,MAAM,oBAAuB,GAAA,IAAA,CAAK,UAAW,CAAA,eAAA,CAAiC,sBAAsB,CAAA;AACpG,IAAA,MAAM,wBAA2B,GAAA,IAAA,CAAK,UAAW,CAAA,eAAA,CAAiC,0BAA0B,CAAA;AAE5G,IAAA,MAAM,aAAgB,GAAA,IAAA,CAAK,UAAW,CAAA,eAAA,CAAiC,eAAe,CAAA;AACtF,IAAA,MAAM,cAAiB,GAAA,IAAA,CAAK,UAAW,CAAA,QAAA,CAA0B,gBAAgB,CAAA;AACjF,IAAA,MAAM,cAAiB,GAAA,IAAA,CAAK,UAAW,CAAA,YAAA,CAA8B,gBAAgB,CAAA;AAErF,IAAA,MAAM,kBAAqB,GAAA,IAAA,CAAK,UAAW,CAAA,eAAA,CAAiC,oBAAoB,CAAA;AAChG,IAAA,MAAM,0BAA6B,GAAA,IAAA,CAAK,UAAW,CAAA,QAAA,CAA0B,4BAA4B,CAAA;AAEzG,IAAO,OAAA;AAAA,MACH,UAAA;AAAA,MACA,YAAA;AAAA,MACA,oBAAA;AAAA,MACA,wBAAA;AAAA,MACA,aAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA,kBAAA;AAAA,MACA;AAAA,KACJ;AAAA;AACJ,EAEA,kBAAsC,GAAA;AAClC,IAAA,MAAM,UAAa,GAAA,IAAA,CAAK,UAAW,CAAA,QAAA,CAA0B,YAAY,CAAA;AACzE,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tB,QAAK,IAAA,CAAA,UAAA,CAAW,KAAK,oBAAoB,CAAA;AACzC,QAAK,IAAA,CAAA,UAAA,CAAW,KAAK,qBAAqB,CAAA;AAC1C,QAAK,IAAA,CAAA,UAAA,CAAW,KAAK,MAAM,CAAA;AAC3B,QAAK,IAAA,CAAA,UAAA,CAAW,KAAK,qBAAqB,CAAA;AAE1C,QAAK,IAAA,CAAA,UAAA,CAAW,YAAa,CAAA,kCAAA,EAAoC,IAAI,CAAA;AACrE,QAAO,OAAA,MAAA;AAAA,OACJ,MAAA;AACH,QAAK,IAAA,CAAA,UAAA,CAAW,MAAM,mBAAmB,CAAA;AACzC,QAAA,MAAM,QAAQ,MAAO,CAAA,KAAA;AACrB,QAAA,IAAI,iBAAiB,KAAO,EAAA;AACxB,UAAA,IAAA,CAAK,UAAW,CAAA,SAAA,CAAU,KAAM,CAAA,OAAA,EAAS,IAAI,CAAA;AAAA;AAEjD,QAAO,OAAA,MAAA;AAAA;AACX,aACK,KAAO,EAAA;AACZ,MAAA,IAAI,iBAAiB,KAAO,EAAA;AACxB,QAAA,IAAA,CAAK,UAAW,CAAA,SAAA,CAAU,KAAM,CAAA,OAAA,EAAS,IAAI,CAAA;AAAA;AAEjD,MAAO,OAAA;AAAA,QACH,IAAM,EAAA,CAAA,CAAA;AAAA,QACN;AAAA,OACJ;AAAA;AACJ;AACJ,EAEQ,gBAAyB,GAAA;AAC7B,IAAA,IAAA,CAAK,WAAW,IAAK,CAAA,CAAA,aAAA,EAAgB,IAAK,CAAA,UAAA,CAAW,SAAS,CAAG,CAAA,CAAA,CAAA;AACjE,IAAK,IAAA,CAAA,UAAA,CAAW,MAAM,qBAAqB,CAAA;AAC3C,IAAA,IAAA,CAAK,eAAe,gBAAiB,EAAA;AAAA;AAE7C;;;;"} \ No newline at end of file +{"version":3,"file":"gitversion.mjs","sources":["../../../src/tools/gitversion/settings.ts","../../../src/tools/gitversion/tool.ts","../../../src/tools/gitversion/runner.ts"],"sourcesContent":["import { type ISettingsProvider, SettingsProvider } from '@tools/common'\nimport { type CommandSettings, type ExecuteSettings } from './models'\n\nexport interface IGitVersionSettingsProvider extends ISettingsProvider {\n getExecuteSettings(): ExecuteSettings\n\n getCommandSettings(): CommandSettings\n}\n\nexport class GitVersionSettingsProvider extends SettingsProvider implements IGitVersionSettingsProvider {\n getExecuteSettings(): ExecuteSettings {\n const targetPath = this.buildAgent.getInput('targetPath')\n\n const disableCache = this.buildAgent.getBooleanInput('disableCache')\n const disableNormalization = this.buildAgent.getBooleanInput('disableNormalization')\n const disableShallowCloneCheck = this.buildAgent.getBooleanInput('disableShallowCloneCheck')\n\n const useConfigFile = this.buildAgent.getBooleanInput('useConfigFile')\n const configFilePath = this.buildAgent.getInput('configFilePath')\n const overrideConfig = this.buildAgent.getListInput('overrideConfig')\n\n const updateAssemblyInfo = this.buildAgent.getBooleanInput('updateAssemblyInfo')\n const updateAssemblyInfoFilename = this.buildAgent.getInput('updateAssemblyInfoFilename')\n\n return {\n targetPath,\n disableCache,\n disableNormalization,\n disableShallowCloneCheck,\n useConfigFile,\n configFilePath,\n overrideConfig,\n updateAssemblyInfo,\n updateAssemblyInfoFilename\n }\n }\n\n getCommandSettings(): CommandSettings {\n const targetPath = this.buildAgent.getInput('targetPath')\n const disableShallowCloneCheck = this.buildAgent.getBooleanInput('disableShallowCloneCheck')\n const args = this.buildAgent.getInput('arguments')\n\n return {\n targetPath,\n disableShallowCloneCheck,\n arguments: args\n }\n }\n}\n","import { type ExecResult } from '@agents/common'\nimport { DotnetTool, keysOf } from '@tools/common'\nimport { type CommandSettings, type ExecuteSettings, type GitVersionOutput } from './models'\nimport { GitVersionSettingsProvider, type IGitVersionSettingsProvider } from './settings'\n\nexport class GitVersionTool extends DotnetTool {\n get packageName(): string {\n return 'GitVersion.Tool'\n }\n\n get toolName(): string {\n return 'dotnet-gitversion'\n }\n\n get toolPathVariable(): string {\n return 'GITVERSION_PATH'\n }\n\n get versionRange(): string | null {\n return '>=5.2.0 <6.1.0'\n }\n\n get settingsProvider(): IGitVersionSettingsProvider {\n return new GitVersionSettingsProvider(this.buildAgent)\n }\n\n async executeJson(): Promise {\n const settings = this.settingsProvider.getExecuteSettings()\n const workDir = await this.getRepoDir(settings)\n\n await this.checkShallowClone(settings, workDir)\n\n const args = await this.getExecuteArguments(workDir, settings)\n\n await this.setDotnetRoot()\n return await this.executeTool(args)\n }\n\n async executeCommand(): Promise {\n const settings = this.settingsProvider.getCommandSettings()\n const workDir = await this.getRepoDir(settings)\n\n await this.checkShallowClone(settings, workDir)\n\n const args = this.getCommandArguments(workDir, settings)\n\n await this.setDotnetRoot()\n return await this.executeTool(args)\n }\n\n writeGitVersionToAgent(output: GitVersionOutput): void {\n for (const property of keysOf(output)) {\n const name = this.toCamelCase(property)\n try {\n let value = output[property]?.toString()\n if (value === '0') {\n value = '0'\n }\n this.buildAgent.setOutput(name, value)\n this.buildAgent.setOutput(`GitVersion_${property}`, value)\n this.buildAgent.setVariable(name, value)\n this.buildAgent.setVariable(`GitVersion_${property}`, value)\n } catch (_error) {\n this.buildAgent.error(`Unable to set output/variable for ${property}`)\n }\n }\n }\n\n protected async getRepoDir(settings: ExecuteSettings | CommandSettings): Promise {\n return await super.getRepoPath(settings.targetPath)\n }\n\n protected async getExecuteArguments(workDir: string, options: ExecuteSettings): Promise {\n const args = [workDir, '/output', 'json', '/l', 'console']\n\n const {\n useConfigFile,\n disableCache,\n disableNormalization,\n configFilePath,\n overrideConfig,\n updateAssemblyInfo,\n updateAssemblyInfoFilename\n //\n } = options\n\n if (disableCache) {\n args.push('/nocache')\n }\n\n if (disableNormalization) {\n args.push('/nonormalize')\n }\n\n if (useConfigFile) {\n if (await this.isValidInputFile('configFilePath', configFilePath)) {\n args.push('/config', configFilePath)\n } else {\n throw new Error(`GitVersion configuration file not found at ${configFilePath}`)\n }\n }\n\n if (overrideConfig) {\n for (let config of overrideConfig) {\n config = config.trim()\n if (config.match(/([a-zA-Z0-9]+(-[a-zA-Z]+)*=[a-zA-Z0-9\\- :.']*)/)) {\n args.push('/overrideconfig', config)\n }\n }\n }\n\n if (updateAssemblyInfo) {\n args.push('/updateassemblyinfo')\n\n // You can specify 'updateAssemblyInfo' without 'updateAssemblyInfoFilename'.\n if (updateAssemblyInfoFilename?.length > 0) {\n if (await this.isValidInputFile('updateAssemblyInfoFilename', updateAssemblyInfoFilename)) {\n args.push(updateAssemblyInfoFilename)\n } else {\n throw new Error(`AssemblyInfoFilename file not found at ${updateAssemblyInfoFilename}`)\n }\n }\n }\n\n return args\n }\n\n protected getCommandArguments(workDir: string, options: CommandSettings): string[] {\n let args = [workDir]\n\n if (options.arguments) {\n args = args.concat(this.argStringToArray(options.arguments))\n }\n return args\n }\n\n private argStringToArray(argString: string): string[] {\n const args: string[] = []\n\n let inQuotes = false\n let escaped = false\n let lastCharWasSpace = true\n let arg = ''\n\n const append = (c: string): void => {\n // we only escape double quotes.\n if (escaped && c !== '\"') {\n arg += '\\\\'\n }\n\n arg += c\n escaped = false\n }\n\n for (let i = 0; i < argString.length; i++) {\n const c = argString.charAt(i)\n\n if (c === ' ' && !inQuotes) {\n if (!lastCharWasSpace) {\n args.push(arg)\n arg = ''\n }\n lastCharWasSpace = true\n continue\n } else {\n lastCharWasSpace = false\n }\n\n if (c === '\"') {\n if (!escaped) {\n inQuotes = !inQuotes\n } else {\n append(c)\n }\n continue\n }\n\n if (c === '\\\\' && escaped) {\n append(c)\n continue\n }\n\n if (c === '\\\\' && inQuotes) {\n escaped = true\n continue\n }\n\n append(c)\n lastCharWasSpace = false\n }\n\n if (!lastCharWasSpace) {\n args.push(arg.trim())\n }\n\n return args\n }\n\n private async checkShallowClone(settings: ExecuteSettings | CommandSettings, workDir: string): Promise {\n if (!settings.disableShallowCloneCheck) {\n const isShallowResult = await this.execute('git', ['-C', workDir, 'rev-parse', '--is-shallow-repository'])\n if (isShallowResult.code === 0 && isShallowResult.stdout?.trim() === 'true') {\n throw new Error(\n 'The repository is shallow. Consider disabling shallow clones. See https://github.com/GitTools/actions/blob/main/docs/cloning.md for more information.'\n )\n }\n }\n }\n\n private toCamelCase(input: string): string {\n return input.replace(/^\\w|[A-Z]|\\b\\w|\\s+/g, function (match, index) {\n if (+match === 0) return '' // or if (/\\s+/.test(match)) for white spaces\n return index === 0 ? match.toLowerCase() : match.toUpperCase()\n })\n }\n}\n","import { type ExecResult, type IBuildAgent } from '@agents/common'\nimport { type Commands, type GitVersionOutput } from './models'\nimport { GitVersionTool } from './tool'\nimport { RunnerBase } from '../common/runner'\n\nexport class Runner extends RunnerBase {\n protected readonly tool: GitVersionTool\n\n constructor(protected readonly buildAgent: IBuildAgent) {\n super(buildAgent)\n this.tool = new GitVersionTool(this.buildAgent)\n }\n\n async run(command: Commands): Promise {\n switch (command) {\n case 'setup':\n return await this.setup()\n case 'execute':\n return await this.execute()\n case 'command':\n return await this.command()\n }\n }\n\n private async setup(): Promise {\n return this.safeExecute(async () => {\n await this.tool.install()\n return { code: 0 }\n }, 'GitVersion setup successfully')\n }\n\n private async execute(): Promise {\n return this.safeExecute(async () => {\n const result = await this.tool.executeJson()\n this.buildAgent.debug('Parsing GitVersion output')\n return this.processGitVersionOutput(result)\n }, 'GitVersion executed successfully')\n }\n\n private async command(): Promise {\n return this.safeExecute(async () => await this.tool.executeCommand(), 'GitVersion executed successfully')\n }\n\n private processGitVersionOutput(result: ExecResult): ExecResult {\n const stdout = result.stdout as string\n if (stdout.lastIndexOf('{') === -1 || stdout.lastIndexOf('}') === -1) {\n this.buildAgent.debug('GitVersion output is not valid JSON')\n this.buildAgent.setFailed('GitVersion output is not valid JSON', true)\n return {\n code: -1,\n error: new Error('GitVersion output is not valid JSON')\n }\n } else {\n const jsonOutput = stdout.substring(stdout.lastIndexOf('{'), stdout.lastIndexOf('}') + 1)\n\n const gitVersionOutput = JSON.parse(jsonOutput) as GitVersionOutput\n this.tool.writeGitVersionToAgent(gitVersionOutput)\n this.buildAgent.setSucceeded('GitVersion executed successfully', true)\n return result\n }\n }\n}\n"],"names":[],"mappings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AAG,CAAA,KAAM,MAAM,MAAO,CAAA,WAAA,CAAY,GAAG,CAAA,KAAM,CAAI,CAAA,EAAA;AAClE,MAAK,IAAA,CAAA,UAAA,CAAW,MAAM,qCAAqC,CAAA;AAC3D,MAAK,IAAA,CAAA,UAAA,CAAW,SAAU,CAAA,qCAAA,EAAuC,IAAI,CAAA;AACrE,MAAO,OAAA;AAAA,QACH,IAAM,EAAA,CAAA,CAAA;AAAA,QACN,KAAA,EAAO,IAAI,KAAA,CAAM,qCAAqC;AAAA,OAC1D;AAAA,KACG,MAAA;AACH,MAAM,MAAA,UAAA,GAAa,MAAO,CAAA,SAAA,CAAU,MAAO,CAAA,WAAA,CAAY,GAAG,CAAA,EAAG,MAAO,CAAA,WAAA,CAAY,GAAG,CAAA,GAAI,CAAC,CAAA;AAExF,MAAM,MAAA,gBAAA,GAAmB,IAAK,CAAA,KAAA,CAAM,UAAU,CAAA;AAC9C,MAAK,IAAA,CAAA,IAAA,CAAK,uBAAuB,gBAAgB,CAAA;AACjD,MAAK,IAAA,CAAA,UAAA,CAAW,YAAa,CAAA,kCAAA,EAAoC,IAAI,CAAA;AACrE,MAAO,OAAA,MAAA;AAAA;AACX;AAER;;;;"} \ No newline at end of file diff --git a/dist/tools/libs/tools.mjs b/dist/tools/libs/tools.mjs index 1762304cb..9674a5cac 100644 --- a/dist/tools/libs/tools.mjs +++ b/dist/tools/libs/tools.mjs @@ -51,6 +51,10 @@ class DotnetTool { } this.buildAgent.info(`Prepending ${toolPath} to PATH`); this.buildAgent.addPath(toolPath); + const pathVariable = this.toolPathVariable; + this.buildAgent.info(`Set ${pathVariable} to ${toolPath}`); + this.buildAgent.setVariable(pathVariable, toolPath); + this.buildAgent.setSucceeded(`${this.toolName} installed successfully`, true); return toolPath; } async execute(cmd, args) { @@ -70,9 +74,9 @@ class DotnetTool { } async executeTool(args) { let toolPath; - const gitVersionPath = this.buildAgent.getVariableAsPath(this.toolPathVariable); - if (gitVersionPath) { - toolPath = path.join(gitVersionPath, os.platform() === "win32" ? `${this.toolName}.exe` : this.toolName); + const variableAsPath = this.buildAgent.getVariableAsPath(this.toolPathVariable); + if (variableAsPath) { + toolPath = path.join(variableAsPath, os.platform() === "win32" ? `${this.toolName}.exe` : this.toolName); } if (!toolPath) { toolPath = await this.buildAgent.which(this.toolName, true); @@ -192,5 +196,45 @@ class SettingsProvider { const keysOf = Object.keys; -export { DotnetTool as D, SettingsProvider as S, keysOf as k }; +class RunnerBase { + constructor(buildAgent) { + this.buildAgent = buildAgent; + } + disableTelemetry() { + this.buildAgent.info(`Running on: '${this.buildAgent.agentName}'`); + this.buildAgent.debug("Disabling telemetry"); + this.tool.disableTelemetry(); + } + async safeExecute(action, successMessage) { + try { + this.disableTelemetry(); + const result = await action(); + if (result.code === 0) { + this.buildAgent.info(`${this.tool.toolName} Output:`); + this.buildAgent.info("-------------------"); + this.buildAgent.info(result.stdout); + this.buildAgent.info("-------------------"); + this.buildAgent.setSucceeded(successMessage, true); + return result; + } else { + this.buildAgent.debug(`${this.tool.toolName} failed`); + this.buildAgent.error(result.stderr); + this.buildAgent.setFailed(result.stderr, true); + return result; + } + } catch (error) { + if (error instanceof Error) { + this.buildAgent.debug(`${this.tool.toolName} failed`); + this.buildAgent.error(error.message); + this.buildAgent.setFailed(error.message, true); + } + return { + code: -1, + error + }; + } + } +} + +export { DotnetTool as D, RunnerBase as R, SettingsProvider as S, keysOf as k }; //# sourceMappingURL=tools.mjs.map diff --git a/dist/tools/libs/tools.mjs.map b/dist/tools/libs/tools.mjs.map index 8d5de0630..225e00ab4 100644 --- a/dist/tools/libs/tools.mjs.map +++ b/dist/tools/libs/tools.mjs.map @@ -1 +1 @@ -{"version":3,"file":"tools.mjs","sources":["../../../src/tools/common/dotnet-tool.ts","../../../src/tools/common/settings.ts","../../../src/tools/common/index.ts"],"sourcesContent":["import * as crypto from 'node:crypto'\nimport * as fs from 'node:fs/promises'\nimport * as os from 'node:os'\nimport * as path from 'node:path'\n\nimport * as semver from 'semver'\nimport { type IBuildAgent, type ExecResult } from '@agents/common'\nimport { ISettingsProvider } from './settings'\nimport { NugetVersions } from './models'\n\nexport interface IDotnetTool {\n disableTelemetry(): void\n\n install(): Promise\n}\n\nexport abstract class DotnetTool implements IDotnetTool {\n private static readonly nugetRoot: string = 'https://azuresearch-usnc.nuget.org/query'\n\n constructor(protected buildAgent: IBuildAgent) {}\n\n abstract get packageName(): string\n\n abstract get toolName(): string\n\n abstract get toolPathVariable(): string\n\n abstract get versionRange(): string | null\n\n abstract get settingsProvider(): ISettingsProvider\n\n disableTelemetry(): void {\n this.buildAgent.info('Disable Telemetry')\n this.buildAgent.setVariable('DOTNET_CLI_TELEMETRY_OPTOUT', 'true')\n this.buildAgent.setVariable('DOTNET_NOLOGO', 'true')\n }\n\n async install(): Promise {\n const dotnetExePath = await this.buildAgent.which('dotnet', true)\n this.buildAgent.debug(`whichPath: ${dotnetExePath}`)\n await this.setDotnetRoot()\n\n const setupSettings = this.settingsProvider.getSetupSettings()\n\n let version: string | null = semver.clean(setupSettings.versionSpec) || setupSettings.versionSpec\n this.buildAgent.info('--------------------------')\n this.buildAgent.info(`Acquiring ${this.packageName} for version spec: ${version}`)\n this.buildAgent.info('--------------------------')\n\n if (!this.isExplicitVersion(version)) {\n version = await this.queryLatestMatch(this.packageName, version, setupSettings.includePrerelease)\n if (!version) {\n throw new Error(`Unable to find ${this.packageName} version '${version}'.`)\n }\n }\n\n if (this.versionRange && !semver.satisfies(version, this.versionRange, { includePrerelease: setupSettings.includePrerelease })) {\n throw new Error(\n `Version spec '${setupSettings.versionSpec}' resolved as '${version}' does not satisfy the range '${this.versionRange}'.` +\n 'See https://github.com/GitTools/actions/blob/main/docs/versions.md for more information.'\n )\n }\n\n let toolPath: string | null = null\n if (!setupSettings.preferLatestVersion) {\n // Let's try and resolve the version locally first\n toolPath = await this.buildAgent.findLocalTool(this.packageName, version)\n if (toolPath) {\n this.buildAgent.info('--------------------------')\n this.buildAgent.info(`${this.packageName} version: ${version} found in local cache at ${toolPath}.`)\n this.buildAgent.info('--------------------------')\n }\n }\n\n if (!toolPath) {\n // Download, extract, cache\n toolPath = await this.installTool(this.packageName, version, setupSettings.ignoreFailedSources)\n this.buildAgent.info('--------------------------')\n this.buildAgent.info(`${this.packageName} version: ${version} installed.`)\n this.buildAgent.info('--------------------------')\n }\n\n // Prepend the tool's path. This prepends the PATH for the current process and\n // instructs the agent to prepend for each task that follows.\n this.buildAgent.info(`Prepending ${toolPath} to PATH`)\n this.buildAgent.addPath(toolPath)\n\n return toolPath\n }\n\n protected async execute(cmd: string, args: string[]): Promise {\n this.buildAgent.info(`Command: ${cmd} ${args.join(' ')}`)\n return await this.buildAgent.exec(cmd, args)\n }\n\n protected async setDotnetRoot(): Promise {\n if (os.platform() !== 'win32' && !this.buildAgent.getVariable('DOTNET_ROOT')) {\n let dotnetPath = await this.buildAgent.which('dotnet', true)\n\n const stats = await fs.lstat(dotnetPath)\n if (stats.isSymbolicLink()) {\n dotnetPath = (await fs.readlink(dotnetPath)) || dotnetPath\n }\n const dotnetRoot = path.dirname(dotnetPath)\n this.buildAgent.setVariable('DOTNET_ROOT', dotnetRoot)\n }\n }\n\n protected async executeTool(args: string[]): Promise {\n let toolPath: string | undefined\n const gitVersionPath = this.buildAgent.getVariableAsPath(this.toolPathVariable)\n if (gitVersionPath) {\n toolPath = path.join(gitVersionPath, os.platform() === 'win32' ? `${this.toolName}.exe` : this.toolName)\n }\n if (!toolPath) {\n toolPath = await this.buildAgent.which(this.toolName, true)\n }\n return await this.execute(toolPath, args)\n }\n\n protected async isValidInputFile(input: string, file: string): Promise {\n return this.filePathSupplied(input) && (await this.buildAgent.fileExists(file))\n }\n\n protected filePathSupplied(file: string): boolean {\n const pathValue = path.resolve(this.buildAgent.getInput(file) || '')\n const repoRoot = this.buildAgent.sourceDir\n return pathValue !== repoRoot\n }\n\n protected async getRepoPath(targetPath: string): Promise {\n const srcDir = this.buildAgent.sourceDir || '.'\n let workDir: string\n if (!targetPath) {\n workDir = srcDir\n } else {\n if (await this.buildAgent.directoryExists(targetPath)) {\n workDir = targetPath\n } else {\n throw new Error(`Directory not found at ${targetPath}`)\n }\n }\n return workDir.replace(/\\\\/g, '/')\n }\n\n private async queryLatestMatch(toolName: string, versionSpec: string, includePrerelease: boolean): Promise {\n this.buildAgent.info(\n `Querying tool versions for ${toolName}${versionSpec ? `@${versionSpec}` : ''} ${includePrerelease ? 'including pre-releases' : ''}`\n )\n\n const toolNameParam = encodeURIComponent(toolName.toLowerCase())\n const prereleaseParam = includePrerelease ? 'true' : 'false'\n const downloadPath = `${DotnetTool.nugetRoot}?q=${toolNameParam}&prerelease=${prereleaseParam}&semVerLevel=2.0.0&take=1`\n\n const response = await fetch(downloadPath)\n\n if (!response || !response.ok) {\n this.buildAgent.info(`failed to query latest version for ${toolName} from ${downloadPath}. Status code: ${response ? response.status : 'unknown'}`)\n return null\n }\n\n const { data } = (await response.json()) as NugetVersions\n\n const versions = data[0].versions.map(x => x.version)\n if (!versions || !versions.length) {\n return null\n }\n\n this.buildAgent.debug(`got versions: ${versions.join(', ')}`)\n\n const version = semver.maxSatisfying(versions, versionSpec, { includePrerelease })\n if (version) {\n this.buildAgent.info(`Found matching version: ${version}`)\n } else {\n this.buildAgent.info('match not found')\n }\n\n return version\n }\n\n private async installTool(toolName: string, version: string, ignoreFailedSources: boolean): Promise {\n const semverVersion = semver.clean(version)\n if (!semverVersion) {\n throw new Error(`Invalid version spec: ${version}`)\n }\n\n const tempDirectory = await this.createTempDirectory()\n\n if (!tempDirectory) {\n throw new Error('Unable to create temp directory')\n }\n\n const args = ['tool', 'install', toolName, '--tool-path', tempDirectory, '--version', semverVersion]\n if (ignoreFailedSources) {\n args.push('--ignore-failed-sources')\n }\n\n const result = await this.execute('dotnet', args)\n const status = result.code === 0 ? 'success' : 'failure'\n const message = result.code === 0 ? result.stdout : result.stderr\n\n this.buildAgent.debug(`Tool install result: ${status} ${message}`)\n\n if (result.code !== 0) {\n throw new Error(message)\n }\n\n const toolPath = await this.buildAgent.cacheToolDirectory(tempDirectory, toolName, semverVersion)\n this.buildAgent.debug(`Cached tool path: ${toolPath}`)\n this.buildAgent.debug(`Cleaning up temp directory: ${tempDirectory}`)\n await this.buildAgent.removeDirectory(tempDirectory)\n\n return toolPath\n }\n\n async createTempDirectory(): Promise {\n const tempRootDir = this.buildAgent.tempDir\n if (!tempRootDir) {\n throw new Error('Temp directory not set')\n }\n\n const uuid = crypto.randomUUID()\n const tempPath = path.join(tempRootDir, uuid)\n this.buildAgent.debug(`Creating temp directory ${tempPath}`)\n await fs.mkdir(tempPath, { recursive: true })\n return tempPath\n }\n\n private isExplicitVersion(versionSpec: string): boolean {\n const cleanedVersionSpec = semver.clean(versionSpec)\n const valid = semver.valid(cleanedVersionSpec) != null\n this.buildAgent.debug(`Is version explicit? ${valid}`)\n\n return valid\n }\n}\n","import { type IBuildAgent } from '@agents/common'\nimport { type SetupSettings } from './models'\n\nexport interface ISettingsProvider {\n getSetupSettings(): SetupSettings\n}\n\nexport class SettingsProvider implements ISettingsProvider {\n constructor(protected buildAgent: IBuildAgent) {}\n\n getSetupSettings(): SetupSettings {\n const versionSpec = this.buildAgent.getInput('versionSpec')\n const includePrerelease = this.buildAgent.getBooleanInput('includePrerelease')\n const ignoreFailedSources = this.buildAgent.getBooleanInput('ignoreFailedSources')\n const preferLatestVersion = this.buildAgent.getBooleanInput('preferLatestVersion')\n\n return {\n versionSpec,\n includePrerelease,\n ignoreFailedSources,\n preferLatestVersion\n }\n }\n}\n","export * from './models'\nexport * from './dotnet-tool'\nexport * from './settings'\n\nexport const keysOf = Object.keys as (obj: T) => (keyof T)[]\n"],"names":["semver.clean","semver.satisfies","semver.maxSatisfying","semver.valid"],"mappings":";;;;;;AAgBO,MAAe,UAAkC,CAAA;AAAA,EAGpD,YAAsB,UAAyB,EAAA;AAAzB,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAAA;AAA0B,EAFhD,OAAwB,SAAoB,GAAA,0CAAA;AAAA,EAc5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AClD,IAAA,IAAA,CAAK,UAAW,CAAA,KAAA,CAAM,CAAwB,qBAAA,EAAA,KAAK,CAAE,CAAA,CAAA;AAErD,IAAO,OAAA,KAAA;AAAA;AAEf;;ACpOO,MAAM,gBAA8C,CAAA;AAAA,EACvD,YAAsB,UAAyB,EAAA;AAAzB,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAAA;AAA0B,EAEhD,gBAAkC,GAAA;AAC9B,IAAA,MAAM,WAAc,GAAA,IAAA,CAAK,UAAW,CAAA,QAAA,CAAwB,aAAa,CAAA;AACzE,IAAA,MAAM,iBAAoB,GAAA,IAAA,CAAK,UAAW,CAAA,eAAA,CAA+B,mBAAmB,CAAA;AAC5F,IAAA,MAAM,mBAAsB,GAAA,IAAA,CAAK,UAAW,CAAA,eAAA,CAA+B,qBAAqB,CAAA;AAChG,IAAA,MAAM,mBAAsB,GAAA,IAAA,CAAK,UAAW,CAAA,eAAA,CAA+B,qBAAqB,CAAA;AAEhG,IAAO,OAAA;AAAA,MACH,WAAA;AAAA,MACA,iBAAA;AAAA,MACA,mBAAA;AAAA,MACA;AAAA,KACJ;AAAA;AAER;;ACnBO,MAAM,SAAS,MAAO,CAAA;;;;"} \ No newline at end of file +{"version":3,"file":"tools.mjs","sources":["../../../src/tools/common/dotnet-tool.ts","../../../src/tools/common/settings.ts","../../../src/tools/common/index.ts","../../../src/tools/common/runner.ts"],"sourcesContent":["import * as crypto from 'node:crypto'\nimport * as fs from 'node:fs/promises'\nimport * as os from 'node:os'\nimport * as path from 'node:path'\n\nimport * as semver from 'semver'\nimport { type IBuildAgent, type ExecResult } from '@agents/common'\nimport { ISettingsProvider } from './settings'\nimport { NugetVersions } from './models'\n\nexport interface IDotnetTool {\n toolName: string\n\n disableTelemetry(): void\n\n install(): Promise\n}\n\nexport abstract class DotnetTool implements IDotnetTool {\n private static readonly nugetRoot: string = 'https://azuresearch-usnc.nuget.org/query'\n\n constructor(protected buildAgent: IBuildAgent) {}\n\n abstract get packageName(): string\n\n abstract get toolName(): string\n\n abstract get toolPathVariable(): string\n\n abstract get versionRange(): string | null\n\n abstract get settingsProvider(): ISettingsProvider\n\n disableTelemetry(): void {\n this.buildAgent.info('Disable Telemetry')\n this.buildAgent.setVariable('DOTNET_CLI_TELEMETRY_OPTOUT', 'true')\n this.buildAgent.setVariable('DOTNET_NOLOGO', 'true')\n }\n\n async install(): Promise {\n const dotnetExePath = await this.buildAgent.which('dotnet', true)\n this.buildAgent.debug(`whichPath: ${dotnetExePath}`)\n await this.setDotnetRoot()\n\n const setupSettings = this.settingsProvider.getSetupSettings()\n\n let version: string | null = semver.clean(setupSettings.versionSpec) || setupSettings.versionSpec\n this.buildAgent.info('--------------------------')\n this.buildAgent.info(`Acquiring ${this.packageName} for version spec: ${version}`)\n this.buildAgent.info('--------------------------')\n\n if (!this.isExplicitVersion(version)) {\n version = await this.queryLatestMatch(this.packageName, version, setupSettings.includePrerelease)\n if (!version) {\n throw new Error(`Unable to find ${this.packageName} version '${version}'.`)\n }\n }\n\n if (this.versionRange && !semver.satisfies(version, this.versionRange, { includePrerelease: setupSettings.includePrerelease })) {\n throw new Error(\n `Version spec '${setupSettings.versionSpec}' resolved as '${version}' does not satisfy the range '${this.versionRange}'.` +\n 'See https://github.com/GitTools/actions/blob/main/docs/versions.md for more information.'\n )\n }\n\n let toolPath: string | null = null\n if (!setupSettings.preferLatestVersion) {\n // Let's try and resolve the version locally first\n toolPath = await this.buildAgent.findLocalTool(this.packageName, version)\n if (toolPath) {\n this.buildAgent.info('--------------------------')\n this.buildAgent.info(`${this.packageName} version: ${version} found in local cache at ${toolPath}.`)\n this.buildAgent.info('--------------------------')\n }\n }\n\n if (!toolPath) {\n // Download, extract, cache\n toolPath = await this.installTool(this.packageName, version, setupSettings.ignoreFailedSources)\n this.buildAgent.info('--------------------------')\n this.buildAgent.info(`${this.packageName} version: ${version} installed.`)\n this.buildAgent.info('--------------------------')\n }\n\n // Prepend the tool's path. This prepends the PATH for the current process and\n // instructs the agent to prepend for each task that follows.\n this.buildAgent.info(`Prepending ${toolPath} to PATH`)\n this.buildAgent.addPath(toolPath)\n\n const pathVariable = this.toolPathVariable\n this.buildAgent.info(`Set ${pathVariable} to ${toolPath}`)\n this.buildAgent.setVariable(pathVariable, toolPath)\n this.buildAgent.setSucceeded(`${this.toolName} installed successfully`, true)\n\n return toolPath\n }\n\n protected async execute(cmd: string, args: string[]): Promise {\n this.buildAgent.info(`Command: ${cmd} ${args.join(' ')}`)\n return await this.buildAgent.exec(cmd, args)\n }\n\n protected async setDotnetRoot(): Promise {\n if (os.platform() !== 'win32' && !this.buildAgent.getVariable('DOTNET_ROOT')) {\n let dotnetPath = await this.buildAgent.which('dotnet', true)\n\n const stats = await fs.lstat(dotnetPath)\n if (stats.isSymbolicLink()) {\n dotnetPath = (await fs.readlink(dotnetPath)) || dotnetPath\n }\n const dotnetRoot = path.dirname(dotnetPath)\n this.buildAgent.setVariable('DOTNET_ROOT', dotnetRoot)\n }\n }\n\n protected async executeTool(args: string[]): Promise {\n let toolPath: string | undefined\n const variableAsPath = this.buildAgent.getVariableAsPath(this.toolPathVariable)\n if (variableAsPath) {\n toolPath = path.join(variableAsPath, os.platform() === 'win32' ? `${this.toolName}.exe` : this.toolName)\n }\n if (!toolPath) {\n toolPath = await this.buildAgent.which(this.toolName, true)\n }\n return await this.execute(toolPath, args)\n }\n\n protected async isValidInputFile(input: string, file: string): Promise {\n return this.filePathSupplied(input) && (await this.buildAgent.fileExists(file))\n }\n\n protected filePathSupplied(file: string): boolean {\n const pathValue = path.resolve(this.buildAgent.getInput(file) || '')\n const repoRoot = this.buildAgent.sourceDir\n return pathValue !== repoRoot\n }\n\n protected async getRepoPath(targetPath: string): Promise {\n const srcDir = this.buildAgent.sourceDir || '.'\n let workDir: string\n if (!targetPath) {\n workDir = srcDir\n } else {\n if (await this.buildAgent.directoryExists(targetPath)) {\n workDir = targetPath\n } else {\n throw new Error(`Directory not found at ${targetPath}`)\n }\n }\n return workDir.replace(/\\\\/g, '/')\n }\n\n private async queryLatestMatch(toolName: string, versionSpec: string, includePrerelease: boolean): Promise {\n this.buildAgent.info(\n `Querying tool versions for ${toolName}${versionSpec ? `@${versionSpec}` : ''} ${includePrerelease ? 'including pre-releases' : ''}`\n )\n\n const toolNameParam = encodeURIComponent(toolName.toLowerCase())\n const prereleaseParam = includePrerelease ? 'true' : 'false'\n const downloadPath = `${DotnetTool.nugetRoot}?q=${toolNameParam}&prerelease=${prereleaseParam}&semVerLevel=2.0.0&take=1`\n\n const response = await fetch(downloadPath)\n\n if (!response || !response.ok) {\n this.buildAgent.info(`failed to query latest version for ${toolName} from ${downloadPath}. Status code: ${response ? response.status : 'unknown'}`)\n return null\n }\n\n const { data } = (await response.json()) as NugetVersions\n\n const versions = data[0].versions.map(x => x.version)\n if (!versions || !versions.length) {\n return null\n }\n\n this.buildAgent.debug(`got versions: ${versions.join(', ')}`)\n\n const version = semver.maxSatisfying(versions, versionSpec, { includePrerelease })\n if (version) {\n this.buildAgent.info(`Found matching version: ${version}`)\n } else {\n this.buildAgent.info('match not found')\n }\n\n return version\n }\n\n private async installTool(toolName: string, version: string, ignoreFailedSources: boolean): Promise {\n const semverVersion = semver.clean(version)\n if (!semverVersion) {\n throw new Error(`Invalid version spec: ${version}`)\n }\n\n const tempDirectory = await this.createTempDirectory()\n\n if (!tempDirectory) {\n throw new Error('Unable to create temp directory')\n }\n\n const args = ['tool', 'install', toolName, '--tool-path', tempDirectory, '--version', semverVersion]\n if (ignoreFailedSources) {\n args.push('--ignore-failed-sources')\n }\n\n const result = await this.execute('dotnet', args)\n const status = result.code === 0 ? 'success' : 'failure'\n const message = result.code === 0 ? result.stdout : result.stderr\n\n this.buildAgent.debug(`Tool install result: ${status} ${message}`)\n\n if (result.code !== 0) {\n throw new Error(message)\n }\n\n const toolPath = await this.buildAgent.cacheToolDirectory(tempDirectory, toolName, semverVersion)\n this.buildAgent.debug(`Cached tool path: ${toolPath}`)\n this.buildAgent.debug(`Cleaning up temp directory: ${tempDirectory}`)\n await this.buildAgent.removeDirectory(tempDirectory)\n\n return toolPath\n }\n\n async createTempDirectory(): Promise {\n const tempRootDir = this.buildAgent.tempDir\n if (!tempRootDir) {\n throw new Error('Temp directory not set')\n }\n\n const uuid = crypto.randomUUID()\n const tempPath = path.join(tempRootDir, uuid)\n this.buildAgent.debug(`Creating temp directory ${tempPath}`)\n await fs.mkdir(tempPath, { recursive: true })\n return tempPath\n }\n\n private isExplicitVersion(versionSpec: string): boolean {\n const cleanedVersionSpec = semver.clean(versionSpec)\n const valid = semver.valid(cleanedVersionSpec) != null\n this.buildAgent.debug(`Is version explicit? ${valid}`)\n\n return valid\n }\n}\n","import { type IBuildAgent } from '@agents/common'\nimport { type SetupSettings } from './models'\n\nexport interface ISettingsProvider {\n getSetupSettings(): SetupSettings\n}\n\nexport class SettingsProvider implements ISettingsProvider {\n constructor(protected buildAgent: IBuildAgent) {}\n\n getSetupSettings(): SetupSettings {\n const versionSpec = this.buildAgent.getInput('versionSpec')\n const includePrerelease = this.buildAgent.getBooleanInput('includePrerelease')\n const ignoreFailedSources = this.buildAgent.getBooleanInput('ignoreFailedSources')\n const preferLatestVersion = this.buildAgent.getBooleanInput('preferLatestVersion')\n\n return {\n versionSpec,\n includePrerelease,\n ignoreFailedSources,\n preferLatestVersion\n }\n }\n}\n","export * from './models'\nexport * from './dotnet-tool'\nexport * from './settings'\n\nexport const keysOf = Object.keys as (obj: T) => (keyof T)[]\n","import type { IRunner } from './models.ts'\nimport { ExecResult, IBuildAgent } from '@agents/common'\nimport { IDotnetTool } from './dotnet-tool.ts'\n\nexport abstract class RunnerBase implements IRunner {\n protected abstract tool: IDotnetTool\n\n abstract run(command: string): Promise\n\n protected constructor(protected readonly buildAgent: IBuildAgent) {}\n\n protected disableTelemetry(): void {\n this.buildAgent.info(`Running on: '${this.buildAgent.agentName}'`)\n this.buildAgent.debug('Disabling telemetry')\n this.tool.disableTelemetry()\n }\n\n protected async safeExecute(action: () => Promise, successMessage: string): Promise {\n try {\n this.disableTelemetry()\n const result = await action()\n\n if (result.code === 0) {\n this.buildAgent.info(`${this.tool.toolName} Output:`)\n this.buildAgent.info('-------------------')\n this.buildAgent.info(result.stdout as string)\n this.buildAgent.info('-------------------')\n this.buildAgent.setSucceeded(successMessage, true)\n return result\n } else {\n this.buildAgent.debug(`${this.tool.toolName} failed`)\n this.buildAgent.error(result.stderr as string)\n this.buildAgent.setFailed(result.stderr as string, true)\n return result\n }\n } catch (error) {\n if (error instanceof Error) {\n this.buildAgent.debug(`${this.tool.toolName} failed`)\n this.buildAgent.error(error.message)\n this.buildAgent.setFailed(error.message, true)\n }\n return {\n code: -1,\n error: error as Error\n }\n }\n }\n}\n"],"names":["semver.clean","semver.satisfies","semver.maxSatisfying","semver.valid"],"mappings":";;;;;;AAkBO,MAAe,UAAkC,CAAA;AAAA,EAGpD,YAAsB,UAAyB,EAAA;AAAzB,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAAA;AAA0B,EAFhD,OAAwB,SAAoB,GAAA,0CAAA;AAAA,EAc5C,gBAAyB,GAAA;AACrB,IAAK,IAAA,CAAA,UAAA,CAAW,KAAK,mBAAmB,CAAA;AACxC,IAAK,IAAA,CAAA,UAAA,CAAW,WAAY,CAAA,6BAAA,EAA+B,MAAM,CAAA;AACjE,IAAK,IAAA,CAAA,UAAA,CAAW,WAAY,CAAA,eAAA,EAAiB,MAAM,CAAA;AAAA;AACvD,EAEA,MAAM,OAA2B,GAAA;AAC7B,IAAA,MAAM,gBAAgB,MAAM,IAAA,CAAK,UAAW,CAAA,KAAA,CAAM,UAAU,IAAI,CAAA;AAChE,IAAA,IAAA,CAAK,UAAW,CAAA,KAAA,CAAM,CAAc,WAAA,EAAA,aAAa,CAAE,CAAA,CAAA;AACnD,IAAA,MAAM,KAAK,aAAc,EAAA;AAEzB,IAAM,MAAA,aAAA,GAAgB,IAAK,CAAA,gBAAA,CAAiB,gBAAiB,EAAA;AAE7D,IAAA,IAAI,UAAyBA,mBAAO,CA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