diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 7ce26598..11ff534e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -31,10 +31,10 @@ jobs: run: cd runtime && go tool cover --func ../cover-runtime.out - name: Build Release - run: go run ./script/build-release + run: go run ./script/build-release --include-install-src --include-local - # - name: Check Version - # run: ~/.xgo/bin/xgo revision + - name: Check Version + run: ~/.xgo/bin/xgo revision - # - name: Check Go Version - # run: ~/.xgo/bin/xgo exec go version \ No newline at end of file + - name: Check Go Version + run: ~/.xgo/bin/xgo exec go version \ No newline at end of file diff --git a/cmd/xgo/version.go b/cmd/xgo/version.go index ff39bc9d..f18e6ca0 100644 --- a/cmd/xgo/version.go +++ b/cmd/xgo/version.go @@ -3,8 +3,8 @@ package main import "fmt" const VERSION = "1.0.11" -const REVISION = "1bc959ae70c34e189c36b8cb3f7b2e1a8665756c+1" -const NUMBER = 136 +const REVISION = "bdfb5083555459e8a25ce31cdde1706aaa58bc43+1" +const NUMBER = 137 func getRevision() string { return fmt.Sprintf("%s %s BUILD_%d", VERSION, REVISION, NUMBER) diff --git a/runtime/core/version.go b/runtime/core/version.go index bcea64ea..da7a67c0 100644 --- a/runtime/core/version.go +++ b/runtime/core/version.go @@ -7,8 +7,8 @@ import ( ) const VERSION = "1.0.11" -const REVISION = "1bc959ae70c34e189c36b8cb3f7b2e1a8665756c+1" -const NUMBER = 136 +const REVISION = "bdfb5083555459e8a25ce31cdde1706aaa58bc43+1" +const NUMBER = 137 // these fields will be filled by compiler const XGO_VERSION = "" diff --git a/script/build-release/main.go b/script/build-release/main.go index 80fdc430..e838a19d 100644 --- a/script/build-release/main.go +++ b/script/build-release/main.go @@ -20,7 +20,7 @@ import ( // go run ./script/build-release // go run ./script/build-release --local --local-name xgo_dev // go run ./script/build-release --local --local-name xgo_dev --debug -// go run ./script/build-release --include-install-src +// go run ./script/build-release --include-install-src --include-local func main() { args := os.Args[1:] @@ -29,6 +29,7 @@ func main() { var localName string var debug bool var includeInstallSrc bool + var includeLocal bool for i := 0; i < n; i++ { arg := args[i] if arg == "--local" { @@ -48,6 +49,10 @@ func main() { includeInstallSrc = true continue } + if arg == "--include-local" { + includeLocal = true + continue + } fmt.Fprintf(os.Stderr, "unrecognized option: %s\n", arg) os.Exit(1) } @@ -70,7 +75,7 @@ func main() { } } - err := buildRelease("xgo-release", installLocal, localName, debug, archs, includeInstallSrc) + err := buildRelease("xgo-release", installLocal, localName, debug, archs, includeInstallSrc, includeLocal) if err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) @@ -82,7 +87,7 @@ type osArch struct { goarch string } -func buildRelease(releaseDirName string, installLocal bool, localName string, debug bool, osArches []*osArch, includeInstallSrc bool) error { +func buildRelease(releaseDirName string, installLocal bool, localName string, debug bool, osArches []*osArch, includeInstallSrc bool, includeLocal bool) error { if installLocal && len(osArches) != 1 { return fmt.Errorf("--install-local requires only one target") } @@ -176,7 +181,7 @@ func buildRelease(releaseDirName string, installLocal bool, localName string, de } for _, osArch := range osArches { - err := buildBinaryRelease(dir, tmpSrcDir, xgoVersionStr, osArch.goos, osArch.goarch, installLocal, localName, extraBuildFlags) + err := buildBinaryRelease(dir, tmpSrcDir, xgoVersionStr, osArch.goos, osArch.goarch, installLocal, includeLocal, localName, extraBuildFlags) if err != nil { return fmt.Errorf("GOOS=%s GOARCH=%s:%w", osArch.goos, osArch.goarch, err) } @@ -247,7 +252,7 @@ func generateSums(dir string, sumFile string) error { // c2876990b545be8396b7d13f0f9c3e23b38236de8f0c9e79afe04bcf1d03742e xgo1.0.0-darwin-arm64.tar.gz // 6ae476cb4c3ab2c81a94d1661070e34833e4a8bda3d95211570391fb5e6a3cc0 xgo1.0.0-darwin-amd64.tar.gz -func buildBinaryRelease(dir string, srcDir string, version string, goos string, goarch string, installLocal bool, localName string, extraBuildFlags []string) error { +func buildBinaryRelease(dir string, srcDir string, version string, goos string, goarch string, installLocal bool, includeLocal bool, localName string, extraBuildFlags []string) error { if version == "" { return fmt.Errorf("requires version") } @@ -293,8 +298,16 @@ func buildBinaryRelease(dir string, srcDir string, version string, goos string, return err } } - + var needInstall bool if installLocal { + needInstall = true + } else if includeLocal { + if runtime.GOOS == goos && runtime.GOARCH == goarch { + needInstall = true + } + } + + if needInstall { homeDir, err := os.UserHomeDir() if err != nil { return err @@ -327,7 +340,9 @@ func buildBinaryRelease(dir string, srcDir string, version string, goos string, if lookPathErr != nil { fmt.Printf("%s built successfully, you may need to add %s to your PATH variables\n", xgoExeName, binDir) } - return nil + if installLocal { + return nil + } } // package it as a tar.gz