initial commit
This commit is contained in:
86
build.gradle
Normal file
86
build.gradle
Normal file
@@ -0,0 +1,86 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version '3.2.0'
|
||||
id 'io.spring.dependency-management' version '1.1.4'
|
||||
}
|
||||
|
||||
group = 'com.cfdeployer'
|
||||
version = '1.0.0'
|
||||
sourceCompatibility = '17'
|
||||
|
||||
configurations {
|
||||
compileOnly {
|
||||
extendsFrom annotationProcessor
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||||
implementation 'commons-io:commons-io:2.15.1'
|
||||
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
annotationProcessor 'org.projectlombok:lombok'
|
||||
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
// Task to download CF CLI binaries
|
||||
task downloadCfCli {
|
||||
group = 'build'
|
||||
description = 'Downloads CF CLI binaries for Linux, macOS, and Windows'
|
||||
|
||||
doLast {
|
||||
def cfCliVersion = '8.7.10'
|
||||
def resourcesDir = file("$projectDir/src/main/resources/cf-cli")
|
||||
resourcesDir.mkdirs()
|
||||
|
||||
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'],
|
||||
[os: 'windows', url: "https://packages.cloudfoundry.org/stable?release=windows64-exe&version=${cfCliVersion}&source=github-rel", ext: 'zip', executable: 'cf.exe']
|
||||
]
|
||||
|
||||
downloads.each { download ->
|
||||
def osDir = file("${resourcesDir}/${download.os}")
|
||||
osDir.mkdirs()
|
||||
|
||||
def archiveFile = file("${osDir}/cf-cli.${download.ext}")
|
||||
|
||||
if (!archiveFile.exists()) {
|
||||
println "Downloading CF CLI for ${download.os}..."
|
||||
|
||||
ant.get(src: download.url, dest: archiveFile, verbose: true)
|
||||
|
||||
println "Extracting CF CLI for ${download.os}..."
|
||||
if (download.ext == 'tgz') {
|
||||
copy {
|
||||
from tarTree(resources.gzip(archiveFile))
|
||||
into osDir
|
||||
}
|
||||
} else if (download.ext == 'zip') {
|
||||
copy {
|
||||
from zipTree(archiveFile)
|
||||
into osDir
|
||||
}
|
||||
}
|
||||
|
||||
archiveFile.delete()
|
||||
println "CF CLI for ${download.os} downloaded and extracted successfully"
|
||||
} else {
|
||||
println "CF CLI for ${download.os} already exists, skipping download"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure CF CLI is downloaded before building
|
||||
processResources.dependsOn downloadCfCli
|
||||
Reference in New Issue
Block a user