Skip to content

Commit

Permalink
改为使用现成的插件生成 git.properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Lixuhuilll committed Dec 25, 2023
1 parent c50dcb6 commit 93b5529
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 38 deletions.
9 changes: 6 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ plugins {
id 'org.springdoc.openapi-gradle-plugin' version '1.8.0'
id 'org.hidetake.swagger.generator' version '2.19.2'
// id 'org.graalvm.buildtools.native' version '0.9.28'
id 'org.ajoberstar.grgit' version '5.2.1'
id 'com.gorylenko.gradle-git-properties' version '2.4.1'
}

apply from: 'git.properties.gradle'

group 'plus.maa'
version '1.0-SNAPSHOT'

Expand Down Expand Up @@ -130,3 +128,8 @@ rootProject.afterEvaluate(){
doNotTrackState("See https://github.com/springdoc/springdoc-openapi-gradle-plugin/issues/102")
}
}

gitProperties {
failOnNoGitDirectory = false
keys = ["git.branch", "git.commit.id", "git.commit.id.abbrev", "git.commit.time"]
}
35 changes: 0 additions & 35 deletions git.properties.gradle

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.info.GitProperties;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -23,6 +24,7 @@
public class SystemController {

private final MaaCopilotProperties properties;
@Nullable // 非必须字段,当 Git 仓库不存在时为 null
private final GitProperties gitProperties;

@GetMapping("/")
Expand Down

0 comments on commit 93b5529

Please sign in to comment.