first draft at stamping, broken because i'm not using workspaces

stamping
Nick Dumas 1 year ago
parent 68824221c1
commit be601acec6

@ -10,7 +10,7 @@ bazel_dep(name = "rules_pkg", version = "0.9.1")
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod") go_deps.from_file(go_mod = "//:go.mod")
use_repo(go_deps, "com_github_engoengine_engo", "com_github_threedotslabs_watermill") use_repo(go_deps, "com_github_engoengine_ecs", "com_github_threedotslabs_watermill")
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci") oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
oci.pull( oci.pull(

@ -20,6 +20,10 @@ go_binary(
name = "echo", name = "echo",
embed = [":echo_lib"], embed = [":echo_lib"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
x_defs = {
"code.ndumas.com/ndumas/gomud.Version":"STABLE_GIT_VERSION",
"code.ndumas.com/ndumas/gomud.Build":"STABLE_GIT_COMMIT",
},
) )
load("@rules_pkg//:pkg.bzl", "pkg_tar") load("@rules_pkg//:pkg.bzl", "pkg_tar")

@ -14,22 +14,30 @@ import (
"github.com/ThreeDotsLabs/watermill/message/router/plugin" "github.com/ThreeDotsLabs/watermill/message/router/plugin"
"github.com/ThreeDotsLabs/watermill/pubsub/gochannel" "github.com/ThreeDotsLabs/watermill/pubsub/gochannel"
"code.ndumas.com/ndumas/gomud"
"code.ndumas.com/ndumas/gomud/engine" "code.ndumas.com/ndumas/gomud/engine"
"code.ndumas.com/ndumas/gomud/logger" "code.ndumas.com/ndumas/gomud/logger"
"code.ndumas.com/ndumas/gomud/telnet" "code.ndumas.com/ndumas/gomud/telnet"
) )
var ( var (
port int port int
verbose int verbose int
versionFlag bool
) )
func main() { func main() {
flag.IntVar(&verbose, "verbose", 0, "-5:Trace, -4:Debug, 0:Info, 4:Warn, 8:Error") flag.IntVar(&verbose, "verbose", 0, "-5:Trace, -4:Debug, 0:Info, 4:Warn, 8:Error")
flag.IntVar(&port, "port", 5555, "MUD server port") flag.IntVar(&port, "port", 5555, "MUD server port")
flag.BoolVar(&versionFlag, "version", false, "print build version")
flag.Parse() flag.Parse()
if versionFlag {
fmt.Printf("%s@%s\n", gomud.VERSION, gomud.BUILD)
return
}
l, err := net.Listen("tcp", fmt.Sprintf(":%d", port)) l, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
if err != nil { if err != nil {
log.Fatalf("error binding to port %d\n: %s", port, err) log.Fatalf("error binding to port %d\n: %s", port, err)

@ -0,0 +1,6 @@
#! /bin/bash
tag=$(git describe --tags --dirty=-dev)
commit=$(git rev-parse HEAD | head -c8)
echo "STABLE_GIT_VERSION:$tag"
echo "STABLE_GIT_COMMIT:$commit"

@ -0,0 +1,6 @@
package gomud
const (
VERSION = ""
BUILD = ""
)
Loading…
Cancel
Save