File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,19 +95,24 @@ val getGitHashTask = tasks.register<Exec>("getGitHash") {
9595
9696 ext.set(" gitVersionOut" , getter)
9797
98- return @register
99- }
98+ commandLine(" echo" , " 'hi'" )
99+ } else {
100+ val stdout = ByteArrayOutputStream ()
100101
101- val stdout = ByteArrayOutputStream ()
102+ commandLine(" git" , " rev-parse" , " --short" , " HEAD" )
103+ standardOutput = stdout
104+ isIgnoreExitValue = true
102105
103- commandLine( " git " , " rev-parse " , " --short " , " HEAD " )
104- standardOutput = stdout
106+ val getter : () -> String = {
107+ val item = standardOutput.toString().trim()
105108
106- val getter: () -> String = {
107- standardOutput.toString().trim()
108- }
109+ item.ifBlank {
110+ " DEV"
111+ }
112+ }
109113
110- ext.set(" gitVersionOut" , getter)
114+ ext.set(" gitVersionOut" , getter)
115+ }
111116}
112117
113118val printVersion = tasks.register<Task >(" printVersion" ) {
You can’t perform that action at this time.
0 commit comments