1
0
forked from SPC/spc-site

Fix task outputs for build date

This commit is contained in:
Alexander Nozik 2022-05-26 21:48:56 +03:00
parent d06cc8d359
commit 1c3fb97826
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
2 changed files with 12 additions and 4 deletions

View File

@ -57,10 +57,14 @@ sourceSets {
} }
} }
//write build time in build to check outdated external data directory val writeBuildDate: Task by tasks.creating {
tasks.getByName<Copy>("processResources") {
doFirst { doFirst {
val deployDate = LocalDateTime.now() val deployDate = LocalDateTime.now()
project.buildDir.resolve("resources/main/buildDate").writeText(deployDate.toString()) project.buildDir.resolve("resources/main/buildDate").writeText(deployDate.toString())
} }
outputs.file("resources/main/buildDate")
} }
//write build time in build to check outdated external data directory
tasks.getByName("processResources").dependsOn(writeBuildDate)

View File

@ -58,7 +58,11 @@ fun Application.spcModule() {
val inProduction: Boolean = environment.config.propertyOrNull("ktor.environment.production") != null val inProduction: Boolean = environment.config.propertyOrNull("ktor.environment.production") != null
if(inProduction) log.info("Production mode activated") if(inProduction){
log.info("Production mode activated")
log.info("Build date: $buildDate")
log.info("Deploy date: $deployDate")
}
if (deployDate != null && buildDate != null && buildDate.isAfter(deployDate)) { if (deployDate != null && buildDate != null && buildDate.isAfter(deployDate)) {
log.info("Outdated data. Resetting data directory.") log.info("Outdated data. Resetting data directory.")