mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-15 15:29:22 +00:00
better version update
This commit is contained in:
parent
2053256e06
commit
cd529394c9
@ -12,16 +12,20 @@ public class UpdateVersion implements FileVisitor {
|
||||
|
||||
String version;
|
||||
String transpilerVersion;
|
||||
String transpilerCoreVersion;
|
||||
|
||||
Pattern artifactVersionPattern = Pattern.compile("(<version>\\d*.\\d*.\\d*-)(\\w*)(</version>\\s*<properties>)");
|
||||
Pattern versionPattern = Pattern.compile("(<version>\\d*.\\d*.\\d*-)(\\w*)(</version>)");
|
||||
Pattern coreVersionPattern = Pattern.compile("(<version>\\d*-)(\\w*)(</version>)");
|
||||
Pattern transpilerVersionPattern = Pattern
|
||||
.compile("(<artifactId>jsweet-maven-plugin</artifactId>\\s*<version>\\d*.\\d*.\\d*-)(\\w*)(</version>)");
|
||||
.compile("(<artifactId>jsweet-maven-plugin</artifactId>\\s*<version>)(\\d*.\\d*.\\d*-\\w*)(</version>)");
|
||||
Pattern transpilerVersionPropertyPattern = Pattern
|
||||
.compile("(<jsweet.transpiler.version>)(\\d*.\\d*.\\d*)(</jsweet.transpiler.version>)");
|
||||
|
||||
public UpdateVersion(String version, String transpilerVersion) {
|
||||
this.version = version;
|
||||
this.transpilerVersion = transpilerVersion;
|
||||
this.transpilerCoreVersion = transpilerVersion.split("-")[0];
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
@ -46,6 +50,8 @@ public class UpdateVersion implements FileVisitor {
|
||||
content = m.replaceAll("$1" + version + "$3");
|
||||
m = coreVersionPattern.matcher(content);
|
||||
content = m.replaceAll("$1" + version + "$3");
|
||||
m = transpilerVersionPropertyPattern.matcher(content);
|
||||
content = m.replaceAll("$1" + transpilerCoreVersion + "$3");
|
||||
m = transpilerVersionPattern.matcher(content);
|
||||
content = m.replaceAll("$1" + transpilerVersion + "$3");
|
||||
FileUtils.writeStringToFile(file, content);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user