mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
parent
1c47fae206
commit
38bd90e6f2
33
build.go
33
build.go
@ -631,20 +631,27 @@ func buildSnap(target target) {
|
|||||||
|
|
||||||
func shouldBuildSyso(dir string) (string, error) {
|
func shouldBuildSyso(dir string) (string, error) {
|
||||||
type M map[string]interface{}
|
type M map[string]interface{}
|
||||||
major, minor, patch, build := semanticVersion()
|
version := getVersion()
|
||||||
|
version = strings.TrimPrefix(version, "v")
|
||||||
|
major, minor, patch := semanticVersion()
|
||||||
bs, err := json.Marshal(M{
|
bs, err := json.Marshal(M{
|
||||||
"FixedFileInfo": M{
|
"FixedFileInfo": M{
|
||||||
"FileVersion": M{
|
"FileVersion": M{
|
||||||
"Major": major,
|
"Major": major,
|
||||||
"Minor": minor,
|
"Minor": minor,
|
||||||
"Patch": patch,
|
"Patch": patch,
|
||||||
"Build": build,
|
},
|
||||||
|
"ProductVersion": M{
|
||||||
|
"Major": major,
|
||||||
|
"Minor": minor,
|
||||||
|
"Patch": patch,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"StringFileInfo": M{
|
"StringFileInfo": M{
|
||||||
"FileDescription": "Open Source Continuous File Synchronization",
|
"FileDescription": "Open Source Continuous File Synchronization",
|
||||||
"LegalCopyright": "The Syncthing Authors",
|
"LegalCopyright": "The Syncthing Authors",
|
||||||
"ProductVersion": getVersion(),
|
"FileVersion": version,
|
||||||
|
"ProductVersion": version,
|
||||||
"ProductName": "Syncthing",
|
"ProductName": "Syncthing",
|
||||||
},
|
},
|
||||||
"IconPath": "assets/logo.ico",
|
"IconPath": "assets/logo.ico",
|
||||||
@ -864,22 +871,18 @@ func getVersion() string {
|
|||||||
return "unknown-dev"
|
return "unknown-dev"
|
||||||
}
|
}
|
||||||
|
|
||||||
func semanticVersion() (major, minor, patch, build int) {
|
func semanticVersion() (major, minor, patch int) {
|
||||||
r := regexp.MustCompile(`v(?P<Major>\d+)\.(?P<Minor>\d+).(?P<Patch>\d+).*\+(?P<CommitsAhead>\d+)`)
|
r := regexp.MustCompile(`v(\d+)\.(\d+).(\d+)`)
|
||||||
matches := r.FindStringSubmatch(getVersion())
|
matches := r.FindStringSubmatch(getVersion())
|
||||||
if len(matches) != 5 {
|
if len(matches) != 4 {
|
||||||
return 0, 0, 0, 0
|
return 0, 0, 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var ints [4]int
|
var ints [3]int
|
||||||
for i := 1; i < 5; i++ {
|
for i, s := range matches[1:] {
|
||||||
value, err := strconv.Atoi(matches[i])
|
ints[i], _ = strconv.Atoi(s)
|
||||||
if err != nil {
|
|
||||||
return 0, 0, 0, 0
|
|
||||||
}
|
}
|
||||||
ints[i-1] = value
|
return ints[0], ints[1], ints[2]
|
||||||
}
|
|
||||||
return ints[0], ints[1], ints[2], ints[3]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getBranchSuffix() string {
|
func getBranchSuffix() string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user