
configurations {
  all {
    resolutionStrategy {
    }
  }
}

dependencies {
    developmentOnly "org.springframework.boot:spring-boot-devtools"
}

ext {
    springProfiles = "dev" + springProfiles
}

springBoot {
    buildInfo {
        excludes = ['time']
    }
}

bootRun {
    args = ["--spring.profiles.active=${springProfiles}"]
}

processResources {
    inputs.property('version', version)
    inputs.property('springProfiles', springProfiles)
    filesMatching("**/application.yml") {
        filter {
            it.replace("@project.version@", version)
        }
        filter {
            it.replace("@spring.profiles.active@", springProfiles)
        }
    }
}

task integrationTest(type: Test) {
    maxHeapSize = "1G"
    useJUnitPlatform()
    description = "Execute integration tests."
    group = "verification"
    include "**/*IT*", "**/*IntTest*"
    testLogging {
        events 'FAILED', 'SKIPPED'
        exceptionFormat "full"
    }
    systemProperty('spring.profiles.active', 'test')
    systemProperty('java.security.egd', 'file:/dev/./urandom')
    // ignoreFailures true
    reports.html.required = false

    // Configure JaCoCo for integration tests
    jacoco {
        destinationFile = file("${buildDir}/jacoco/integrationTest.exec")
    }

    // Run the JaCoCo integration test report after integration tests
    finalizedBy 'jacocoIntegrationTestReport'
}
integrationTest.dependsOn test

bootJar.dependsOn processResources
