forked from SPC/spc-site
Fix task outputs for build date
This commit is contained in:
parent
d06cc8d359
commit
1c3fb97826
@ -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)
|
@ -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.")
|
||||||
|
Loading…
Reference in New Issue
Block a user