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
This commit is contained in:
mpl 2018-05-15 20:14:25 +02:00
parent fe934a3c72
commit 8b40fb83fe
1 changed files with 5 additions and 1 deletions

View File

@ -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")