diff --git a/dist/tools/azure/agent.mjs b/dist/tools/azure/agent.mjs index bb4ea4f87..483394af2 100644 --- a/dist/tools/azure/agent.mjs +++ b/dist/tools/azure/agent.mjs @@ -80,6 +80,11 @@ class BuildAgent extends BuildAgentBase { setFailed = (message, done) => this._setResult(TaskResult.Failed, message, done); setOutput = (name, value) => this._setVariable(name, value, true); setVariable = (name, value) => this._setVariable(name, value); + updateBuildNumber = (version) => this._updateBuildNumber(version); + _updateBuildNumber(version) { + this.debug(`build number: ${version}`); + issueCommand("build.updatebuildnumber", {}, version); + } _setResult(result, message, done) { this.debug(`task result: ${TaskResult[result]}`); if (result === TaskResult.Failed && message) { diff --git a/dist/tools/azure/agent.mjs.map b/dist/tools/azure/agent.mjs.map index a747a1075..9c893e8d8 100644 --- a/dist/tools/azure/agent.mjs.map +++ b/dist/tools/azure/agent.mjs.map @@ -1 +1 @@ -{"version":3,"file":"agent.mjs","sources":["../../../src/agents/azure/command.ts","../../../src/agents/azure/build-agent.ts"],"sourcesContent":["import * as os from 'node:os'\nimport * as process from 'node:process'\n\nconst CMD_PREFIX = '##vso['\n\nexport type CommandProperties = Record\n\nexport enum TaskResult {\n Succeeded = 0,\n SucceededWithIssues = 1,\n Failed = 2,\n Cancelled = 3,\n Skipped = 4\n}\n\n/**\n * Command Format:\n * ##vso[artifact.command key=value;key=value]user message\n *\n * Examples:\n * ##vso[task.progress value=58]\n * ##vso[task.issue type=warning;]This is the user warning message\n **/\nexport function issueCommand(command: string, properties: CommandProperties, message: string): void {\n const cmd = new Command(command, properties, message)\n process.stdout.write(cmd.toString() + os.EOL)\n}\n\nclass Command {\n private readonly command: string\n private readonly message: string\n private readonly properties: CommandProperties\n\n constructor(command: string, properties: CommandProperties, message: string) {\n if (!command) {\n command = 'missing.command'\n }\n\n this.command = command\n this.properties = properties\n this.message = message\n }\n\n toString(): string {\n let cmdStr = CMD_PREFIX + this.command\n\n if (this.properties && Object.keys(this.properties).length > 0) {\n cmdStr += ' '\n for (const key in this.properties) {\n if (Object.prototype.hasOwnProperty.call(this.properties, key)) {\n const val = this.properties[key] as string\n if (val) {\n // safely append the val - avoid blowing up when attempting to\n // call .replace() if message is not a string for some reason\n cmdStr += `${key}=${escapeProperty(`${val || ''}`)};`\n }\n }\n }\n }\n\n cmdStr += ']'\n\n // safely append the message - avoid blowing up when attempting to\n // call .replace() if message is not a string for some reason\n const message = `${this.message || ''}`\n cmdStr += escapeData(message)\n\n return cmdStr\n }\n}\n\nfunction escapeData(s: string | object): string {\n return toCommandValue(s).replace(/%/g, '%AZP25').replace(/\\r/g, '%0D').replace(/\\n/g, '%0A')\n}\n\nfunction escapeProperty(s: string | object): string {\n return toCommandValue(s).replace(/%/g, '%AZP25').replace(/\\r/g, '%0D').replace(/\\n/g, '%0A').replace(/]/g, '%5D').replace(/;/g, '%3B')\n}\n\nfunction toCommandValue(input: string | object): string {\n if (input === null || input === undefined) {\n return ''\n } else if (typeof input === 'string' || input instanceof String) {\n return input as string\n }\n return JSON.stringify(input)\n}\n","import * as os from 'node:os'\nimport * as process from 'node:process'\nimport { BuildAgentBase, type IBuildAgent } from '@agents/common'\nimport { issueCommand, TaskResult } from './command'\n\nexport class BuildAgent extends BuildAgentBase implements IBuildAgent {\n agentName = 'Azure Pipelines'\n\n sourceDirVariable = 'BUILD_SOURCESDIRECTORY'\n tempDirVariable = 'AGENT_TEMPDIRECTORY'\n cacheDirVariable = 'AGENT_TOOLSDIRECTORY'\n\n addPath(inputPath: string): void {\n super.addPath(inputPath)\n issueCommand('task.prependpath', {}, inputPath)\n }\n\n info = (message: string): void => {\n process.stdout.write(message + os.EOL)\n }\n\n debug = (message: string): void => issueCommand('task.debug', {}, message)\n\n warn = (message: string): void => issueCommand('task.issue', { type: 'warning' }, message)\n\n error = (message: string): void => issueCommand('task.issue', { type: 'error' }, message)\n\n setSucceeded = (message: string, done?: boolean): void => this._setResult(TaskResult.Succeeded, message, done)\n\n setFailed = (message: string, done?: boolean): void => this._setResult(TaskResult.Failed, message, done)\n\n setOutput = (name: string, value: string): void => this._setVariable(name, value, true)\n\n setVariable = (name: string, value: string): void => this._setVariable(name, value)\n\n private _setResult(result: TaskResult, message: string, done?: boolean): void {\n this.debug(`task result: ${TaskResult[result]}`)\n // add an error issue\n if (result === TaskResult.Failed && message) {\n this.error(message)\n } else if (result === TaskResult.SucceededWithIssues && message) {\n this.warn(message)\n } else {\n this.info(message)\n }\n // task.complete\n const properties: Record = { result: TaskResult[result] }\n if (done) {\n properties['done'] = 'true'\n }\n issueCommand('task.complete', properties, message)\n }\n\n private _setVariable(name: string, val: string, isOutput = false): void {\n const key: string = this._getVariableKey(name)\n const varValue = val || ''\n process.env[key] = varValue\n\n issueCommand(\n 'task.setvariable',\n {\n variable: name || '',\n isOutput: (isOutput || false).toString(),\n issecret: 'false'\n },\n varValue\n )\n }\n\n private _getVariableKey(name: string): string {\n return name.replace(/\\./g, '_').replace(/ /g, '_').toUpperCase()\n }\n}\n"],"names":["TaskResult"],"mappings":";;;;AAGA,MAAM,UAAa,GAAA,QAAA;AAIP,IAAA,UAAA,qBAAAA,WAAL,KAAA;AACH,EAAAA,WAAAA,CAAAA,WAAAA,CAAA,eAAY,CAAZ,CAAA,GAAA,WAAA;AACA,EAAAA,WAAAA,CAAAA,WAAAA,CAAA,yBAAsB,CAAtB,CAAA,GAAA,qBAAA;AACA,EAAAA,WAAAA,CAAAA,WAAAA,CAAA,YAAS,CAAT,CAAA,GAAA,QAAA;AACA,EAAAA,WAAAA,CAAAA,WAAAA,CAAA,eAAY,CAAZ,CAAA,GAAA,WAAA;AACA,EAAAA,WAAAA,CAAAA,WAAAA,CAAA,aAAU,CAAV,CAAA,GAAA,SAAA;AALQ,EAAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA,CAAA;AAgBI,SAAA,YAAA,CAAa,OAAiB,EAAA,UAAA,EAA+B,OAAuB,EAAA;AAChG,EAAA,MAAM,GAAM,GAAA,IAAI,OAAQ,CAAA,OAAA,EAAS,YAA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AAM,UAAqC,GAAA,EAAE,MAAQ,EAAA,UAAA,CAAW,MAAM,CAAE,EAAA;AACxE,IAAA,IAAI,IAAM,EAAA;AACN,MAAA,UAAA,CAAW,MAAM,CAAI,GAAA,MAAA;AAAA;AAEzB,IAAa,YAAA,CAAA,eAAA,EAAiB,YAAY,OAAO,CAAA;AAAA;AACrD,EAEQ,YAAa,CAAA,IAAA,EAAc,GAAa,EAAA,QAAA,GAAW,KAAa,EAAA;AACpE,IAAM,MAAA,GAAA,GAAc,IAAK,CAAA,eAAA,CAAgB,IAAI,CAAA;AAC7C,IAAA,MAAM,WAAW,GAAO,IAAA,EAAA;AACxB,IAAQ,OAAA,CAAA,GAAA,CAAI,GAAG,CAAI,GAAA,QAAA;AAEnB,IAAA,YAAA;AAAA,MACI,kBAAA;AAAA,MACA;AAAA,QACI,UAAU,IAAQ,IAAA,EAAA;AAAA,QAClB,QAAA,EAAA,CAAW,QAAY,IAAA,KAAA,EAAO,QAAS,EAAA;AAAA,QACvC,QAAU,EAAA;AAAA,OACd;AAAA,MACA;AAAA,KACJ;AAAA;AACJ,EAEQ,gBAAgB,IAAsB,EAAA;AAC1C,IAAO,OAAA,IAAA,CAAK,QAAQ,KAAO,EAAA,GAAG,EAAE,OAAQ,CAAA,IAAA,EAAM,GAAG,CAAA,CAAE,WAAY,EAAA;AAAA;AAEvE;;;;"} \ No newline at end of file +{"version":3,"file":"agent.mjs","sources":["../../../src/agents/azure/command.ts","../../../src/agents/azure/build-agent.ts"],"sourcesContent":["import * as os from 'node:os'\nimport * as process from 'node:process'\n\nconst CMD_PREFIX = '##vso['\n\nexport type CommandProperties = Record\n\nexport enum TaskResult {\n Succeeded = 0,\n SucceededWithIssues = 1,\n Failed = 2,\n Cancelled = 3,\n Skipped = 4\n}\n\n/**\n * Command Format:\n * ##vso[artifact.command key=value;key=value]user message\n *\n * Examples:\n * ##vso[task.progress value=58]\n * ##vso[task.issue type=warning;]This is the user warning message\n **/\nexport function issueCommand(command: string, properties: CommandProperties, message: string): void {\n const cmd = new Command(command, properties, message)\n process.stdout.write(cmd.toString() + os.EOL)\n}\n\nclass Command {\n private readonly command: string\n private readonly message: string\n private readonly properties: CommandProperties\n\n constructor(command: string, properties: CommandProperties, message: string) {\n if (!command) {\n command = 'missing.command'\n }\n\n this.command = command\n this.properties = properties\n this.message = message\n }\n\n toString(): string {\n let cmdStr = CMD_PREFIX + this.command\n\n if (this.properties && Object.keys(this.properties).length > 0) {\n cmdStr += ' '\n for (const key in this.properties) {\n if (Object.prototype.hasOwnProperty.call(this.properties, key)) {\n const val = this.properties[key] as string\n if (val) {\n // safely append the val - avoid blowing up when attempting to\n // call .replace() if message is not a string for some reason\n cmdStr += `${key}=${escapeProperty(`${val || ''}`)};`\n }\n }\n }\n }\n\n cmdStr += ']'\n\n // safely append the message - avoid blowing up when attempting to\n // call .replace() if message is not a string for some reason\n const message = `${this.message || ''}`\n cmdStr += escapeData(message)\n\n return cmdStr\n }\n}\n\nfunction escapeData(s: string | object): string {\n return toCommandValue(s).replace(/%/g, '%AZP25').replace(/\\r/g, '%0D').replace(/\\n/g, '%0A')\n}\n\nfunction escapeProperty(s: string | object): string {\n return toCommandValue(s).replace(/%/g, '%AZP25').replace(/\\r/g, '%0D').replace(/\\n/g, '%0A').replace(/]/g, '%5D').replace(/;/g, '%3B')\n}\n\nfunction toCommandValue(input: string | object): string {\n if (input === null || input === undefined) {\n return ''\n } else if (typeof input === 'string' || input instanceof String) {\n return input as string\n }\n return JSON.stringify(input)\n}\n","import * as os from 'node:os'\nimport * as process from 'node:process'\nimport { BuildAgentBase, type IBuildAgent } from '@agents/common'\nimport { issueCommand, TaskResult } from './command'\n\nexport class BuildAgent extends BuildAgentBase implements IBuildAgent {\n agentName = 'Azure Pipelines'\n\n sourceDirVariable = 'BUILD_SOURCESDIRECTORY'\n tempDirVariable = 'AGENT_TEMPDIRECTORY'\n cacheDirVariable = 'AGENT_TOOLSDIRECTORY'\n\n addPath(inputPath: string): void {\n super.addPath(inputPath)\n issueCommand('task.prependpath', {}, inputPath)\n }\n\n info = (message: string): void => {\n process.stdout.write(message + os.EOL)\n }\n\n debug = (message: string): void => issueCommand('task.debug', {}, message)\n\n warn = (message: string): void => issueCommand('task.issue', { type: 'warning' }, message)\n\n error = (message: string): void => issueCommand('task.issue', { type: 'error' }, message)\n\n setSucceeded = (message: string, done?: boolean): void => this._setResult(TaskResult.Succeeded, message, done)\n\n setFailed = (message: string, done?: boolean): void => this._setResult(TaskResult.Failed, message, done)\n\n setOutput = (name: string, value: string): void => this._setVariable(name, value, true)\n\n setVariable = (name: string, value: string): void => this._setVariable(name, value)\n\n updateBuildNumber = (version: string): void => this._updateBuildNumber(version)\n\n private _updateBuildNumber(version: string): void {\n this.debug(`build number: ${version}`)\n issueCommand('build.updatebuildnumber', {}, version)\n }\n\n private _setResult(result: TaskResult, message: string, done?: boolean): void {\n this.debug(`task result: ${TaskResult[result]}`)\n // add an error issue\n if (result === TaskResult.Failed && message) {\n this.error(message)\n } else if (result === TaskResult.SucceededWithIssues && message) {\n this.warn(message)\n } else {\n this.info(message)\n }\n // task.complete\n const properties: Record = { result: TaskResult[result] }\n if (done) {\n properties['done'] = 'true'\n }\n issueCommand('task.complete', properties, message)\n }\n\n private _setVariable(name: string, val: string, isOutput = false): void {\n const key: string = this._getVariableKey(name)\n const varValue = val || ''\n process.env[key] = varValue\n\n issueCommand(\n 'task.setvariable',\n {\n variable: name || '',\n isOutput: (isOutput || false).toString(),\n issecret: 'false'\n },\n varValue\n )\n }\n\n private _getVariableKey(name: string): string {\n return name.replace(/\\./g, '_').replace(/ /g, '_').toUpperCase()\n }\n}\n"],"names":["TaskResult"],"mappings":";;;;AAGA,MAAM,UAAa,GAAA,QAAA;AAIP,IAAA,UAAA,qBAAAA,WAAL,KAAA;AACH,EAAAA,WAAAA,CAAAA,WAAAA,CAAA,eAAY,CAAZ,CAAA,GAAA,WAAA;AACA,EAAAA,WAAAA,CAAAA,WAAAA,CAAA,yBAAsB,CAAtB,CA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AAAA,QAClB,QAAA,EAAA,CAAW,QAAY,IAAA,KAAA,EAAO,QAAS,EAAA;AAAA,QACvC,QAAU,EAAA;AAAA,OACd;AAAA,MACA;AAAA,KACJ;AAAA;AACJ,EAEQ,gBAAgB,IAAsB,EAAA;AAC1C,IAAO,OAAA,IAAA,CAAK,QAAQ,KAAO,EAAA,GAAG,EAAE,OAAQ,CAAA,IAAA,EAAM,GAAG,CAAA,CAAE,WAAY,EAAA;AAAA;AAEvE;;;;"} \ No newline at end of file diff --git a/dist/tools/github/agent.mjs b/dist/tools/github/agent.mjs index 59a93ee53..aca3e8acf 100644 --- a/dist/tools/github/agent.mjs +++ b/dist/tools/github/agent.mjs @@ -132,6 +132,7 @@ class BuildAgent extends BuildAgentBase { } issueCommand("set-env", { name }, convertedVal); }; + updateBuildNumber = (version) => this.debug(`updateBuildNumber - ${version}`); } export { BuildAgent }; diff --git a/dist/tools/github/agent.mjs.map b/dist/tools/github/agent.mjs.map index 90eb04a2a..379abe4d5 100644 --- a/dist/tools/github/agent.mjs.map +++ b/dist/tools/github/agent.mjs.map @@ -1 +1 @@ -{"version":3,"file":"agent.mjs","sources":["../../../src/agents/github/command.ts","../../../src/agents/github/build-agent.ts"],"sourcesContent":["import * as crypto from 'node:crypto'\nimport * as os from 'node:os'\nimport * as fs from 'node:fs'\n\nconst CMD_STRING = '::'\n\nexport type CommandProperties = Record\n\n/**\n * Commands\n *\n * Command Format:\n * ::name key=value,key=value::message\n *\n * Examples:\n * ::warning::This is the message\n * ::set-env name=MY_VAR::some value\n */\nexport function issueCommand(command: string, properties: CommandProperties, message: string): void {\n const cmd = new Command(command, properties, message)\n process.stdout.write(cmd.toString() + os.EOL)\n}\n\nexport function issueFileCommand(command: string, message: string | object): void {\n const filePath = process.env[`GITHUB_${command}`]\n if (!filePath) {\n throw new Error(`Unable to find environment variable for file command ${command}`)\n }\n if (!fs.existsSync(filePath)) {\n throw new Error(`Missing file at path: ${filePath}`)\n }\n\n fs.appendFileSync(filePath, `${toCommandValue(message)}${os.EOL}`, {\n encoding: 'utf8'\n })\n}\n\nexport enum ExitCode {\n /**\n * A code indicating that the action was successful\n */\n Success = 0,\n\n /**\n * A code indicating that the action was a failure\n */\n Failure = 1\n}\n\nclass Command {\n private readonly command: string\n private readonly message: string\n private readonly properties: CommandProperties\n\n constructor(command: string, properties: CommandProperties, message: string) {\n if (!command) {\n command = 'missing.command'\n }\n\n this.command = command\n this.properties = properties\n this.message = message\n }\n\n toString(): string {\n let cmdStr = CMD_STRING + this.command\n\n if (this.properties && Object.keys(this.properties).length > 0) {\n cmdStr += ' '\n let first = true\n for (const key in this.properties) {\n if (Object.prototype.hasOwnProperty.call(this.properties, key)) {\n const val = this.properties[key]\n if (val) {\n if (first) {\n first = false\n } else {\n cmdStr += ','\n }\n\n cmdStr += `${key}=${escapeProperty(val)}`\n }\n }\n }\n }\n\n cmdStr += `${CMD_STRING}${escapeData(this.message)}`\n return cmdStr\n }\n}\n\nfunction escapeData(s: string | object): string {\n return toCommandValue(s).replace(/%/g, '%25').replace(/\\r/g, '%0D').replace(/\\n/g, '%0A')\n}\n\nfunction escapeProperty(s: string | object): string {\n return toCommandValue(s).replace(/%/g, '%25').replace(/\\r/g, '%0D').replace(/\\n/g, '%0A').replace(/:/g, '%3A').replace(/,/g, '%2C')\n}\n\nexport function toCommandValue(input: string | object): string {\n if (input === null || input === undefined) {\n return ''\n } else if (typeof input === 'string' || input instanceof String) {\n return input as string\n }\n return JSON.stringify(input)\n}\n\nexport function prepareKeyValueMessage(key: string, value: string | object): string {\n const uuid = crypto.randomUUID()\n const delimiter = `ghadelimiter_${uuid}`\n const convertedValue = toCommandValue(value)\n\n // These should realistically never happen, but just in case someone finds a\n // way to exploit uuid generation let's not allow keys or values that contain\n // the delimiter.\n if (key.includes(delimiter)) {\n throw new Error(`Unexpected input: name should not contain the delimiter \"${delimiter}\"`)\n }\n\n if (convertedValue.includes(delimiter)) {\n throw new Error(`Unexpected input: value should not contain the delimiter \"${delimiter}\"`)\n }\n\n return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`\n}\n","import * as os from 'node:os'\nimport process from 'node:process'\nimport { BuildAgentBase, type IBuildAgent } from '@agents/common'\nimport { ExitCode, issueCommand, issueFileCommand, prepareKeyValueMessage, toCommandValue } from './command'\n\nexport class BuildAgent extends BuildAgentBase implements IBuildAgent {\n agentName = 'GitHub Actions'\n\n sourceDirVariable = 'GITHUB_WORKSPACE'\n tempDirVariable = 'RUNNER_TEMP'\n cacheDirVariable = 'RUNNER_TOOL_CACHE'\n\n addPath(inputPath: string): void {\n super.addPath(inputPath)\n const filePath = process.env['GITHUB_PATH'] || ''\n if (filePath) {\n issueFileCommand('PATH', inputPath)\n } else {\n issueCommand('add-path', {}, inputPath)\n }\n }\n\n debug = (message: string): void => issueCommand('debug', {}, message)\n\n info = (message: string): void => {\n process.stdout.write(message + os.EOL)\n }\n\n warn = (message: string): void => issueCommand('warning', {}, message)\n\n error = (message: string): void => issueCommand('error', {}, message)\n\n setSucceeded(_message: string, _done?: boolean): void {\n process.exitCode = ExitCode.Success\n }\n\n setFailed = (message: string, _done?: boolean): void => {\n process.exitCode = ExitCode.Failure\n this.error(message)\n }\n\n setOutput = (name: string, value: string): void => {\n const filePath = process.env['GITHUB_OUTPUT'] || ''\n if (filePath) {\n return issueFileCommand('OUTPUT', prepareKeyValueMessage(name, value))\n }\n\n process.stdout.write(os.EOL)\n issueCommand('set-output', { name }, toCommandValue(value))\n }\n\n setVariable = (name: string, value: string): void => {\n const convertedVal = toCommandValue(value)\n process.env[name] = convertedVal\n\n const filePath = process.env['GITHUB_ENV'] || ''\n if (filePath) {\n return issueFileCommand('ENV', prepareKeyValueMessage(name, value))\n }\n\n issueCommand('set-env', { name }, convertedVal)\n }\n}\n"],"names":["ExitCode","process"],"mappings":";;;;;;AAIA,MAAM,UAAa,GAAA,IAAA;AAcH,SAAA,YAAA,CAAa,OAAiB,EAAA,UAAA,EAA+B,OAAuB,EAAA;AAChG,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e,CAAK,IAAA,EAAA;AACjD,IAAA,IAAI,QAAU,EAAA;AACV,MAAA,OAAO,gBAAiB,CAAA,QAAA,EAAU,sBAAuB,CAAA,IAAA,EAAM,KAAK,CAAC,CAAA;AAAA;AAGzE,IAAQA,gBAAA,CAAA,MAAA,CAAO,KAAM,CAAA,EAAA,CAAG,GAAG,CAAA;AAC3B,IAAA,YAAA,CAAa,cAAc,EAAE,IAAA,EAAQ,EAAA,cAAA,CAAe,KAAK,CAAC,CAAA;AAAA,GAC9D;AAAA,EAEA,WAAA,GAAc,CAAC,IAAA,EAAc,KAAwB,KAAA;AACjD,IAAM,MAAA,YAAA,GAAe,eAAe,KAAK,CAAA;AACzC,IAAQA,gBAAA,CAAA,GAAA,CAAI,IAAI,CAAI,GAAA,YAAA;AAEpB,IAAA,MAAM,QAAW,GAAAA,gBAAA,CAAQ,GAAI,CAAA,YAAY,CAAK,IAAA,EAAA;AAC9C,IAAA,IAAI,QAAU,EAAA;AACV,MAAA,OAAO,gBAAiB,CAAA,KAAA,EAAO,sBAAuB,CAAA,IAAA,EAAM,KAAK,CAAC,CAAA;AAAA;AAGtE,IAAA,YAAA,CAAa,SAAW,EAAA,EAAE,IAAK,EAAA,EAAG,YAAY,CAAA;AAAA,GAClD;AACJ;;;;"} \ No newline at end of file +{"version":3,"file":"agent.mjs","sources":["../../../src/agents/github/command.ts","../../../src/agents/github/build-agent.ts"],"sourcesContent":["import * as crypto from 'node:crypto'\nimport * as os from 'node:os'\nimport * as fs from 'node:fs'\n\nconst CMD_STRING = '::'\n\nexport type CommandProperties = Record\n\n/**\n * Commands\n *\n * Command Format:\n * ::name key=value,key=value::message\n *\n * Examples:\n * ::warning::This is the message\n * ::set-env name=MY_VAR::some value\n */\nexport function issueCommand(command: string, properties: CommandProperties, message: string): void {\n const cmd = new Command(command, properties, message)\n process.stdout.write(cmd.toString() + os.EOL)\n}\n\nexport function issueFileCommand(command: string, message: string | object): void {\n const filePath = process.env[`GITHUB_${command}`]\n if (!filePath) {\n throw new Error(`Unable to find environment variable for file command ${command}`)\n }\n if (!fs.existsSync(filePath)) {\n throw new Error(`Missing file at path: ${filePath}`)\n }\n\n fs.appendFileSync(filePath, `${toCommandValue(message)}${os.EOL}`, {\n encoding: 'utf8'\n })\n}\n\nexport enum ExitCode {\n /**\n * A code indicating that the action was successful\n */\n Success = 0,\n\n /**\n * A code indicating that the action was a failure\n */\n Failure = 1\n}\n\nclass Command {\n private readonly command: string\n private readonly message: string\n private readonly properties: CommandProperties\n\n constructor(command: string, properties: CommandProperties, message: string) {\n if (!command) {\n command = 'missing.command'\n }\n\n this.command = command\n this.properties = properties\n this.message = message\n }\n\n toString(): string {\n let cmdStr = CMD_STRING + this.command\n\n if (this.properties && Object.keys(this.properties).length > 0) {\n cmdStr += ' '\n let first = true\n for (const key in this.properties) {\n if (Object.prototype.hasOwnProperty.call(this.properties, key)) {\n const val = this.properties[key]\n if (val) {\n if (first) {\n first = false\n } else {\n cmdStr += ','\n }\n\n cmdStr += `${key}=${escapeProperty(val)}`\n }\n }\n }\n }\n\n cmdStr += `${CMD_STRING}${escapeData(this.message)}`\n return cmdStr\n }\n}\n\nfunction escapeData(s: string | object): string {\n return toCommandValue(s).replace(/%/g, '%25').replace(/\\r/g, '%0D').replace(/\\n/g, '%0A')\n}\n\nfunction escapeProperty(s: string | object): string {\n return toCommandValue(s).replace(/%/g, '%25').replace(/\\r/g, '%0D').replace(/\\n/g, '%0A').replace(/:/g, '%3A').replace(/,/g, '%2C')\n}\n\nexport function toCommandValue(input: string | object): string {\n if (input === null || input === undefined) {\n return ''\n } else if (typeof input === 'string' || input instanceof String) {\n return input as string\n }\n return JSON.stringify(input)\n}\n\nexport function prepareKeyValueMessage(key: string, value: string | object): string {\n const uuid = crypto.randomUUID()\n const delimiter = `ghadelimiter_${uuid}`\n const convertedValue = toCommandValue(value)\n\n // These should realistically never happen, but just in case someone finds a\n // way to exploit uuid generation let's not allow keys or values that contain\n // the delimiter.\n if (key.includes(delimiter)) {\n throw new Error(`Unexpected input: name should not contain the delimiter \"${delimiter}\"`)\n }\n\n if (convertedValue.includes(delimiter)) {\n throw new Error(`Unexpected input: value should not contain the delimiter \"${delimiter}\"`)\n }\n\n return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`\n}\n","import * as os from 'node:os'\nimport process from 'node:process'\nimport { BuildAgentBase, type IBuildAgent } from '@agents/common'\nimport { ExitCode, issueCommand, issueFileCommand, prepareKeyValueMessage, toCommandValue } from './command'\n\nexport class BuildAgent extends BuildAgentBase implements IBuildAgent {\n agentName = 'GitHub Actions'\n\n sourceDirVariable = 'GITHUB_WORKSPACE'\n tempDirVariable = 'RUNNER_TEMP'\n cacheDirVariable = 'RUNNER_TOOL_CACHE'\n\n addPath(inputPath: string): void {\n super.addPath(inputPath)\n const filePath = process.env['GITHUB_PATH'] || ''\n if (filePath) {\n issueFileCommand('PATH', inputPath)\n } else {\n issueCommand('add-path', {}, inputPath)\n }\n }\n\n debug = (message: string): void => issueCommand('debug', {}, message)\n\n info = (message: string): void => {\n process.stdout.write(message + os.EOL)\n }\n\n warn = (message: string): void => issueCommand('warning', {}, message)\n\n error = (message: string): void => issueCommand('error', {}, message)\n\n setSucceeded(_message: string, _done?: boolean): void {\n process.exitCode = ExitCode.Success\n }\n\n setFailed = (message: string, _done?: boolean): void => {\n process.exitCode = ExitCode.Failure\n this.error(message)\n }\n\n setOutput = (name: string, value: string): void => {\n const filePath = process.env['GITHUB_OUTPUT'] || ''\n if (filePath) {\n return issueFileCommand('OUTPUT', prepareKeyValueMessage(name, value))\n }\n\n process.stdout.write(os.EOL)\n issueCommand('set-output', { name }, toCommandValue(value))\n }\n\n setVariable = (name: string, value: string): void => {\n const convertedVal = toCommandValue(value)\n process.env[name] = convertedVal\n\n const filePath = process.env['GITHUB_ENV'] || ''\n if (filePath) {\n return issueFileCommand('ENV', prepareKeyValueMessage(name, value))\n }\n\n issueCommand('set-env', { name }, convertedVal)\n }\n\n updateBuildNumber = (version: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,IAAA,IAAA,CAAK,MAAM,OAAO,CAAA;AAAA,GACtB;AAAA,EAEA,SAAA,GAAY,CAAC,IAAA,EAAc,KAAwB,KAAA;AAC/C,IAAA,MAAM,QAAW,GAAAA,gBAAA,CAAQ,GAAI,CAAA,eAAe,CAAK,IAAA,EAAA;AACjD,IAAA,IAAI,QAAU,EAAA;AACV,MAAA,OAAO,gBAAiB,CAAA,QAAA,EAAU,sBAAuB,CAAA,IAAA,EAAM,KAAK,CAAC,CAAA;AAAA;AAGzE,IAAQA,gBAAA,CAAA,MAAA,CAAO,KAAM,CAAA,EAAA,CAAG,GAAG,CAAA;AAC3B,IAAA,YAAA,CAAa,cAAc,EAAE,IAAA,EAAQ,EAAA,cAAA,CAAe,KAAK,CAAC,CAAA;AAAA,GAC9D;AAAA,EAEA,WAAA,GAAc,CAAC,IAAA,EAAc,KAAwB,KAAA;AACjD,IAAM,MAAA,YAAA,GAAe,eAAe,KAAK,CAAA;AACzC,IAAQA,gBAAA,CAAA,GAAA,CAAI,IAAI,CAAI,GAAA,YAAA;AAEpB,IAAA,MAAM,QAAW,GAAAA,gBAAA,CAAQ,GAAI,CAAA,YAAY,CAAK,IAAA,EAAA;AAC9C,IAAA,IAAI,QAAU,EAAA;AACV,MAAA,OAAO,gBAAiB,CAAA,KAAA,EAAO,sBAAuB,CAAA,IAAA,EAAM,KAAK,CAAC,CAAA;AAAA;AAGtE,IAAA,YAAA,CAAa,SAAW,EAAA,EAAE,IAAK,EAAA,EAAG,YAAY,CAAA;AAAA,GAClD;AAAA,EAEA,oBAAoB,CAAC,OAAA,KAA0B,KAAK,KAAM,CAAA,CAAA,oBAAA,EAAuB,OAAO,CAAE,CAAA,CAAA;AAC9F;;;;"} \ No newline at end of file diff --git a/dist/tools/libs/agents.mjs.map b/dist/tools/libs/agents.mjs.map index 7e1811efb..965eb9d4f 100644 --- a/dist/tools/libs/agents.mjs.map +++ b/dist/tools/libs/agents.mjs.map @@ -1 +1 @@ -{"version":3,"file":"agents.mjs","sources":["../../../src/agents/common/lookPath.ts","../../../src/agents/common/build-agent.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport * as path from 'node:path'\nimport * as process from 'node:process'\n\n/**\n * Sometimes, people want to look for local executable files\n * which are specified with either relative or absolute file path.\n * @private\n * @param cmd\n * @return {string} An absolute path of given command, or undefined.\n */\nconst isFilePath = (cmd: string): string | undefined => {\n return cmd.includes(path.sep) ? path.resolve(cmd) : undefined\n}\n\n/**\n * Just promisifies \"fs.access\"\n * @private\n * @param {string} filePath An absolute file path with an applicable extension appended.\n * @return {Promise} Resolves absolute path or empty string.\n */\nconst access = async (filePath: string): Promise => {\n try {\n await fs.access(filePath)\n return filePath\n } catch (_error) {\n return undefined\n }\n}\n\n/**\n * Resolves if the given file is executable or not, regarding \"PATHEXT\" to be applied.\n * @private\n * @param {string} absPath A file path to be checked.\n * @param {LookPathOption} options Options for lookPath.\n * @return {Promise} Resolves the absolute file path just checked, or undefined.\n */\nconst isExecutable = async (absPath: string, options: LookPathOption = {}): Promise => {\n const envVars = options.env || process.env\n const extension = (envVars.PATHEXT || '').split(path.delimiter).concat('')\n const bins = await Promise.all(extension.map(async ext => access(absPath + ext.toLowerCase())))\n return bins.find(bin => !!bin)\n}\n\n/**\n * Returns a list of directories on which the target command should be looked for.\n * @private\n * @param {string[]} options.include Will be added to \"PATH\" env.\n * @param {string[]} options.exclude Will be filtered from \"PATH\" env.\n * @return {string[]} Directories to dig into.\n */\nconst getDirsToWalkThrough = (options: LookPathOption): string[] => {\n const envVars = options.env || process.env\n const envName = process.platform === 'win32' ? 'Path' : 'PATH'\n const envPath = envVars[envName] || ''\n return envPath\n .split(path.delimiter)\n .concat(options.include || [])\n .filter(p => !(options.exclude || []).includes(p))\n}\n\n/**\n * Returns async promise with absolute file path of given command,\n * and resolves with undefined if the command not found.\n * @param {string} command Command name to look for.\n * @param {LookPathOption} opt Options for lookPath.\n * @return {Promise} Resolves absolute file path, or undefined if not found.\n */\nexport async function lookPath(command: string, opt: LookPathOption = {}): Promise {\n const directPath = isFilePath(command)\n if (directPath) return isExecutable(directPath, opt)\n\n const dirs = getDirsToWalkThrough(opt)\n const bins = await Promise.all(dirs.map(async dir => isExecutable(path.join(dir, command), opt)))\n return bins.find(bin => !!bin)\n}\n\n/**\n * Options for lookPath.\n */\nexport interface LookPathOption {\n /**\n * Additional paths to look for, would be dealt same as PATH env.\n * Example: ['/tmp/bin', 'usr/local/bin']\n */\n include?: string[]\n /**\n * Paths to exclude to look for.\n * Example: ['/mnt']\n */\n exclude?: string[]\n /**\n * Set of env var to be used ON BEHALF OF the existing env of your runtime.\n * If `include` or `exclude` are given, they will be applied to this env set.\n */\n env?: NodeJS.ProcessEnv\n}\n","import { exec as execNonPromise, ExecOptions } from 'node:child_process'\nimport * as fs from 'node:fs/promises'\nimport * as process from 'node:process'\nimport * as path from 'node:path'\nimport * as util from 'node:util'\nimport * as semver from 'semver'\nimport { lookPath } from './lookPath'\nimport { type ExecResult } from './models'\n\nexport interface IBuildAgent {\n agentName: string\n sourceDirVariable: string\n tempDirVariable: string\n cacheDirVariable: string\n\n sourceDir: string\n tempDir: string\n cacheDir: string\n\n addPath(inputPath: string): void\n\n debug(message: string): void\n\n info(message: string): void\n\n warn(message: string): void\n\n error(message: string): void\n\n exec(exec: string, args: string[]): Promise\n\n cacheToolDirectory(sourceDir: string, tool: string, version: string): Promise\n\n directoryExists(dir: string): Promise\n\n removeDirectory(dir: string): Promise\n\n fileExists(file: string): Promise\n\n findLocalTool(toolName: string, versionSpec: string): Promise\n\n getInput(input: string, required?: boolean): string\n\n getInput(input: Extract, required?: boolean): string\n\n getBooleanInput(input: Extract, required?: boolean): boolean\n\n getDelimitedInput(input: Extract, delimiter: string, required?: boolean): string[]\n\n getListInput(input: Extract, required?: boolean): string[]\n\n setSucceeded(message: string, done?: boolean): void\n\n setFailed(message: string, done?: boolean): void\n\n setOutput(name: string, value: string): void\n\n getVariable(name: string): string | undefined\n\n getVariableAsPath(name: string): string\n\n setVariable(name: string, value: string): void\n\n which(tool: string, check?: boolean): Promise\n}\n\nexport abstract class BuildAgentBase implements IBuildAgent {\n abstract agentName: string\n abstract sourceDirVariable: string\n abstract tempDirVariable: string\n abstract cacheDirVariable: string\n\n abstract debug(message: string): void\n\n abstract info(message: string): void\n\n abstract warn(message: string): void\n\n abstract error(message: string): void\n\n abstract setSucceeded(message: string, done?: boolean): void\n\n abstract setFailed(message: string, done?: boolean): void\n\n abstract setOutput(name: string, value: string): void\n\n abstract setVariable(name: string, value: string): void\n\n get sourceDir(): string {\n return this.getVariableAsPath(this.sourceDirVariable)?.replace(/\\\\/g, '/')\n }\n\n get tempDir(): string {\n return this.getVariableAsPath(this.tempDirVariable)\n }\n\n get cacheDir(): string {\n return this.getVariableAsPath(this.cacheDirVariable)\n }\n\n addPath(inputPath: string): void {\n const envName = process.platform === 'win32' ? 'Path' : 'PATH'\n const newPath = inputPath + path.delimiter + process.env[envName]\n this.debug(`new Path: ${newPath}`)\n process.env[envName] = newPath\n process.env.Path = newPath\n this.info(`Updated PATH: ${process.env[envName]}`)\n }\n\n getInput(input: Extract, required?: boolean): string {\n const inputProp = input.replace(/ /g, '_').toUpperCase()\n const val = this.getVariable(`INPUT_${inputProp}`)\n if (required && !val) {\n throw new Error(`Input required and not supplied: ${inputProp}`)\n }\n return val.trim()\n }\n\n getBooleanInput(input: Extract, required?: boolean): boolean {\n const inputValue = this.getInput(input, required)\n return (inputValue || 'false').toLowerCase() === 'true'\n }\n\n getDelimitedInput(input: Extract, delimiter: string, required?: boolean): string[] {\n return this.getInput(input, required)\n .split(delimiter)\n .filter(x => {\n if (x) {\n return x.trim()\n }\n })\n }\n\n getListInput(input: Extract, required?: boolean): string[] {\n return this.getDelimitedInput(input, '\\n', required)\n }\n\n getVariable(name: string): string {\n const value = (process.env[name] || '').trim()\n this.debug(`getVariable - ${name}: ${value}`)\n return value.trim()\n }\n\n getVariableAsPath(name: string): string {\n return path.resolve(path.normalize(this.getVariable(name)))\n }\n\n async directoryExists(dir: string): Promise {\n try {\n await fs.access(dir)\n return (await fs.stat(dir)).isDirectory()\n } catch (_error) {\n return false\n }\n }\n\n async removeDirectory(dir: string): Promise {\n await fs.rm(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 1000 })\n }\n\n async fileExists(file: string): Promise {\n try {\n await fs.access(file)\n return (await fs.stat(file)).isFile()\n } catch (_error) {\n return false\n }\n }\n\n async cacheToolDirectory(sourceDir: string, tool: string, version: string): Promise {\n if (!tool) {\n throw new Error('tool is a required parameter')\n }\n if (!version) {\n throw new Error('version is a required parameter')\n }\n if (!sourceDir) {\n throw new Error('sourceDir is a required parameter')\n }\n\n const cacheRoot = this.cacheDir\n if (!cacheRoot) {\n this.debug('cache root not set')\n return ''\n }\n\n version = semver.clean(version) || version\n const destPath = path.join(cacheRoot, tool, version)\n if (await this.directoryExists(destPath)) {\n this.debug(`Destination directory ${destPath} already exists, removing`)\n await this.removeDirectory(destPath)\n }\n\n this.debug(`Copying ${sourceDir} to ${destPath}`)\n await fs.mkdir(destPath, { recursive: true })\n await fs.cp(sourceDir, destPath, { recursive: true, force: true })\n\n this.debug(`Caching ${tool}@${version} from ${sourceDir}`)\n return destPath\n }\n\n async findLocalTool(toolName: string, versionSpec: string): Promise {\n if (!toolName) {\n throw new Error('toolName is a required parameter')\n }\n if (!versionSpec) {\n throw new Error('versionSpec is a required parameter')\n }\n\n const cacheRoot = this.cacheDir\n if (!cacheRoot) {\n this.debug('cache root not set')\n return null\n }\n\n versionSpec = semver.clean(versionSpec) || versionSpec\n this.info(`Looking for local tool ${toolName}@${versionSpec}`)\n const toolPath = path.join(cacheRoot, toolName, versionSpec)\n if (!(await this.directoryExists(toolPath))) {\n this.info(`Directory ${toolPath} not found`)\n return null\n } else {\n this.info(`Found tool ${toolName}@${versionSpec} at ${toolPath}`)\n }\n\n return toolPath\n }\n\n async exec(cmd: string, args: string[]): Promise {\n const exec = util.promisify(execNonPromise)\n\n try {\n const commandOptions: ExecOptions = { maxBuffer: 1024 * 1024 * 10 } // 10MB\n const { stdout, stderr } = await exec(`${cmd} ${args.join(' ')}`, commandOptions)\n return {\n code: 0,\n error: null,\n stderr,\n stdout\n }\n } catch (e) {\n const error = e as Error & { code: number; stderr: string; stdout: string }\n return {\n code: error.code,\n error,\n stderr: error.stderr,\n stdout: error.stdout\n }\n }\n }\n\n async which(tool: string, _check?: boolean): Promise {\n this.debug(`looking for tool '${tool}' in PATH`)\n let toolPath = await lookPath(tool)\n if (toolPath) {\n toolPath = path.resolve(toolPath)\n this.debug(`found tool '${tool}' in PATH: ${toolPath}`)\n return toolPath\n }\n throw new Error(`Unable to locate executable file: ${tool}`)\n }\n}\n"],"names":["semver.clean","exec","execNonPromise"],"mappings":";;;;;;;AAWA,MAAM,UAAA,GAAa,CAAC,GAAoC,KAAA;AACpD,EAAO,OAAA,GAAA,CAAI,SAAS,IAAK,CAAA,GAAG,IAAI,IAAK,CAAA,OAAA,CAAQ,GAAG,CAAI,GAAA,KAAA,CAAA;AACxD,CAAA;AAQA,MAAM,MAAA,GAAS,OAAO,QAAkD,KAAA;AACpE,EAAI,IAAA;AACA,IAAM,MAAA,EAAA,CAAG,OAAO,QAAQ,CAAA;AACxB,IAAO,OAAA,QAAA;AAAA,WACF,MAAQ,EAAA;AACb,IAAO,OAAA,KAAA,CAAA;AAAA;AAEf,CAAA;AASA,MAAM,YAAe,GAAA,OAAO,OAAiB,EAAA,OAAA,GAA0B,EAAoC,KAAA;AACvG,EAAM,MAAA,OAAA,GAAU,OAAQ,CAAA,GAAA,IAAO,OAAQ,CAAA,GAAA;AACvC,EAAM,MAAA,SAAA,GAAA,CAAa,QAAQ,OAAW,IAAA,EAAA,EAAI,MAAM,IAAK,CAAA,SAAS,CAAE,CAAA,MAAA,CAAO,EAAE,CAAA;AACzE,EAAA,MAAM,IAAO,GAAA,MAAM,OAAQ,CAAA,GAAA,CAAI,UAAU,GAAI,CAAA,OAAM,GAAO,KAAA,MAAA,CAAO,OAAU,GAAA,GAAA,C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W,QAAA,GAAA,IAAA,CAAK,QAAQ,QAAQ,CAAA;AAChC,MAAA,IAAA,CAAK,KAAM,CAAA,CAAA,YAAA,EAAe,IAAI,CAAA,WAAA,EAAc,QAAQ,CAAE,CAAA,CAAA;AACtD,MAAO,OAAA,QAAA;AAAA;AAEX,IAAA,MAAM,IAAI,KAAA,CAAM,CAAqC,kCAAA,EAAA,IAAI,CAAE,CAAA,CAAA;AAAA;AAEnE;;;;"} \ No newline at end of file +{"version":3,"file":"agents.mjs","sources":["../../../src/agents/common/lookPath.ts","../../../src/agents/common/build-agent.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport * as path from 'node:path'\nimport * as process from 'node:process'\n\n/**\n * Sometimes, people want to look for local executable files\n * which are specified with either relative or absolute file path.\n * @private\n * @param cmd\n * @return {string} An absolute path of given command, or undefined.\n */\nconst isFilePath = (cmd: string): string | undefined => {\n return cmd.includes(path.sep) ? path.resolve(cmd) : undefined\n}\n\n/**\n * Just promisifies \"fs.access\"\n * @private\n * @param {string} filePath An absolute file path with an applicable extension appended.\n * @return {Promise} Resolves absolute path or empty string.\n */\nconst access = async (filePath: string): Promise => {\n try {\n await fs.access(filePath)\n return filePath\n } catch (_error) {\n return undefined\n }\n}\n\n/**\n * Resolves if the given file is executable or not, regarding \"PATHEXT\" to be applied.\n * @private\n * @param {string} absPath A file path to be checked.\n * @param {LookPathOption} options Options for lookPath.\n * @return {Promise} Resolves the absolute file path just checked, or undefined.\n */\nconst isExecutable = async (absPath: string, options: LookPathOption = {}): Promise => {\n const envVars = options.env || process.env\n const extension = (envVars.PATHEXT || '').split(path.delimiter).concat('')\n const bins = await Promise.all(extension.map(async ext => access(absPath + ext.toLowerCase())))\n return bins.find(bin => !!bin)\n}\n\n/**\n * Returns a list of directories on which the target command should be looked for.\n * @private\n * @param {string[]} options.include Will be added to \"PATH\" env.\n * @param {string[]} options.exclude Will be filtered from \"PATH\" env.\n * @return {string[]} Directories to dig into.\n */\nconst getDirsToWalkThrough = (options: LookPathOption): string[] => {\n const envVars = options.env || process.env\n const envName = process.platform === 'win32' ? 'Path' : 'PATH'\n const envPath = envVars[envName] || ''\n return envPath\n .split(path.delimiter)\n .concat(options.include || [])\n .filter(p => !(options.exclude || []).includes(p))\n}\n\n/**\n * Returns async promise with absolute file path of given command,\n * and resolves with undefined if the command not found.\n * @param {string} command Command name to look for.\n * @param {LookPathOption} opt Options for lookPath.\n * @return {Promise} Resolves absolute file path, or undefined if not found.\n */\nexport async function lookPath(command: string, opt: LookPathOption = {}): Promise {\n const directPath = isFilePath(command)\n if (directPath) return isExecutable(directPath, opt)\n\n const dirs = getDirsToWalkThrough(opt)\n const bins = await Promise.all(dirs.map(async dir => isExecutable(path.join(dir, command), opt)))\n return bins.find(bin => !!bin)\n}\n\n/**\n * Options for lookPath.\n */\nexport interface LookPathOption {\n /**\n * Additional paths to look for, would be dealt same as PATH env.\n * Example: ['/tmp/bin', 'usr/local/bin']\n */\n include?: string[]\n /**\n * Paths to exclude to look for.\n * Example: ['/mnt']\n */\n exclude?: string[]\n /**\n * Set of env var to be used ON BEHALF OF the existing env of your runtime.\n * If `include` or `exclude` are given, they will be applied to this env set.\n */\n env?: NodeJS.ProcessEnv\n}\n","import { exec as execNonPromise, ExecOptions } from 'node:child_process'\nimport * as fs from 'node:fs/promises'\nimport * as process from 'node:process'\nimport * as path from 'node:path'\nimport * as util from 'node:util'\nimport * as semver from 'semver'\nimport { lookPath } from './lookPath'\nimport { type ExecResult } from './models'\n\nexport interface IBuildAgent {\n agentName: string\n sourceDirVariable: string\n tempDirVariable: string\n cacheDirVariable: string\n\n sourceDir: string\n tempDir: string\n cacheDir: string\n\n addPath(inputPath: string): void\n\n debug(message: string): void\n\n info(message: string): void\n\n warn(message: string): void\n\n error(message: string): void\n\n exec(exec: string, args: string[]): Promise\n\n cacheToolDirectory(sourceDir: string, tool: string, version: string): Promise\n\n directoryExists(dir: string): Promise\n\n removeDirectory(dir: string): Promise\n\n fileExists(file: string): Promise\n\n findLocalTool(toolName: string, versionSpec: string): Promise\n\n getInput(input: string, required?: boolean): string\n\n getInput(input: Extract, required?: boolean): string\n\n getBooleanInput(input: Extract, required?: boolean): boolean\n\n getDelimitedInput(input: Extract, delimiter: string, required?: boolean): string[]\n\n getListInput(input: Extract, required?: boolean): string[]\n\n setSucceeded(message: string, done?: boolean): void\n\n setFailed(message: string, done?: boolean): void\n\n setOutput(name: string, value: string): void\n\n getVariable(name: string): string | undefined\n\n getVariableAsPath(name: string): string\n\n setVariable(name: string, value: string): void\n\n updateBuildNumber: (version: string) => void\n\n which(tool: string, check?: boolean): Promise\n}\n\nexport abstract class BuildAgentBase implements IBuildAgent {\n abstract agentName: string\n abstract sourceDirVariable: string\n abstract tempDirVariable: string\n abstract cacheDirVariable: string\n\n abstract debug(message: string): void\n\n abstract info(message: string): void\n\n abstract warn(message: string): void\n\n abstract error(message: string): void\n\n abstract setSucceeded(message: string, done?: boolean): void\n\n abstract setFailed(message: string, done?: boolean): void\n\n abstract setOutput(name: string, value: string): void\n\n abstract setVariable(name: string, value: string): void\n\n abstract updateBuildNumber: (version: string) => void\n\n get sourceDir(): string {\n return this.getVariableAsPath(this.sourceDirVariable)?.replace(/\\\\/g, '/')\n }\n\n get tempDir(): string {\n return this.getVariableAsPath(this.tempDirVariable)\n }\n\n get cacheDir(): string {\n return this.getVariableAsPath(this.cacheDirVariable)\n }\n\n addPath(inputPath: string): void {\n const envName = process.platform === 'win32' ? 'Path' : 'PATH'\n const newPath = inputPath + path.delimiter + process.env[envName]\n this.debug(`new Path: ${newPath}`)\n process.env[envName] = newPath\n process.env.Path = newPath\n this.info(`Updated PATH: ${process.env[envName]}`)\n }\n\n getInput(input: Extract, required?: boolean): string {\n const inputProp = input.replace(/ /g, '_').toUpperCase()\n const val = this.getVariable(`INPUT_${inputProp}`)\n if (required && !val) {\n throw new Error(`Input required and not supplied: ${inputProp}`)\n }\n return val.trim()\n }\n\n getBooleanInput(input: Extract, required?: boolean): boolean {\n const inputValue = this.getInput(input, required)\n return (inputValue || 'false').toLowerCase() === 'true'\n }\n\n getDelimitedInput(input: Extract, delimiter: string, required?: boolean): string[] {\n return this.getInput(input, required)\n .split(delimiter)\n .filter(x => {\n if (x) {\n return x.trim()\n }\n })\n }\n\n getListInput(input: Extract, required?: boolean): string[] {\n return this.getDelimitedInput(input, '\\n', required)\n }\n\n getVariable(name: string): string {\n const value = (process.env[name] || '').trim()\n this.debug(`getVariable - ${name}: ${value}`)\n return value.trim()\n }\n\n getVariableAsPath(name: string): string {\n return path.resolve(path.normalize(this.getVariable(name)))\n }\n\n async directoryExists(dir: string): Promise {\n try {\n await fs.access(dir)\n return (await fs.stat(dir)).isDirectory()\n } catch (_error) {\n return false\n }\n }\n\n async removeDirectory(dir: string): Promise {\n await fs.rm(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 1000 })\n }\n\n async fileExists(file: string): Promise {\n try {\n await fs.access(file)\n return (await fs.stat(file)).isFile()\n } catch (_error) {\n return false\n }\n }\n\n async cacheToolDirectory(sourceDir: string, tool: string, version: string): Promise {\n if (!tool) {\n throw new Error('tool is a required parameter')\n }\n if (!version) {\n throw new Error('version is a required parameter')\n }\n if (!sourceDir) {\n throw new Error('sourceDir is a required parameter')\n }\n\n const cacheRoot = this.cacheDir\n if (!cacheRoot) {\n this.debug('cache root not set')\n return ''\n }\n\n version = semver.clean(version) || version\n const destPath = path.join(cacheRoot, tool, version)\n if (await this.directoryExists(destPath)) {\n this.debug(`Destination directory ${destPath} already exists, removing`)\n await this.removeDirectory(destPath)\n }\n\n this.debug(`Copying ${sourceDir} to ${destPath}`)\n await fs.mkdir(destPath, { recursive: true })\n await fs.cp(sourceDir, destPath, { recursive: true, force: true })\n\n this.debug(`Caching ${tool}@${version} from ${sourceDir}`)\n return destPath\n }\n\n async findLocalTool(toolName: string, versionSpec: string): Promise {\n if (!toolName) {\n throw new Error('toolName is a required parameter')\n }\n if (!versionSpec) {\n throw new Error('versionSpec is a required parameter')\n }\n\n const cacheRoot = this.cacheDir\n if (!cacheRoot) {\n this.debug('cache root not set')\n return null\n }\n\n versionSpec = semver.clean(versionSpec) || versionSpec\n this.info(`Looking for local tool ${toolName}@${versionSpec}`)\n const toolPath = path.join(cacheRoot, toolName, versionSpec)\n if (!(await this.directoryExists(toolPath))) {\n this.info(`Directory ${toolPath} not found`)\n return null\n } else {\n this.info(`Found tool ${toolName}@${versionSpec} at ${toolPath}`)\n }\n\n return toolPath\n }\n\n async exec(cmd: string, args: string[]): Promise {\n const exec = util.promisify(execNonPromise)\n\n try {\n const commandOptions: ExecOptions = { maxBuffer: 1024 * 1024 * 10 } // 10MB\n const { stdout, stderr } = await exec(`${cmd} ${args.join(' ')}`, commandOptions)\n return {\n code: 0,\n error: null,\n stderr,\n stdout\n }\n } catch (e) {\n const error = e as Error & { code: number; stderr: string; stdout: string }\n return {\n code: error.code,\n error,\n stderr: error.stderr,\n stdout: error.stdout\n }\n }\n }\n\n async which(tool: string, _check?: boolean): Promise {\n this.debug(`looking for tool '${tool}' in PATH`)\n let toolPath = await lookPath(tool)\n if (toolPath) {\n toolPath = path.resolve(toolPath)\n this.debug(`found tool '${tool}' in PATH: ${toolPath}`)\n return toolPath\n }\n throw new Error(`Unable to locate executable file: ${tool}`)\n }\n}\n"],"names":["semver.clean","exec","execNonPromise"],"mappings":";;;;;;;AAWA,MAAM,UAAA,GAAa,CAAC,GAAoC,KAAA;AACpD,EAAO,OAAA,GAAA,CAAI,SAAS,IAAK,CAAA,GAAG,IAAI,IAAK,CAAA,OAAA,CAAQ,GAAG,CAAI,GAAA,KAAA,CAAA;AACxD,CAAA;AAQA,MAAM,MAAA,GAAS,OAAO,QAAkD,KAAA;AACpE,EAAI,IAAA;AACA,IAAM,MAAA,EAAA,CAAG,OAAO,QAAQ,CAAA;AACxB,IAAO,OAAA,QAAA;AAAA,WACF,MAAQ,EAAA;AACb,IAAO,OAAA,KAAA,CAAA;AAAA;AAEf,CAAA;AASA,MAAM,YAAe,GAAA,OAAO,OAAiB,EA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AAA,IAAA;AAAA,QACZ,KAAA;AAAA,QACA,QAAQ,KAAM,CAAA,MAAA;AAAA,QACd,QAAQ,KAAM,CAAA;AAAA,OAClB;AAAA;AACJ;AACJ,EAEA,MAAM,KAAM,CAAA,IAAA,EAAc,MAAmC,EAAA;AACzD,IAAK,IAAA,CAAA,KAAA,CAAM,CAAqB,kBAAA,EAAA,IAAI,CAAW,SAAA,CAAA,CAAA;AAC/C,IAAI,IAAA,QAAA,GAAW,MAAM,QAAA,CAAS,IAAI,CAAA;AAClC,IAAA,IAAI,QAAU,EAAA;AACV,MAAW,QAAA,GAAA,IAAA,CAAK,QAAQ,QAAQ,CAAA;AAChC,MAAA,IAAA,CAAK,KAAM,CAAA,CAAA,YAAA,EAAe,IAAI,CAAA,WAAA,EAAc,QAAQ,CAAE,CAAA,CAAA;AACtD,MAAO,OAAA,QAAA;AAAA;AAEX,IAAA,MAAM,IAAI,KAAA,CAAM,CAAqC,kCAAA,EAAA,IAAI,CAAE,CAAA,CAAA;AAAA;AAEnE;;;;"} \ No newline at end of file diff --git a/dist/tools/libs/gitversion.mjs b/dist/tools/libs/gitversion.mjs index 7adbea1a8..37ff6045b 100644 --- a/dist/tools/libs/gitversion.mjs +++ b/dist/tools/libs/gitversion.mjs @@ -88,6 +88,10 @@ class GitVersionTool extends DotnetTool { this.buildAgent.error(`Unable to set output/variable for ${property}`); } } + if (output.FullSemVer.endsWith("+0")) { + output.FullSemVer = output.FullSemVer.slice(0, -2); + } + this.buildAgent.updateBuildNumber(output.FullSemVer); } async getRepoDir(settings) { return await super.getRepoPath(settings.targetPath); diff --git a/dist/tools/libs/gitversion.mjs.map b/dist/tools/libs/gitversion.mjs.map index d4561bbf5..0dd10b1ab 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', '/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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,MAAA,CAAO,YAAY,GAAG,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 +{"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 if (output.FullSemVer.endsWith('+0')) {\n output.FullSemVer = output.FullSemVer.slice(0, -2)\n }\n this.buildAgent.updateBuildNumber(output.FullSemVer)\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":";;;;;;;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,IA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CAAO,YAAY,GAAG,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/local/agent.mjs b/dist/tools/local/agent.mjs index 857cf2a61..4dab82500 100644 --- a/dist/tools/local/agent.mjs +++ b/dist/tools/local/agent.mjs @@ -25,6 +25,7 @@ class BuildAgent extends BuildAgentBase { this.debug(`setVariable - ${name} - ${value}`); process.env[name] = value; } + updateBuildNumber = (version) => this.debug(`updateBuildNumber - ${version}`); } export { BuildAgent }; diff --git a/dist/tools/local/agent.mjs.map b/dist/tools/local/agent.mjs.map index 39750a2f3..540dc042c 100644 --- a/dist/tools/local/agent.mjs.map +++ b/dist/tools/local/agent.mjs.map @@ -1 +1 @@ -{"version":3,"file":"agent.mjs","sources":["../../../src/agents/local/build-agent.ts"],"sourcesContent":["import * as process from 'node:process'\n\nimport { BuildAgentBase, type IBuildAgent } from '@agents/common'\n\nexport class BuildAgent extends BuildAgentBase implements IBuildAgent {\n agentName = 'Local'\n\n sourceDirVariable = 'AGENT_SOURCE_DIR'\n tempDirVariable = 'AGENT_TEMP_DIR'\n cacheDirVariable = 'AGENT_TOOLS_DIR'\n\n debug = (message: string): void => {\n process.stdout.write(`[debug] ${message}`)\n }\n\n info = (message: string): void => {\n process.stdout.write(`[info] - ${message}`)\n }\n\n warn = (message: string): void => {\n process.stderr.write(`[warn] - ${message}`)\n }\n\n error = (message: string): void => {\n process.stderr.write(`[error] - ${message}`)\n }\n\n setSucceeded = (message: string, done?: boolean): void => this.info(`setSucceeded - ${message} - ${done}`)\n\n setFailed = (message: string, done?: boolean): void => this.error(`setFailed - ${message} - ${done}`)\n\n setOutput = (name: string, value: string): void => this.debug(`setOutput - ${name} - ${value}`)\n\n setVariable(name: string, value: string): void {\n this.debug(`setVariable - ${name} - ${value}`)\n process.env[name] = value\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,mBAAmB,cAAsC,CAAA;AAAA,EAClE,SAAY,GAAA,OAAA,CAAA;AAAA,EAEZ,iBAAoB,GAAA,kBAAA,CAAA;AAAA,EACpB,eAAkB,GAAA,gBAAA,CAAA;AAAA,EAClB,gBAAmB,GAAA,iBAAA,CAAA;AAAA,EAEnB,KAAA,GAAQ,CAAC,OAA0B,KAAA;AAC/B,IAAA,OAAA,CAAQ,MAAO,CAAA,KAAA,CAAM,CAAW,QAAA,EAAA,OAAO,CAAE,CAAA,CAAA,CAAA;AAAA,GAC7C,CAAA;AAAA,EAEA,IAAA,GAAO,CAAC,OAA0B,KAAA;AAC9B,IAAA,OAAA,CAAQ,MAAO,CAAA,KAAA,CAAM,CAAY,SAAA,EAAA,OAAO,CAAE,CAAA,CAAA,CAAA;AAAA,GAC9C,CAAA;AAAA,EAEA,IAAA,GAAO,CAAC,OAA0B,KAAA;AAC9B,IAAA,OAAA,CAAQ,MAAO,CAAA,KAAA,CAAM,CAAY,SAAA,EAAA,OAAO,CAAE,CAAA,CAAA,CAAA;AAAA,GAC9C,CAAA;AAAA,EAEA,KAAA,GAAQ,CAAC,OAA0B,KAAA;AAC/B,IAAA,OAAA,CAAQ,MAAO,CAAA,KAAA,CAAM,CAAa,UAAA,EAAA,OAAO,CAAE,CAAA,CAAA,CAAA;AAAA,GAC/C,CAAA;AAAA,EAEA,YAAA,GAAe,CAAC,OAAA,EAAiB,IAAyB,KAAA,IAAA,CAAK,KAAK,CAAkB,eAAA,EAAA,OAAO,CAAM,GAAA,EAAA,IAAI,CAAE,CAAA,CAAA,CAAA;AAAA,EAEzG,SAAA,GAAY,CAAC,OAAA,EAAiB,IAAyB,KAAA,IAAA,CAAK,MAAM,CAAe,YAAA,EAAA,OAAO,CAAM,GAAA,EAAA,IAAI,CAAE,CAAA,CAAA,CAAA;AAAA,EAEpG,SAAA,GAAY,CAAC,IAAA,EAAc,KAAwB,KAAA,IAAA,CAAK,MAAM,CAAe,YAAA,EAAA,IAAI,CAAM,GAAA,EAAA,KAAK,CAAE,CAAA,CAAA,CAAA;AAAA,EAE9F,WAAA,CAAY,MAAc,KAAqB,EAAA;AAC3C,IAAA,IAAA,CAAK,KAAM,CAAA,CAAA,cAAA,EAAiB,IAAI,CAAA,GAAA,EAAM,KAAK,CAAE,CAAA,CAAA,CAAA;AAC7C,IAAQ,OAAA,CAAA,GAAA,CAAI,IAAI,CAAI,GAAA,KAAA,CAAA;AAAA,GACxB;AACJ;;;;"} \ No newline at end of file +{"version":3,"file":"agent.mjs","sources":["../../../src/agents/local/build-agent.ts"],"sourcesContent":["import * as process from 'node:process'\n\nimport { BuildAgentBase, type IBuildAgent } from '@agents/common'\n\nexport class BuildAgent extends BuildAgentBase implements IBuildAgent {\n agentName = 'Local'\n\n sourceDirVariable = 'AGENT_SOURCE_DIR'\n tempDirVariable = 'AGENT_TEMP_DIR'\n cacheDirVariable = 'AGENT_TOOLS_DIR'\n\n debug = (message: string): void => {\n process.stdout.write(`[debug] ${message}`)\n }\n\n info = (message: string): void => {\n process.stdout.write(`[info] - ${message}`)\n }\n\n warn = (message: string): void => {\n process.stderr.write(`[warn] - ${message}`)\n }\n\n error = (message: string): void => {\n process.stderr.write(`[error] - ${message}`)\n }\n\n setSucceeded = (message: string, done?: boolean): void => this.info(`setSucceeded - ${message} - ${done}`)\n\n setFailed = (message: string, done?: boolean): void => this.error(`setFailed - ${message} - ${done}`)\n\n setOutput = (name: string, value: string): void => this.debug(`setOutput - ${name} - ${value}`)\n\n setVariable(name: string, value: string): void {\n this.debug(`setVariable - ${name} - ${value}`)\n process.env[name] = value\n }\n\n updateBuildNumber = (version: string): void => this.debug(`updateBuildNumber - ${version}`)\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,mBAAmB,cAAsC,CAAA;AAAA,EAClE,SAAY,GAAA,OAAA;AAAA,EAEZ,iBAAoB,GAAA,kBAAA;AAAA,EACpB,eAAkB,GAAA,gBAAA;AAAA,EAClB,gBAAmB,GAAA,iBAAA;AAAA,EAEnB,KAAA,GAAQ,CAAC,OAA0B,KAAA;AAC/B,IAAA,OAAA,CAAQ,MAAO,CAAA,KAAA,CAAM,CAAW,QAAA,EAAA,OAAO,CAAE,CAAA,CAAA;AAAA,GAC7C;AAAA,EAEA,IAAA,GAAO,CAAC,OAA0B,KAAA;AAC9B,IAAA,OAAA,CAAQ,MAAO,CAAA,KAAA,CAAM,CAAY,SAAA,EAAA,OAAO,CAAE,CAAA,CAAA;AAAA,GAC9C;AAAA,EAEA,IAAA,GAAO,CAAC,OAA0B,KAAA;AAC9B,IAAA,OAAA,CAAQ,MAAO,CAAA,KAAA,CAAM,CAAY,SAAA,EAAA,OAAO,CAAE,CAAA,CAAA;AAAA,GAC9C;AAAA,EAEA,KAAA,GAAQ,CAAC,OAA0B,KAAA;AAC/B,IAAA,OAAA,CAAQ,MAAO,CAAA,KAAA,CAAM,CAAa,UAAA,EAAA,OAAO,CAAE,CAAA,CAAA;AAAA,GAC/C;AAAA,EAEA,YAAA,GAAe,CAAC,OAAA,EAAiB,IAAyB,KAAA,IAAA,CAAK,KAAK,CAAkB,eAAA,EAAA,OAAO,CAAM,GAAA,EAAA,IAAI,CAAE,CAAA,CAAA;AAAA,EAEzG,SAAA,GAAY,CAAC,OAAA,EAAiB,IAAyB,KAAA,IAAA,CAAK,MAAM,CAAe,YAAA,EAAA,OAAO,CAAM,GAAA,EAAA,IAAI,CAAE,CAAA,CAAA;AAAA,EAEpG,SAAA,GAAY,CAAC,IAAA,EAAc,KAAwB,KAAA,IAAA,CAAK,MAAM,CAAe,YAAA,EAAA,IAAI,CAAM,GAAA,EAAA,KAAK,CAAE,CAAA,CAAA;AAAA,EAE9F,WAAA,CAAY,MAAc,KAAqB,EAAA;AAC3C,IAAA,IAAA,CAAK,KAAM,CAAA,CAAA,cAAA,EAAiB,IAAI,CAAA,GAAA,EAAM,KAAK,CAAE,CAAA,CAAA;AAC7C,IAAQ,OAAA,CAAA,GAAA,CAAI,IAAI,CAAI,GAAA,KAAA;AAAA;AACxB,EAEA,oBAAoB,CAAC,OAAA,KAA0B,KAAK,KAAM,CAAA,CAAA,oBAAA,EAAuB,OAAO,CAAE,CAAA,CAAA;AAC9F;;;;"} \ No newline at end of file diff --git a/src/__tests__/tools/gitversion/tool.spec.ts b/src/__tests__/tools/gitversion/tool.spec.ts index 8febc3bdc..af875e006 100644 --- a/src/__tests__/tools/gitversion/tool.spec.ts +++ b/src/__tests__/tools/gitversion/tool.spec.ts @@ -58,6 +58,9 @@ describe('GitVersionTool', () => { }, setVariable(name: string, value: string) { variables.set(name, value) + }, + updateBuildNumber(_version: string): void { + return } } as IBuildAgent tool = new TestGitVersionTool(buildAgent) diff --git a/src/agents/azure/build-agent.ts b/src/agents/azure/build-agent.ts index 0f3d348e0..5a43f0f62 100644 --- a/src/agents/azure/build-agent.ts +++ b/src/agents/azure/build-agent.ts @@ -33,6 +33,13 @@ export class BuildAgent extends BuildAgentBase implements IBuildAgent { setVariable = (name: string, value: string): void => this._setVariable(name, value) + updateBuildNumber = (version: string): void => this._updateBuildNumber(version) + + private _updateBuildNumber(version: string): void { + this.debug(`build number: ${version}`) + issueCommand('build.updatebuildnumber', {}, version) + } + private _setResult(result: TaskResult, message: string, done?: boolean): void { this.debug(`task result: ${TaskResult[result]}`) // add an error issue diff --git a/src/agents/common/build-agent.ts b/src/agents/common/build-agent.ts index 8ac2294bc..b74f1b2a2 100644 --- a/src/agents/common/build-agent.ts +++ b/src/agents/common/build-agent.ts @@ -61,6 +61,8 @@ export interface IBuildAgent { setVariable(name: string, value: string): void + updateBuildNumber: (version: string) => void + which(tool: string, check?: boolean): Promise } @@ -86,6 +88,8 @@ export abstract class BuildAgentBase implements IBuildAgent { abstract setVariable(name: string, value: string): void + abstract updateBuildNumber: (version: string) => void + get sourceDir(): string { return this.getVariableAsPath(this.sourceDirVariable)?.replace(/\\/g, '/') } diff --git a/src/agents/github/build-agent.ts b/src/agents/github/build-agent.ts index 12a404892..38e153f11 100644 --- a/src/agents/github/build-agent.ts +++ b/src/agents/github/build-agent.ts @@ -60,4 +60,6 @@ export class BuildAgent extends BuildAgentBase implements IBuildAgent { issueCommand('set-env', { name }, convertedVal) } + + updateBuildNumber = (version: string): void => this.debug(`updateBuildNumber - ${version}`) } diff --git a/src/agents/local/build-agent.ts b/src/agents/local/build-agent.ts index 39fefda1d..1a516770a 100644 --- a/src/agents/local/build-agent.ts +++ b/src/agents/local/build-agent.ts @@ -35,4 +35,6 @@ export class BuildAgent extends BuildAgentBase implements IBuildAgent { this.debug(`setVariable - ${name} - ${value}`) process.env[name] = value } + + updateBuildNumber = (version: string): void => this.debug(`updateBuildNumber - ${version}`) } diff --git a/src/tools/gitversion/tool.ts b/src/tools/gitversion/tool.ts index 52feee3bb..3e19eeec5 100644 --- a/src/tools/gitversion/tool.ts +++ b/src/tools/gitversion/tool.ts @@ -64,6 +64,11 @@ export class GitVersionTool extends DotnetTool { this.buildAgent.error(`Unable to set output/variable for ${property}`) } } + + if (output.FullSemVer.endsWith('+0')) { + output.FullSemVer = output.FullSemVer.slice(0, -2) + } + this.buildAgent.updateBuildNumber(output.FullSemVer) } protected async getRepoDir(settings: ExecuteSettings | CommandSettings): Promise {