Skip to content

Commit dd92719

Browse files
authored
Merge pull request #1594 from asbjornu/feature/tfstask-path-parameter
Added path parameter to the TfsTask
2 parents 9f6fbbd + 74ee1c8 commit dd92719

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/GitVersionTfsTask/GitVersion.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ export class GitVersionTask {
1212
const updateAssemblyInfo = tl.getBoolInput('updateAssemblyInfo');
1313
const updateAssemblyInfoFilename = tl.getInput('updateAssemblyInfoFilename');
1414
const additionalArguments = tl.getInput('additionalArguments');
15+
const targetPath = tl.getInput('targetPath');
1516
const preferBundledVersion = tl.getBoolInput('preferBundledVersion');
1617

1718
const currentDirectory = __dirname;
18-
const sourcesDirectory = tl.getVariable("Build.SourcesDirectory") || ".";
19+
const workingDirectory = !targetPath
20+
? tl.getVariable("Build.SourcesDirectory")
21+
: path.join(tl.getVariable("Build.SourcesDirectory"), targetPath);
1922

2023
let gitVersionPath = tl.getInput('gitVersionPath');
2124
if (!gitVersionPath) {
@@ -69,7 +72,7 @@ export class GitVersionTask {
6972
}
7073

7174
toolRunner.arg([
72-
sourcesDirectory,
75+
workingDirectory,
7376
"/output",
7477
"buildserver",
7578
"/nofetch"]);

src/GitVersionTfsTask/GitVersionTask/task.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@
5454
"helpMarkDown": "Optionally supply the path to GitVersion.exe",
5555
"groupName": "additional"
5656
},
57+
{
58+
"name": "targetPath",
59+
"type": "string",
60+
"label": "Working directory path",
61+
"defaultValue": "",
62+
"required": false,
63+
"helpMarkDown": "Optionally supply the path to the working directory",
64+
"groupName": "additional"
65+
},
5766
{
5867
"name": "preferBundledVersion",
5968
"type": "boolean",

0 commit comments

Comments
 (0)