sing-box/cmd/internal/build/main.go

33 lines
659 B
Go
Raw Normal View History

2022-12-11 14:38:01 +08:00
package main
import (
"os"
"os/exec"
2022-10-25 12:55:00 +08:00
"github.com/sagernet/sing-box/cmd/internal/build_shared"
C "github.com/sagernet/sing-box/constant"
2022-12-11 14:38:01 +08:00
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing/common"
2022-12-11 14:38:01 +08:00
)
func main() {
2022-10-25 12:55:00 +08:00
build_shared.FindSDK()
2022-12-11 14:38:01 +08:00
currentTag, err := common.Exec("git", "describe", "--tags", "--abbrev=0").Read()
if err != nil {
log.Fatal(err)
}
if "v"+C.Version != currentTag {
log.Fatal("version mismatch, update constant.Version to ", currentTag[1:])
}
2022-12-11 14:38:01 +08:00
command := exec.Command(os.Args[1], os.Args[2:]...)
command.Stdout = os.Stdout
command.Stderr = os.Stderr
err = command.Run()
2022-12-11 14:38:01 +08:00
if err != nil {
log.Fatal(err)
}
}