Skip to content

Commit

Permalink
GitTools#1051 - implemented nocache and nonormalize
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Mar 2, 2024
1 parent 5b09438 commit e892f36
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
16 changes: 16 additions & 0 deletions dist/azure/gitversion/execute/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@
"helpMarkDown": "Optionally supply the path to the working directory",
"groupName": "gitversionDetails"
},
{
"name": "disableCache",
"type": "boolean",
"label": "Disable Cache",
"defaultValue": "false",
"required": false,
"helpMarkDown": "Whether to disable GitVersion cache"
},
{
"name": "disableNormalization",
"type": "boolean",
"label": "Disable Normalization",
"defaultValue": "false",
"required": false,
"helpMarkDown": "Whether to disable GitVersion normalization"
},
{
"name": "useConfigFile",
"type": "boolean",
Expand Down
8 changes: 8 additions & 0 deletions gitversion/execute/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ inputs:
description: Optionally supply the path to the working directory
required: false
default: ''
disableCache:
description: Whether to disable caching
required: false
default: 'false'
disableNormalization:
description: Whether to disable normalization
required: false
default: 'false'
useConfigFile:
description: Whether to use a custom configuration file
required: false
Expand Down
4 changes: 4 additions & 0 deletions src/tools/gitversion/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { ISettingsProvider } from '../common/models'

export enum ExecuteFields {
targetPath = 'targetPath',
disableCache = 'disableCache',
disableNormalization = 'disableNormalization',
useConfigFile = 'useConfigFile',
configFilePath = 'configFilePath',
updateAssemblyInfo = 'updateAssemblyInfo',
Expand All @@ -12,6 +14,8 @@ export enum ExecuteFields {

export interface GitVersionSettings {
[ExecuteFields.targetPath]: string
[ExecuteFields.disableCache]: boolean
[ExecuteFields.disableNormalization]: boolean
[ExecuteFields.useConfigFile]: boolean
[ExecuteFields.configFilePath]: string
[ExecuteFields.updateAssemblyInfo]: boolean
Expand Down
12 changes: 11 additions & 1 deletion src/tools/gitversion/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export class GitVersionTool extends DotnetTool implements IGitVersionTool {
private getArguments(workDir: string, options: GitVersionSettings): string[] {
let args = [workDir, '/output', 'json', '/output', 'buildserver']

const { useConfigFile, configFilePath, updateAssemblyInfo, updateAssemblyInfoFilename, additionalArguments } = options
const { useConfigFile, disableCache, disableNormalization, configFilePath, updateAssemblyInfo, updateAssemblyInfoFilename, additionalArguments } =
options

if (useConfigFile) {
if (this.buildAgent.isValidInputFile('configFilePath', configFilePath)) {
Expand All @@ -56,6 +57,15 @@ export class GitVersionTool extends DotnetTool implements IGitVersionTool {
throw new Error('GitVersion configuration file not found at ' + configFilePath)
}
}

if (disableCache) {
args.push('/nocache')
}

if (disableNormalization) {
args.push('/nonormalize')
}

if (updateAssemblyInfo) {
args.push('/updateassemblyinfo')

Expand Down

0 comments on commit e892f36

Please sign in to comment.