Skip to content

Commit 8d4f9ab

Browse files
committed
GH 1782 - fix vsix config file
1 parent af4e947 commit 8d4f9ab

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

src/GitVersionTfsTask/GitVersion.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export class GitVersionTask {
77
execOptions: tr.IExecOptions;
88

99
preferBundledVersion: boolean;
10-
configFilePathSupplied: boolean;
10+
useConfigFile: boolean;
1111
configFilePath: string;
1212
updateAssemblyInfo: boolean;
1313

@@ -22,11 +22,13 @@ export class GitVersionTask {
2222

2323
constructor() {
2424
this.preferBundledVersion = tl.getBoolInput('preferBundledVersion') || true;
25-
this.configFilePathSupplied = tl.filePathSupplied('configFilePath');
26-
this.configFilePath = tl.getPathInput('configFilePath', false, true);
27-
this.updateAssemblyInfo = tl.getBoolInput('updateAssemblyInfo');
2825

26+
this.useConfigFile = tl.getBoolInput('useConfigFile');
27+
this.configFilePath = tl.getInput('configFilePath');
28+
29+
this.updateAssemblyInfo = tl.getBoolInput('updateAssemblyInfo');
2930
this.updateAssemblyInfoFilename = tl.getInput('updateAssemblyInfoFilename');
31+
3032
this.additionalArguments = tl.getInput('additionalArguments');
3133
this.targetPath = tl.getInput('targetPath');
3234
this.runtime = tl.getInput('runtime') || "core";
@@ -60,16 +62,22 @@ export class GitVersionTask {
6062
"buildserver",
6163
"/nofetch"]);
6264

63-
if (this.configFilePathSupplied && this.configFilePath) {
64-
exe.arg(["/config", this.configFilePath]);
65+
if (this.useConfigFile) {
66+
if (tl.filePathSupplied('configFilePath') && tl.exist(this.configFilePath) && tl.stats(this.configFilePath).isFile()) {
67+
exe.arg(["/config", this.configFilePath]);
68+
}
69+
else {
70+
throw 'GitVersion configuration file not found at ' + this.configFilePath;
71+
}
6572
}
6673

6774
if (this.updateAssemblyInfo) {
6875
exe.arg("/updateassemblyinfo");
69-
if (this.updateAssemblyInfoFilename) {
76+
if (tl.filePathSupplied('updateAssemblyInfoFilename') && tl.exist(this.updateAssemblyInfoFilename) && tl.stats(this.updateAssemblyInfoFilename).isFile()) {
7077
exe.arg(this.updateAssemblyInfoFilename);
71-
} else {
72-
exe.arg("true");
78+
}
79+
else {
80+
throw 'AssemblyInfoFilename file not found at ' + this.updateAssemblyInfoFilename;
7381
}
7482
}
7583

src/GitVersionTfsTask/GitVersionTask/task.json

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,21 @@
4242
"defaultValue": "true",
4343
"required": false,
4444
"helpMarkDown": "If checked it will prefer the bundled version over a version found in path"
45+
}, {
46+
"name": "useConfigFile",
47+
"type": "boolean",
48+
"label": "Specify Configuration file",
49+
"defaultValue": "false",
50+
"required": false,
51+
"helpMarkDown": "Whether to use a custom configuration file"
4552
}, {
4653
"name": "configFilePath",
4754
"type": "filePath",
48-
"label": "Config file",
55+
"label": "Configuration file",
4956
"defaultValue": "",
5057
"required": false,
51-
"helpMarkDown": "Optional path to config file (defaults to GitVersion.yml)"
58+
"helpMarkDown": "Optional path to config file (defaults to GitVersion.yml)",
59+
"visibleRule": "useConfigFile = true"
5260
}, {
5361
"name": "updateAssemblyInfo",
5462
"type": "boolean",
@@ -83,10 +91,10 @@
8391
}, {
8492
"name": "additionalArguments",
8593
"type": "string",
86-
"label": "Additional GitVersion.exe arguments",
94+
"label": "Additional GitVersion arguments",
8795
"defaultValue": "",
8896
"required": false,
89-
"helpMarkDown": "Additional arguments to send to GitVersion.exe",
97+
"helpMarkDown": "Additional arguments to send to GitVersion",
9098
"groupName": "additional"
9199
}],
92100
"execution": {
@@ -96,4 +104,4 @@
96104
"workingDirectory": "."
97105
}
98106
}
99-
}
107+
}

0 commit comments

Comments
 (0)