Skip to content

Commit

Permalink
feat: verify feat
Browse files Browse the repository at this point in the history
  • Loading branch information
sukidayou committed Dec 16, 2024
1 parent 9d20ce1 commit f6d6cd9
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions src/main/java/org/casbin/util/VersionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,34 +90,29 @@ public static String getCliVersion() throws IOException {
String commitMessage = properties.getProperty("git.commit.message.full", "Unknown");
Pattern pattern = Pattern.compile("^(fix|feat|chore|docs|style|refactor|test|perf|build|ci):");
Matcher matcher = pattern.matcher(commitMessage);

if(tag.isEmpty() || tag.equals("Unknown")) {
String tags = properties.getProperty("git.tags", "Unknown");
tag = tags;
if(tags.isEmpty() || tags.equals("Unknown")) {
tag = properties.getProperty("git.tags", "Unknown");
if(tag.isEmpty() || tag.equals("Unknown")) {
InputStream versionInputStream = Client.class.getResourceAsStream("/META-INF/lastCli.version");
if (versionInputStream != null) {
BufferedReader reader = new BufferedReader(new InputStreamReader(versionInputStream, StandardCharsets.UTF_8));
String version = "";
String line;
if ((line = reader.readLine()) != null) {
version = line;
if (matcher.find()) {
tag = calculateNewVersion(version, matcher.group(1));
}
String version = reader.readLine();
if (version != null && matcher.find()) {
tag = calculateNewVersion(version, matcher.group(1));
}
}
}
}else {
if(!commitCount.isEmpty() && !commitCount.equals("0") && !commitCount.equals("Unknown")) {
if (matcher.find()) {
tag = calculateNewVersion(tag, matcher.group(1));
commitCount = "0";
}
}
}else if(!commitCount.isEmpty() && !commitCount.equals("0") && !commitCount.equals("Unknown") && matcher.find()) {
tag = calculateNewVersion(tag, matcher.group(1));
commitCount = "0";
}
if ((commitCount.isEmpty() || commitCount.equals("0") || commitCount.equals("Unknown")) && (!tag.isEmpty() && !tag.equals("Unknown"))) {

if ((commitCount.isEmpty() || commitCount.equals("0") || commitCount.equals("Unknown"))
&& (!tag.isEmpty() && !tag.equals("Unknown"))) {
return tag;
}

return commitId;
}

Expand Down

0 comments on commit f6d6cd9

Please sign in to comment.