@@ -150,16 +150,33 @@ kotlin {
150150
151151val zitiVersion = libs.versions.ziti.cli.get()
152152val binDir = layout.buildDirectory.dir(" bin" ).get()
153+ val srcDir = layout.buildDirectory.dir(" ziti-src" ).get()
153154val zitiCLI = binDir.file(" ziti" )
154155val quickstartHome = layout.buildDirectory.dir(" quickstart" ).get()
155156
157+ tasks.register<Exec >(" zitiCheckout" ) {
158+ group = LifecycleBasePlugin .BUILD_GROUP
159+ description = " checkout ziti cli source"
160+
161+ if (srcDir.asFile.exists()) {
162+ srcDir.asFile.deleteRecursively()
163+ }
164+
165+ commandLine(" env" , " git" , " clone" ,
166+ " --depth" , " 1" , " --branch" , " v${zitiVersion} " ,
167+ " https://github.com/openziti/ziti" , " ${srcDir.asFile.absolutePath} "
168+ )
169+ }
170+
156171tasks.register<Exec >(" buildZiti" ) {
172+ dependsOn(" zitiCheckout" )
157173 group = LifecycleBasePlugin .BUILD_GROUP
158174 description = " Builds the Ziti CLI"
175+ workingDir(srcDir)
176+
159177 environment(" GOBIN" , binDir.asFile.absolutePath)
160- commandLine(" env" ,
161- " go" , " install" , " github.com/openziti/ziti/ziti@v${zitiVersion} "
162- )
178+ environment(" GOWORK" , " off" )
179+ commandLine(" env" , " go" , " install" , " ./ziti" )
163180 outputs.file(zitiCLI)
164181}
165182
0 commit comments