File tree 2 files changed +17
-8
lines changed
build-logic/src/main/groovy
2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ plugins {
10
10
id ' buildlogic.java-graalvm-conventions'
11
11
}
12
12
13
+ version = rootProject. version
14
+
13
15
dependencies {
14
16
implementation ' org.apache.commons:commons-text'
15
17
implementation project(' :utilities' )
Original file line number Diff line number Diff line change @@ -18,25 +18,32 @@ compileJava {
18
18
]
19
19
}
20
20
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
+ ))
22
27
23
28
class ApplicationPropertiesProcessResourcesAction implements Action<ProcessResources > {
24
29
25
- private final String cliVersion
30
+ private final Map< String , String > properties = [:]
26
31
27
- ApplicationPropertiesProcessResourcesAction (String cliVersion ) {
28
- this . cliVersion = cliVersion
32
+ ApplicationPropertiesProcessResourcesAction (Map< String , String > props ) {
33
+ this . properties . putAll(props)
29
34
}
30
35
31
36
@Override
32
37
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
34
43
processResources. filesMatching(" application.properties" ) {
35
44
filter(
36
45
org.apache.tools.ant.filters.ReplaceTokens ,
37
- tokens : [
38
- ' cli.version' : localCliVersion
39
- ]
46
+ tokens : localProps
40
47
)
41
48
}
42
49
}
You can’t perform that action at this time.
0 commit comments