added buildAgent.getSourceDir

This commit is contained in:
Artur Stolear
2019-11-22 16:34:02 +02:00
parent 97e28c979f
commit c6860ee6ba
6 changed files with 38 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -61,6 +61,10 @@ class BuildAgent implements IBuildAgent {
});
}
public getSourceDir(): string {
return this.getVariable("Build.SourcesDirectory");
}
public getInput(input: string, required?: boolean): string {
return taskLib.getInput(input, required);
}

View File

@@ -146,10 +146,13 @@ class DotnetTool implements IDotnetTool {
@injectable()
class GitVersionTool implements IGitVersionTool {
private buildAgent: IBuildAgent;
private dotnetTool: IDotnetTool;
constructor(
@inject(TYPES.IBuildAgent) buildAgent: IBuildAgent,
@inject(TYPES.IDotnetTool) dotnetTool: IDotnetTool,
) {
this.buildAgent = buildAgent;
this.dotnetTool = dotnetTool;
}
@@ -158,6 +161,8 @@ class GitVersionTool implements IGitVersionTool {
}
public run(options: IGitVersionOptions): Promise<IExecResult> {
console.log("Workspace: " + this.buildAgent.getSourceDir());
console.log(options);
return;
}

View File

@@ -99,6 +99,10 @@ class BuildAgent implements IBuildAgent {
};
}
public getSourceDir(): string {
return this.getVariable("GITHUB_WORKSPACE");
}
public getInput(input: string, required?: boolean): string {
return core.getInput(input, { required } as core.InputOptions);
}

View File

@@ -16,6 +16,7 @@ export interface IBuildAgent {
addPath: (inputPath: string) => void;
which: (tool: string, check?: boolean) => Promise<string>;
exec: (exec: string, args: string[]) => Promise<IExecResult>;
getSourceDir: () => string;
getInput(input: string, required?: boolean): string;
getBooleanInput(input: string, required?: boolean): boolean;