
There's a known issue [1] where property expansion changes the input files line endings to the operating system's default. This causes problems for us on Windows as the line endings become \r\n which breaks our formatting checks. This commit tunes the checkFormatMain task to exclude the generated source files from checking. In their place, the original templates are added. This ensures that the inputs are correctly formatted and, therefore, that the output should be too (other than the line endings on Windows). Closes gh-30039 [1] https://github.com/gradle/gradle/issues/1151
195 lines
7.3 KiB
Groovy
195 lines
7.3 KiB
Groovy
plugins {
|
|
id "java-library"
|
|
id "org.jetbrains.kotlin.jvm"
|
|
id "org.springframework.boot.conventions"
|
|
id "org.springframework.boot.configuration-properties"
|
|
id "org.springframework.boot.deployed"
|
|
id "org.springframework.boot.optional-dependencies"
|
|
}
|
|
|
|
description = "Spring Boot"
|
|
|
|
def tomcatConfigProperties = "$buildDir/tomcat-config-properties"
|
|
|
|
configurations {
|
|
tomcatDistribution
|
|
}
|
|
|
|
dependencies {
|
|
annotationProcessor("org.apache.logging.log4j:log4j-core")
|
|
|
|
api("org.springframework:spring-core")
|
|
api("org.springframework:spring-context")
|
|
|
|
optional("ch.qos.logback:logback-classic")
|
|
optional("com.atomikos:transactions-jdbc")
|
|
optional("com.atomikos:transactions-jms")
|
|
optional("com.atomikos:transactions-jta")
|
|
optional("com.fasterxml.jackson.core:jackson-databind")
|
|
optional("com.h2database:h2")
|
|
optional("com.google.code.gson:gson")
|
|
optional("com.oracle.database.jdbc:ucp")
|
|
optional("com.oracle.database.jdbc:ojdbc8")
|
|
optional("com.samskivert:jmustache")
|
|
optional("com.zaxxer:HikariCP")
|
|
optional("io.netty:netty-tcnative-boringssl-static")
|
|
optional("io.projectreactor:reactor-tools")
|
|
optional("io.projectreactor.netty:reactor-netty-http")
|
|
optional("io.r2dbc:r2dbc-pool")
|
|
optional("io.rsocket:rsocket-core")
|
|
optional("io.rsocket:rsocket-transport-netty")
|
|
optional("io.undertow:undertow-servlet") {
|
|
exclude group: "org.jboss.spec.javax.annotation", module: "jboss-annotations-api_1.3_spec"
|
|
exclude group: "org.jboss.spec.javax.servlet", module: "jboss-servlet-api_4.0_spec"
|
|
}
|
|
optional("jakarta.jms:jakarta.jms-api")
|
|
optional("jakarta.persistence:jakarta.persistence-api")
|
|
optional("jakarta.servlet:jakarta.servlet-api")
|
|
optional("jakarta.transaction:jakarta.transaction-api")
|
|
optional("junit:junit")
|
|
optional("org.apache.commons:commons-dbcp2") {
|
|
exclude(group: "commons-logging", module: "commons-logging")
|
|
}
|
|
optional("org.apache.httpcomponents:httpclient") {
|
|
exclude(group: "commons-logging", module: "commons-logging")
|
|
}
|
|
optional("org.apache.httpcomponents.client5:httpclient5")
|
|
optional("org.apache.logging.log4j:log4j-api")
|
|
optional("org.apache.logging.log4j:log4j-core")
|
|
optional("org.apache.tomcat.embed:tomcat-embed-core")
|
|
optional("org.apache.tomcat.embed:tomcat-embed-jasper")
|
|
optional("org.apache.tomcat:tomcat-jdbc")
|
|
optional("org.assertj:assertj-core")
|
|
optional("org.codehaus.groovy:groovy")
|
|
optional("org.codehaus.groovy:groovy-xml")
|
|
optional("org.eclipse.jetty:jetty-servlets")
|
|
optional("org.eclipse.jetty:jetty-util")
|
|
optional("org.eclipse.jetty:jetty-webapp") {
|
|
exclude(group: "javax.servlet", module: "javax.servlet-api")
|
|
}
|
|
optional("org.eclipse.jetty:jetty-alpn-conscrypt-server") {
|
|
exclude(group: "javax.servlet", module: "javax.servlet-api")
|
|
}
|
|
optional("org.eclipse.jetty.http2:http2-server") {
|
|
exclude(group: "javax.servlet", module: "javax.servlet-api")
|
|
}
|
|
optional("org.flywaydb:flyway-core")
|
|
optional("org.hamcrest:hamcrest-library")
|
|
optional("org.hibernate:hibernate-core") {
|
|
exclude(group: "javax.activation", module: "javax.activation-api")
|
|
exclude(group: "javax.persistence", module: "javax.persistence-api")
|
|
exclude(group: "javax.xml.bind", module: "jaxb-api")
|
|
exclude(group: "org.jboss.spec.javax.transaction", module: "jboss-transaction-api_1.2_spec")
|
|
}
|
|
optional("org.hibernate.validator:hibernate-validator")
|
|
optional("org.jooq:jooq") {
|
|
exclude(group: "javax.xml.bind", module: "jaxb-api")
|
|
}
|
|
optional("org.liquibase:liquibase-core") {
|
|
exclude(group: "javax.xml.bind", module: "jaxb-api")
|
|
}
|
|
optional("org.postgresql:postgresql")
|
|
optional("org.slf4j:jul-to-slf4j")
|
|
optional("org.slf4j:slf4j-api")
|
|
optional("org.springframework:spring-messaging")
|
|
optional("org.springframework:spring-orm")
|
|
optional("org.springframework:spring-oxm")
|
|
optional("org.springframework:spring-r2dbc")
|
|
optional("org.springframework:spring-test")
|
|
optional("org.springframework:spring-web")
|
|
optional("org.springframework:spring-webflux")
|
|
optional("org.springframework:spring-webmvc")
|
|
optional("org.springframework.security:spring-security-web")
|
|
optional("org.springframework.ws:spring-ws-core")
|
|
optional("org.yaml:snakeyaml")
|
|
optional("org.jetbrains.kotlin:kotlin-reflect")
|
|
optional("org.jetbrains.kotlin:kotlin-stdlib")
|
|
|
|
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
|
testImplementation("com.google.appengine:appengine-api-1.0-sdk") {
|
|
exclude group: "javax.inject", module: "javax.inject"
|
|
}
|
|
testImplementation("com.ibm.db2:jcc")
|
|
testImplementation("com.jayway.jsonpath:json-path")
|
|
testImplementation("com.microsoft.sqlserver:mssql-jdbc")
|
|
testImplementation("com.squareup.okhttp3:okhttp")
|
|
testImplementation("com.sun.xml.messaging.saaj:saaj-impl")
|
|
testImplementation("io.projectreactor:reactor-test")
|
|
testImplementation("io.r2dbc:r2dbc-h2")
|
|
testImplementation("jakarta.inject:jakarta.inject-api")
|
|
testImplementation("jakarta.persistence:jakarta.persistence-api")
|
|
testImplementation("jakarta.xml.ws:jakarta.xml.ws-api")
|
|
testImplementation("mysql:mysql-connector-java")
|
|
testImplementation("net.sourceforge.jtds:jtds")
|
|
testImplementation("org.apache.derby:derby")
|
|
testImplementation("org.awaitility:awaitility")
|
|
testImplementation("org.eclipse.jetty:jetty-client")
|
|
testImplementation("org.eclipse.jetty.http2:http2-client")
|
|
testImplementation("org.eclipse.jetty.http2:http2-http-client-transport")
|
|
testImplementation("org.firebirdsql.jdbc:jaybird-jdk18") {
|
|
exclude group: "javax.resource", module: "connector-api"
|
|
}
|
|
testImplementation("org.hsqldb:hsqldb")
|
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
|
testImplementation("org.mariadb.jdbc:mariadb-java-client")
|
|
testImplementation("org.mockito:mockito-core")
|
|
testImplementation("org.mockito:mockito-junit-jupiter")
|
|
testImplementation("org.springframework:spring-context-support")
|
|
testImplementation("org.springframework.data:spring-data-redis")
|
|
testImplementation("org.springframework.data:spring-data-r2dbc")
|
|
testImplementation("org.xerial:sqlite-jdbc")
|
|
|
|
testRuntimeOnly("org.testcontainers:jdbc") {
|
|
exclude group: "javax.annotation", module: "javax.annotation-api"
|
|
exclude group: "javax.xml.bind", module: "jaxb-api"
|
|
}
|
|
|
|
tomcatDistribution("org.apache.tomcat:tomcat:${tomcatVersion}@zip")
|
|
}
|
|
|
|
task extractTomcatConfigProperties(type: Sync) {
|
|
destinationDir = file(tomcatConfigProperties)
|
|
from {
|
|
zipTree(configurations.tomcatDistribution.incoming.files.singleFile).matching {
|
|
include '**/conf/catalina.properties'
|
|
}.singleFile
|
|
}
|
|
}
|
|
|
|
def syncJavaTemplates = tasks.register("syncJavaTemplates", Sync) {
|
|
from("src/main/javaTemplates")
|
|
into("build/generated-sources/main")
|
|
def properties = ["springBootVersion": project.version]
|
|
expand(properties)
|
|
inputs.properties(properties)
|
|
}
|
|
|
|
tasks.named("checkFormatMain") {
|
|
def generatedSources = fileTree("build/generated-sources/main")
|
|
// Exclude source generated from the templates as expand(properties) changes line endings on Windows
|
|
exclude { candidate -> generatedSources.contains(candidate.file) }
|
|
// Add the templates to check that the input is correctly formatted
|
|
source(fileTree("src/main/javaTemplates"))
|
|
}
|
|
|
|
plugins.withType(EclipsePlugin) {
|
|
eclipse {
|
|
synchronizationTasks syncJavaTemplates
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDirs syncJavaTemplates
|
|
}
|
|
}
|
|
test {
|
|
output.dir(tomcatConfigProperties, builtBy: "extractTomcatConfigProperties")
|
|
}
|
|
}
|
|
|
|
toolchain {
|
|
testJvmArgs.add("--add-opens=java.base/java.net=ALL-UNNAMED")
|
|
}
|