Skip to content

Commit b7cf5f6

Browse files
generate the Versions.java file instead of doing a string replace
1 parent d06a424 commit b7cf5f6

File tree

2 files changed

+14
-42
lines changed

2 files changed

+14
-42
lines changed

build.gradle

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ ext {
7272
buildRevision = versioning.info.commit
7373
}
7474

75+
task createVersionFile {
76+
new File("${projectDir}/grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/util/Versions.java").text = """
77+
package net.devh.boot.grpc.common.util;
78+
public final class Versions {
79+
public static final String PROJECT_VERSION = "v${projectVersion}";
80+
private Versions() {}
81+
}
82+
"""
83+
}
84+
85+
clean.doFirst {
86+
delete "${projectDir}/grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/util/Versions.java"
87+
}
88+
7589
allprojects {
7690
apply plugin: 'java'
7791
apply plugin: 'idea'
@@ -224,17 +238,6 @@ allprojects { project ->
224238
}
225239
}
226240

227-
File versionsFile = file("${projectDir}/src/main/java/net/devh/boot/grpc/common/util/Versions.java")
228-
task replaceVersion {
229-
ant.replaceregexp(
230-
file: versionsFile,
231-
match: 'VERSIONS_STRING_PLACEHOLDER',
232-
replace: "v${projectVersion}",
233-
flags: 'g',
234-
byline: true,
235-
)
236-
}
237-
238241
// Javadoc Task
239242
javadoc {
240243
dependsOn delombok

grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/util/Versions.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)