/* * Copyright 2012-present the original author or authors. * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import org.springframework.boot.build.properties.BuildProperties import org.springframework.boot.build.properties.BuildType plugins { id "java" id "eclipse" id "org.springframework.boot.deployed" id "org.springframework.boot.integration-test" } description = "Spring Boot CLI" sourceSets { main { java { srcDir file("src/json-shade/java") } } } configurations { loader testRepository compileOnlyProject compileClasspath.extendsFrom(compileOnlyProject) } dependencies { compileOnlyProject(project(":core:spring-boot")) implementation(project(":loader:spring-boot-loader-tools")) implementation("jline:jline") implementation("net.sf.jopt-simple:jopt-simple") implementation("org.apache.httpcomponents.client5:httpclient5") implementation("org.slf4j:slf4j-simple") implementation("org.springframework:spring-core") implementation("org.springframework.security:spring-security-crypto") intTestImplementation(project(":test-support:spring-boot-test-support")) loader(project(":loader:spring-boot-loader")) testImplementation(project(":core:spring-boot")) testImplementation(project(":core:spring-boot-test")) testImplementation(project(":test-support:spring-boot-test-support")) } architectureCheck { nullMarked { enabled = false ignoredPackages = ['org.springframework.boot.cli.json'] } } tasks.register("fullJar", Jar) { dependsOn configurations.loader archiveClassifier = "full" entryCompression = "stored" from(configurations.runtimeClasspath) { into "BOOT-INF/lib" } from(sourceSets.main.output) { into "BOOT-INF/classes" } from { zipTree(configurations.loader.singleFile).matching { exclude "META-INF/LICENSE.txt" exclude "META-INF/NOTICE.txt" exclude "META-INF/spring-boot.properties" } } manifest { attributes( "Main-Class": "org.springframework.boot.loader.launch.JarLauncher", "Start-Class": "org.springframework.boot.cli.SpringCli" ) } } def configureArchive(archive) { archive.archiveClassifier = "bin" archive.into "spring-${project.version}" archive.from(fullJar) { rename { it.replace("-full", "") } into "lib/" } archive.from(file("src/main/content")) { dirPermissions { unix(0755) } filePermissions { unix(0644) } } archive.from(file("src/main/executablecontent")) { filePermissions { unix(0755) } } } tasks.register("zip", Zip) { archiveClassifier = "bin" configureArchive it } intTest { dependsOn zip } tasks.register("tar", Tar) { compression = "gzip" archiveExtension = "tar.gz" configureArchive it } if (BuildProperties.get(project).buildType() == BuildType.OPEN_SOURCE) { def homebrewFormula = tasks.register("homebrewFormula", org.springframework.boot.build.cli.HomebrewFormula) { dependsOn tar outputDir = layout.buildDirectory.dir("homebrew") template = file("src/main/homebrew/spring-boot.rb") archive = tar.archiveFile } publishing { publications { getByName("maven") { artifact(homebrewFormula.map { it.outputDir.file("spring-boot.rb") }) { formula -> formula.classifier = "homebrew" formula.extension = "rb" } } } } } publishing { publications { getByName("maven") { artifact fullJar artifact tar artifact zip } } } eclipse.classpath { // https://github.com/eclipse/buildship/issues/939 plusConfigurations += [ configurations.compileOnlyProject ] } tasks.named("compileTestJava") { options.nullability.checking = "tests" } tasks.named("compileIntTestJava") { options.nullability.checking = "tests" }