@@ -32,16 +32,31 @@ import (
3232 "github.com/rs/zerolog/log"
3333)
3434
35+ // BuildProvChecker builds myst binary with provider checker API. Like go tool, it supports cross-platform build with env vars: GOOS, GOARCH.
36+ func BuildProvChecker () error {
37+ logconfig .Bootstrap ()
38+ if err := buildBinary (path .Join ("cmd" , "mysterium_node" , "mysterium_node.go" ), "myst" , true ); err != nil {
39+ return err
40+ }
41+ if err := copyConfig ("myst" ); err != nil {
42+ return err
43+ }
44+ if err := buildBinary (path .Join ("cmd" , "supervisor" , "supervisor.go" ), "myst_supervisor" , false ); err != nil {
45+ return err
46+ }
47+ return nil
48+ }
49+
3550// Build builds the project. Like go tool, it supports cross-platform build with env vars: GOOS, GOARCH.
3651func Build () error {
3752 logconfig .Bootstrap ()
38- if err := buildBinary (path .Join ("cmd" , "mysterium_node" , "mysterium_node.go" ), "myst" ); err != nil {
53+ if err := buildBinary (path .Join ("cmd" , "mysterium_node" , "mysterium_node.go" ), "myst" , false ); err != nil {
3954 return err
4055 }
4156 if err := copyConfig ("myst" ); err != nil {
4257 return err
4358 }
44- if err := buildBinary (path .Join ("cmd" , "supervisor" , "supervisor.go" ), "myst_supervisor" ); err != nil {
59+ if err := buildBinary (path .Join ("cmd" , "supervisor" , "supervisor.go" ), "myst_supervisor" , false ); err != nil {
4560 return err
4661 }
4762 return nil
@@ -67,7 +82,7 @@ func buildCrossBinary(os, arch string) error {
6782 return sh .Run ("bin/build_xgo" , os + "/" + arch )
6883}
6984
70- func buildBinary (source , target string ) error {
85+ func buildBinary (source , target string , provChecker bool ) error {
7186 targetOS , ok := os .LookupEnv ("GOOS" )
7287 if ! ok {
7388 targetOS = runtime .GOOS
@@ -76,10 +91,10 @@ func buildBinary(source, target string) error {
7691 if ! ok {
7792 targetArch = runtime .GOARCH
7893 }
79- return buildBinaryFor (source , target , targetOS , targetArch , nil , false )
94+ return buildBinaryFor (source , target , targetOS , targetArch , nil , false , provChecker )
8095}
8196
82- func buildBinaryFor (source , target , targetOS , targetArch string , extraEnvs map [string ]string , buildStatic bool ) error {
97+ func buildBinaryFor (source , target , targetOS , targetArch string , extraEnvs map [string ]string , buildStatic , provChecker bool ) error {
8398 log .Info ().Msgf ("Building %s -> %s %s/%s" , source , target , targetOS , targetArch )
8499
85100 buildDir , err := filepath .Abs (path .Join ("build" , target ))
@@ -100,6 +115,9 @@ func buildBinaryFor(source, target, targetOS, targetArch string, extraEnvs map[s
100115 if buildStatic {
101116 flags = append (flags , "-a" , "-tags" , "netgo" )
102117 }
118+ if provChecker {
119+ flags = append (flags , "-tags" , "prov_checker" )
120+ }
103121
104122 if targetOS == "windows" {
105123 target += ".exe"
0 commit comments