Tanzu Changes
This commit is contained in:
39
build.gradle
39
build.gradle
@@ -42,6 +42,8 @@ task downloadCfCli {
|
||||
def resourcesDir = file("$projectDir/src/main/resources/cf-cli")
|
||||
resourcesDir.mkdirs()
|
||||
|
||||
// Download for all platforms (useful for local development on different OSes)
|
||||
// For production Tanzu deployment, only Linux binary will be used
|
||||
def downloads = [
|
||||
[os: 'linux', url: "https://packages.cloudfoundry.org/stable?release=linux64-binary&version=${cfCliVersion}&source=github-rel", ext: 'tgz', executable: 'cf'],
|
||||
[os: 'macos', url: "https://packages.cloudfoundry.org/stable?release=macosx64-binary&version=${cfCliVersion}&source=github-rel", ext: 'tgz', executable: 'cf'],
|
||||
@@ -81,5 +83,42 @@ task downloadCfCli {
|
||||
}
|
||||
}
|
||||
|
||||
// Task to download only Linux CF CLI (for production Tanzu builds)
|
||||
task downloadCfCliLinuxOnly {
|
||||
group = 'build'
|
||||
description = 'Downloads CF CLI binary for Linux only (production builds)'
|
||||
|
||||
doLast {
|
||||
def cfCliVersion = '8.7.10'
|
||||
def resourcesDir = file("$projectDir/src/main/resources/cf-cli")
|
||||
resourcesDir.mkdirs()
|
||||
|
||||
def download = [os: 'linux', url: "https://packages.cloudfoundry.org/stable?release=linux64-binary&version=${cfCliVersion}&source=github-rel", ext: 'tgz', executable: 'cf']
|
||||
|
||||
def osDir = file("${resourcesDir}/${download.os}")
|
||||
osDir.mkdirs()
|
||||
|
||||
def archiveFile = file("${osDir}/cf-cli.${download.ext}")
|
||||
|
||||
if (!archiveFile.exists()) {
|
||||
println "Downloading CF CLI for Linux..."
|
||||
ant.get(src: download.url, dest: archiveFile, verbose: true)
|
||||
|
||||
println "Extracting CF CLI for Linux..."
|
||||
copy {
|
||||
from tarTree(resources.gzip(archiveFile))
|
||||
into osDir
|
||||
}
|
||||
|
||||
archiveFile.delete()
|
||||
println "CF CLI for Linux downloaded and extracted successfully"
|
||||
} else {
|
||||
println "CF CLI for Linux already exists, skipping download"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure CF CLI is downloaded before building
|
||||
// Use downloadCfCli for local development (all platforms)
|
||||
// Use downloadCfCliLinuxOnly for production Tanzu builds (Linux only)
|
||||
processResources.dependsOn downloadCfCli
|
||||
|
||||
Reference in New Issue
Block a user