plugins { id "java" id "org.springframework.boot.docker-test" id "de.undercouch.download" } description = "Spring Boot Loader Integration Tests" def oracleJdkVersion = "17.0.8" def oracleJdkArch = "aarch64".equalsIgnoreCase(System.getProperty("os.arch")) ? "aarch64" : "x64" configurations { app } dependencies { app project(path: ":spring-boot-project:spring-boot-dependencies", configuration: "mavenRepository") app project(path: ":spring-boot-project:spring-boot-tools:spring-boot-gradle-plugin", configuration: "mavenRepository") app project(path: ":spring-boot-project:spring-boot-starters:spring-boot-starter-web", configuration: "mavenRepository") app project(path: ":spring-boot-project:spring-boot-starters:spring-boot-starter", configuration: "mavenRepository") app("org.bouncycastle:bcprov-jdk18on:1.78.1") dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker")) dockerTestImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test")) dockerTestImplementation("org.testcontainers:junit-jupiter") dockerTestImplementation("org.testcontainers:testcontainers") } task syncMavenRepository(type: Sync) { from configurations.app into layout.buildDirectory.dir("docker-test-maven-repository") } task syncAppSource(type: org.springframework.boot.build.SyncAppSource) { sourceDirectory = file("spring-boot-loader-tests-app") destinationDirectory = file(layout.buildDirectory.dir("spring-boot-loader-tests-app")) } task buildApp(type: GradleBuild) { dependsOn syncAppSource, syncMavenRepository dir = layout.buildDirectory.dir("spring-boot-loader-tests-app") startParameter.buildCacheEnabled = false tasks = ["build"] } task syncSignedJarAppSource(type: org.springframework.boot.build.SyncAppSource) { sourceDirectory = file("spring-boot-loader-tests-signed-jar") destinationDirectory = file(layout.buildDirectory.dir("spring-boot-loader-tests-signed-jar")) } task buildSignedJarApp(type: GradleBuild) { dependsOn syncSignedJarAppSource, syncMavenRepository dir = layout.buildDirectory.dir("spring-boot-loader-tests-signed-jar") startParameter.buildCacheEnabled = false tasks = ["build"] } task downloadJdk(type: Download) { def destFolder = new File(project.gradle.gradleUserHomeDir, "caches/springboot/downloads/jdk/oracle") destFolder.mkdirs() src "https://download.oracle.com/java/17/archive/jdk-${oracleJdkVersion}_linux-${oracleJdkArch}_bin.tar.gz" dest destFolder tempAndMove true overwrite false retries 3 } task syncJdkDownloads(type: Sync) { dependsOn downloadJdk from "${project.gradle.gradleUserHomeDir}/caches/springboot/downloads/jdk/oracle/" include "jdk-${oracleJdkVersion}_linux-${oracleJdkArch}_bin.tar.gz" into layout.buildDirectory.dir("downloads/jdk/oracle/") } tasks.named("processDockerTestResources").configure { dependsOn syncJdkDownloads } tasks.named("dockerTest").configure { dependsOn buildApp, buildSignedJarApp }