Stop publishing CLI's Homebrew formula in commercial builds

Closes gh-43247
This commit is contained in:
Andy Wilkinson 2024-11-22 11:58:50 +00:00
parent c36d307f6a
commit cf1dadf2e7
1 changed files with 23 additions and 11 deletions

View File

@ -1,3 +1,6 @@
import org.springframework.boot.build.properties.BuildProperties
import org.springframework.boot.build.properties.BuildType
plugins { plugins {
id "java" id "java"
id "eclipse" id "eclipse"
@ -104,17 +107,27 @@ task tar(type: Tar) {
configureArchive it configureArchive it
} }
task homebrewFormula(type: org.springframework.boot.build.cli.HomebrewFormula) { if (BuildProperties.get(project).buildType() == BuildType.OPEN_SOURCE) {
dependsOn tar task homebrewFormula(type: org.springframework.boot.build.cli.HomebrewFormula) {
outputDir = layout.buildDirectory.dir("homebrew") dependsOn tar
template = file("src/main/homebrew/spring-boot.rb") outputDir = layout.buildDirectory.dir("homebrew")
archive = tar.archiveFile template = file("src/main/homebrew/spring-boot.rb")
} archive = tar.archiveFile
}
def homebrewFormulaArtifact = artifacts.add("archives", file(layout.buildDirectory.file("homebrew/spring-boot.rb"))) { def homebrewFormulaArtifact = artifacts.add("archives", file(layout.buildDirectory.file("homebrew/spring-boot.rb"))) {
type "rb" type "rb"
classifier "homebrew" classifier "homebrew"
builtBy "homebrewFormula" builtBy "homebrewFormula"
}
publishing {
publications {
getByName("maven") {
artifact homebrewFormulaArtifact
}
}
}
} }
publishing { publishing {
@ -123,7 +136,6 @@ publishing {
artifact fullJar artifact fullJar
artifact tar artifact tar
artifact zip artifact zip
artifact homebrewFormulaArtifact
} }
} }
} }