Somewhat better version handling

This commit is contained in:
Imbus 2025-01-28 11:40:56 +01:00
parent e7596e41f7
commit f5de8d1f37
5 changed files with 19 additions and 12 deletions

View file

@ -17,19 +17,18 @@ help:
@echo " help - Show this help message" @echo " help - Show this help message"
release: $(RELEASE_NAME) release: $(RELEASE_NAME)
make -C ./rex_client make -C ./rex_client REX_VERSION=$(REX_VERSION)
make -C ./rex_server make -C ./rex_server REX_VERSION=$(REX_VERSION)
mv ./rex_client/rexclient $(RELEASE_NAME) mv ./rex_client/rexclient $(RELEASE_NAME)
mv ./rex_server/rexserver $(RELEASE_NAME) mv ./rex_server/rexserver $(RELEASE_NAME)
cp ./LICENSE.txt $(RELEASE_NAME) cp ./LICENSE.txt $(RELEASE_NAME)
cp ./VERSION.txt $(RELEASE_NAME)
cp ./README.md $(RELEASE_NAME) cp ./README.md $(RELEASE_NAME)
mkdir -p $(RELEASE_NAME)/source mkdir -p $(RELEASE_NAME)/source
cp ./VERSION.txt $(RELEASE_NAME)/source cp ./VERSION.txt $(RELEASE_NAME)/source
git ls-files | xargs -I{} cp --parents {} $(RELEASE_NAME)/source git ls-files | xargs -I{} cp --parents {} $(RELEASE_NAME)/source
date -I > $(RELEASE_NAME)/VERSION.txt date -I > $(RELEASE_NAME)/INFO.txt
echo $(rev) >> $(RELEASE_NAME)/VERSION.txt echo $(REX_VERSION) >> $(RELEASE_NAME)/INFO.txt
go version >> $(RELEASE_NAME)/VERSION.txt go version >> $(RELEASE_NAME)/INFO.txt
tar cvzf $(RELEASE_NAME).tar.gz $(RELEASE_NAME) tar cvzf $(RELEASE_NAME).tar.gz $(RELEASE_NAME)
$(RELEASE_NAME): $(RELEASE_NAME):

View file

@ -1,7 +1,10 @@
NAME = rexclient NAME = rexclient
VERSION_FILE := ../VERSION.txt
REX_VERSION ?= $(shell cat $(VERSION_FILE))
build: commit.txt build: commit.txt
go build -tags no_emoji -trimpath -ldflags="-s -w" -buildvcs=false -o $(NAME) go build -tags no_emoji -trimpath -ldflags="-s -w -X main.rex_version=$(REX_VERSION)" -buildvcs=false -o $(NAME)
run: commit.txt run: commit.txt
go run . go run .

View file

@ -15,13 +15,11 @@ import (
model "rex_model" model "rex_model"
) )
//go:generate sh -c "printf %s $(git rev-parse --short HEAD) > commit.txt" var rex_version = "UNDEFINED"
//go:embed commit.txt
var git_rev string
func main() { func main() {
a := app.New() a := app.New()
w := a.NewWindow(fmt.Sprintf("RexForge %s", strings.ToUpper(git_rev))) w := a.NewWindow(fmt.Sprintf("RexForge %s", strings.ToUpper(rex_version)))
w.Resize(fyne.NewSize(900, 600)) w.Resize(fyne.NewSize(900, 600))
addons := model.AddonIndex addons := model.AddonIndex

View file

@ -1,7 +1,10 @@
NAME = rexserver NAME = rexserver
VERSION_FILE := ../VERSION.txt
REX_VERSION ?= $(shell cat $(VERSION_FILE))
build: commit.txt build: commit.txt
go build -o $(NAME) go build -ldflags="-X main.rex_version=$(REX_VERSION)" -o $(NAME)
run: commit.txt run: commit.txt
go run . go run .

View file

@ -7,11 +7,15 @@ import (
"net/http" "net/http"
"rex_model" "rex_model"
"time" "time"
"strings"
) )
var rex_version = "UNDEFINED"
func main() { func main() {
port := ":8080" port := ":8080"
addons := rex_model.AddonIndex addons := rex_model.AddonIndex
log.Printf("Starting RexForge server version: %s", strings.ToUpper(rex_version))
mux := http.NewServeMux() mux := http.NewServeMux()