From 3b2339dc2adac83eb9d73eb7f422697abe59d1b3 Mon Sep 17 00:00:00 2001 From: mike76-dev Date: Mon, 18 Mar 2024 15:33:16 +0100 Subject: [PATCH] Use separate versions for hsc and hsd --- Makefile | 6 ++++-- cmd/hsc/main.go | 2 +- cmd/hsd/main.go | 2 +- internal/build/version.go | 14 +++++++++++--- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index e861682..f24f926 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,10 @@ else endif ldflags= \ --X "github.com/mike76-dev/hostscore/internal/build.BinaryName=hsd" \ +-X "github.com/mike76-dev/hostscore/internal/build.NodeBinaryName=hsd" \ -X "github.com/mike76-dev/hostscore/internal/build.NodeVersion=0.1.0" \ +-X "github.com/mike76-dev/hostscore/internal/build.ClientBinaryName=hsc" \ +-X "github.com/mike76-dev/hostscore/internal/build.ClientVersion=0.1.0" \ -X "github.com/mike76-dev/hostscore/internal/build.GitRevision=${GIT_DIRTY}${GIT_REVISION}" \ -X "github.com/mike76-dev/hostscore/internal/build.BuildTime=${BUILD_TIME}" @@ -21,10 +23,10 @@ pkgs = \ ./api \ ./cmd/hsc \ ./cmd/hsd \ + ./external \ ./hostdb \ ./persist \ ./rhp \ - ./syncer \ ./wallet # release-pkgs determine which packages are built for release and distribution diff --git a/cmd/hsc/main.go b/cmd/hsc/main.go index de6e412..fc68666 100644 --- a/cmd/hsc/main.go +++ b/cmd/hsc/main.go @@ -50,7 +50,7 @@ func main() { log.Fatalf("Provided parameter is invalid: %v\n", *dir) } - fmt.Printf("hsc v%v\n", build.NodeVersion) + fmt.Printf("%s v%v\n", build.ClientBinaryName, build.ClientVersion) if build.GitRevision == "" { fmt.Println("WARN: compiled without build commit or version. To compile correctly, please use the makefile") } else { diff --git a/cmd/hsd/main.go b/cmd/hsd/main.go index d0436dc..2043ec0 100644 --- a/cmd/hsd/main.go +++ b/cmd/hsd/main.go @@ -219,7 +219,7 @@ func main() { cmd.Usage() return } - fmt.Printf("hsd v%v\n", build.NodeVersion) + fmt.Printf("%s v%v\n", build.NodeBinaryName, build.NodeVersion) if build.GitRevision != "" { fmt.Println("Git Revision " + build.GitRevision) } diff --git a/internal/build/version.go b/internal/build/version.go index b445695..4bf25d1 100644 --- a/internal/build/version.go +++ b/internal/build/version.go @@ -15,13 +15,21 @@ const ( ) var ( - // BinaryName is the name of the node binary. It is supplied at compile time - // via ldflags. - BinaryName = "unknown" + // NodeBinaryName is the name of the node binary. It is supplied at compile + // time via ldflags. + NodeBinaryName = "unknown" // NodeVersion is the current version of the node software. It is supplied // at compile time via ldflags. NodeVersion = "?.?.?" + + // ClientBinaryName is the name of the client binary. It is supplied at compile + // time via ldflags. + ClientBinaryName = "unknown" + + // ClientVersion is the current version of the client software. It is supplied + // at compile time via ldflags. + ClientVersion = "?.?.?" ) // IsVersion returns whether str is a valid release version with no -rc component.