forked from hwaf/hwaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd_waf_build.go
57 lines (48 loc) · 1.12 KB
/
cmd_waf_build.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package main
import (
"os"
"os/exec"
"github.com/gonuts/commander"
"github.com/gonuts/flag"
)
func hwaf_make_cmd_waf_build() *commander.Command {
cmd := &commander.Command{
Run: hwaf_run_cmd_waf_build,
UsageLine: "build",
Short: "build local project or packages",
Long: `
build builds the local project or packages.
ex:
$ hwaf build
$ hwaf build --prefix=my-install-area
$ hwaf build --prefix=my-install-area --destdir=/tmp/dest
`,
Flag: *flag.NewFlagSet("hwaf-waf-build", flag.ExitOnError),
CustomFlags: true,
}
return cmd
}
func hwaf_run_cmd_waf_build(cmd *commander.Command, args []string) {
var err error
//n := "hwaf-" + cmd.Name()
waf, err := g_ctx.WafBin()
handle_err(err)
subargs := []string{"build"}
run_tests := false
for _, arg := range args {
if arg == "check" {
arg = "--alltests"
run_tests = true
}
subargs = append(subargs, arg)
}
if !run_tests {
subargs = append(subargs[:1], append([]string{"--notests"}, subargs[1:]...)...)
}
sub := exec.Command(waf, subargs...)
sub.Stdout = os.Stdout
sub.Stderr = os.Stderr
err = sub.Run()
handle_err(err)
}
// EOF