File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed
build-logic/src/main/groovy Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ plugins {
1010 id ' buildlogic.java-graalvm-conventions'
1111}
1212
13+ version = rootProject. version
14+
1315dependencies {
1416 implementation ' org.apache.commons:commons-text'
1517 implementation project(' :utilities' )
Original file line number Diff line number Diff line change @@ -18,25 +18,32 @@ compileJava {
1818 ]
1919}
2020
21- tasks. withType(ProcessResources ). configureEach(new ApplicationPropertiesProcessResourcesAction (project. version))
21+ tasks. withType(ProcessResources )
22+ .configureEach(new ApplicationPropertiesProcessResourcesAction (
23+ [
24+ " cli.version" : rootProject. version
25+ ]
26+ ))
2227
2328class ApplicationPropertiesProcessResourcesAction implements Action<ProcessResources > {
2429
25- private final String cliVersion
30+ private final Map< String , String > properties = [:]
2631
27- ApplicationPropertiesProcessResourcesAction (String cliVersion ) {
28- this . cliVersion = cliVersion
32+ ApplicationPropertiesProcessResourcesAction (Map< String , String > props ) {
33+ this . properties . putAll(props)
2934 }
3035
3136 @Override
3237 void execute (ProcessResources processResources ) {
33- def localCliVersion = cliVersion // prevent issues with decorated closure
38+ def localProps = properties // prevent issues with decorated closure
39+ // make sure to rerun task if properties change
40+ processResources. inputs. properties(localProps)
41+
42+ // replace tokens in application.properties
3443 processResources. filesMatching(" application.properties" ) {
3544 filter(
3645 org.apache.tools.ant.filters.ReplaceTokens ,
37- tokens : [
38- ' cli.version' : localCliVersion
39- ]
46+ tokens : localProps
4047 )
4148 }
4249 }
You can’t perform that action at this time.
0 commit comments