mirror of
https://github.com/grafana/grafana.git
synced 2024-11-21 16:38:03 -06:00
build: use vendor folder for building (#19677)
* build: use vendor folder for building not sure if this is a good idea or not, but this stops module fetching * untouch yarn.lock Signed-off-by: Kyle Brandt <kyle@grafana.com> * modules on in runPrint
This commit is contained in:
parent
0ad2242fb8
commit
29a04ad69c
@ -1,7 +1,7 @@
|
|||||||
[run]
|
[run]
|
||||||
init_cmds = [
|
init_cmds = [
|
||||||
["go", "run", "build.go", "-dev", "build-cli"],
|
["go", "run", "-mod=vendor", "build.go", "-dev", "build-cli"],
|
||||||
["go", "run", "build.go", "-dev", "build-server"],
|
["go", "run", "-mod=vendor", "build.go", "-dev", "build-server"],
|
||||||
["./bin/grafana-server", "-packaging=dev", "cfg:app_mode=development"]
|
["./bin/grafana-server", "-packaging=dev", "cfg:app_mode=development"]
|
||||||
]
|
]
|
||||||
watch_all = true
|
watch_all = true
|
||||||
@ -14,6 +14,6 @@ watch_dirs = [
|
|||||||
watch_exts = [".go", ".ini", ".toml", ".template.html"]
|
watch_exts = [".go", ".ini", ".toml", ".template.html"]
|
||||||
build_delay = 1500
|
build_delay = 1500
|
||||||
cmds = [
|
cmds = [
|
||||||
["go", "run", "build.go", "-dev", "build-server"],
|
["go", "run", "-mod=vendor", "build.go", "-dev", "build-server"],
|
||||||
["./bin/grafana-server", "-packaging=dev", "cfg:app_mode=development"]
|
["./bin/grafana-server", "-packaging=dev", "cfg:app_mode=development"]
|
||||||
]
|
]
|
||||||
|
6
build.go
6
build.go
@ -51,6 +51,7 @@ var (
|
|||||||
skipRpmGen bool = false
|
skipRpmGen bool = false
|
||||||
skipDebGen bool = false
|
skipDebGen bool = false
|
||||||
printGenVersion bool = false
|
printGenVersion bool = false
|
||||||
|
modVendor bool = true
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -68,6 +69,7 @@ func main() {
|
|||||||
flag.StringVar(&pkgArch, "pkg-arch", "", "PKG ARCH")
|
flag.StringVar(&pkgArch, "pkg-arch", "", "PKG ARCH")
|
||||||
flag.StringVar(&phjsToRelease, "phjs", "", "PhantomJS binary")
|
flag.StringVar(&phjsToRelease, "phjs", "", "PhantomJS binary")
|
||||||
flag.BoolVar(&race, "race", race, "Use race detector")
|
flag.BoolVar(&race, "race", race, "Use race detector")
|
||||||
|
flag.BoolVar(&modVendor, "modVendor", modVendor, "Go modules use vendor folder")
|
||||||
flag.BoolVar(&includeBuildId, "includeBuildId", includeBuildId, "IncludeBuildId in package name")
|
flag.BoolVar(&includeBuildId, "includeBuildId", includeBuildId, "IncludeBuildId in package name")
|
||||||
flag.BoolVar(&enterprise, "enterprise", enterprise, "Build enterprise version of Grafana")
|
flag.BoolVar(&enterprise, "enterprise", enterprise, "Build enterprise version of Grafana")
|
||||||
flag.StringVar(&buildIdRaw, "buildId", "0", "Build ID from CI system")
|
flag.StringVar(&buildIdRaw, "buildId", "0", "Build ID from CI system")
|
||||||
@ -499,6 +501,9 @@ func build(binaryName, pkg string, tags []string) {
|
|||||||
if race {
|
if race {
|
||||||
args = append(args, "-race")
|
args = append(args, "-race")
|
||||||
}
|
}
|
||||||
|
if modVendor {
|
||||||
|
args = append(args, "-mod=vendor")
|
||||||
|
}
|
||||||
|
|
||||||
args = append(args, "-o", binary)
|
args = append(args, "-o", binary)
|
||||||
args = append(args, pkg)
|
args = append(args, pkg)
|
||||||
@ -621,6 +626,7 @@ func runError(cmd string, args ...string) ([]byte, error) {
|
|||||||
func runPrint(cmd string, args ...string) {
|
func runPrint(cmd string, args ...string) {
|
||||||
log.Println(cmd, strings.Join(args, " "))
|
log.Println(cmd, strings.Join(args, " "))
|
||||||
ecmd := exec.Command(cmd, args...)
|
ecmd := exec.Command(cmd, args...)
|
||||||
|
ecmd.Env = append(os.Environ(), "GO111MODULE=on")
|
||||||
ecmd.Stdout = os.Stdout
|
ecmd.Stdout = os.Stdout
|
||||||
ecmd.Stderr = os.Stderr
|
ecmd.Stderr = os.Stderr
|
||||||
err := ecmd.Run()
|
err := ecmd.Run()
|
||||||
|
Loading…
Reference in New Issue
Block a user