@@ -124,6 +124,12 @@ OpenWhiskPlatform.zipFileName =
124124project. ext. packageVersion =
125125 rootProject. findProperty(' packageVersion' ) ?: ' latest'
126126
127+ project. ext. cliBuildLocation =
128+ rootProject. findProperty(' cliBuildLocation' ) ?: ' ./build'
129+
130+ project. ext. cliReleaseLocation =
131+ rootProject. findProperty(' cliReleaseLocation' ) ?: ' ./release'
132+
127133String buildFileName = System . env[' build_file_name' ] ?:
128134 (rootProject. findProperty(' buildFileName' ) ?: ' wsk' )
129135
@@ -192,7 +198,7 @@ goBuild {
192198 // parse the command with the GString engine at execution time.
193199 go([' build' ,
194200 ' -ldflags' , " -X main.CLI_BUILD_TIME=${ now} " as String ,
195- ' -o' , ' ./build /${GOOS}-${GOARCH}/' + buildFileName+ ' ${GOEXE}' ,
201+ ' -o' , cliBuildLocation + ' /${GOOS}-${GOARCH}/' + buildFileName+ ' ${GOEXE}' ,
196202 golang. packagePath ] as List<String > )
197203}
198204
@@ -201,8 +207,8 @@ gofmt {
201207}
202208
203209task compile (type : Copy , dependsOn : goBuild) {
204- destinationDir = file(' ./build ' )
205- from(" ./build /${ rootProject.localPlatform.goOs} -${ rootProject.localPlatform.goArch} " )
210+ destinationDir = file(cliBuildLocation )
211+ from(" ${ cliBuildLocation } /${ rootProject.localPlatform.goOs} -${ rootProject.localPlatform.goArch} " )
206212}
207213
208214task build (type : DefaultTask , dependsOn : compile)
@@ -216,9 +222,9 @@ task individualArchives(
216222 task(" release${ p.goOs.capitalize()}${ p.goArch.capitalize()} " ,
217223 type : (p. goOs == ' linux' ) ? Tar : Zip , dependsOn: compile) {
218224 if (p. goOs == ' linux' ) { compression = Compression . GZIP }
219- destinationDir = file(' ./release ' )
225+ destinationDir = file(cliReleaseLocation )
220226 baseName = " ${ p.zipFileName} -${ packageVersion} -${ p.owOs} -${ p.goArch} "
221- from " ./build /${ p.goOs} -${ p.goArch} /"
227+ from " ${ cliBuildLocation } /${ p.goOs} -${ p.goArch} /"
222228 include " ${ buildFileName} *"
223229 from " ./"
224230 include " LICENSE.txt" , " NOTICE.txt" , " README.md"
@@ -244,18 +250,18 @@ task index() {
244250 }
245251
246252 doLast {
247- mkdir(' ./build ' )
248- file(' ./build/ content.json' ). text = groovy.json.JsonOutput . toJson([" cli" : content])
253+ mkdir(cliBuildLocation )
254+ file(" ${ cliBuildLocation } / content.json" ). text = groovy.json.JsonOutput . toJson([" cli" : content])
249255 }
250256}
251257
252258task releaseBinaries (type : Tar , dependsOn : [individualArchives, index]) {
253259 compression = Compression . GZIP
254- destinationDir = file(' ./release ' )
260+ destinationDir = file(cliReleaseLocation )
255261 baseName = " ${ OpenWhiskPlatform.zipFileName} -${ packageVersion} -all"
256- from(' ./build/ content.json' ) { into(' .' ) }
262+ from(" ${ cliBuildLocation } / content.json" ) { into(' .' ) }
257263 rootProject. platforms. each() { p ->
258- from(' ./release/ ' ) {
264+ from(cliReleaseLocation ) {
259265 include(" ${ p.zipFileName} -${ packageVersion} -${ p.owOs} -${ p.goArch} .*" )
260266 into p. archiveDirName
261267 rename { p. archiveFileName }
@@ -264,5 +270,5 @@ task releaseBinaries(type: Tar, dependsOn: [individualArchives, index]) {
264270}
265271
266272task clean (type : Delete , dependsOn : goClean) {
267- delete ' ./build ' , ' ./release '
273+ delete cliBuildLocation, cliReleaseLocation
268274}
0 commit comments