Support build.go -no-upgrade install (fixes #975)
This commit is contained in:
parent
70d8903d3c
commit
ddd2759cec
17
build.go
17
build.go
@ -82,7 +82,7 @@ func main() {
|
|||||||
checkRequiredGoVersion()
|
checkRequiredGoVersion()
|
||||||
|
|
||||||
if flag.NArg() == 0 {
|
if flag.NArg() == 0 {
|
||||||
install("./cmd/...")
|
install("./cmd/...", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,11 @@ func main() {
|
|||||||
|
|
||||||
case "install":
|
case "install":
|
||||||
pkg := "./cmd/..."
|
pkg := "./cmd/..."
|
||||||
install(pkg)
|
var tags []string
|
||||||
|
if noupgrade {
|
||||||
|
tags = []string{"noupgrade"}
|
||||||
|
}
|
||||||
|
install(pkg, tags)
|
||||||
|
|
||||||
case "build":
|
case "build":
|
||||||
pkg := "./cmd/syncthing"
|
pkg := "./cmd/syncthing"
|
||||||
@ -168,10 +172,15 @@ func test(pkg string) {
|
|||||||
runPrint("go", "test", "-short", "-timeout", "10s", pkg)
|
runPrint("go", "test", "-short", "-timeout", "10s", pkg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func install(pkg string) {
|
func install(pkg string, tags []string) {
|
||||||
os.Setenv("GOBIN", "./bin")
|
os.Setenv("GOBIN", "./bin")
|
||||||
|
args := []string{"install", "-v", "-ldflags", ldflags()}
|
||||||
|
if len(tags) > 0 {
|
||||||
|
args = append(args, "-tags", strings.Join(tags, ","))
|
||||||
|
}
|
||||||
|
args = append(args, pkg)
|
||||||
setBuildEnv()
|
setBuildEnv()
|
||||||
runPrint("go", "install", "-v", "-ldflags", ldflags(), pkg)
|
runPrint("go", args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func build(pkg string, tags []string) {
|
func build(pkg string, tags []string) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user