@@ -7,7 +7,7 @@ export class GitVersionTask {
7
7
execOptions : tr . IExecOptions ;
8
8
9
9
preferBundledVersion : boolean ;
10
- configFilePathSupplied : boolean ;
10
+ useConfigFile : boolean ;
11
11
configFilePath : string ;
12
12
updateAssemblyInfo : boolean ;
13
13
@@ -22,11 +22,13 @@ export class GitVersionTask {
22
22
23
23
constructor ( ) {
24
24
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' ) ;
28
25
26
+ this . useConfigFile = tl . getBoolInput ( 'useConfigFile' ) ;
27
+ this . configFilePath = tl . getInput ( 'configFilePath' ) ;
28
+
29
+ this . updateAssemblyInfo = tl . getBoolInput ( 'updateAssemblyInfo' ) ;
29
30
this . updateAssemblyInfoFilename = tl . getInput ( 'updateAssemblyInfoFilename' ) ;
31
+
30
32
this . additionalArguments = tl . getInput ( 'additionalArguments' ) ;
31
33
this . targetPath = tl . getInput ( 'targetPath' ) ;
32
34
this . runtime = tl . getInput ( 'runtime' ) || "core" ;
@@ -60,16 +62,22 @@ export class GitVersionTask {
60
62
"buildserver" ,
61
63
"/nofetch" ] ) ;
62
64
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
+ }
65
72
}
66
73
67
74
if ( this . updateAssemblyInfo ) {
68
75
exe . arg ( "/updateassemblyinfo" ) ;
69
- if ( this . updateAssemblyInfoFilename ) {
76
+ if ( tl . filePathSupplied ( 'updateAssemblyInfoFilename' ) && tl . exist ( this . updateAssemblyInfoFilename ) && tl . stats ( this . updateAssemblyInfoFilename ) . isFile ( ) ) {
70
77
exe . arg ( this . updateAssemblyInfoFilename ) ;
71
- } else {
72
- exe . arg ( "true" ) ;
78
+ }
79
+ else {
80
+ throw 'AssemblyInfoFilename file not found at ' + this . updateAssemblyInfoFilename ;
73
81
}
74
82
}
75
83
0 commit comments