From 8b40fb83fe02d9b58861c1631b8403df5c6327d7 Mon Sep 17 00:00:00 2001 From: mpl Date: Tue, 15 May 2018 20:14:25 +0200 Subject: [PATCH] make.go: add with_embed build tag to all generated resources And then build targets with with_embed only if embed_static command-line flag is true. Fixes #1157 Change-Id: If6a998749e0caae5ee21037d667bcc476562a354 --- make.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/make.go b/make.go index f0c9fae97..682a01de0 100644 --- a/make.go +++ b/make.go @@ -180,6 +180,9 @@ func main() { // and some underlying libraries tags = append(tags, "with_sqlite") } + if *embedResources { + tags = append(tags, "with_embed") + } baseArgs := []string{"install", "-v"} if *race { baseArgs = append(baseArgs, "-race") @@ -589,7 +592,7 @@ func genEmbeds() error { "app/scanningcabinet/ui", } { embeds := fullSrcPath(embeds) - var args []string + args := []string{"-build-tags=with_embed"} args = append(args, embeds) cmd := exec.Command(cmdName, args...) cmd.Stdout = os.Stdout @@ -984,6 +987,7 @@ func embedClosure(closureDir, embedFile string) error { // then embed it as a quoted string var qb bytes.Buffer + fmt.Fprint(&qb, "// +build with_embed\n\n") fmt.Fprint(&qb, "package closure\n\n") fmt.Fprint(&qb, "import \"time\"\n\n") fmt.Fprint(&qb, "func init() {\n")