File tree Expand file tree Collapse file tree
src/main/resources/static Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import com.gorylenko.GenerateGitPropertiesTask
12import kotlinx.kover.gradle.plugin.dsl.AggregationType
23import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
34import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
5+ import java.util.*
46
57plugins {
68 alias(libs.plugins.kotlin.spring)
@@ -226,3 +228,20 @@ val compileKotlin: KotlinCompile by tasks
226228compileKotlin.compilerOptions {
227229 freeCompilerArgs.set(listOf (" -Xannotation-default-target=param-property" ))
228230}
231+
232+ val generateGitProperties = tasks.named<GenerateGitPropertiesTask >(" generateGitProperties" )
233+
234+ val gitHash: Provider <String > = generateGitProperties.map { task ->
235+ val props = Properties ()
236+ task.output.get().asFile.inputStream().use(props::load)
237+ props.getProperty(" git.commit.id.abbrev" )
238+ }
239+
240+ tasks.processResources {
241+ dependsOn(generateGitProperties)
242+ filesMatching(" static/sw.js" ) {
243+ expand(
244+ " APP_VERSION" to gitHash.get()
245+ )
246+ }
247+ }
Original file line number Diff line number Diff line change 1- const CACHE_NAME = ' trainer-advisor-v25.1' ;
1+ const CACHE_NAME = " trainer-advisor-${APP_VERSION}" ;
22const OFFLINE_URL = '/offline.html' ;
33
44const urlsToCache = [
You can’t perform that action at this time.
0 commit comments