-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
79 lines (65 loc) · 1.48 KB
/
main.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package main
import (
"log"
"os"
"runtime"
"time"
"gopkg.in/urfave/cli.v2"
"github.com/nuls-io/nuls-v2-package/cmd"
"github.com/nuls-io/nuls-v2-package/config"
"github.com/nuls-io/nuls-v2-package/util"
)
func main() {
//test()
//os.Exit(0)
if err := setupAPP().Run(os.Args); err != nil {
log.Printf(err.Error())
os.Exit(1)
}
}
func test() {
log.Println("start maven package , exec mvn package")
sysType := runtime.GOOS
cmd := "bash"
args := []string {"-c", "cd .. && mvn clean package -Dmaven.test.skip=true"}
if sysType == "windows" {
// windows系统
cmd = "cmd"
}
//cmd = "cd .. && mvn clean package -Dmaven.test.skip=true"
res := util.Command(cmd, args)
log.Println(res)
//err, out, errout := util.Shellout("cd .. && mvn clean package -Dmaven.test.skip=true")
//if err != nil {
// log.Printf("error: %v\n", err)
//}
//fmt.Println("--- stdout ---")
//fmt.Println(out)
//fmt.Println("--- stderr ---")
//fmt.Println(errout)
}
func setupAPP() *cli.App {
app := cli.App{}
app.Name = "package"
app.Usage = "run ./package"
app.Version = "1.0"
app.Compiled = time.Now()
app.Authors = []*cli.Author{
{
Name: "nuls core team",
Email: "dev@nuls.io",
},
}
app.Action = startup
app.Before = initConfig
app.Commands = cmd.GetCommands()
app.Flags = config.GetFlags()
return &app
}
func initConfig(context *cli.Context) error {
runtime.GOMAXPROCS(runtime.NumCPU())
return nil
}
func startup(context *cli.Context) error {
return cmd.DoPackage(context)
}