Skip to content

Commit 1b52473

Browse files
committed
feat: remove chain-id from network for now, refactor makefile
1 parent 4169c33 commit 1b52473

File tree

3 files changed

+45
-25
lines changed

3 files changed

+45
-25
lines changed

Makefile

+26-23
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
11
#!/usr/bin/make -f
22

3-
GO_VERSION=1.22
4-
GO_SYSTEM_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1-2)
5-
REQUIRE_GO_VERSION = $(GO_VERSION)
3+
# Go version and build settings
4+
GO_VERSION := 1.22
5+
GO_SYSTEM_VERSION := $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1-2)
6+
REQUIRE_GO_VERSION := $(GO_VERSION)
7+
ENABLED_FLAGS :=
68

7-
WEAVE_VERSION=v0.0.1
9+
# Project version
10+
WEAVE_VERSION := v0.0.1
811

12+
# Build directory
913
BUILDDIR ?= $(CURDIR)/build
10-
BUILD_TARGETS = build
1114

12-
release_version=$(filter-out $@,$(MAKECMDGOALS))
15+
# Build targets
16+
BUILD_TARGETS := build install test
1317

18+
# Version check
1419
check_version:
15-
ifneq ($(GO_SYSTEM_VERSION), $(REQUIRE_GO_VERSION))
16-
@echo "ERROR: Go version ${REQUIRE_GO_VERSION} is required for Weave."
17-
exit 1
18-
endif
19-
20-
build: BUILD_ARGS=-o $(BUILDDIR)/
20+
@if [ "$(GO_SYSTEM_VERSION)" != "$(REQUIRE_GO_VERSION)" ]; then \
21+
echo "ERROR: Go version $(REQUIRE_GO_VERSION) is required for Weave."; \
22+
exit 1; \
23+
fi
2124

22-
$(BUILD_TARGETS): check_version go.sum $(BUILDDIR)/
23-
ifeq ($(OS),Windows_NT)
24-
exit 1
25-
else
26-
go $@ -mod=readonly -ldflags "-X github.com/initia-labs/weave/cmd.Version=$(WEAVE_VERSION)" .
27-
endif
25+
# Build settings
26+
LDFLAGS := -X github.com/initia-labs/weave/cmd.Version=$(WEAVE_VERSION) \
27+
-X github.com/initia-labs/weave/flags.EnabledFlags=$(ENABLED_FLAGS)
2828

29-
$(BUILDDIR)/:
30-
mkdir -p $(BUILDDIR)/
29+
# Build targets
30+
build: check_version $(BUILDDIR)
31+
go build -mod=readonly -ldflags "$(LDFLAGS)" -o $(BUILDDIR)/weave .
3132

32-
install:
33-
go install -ldflags "-X github.com/initia-labs/weave/cmd.Version=$(WEAVE_VERSION)" .
33+
install: check_version
34+
go install -ldflags "$(LDFLAGS)" .
3435

35-
test:
36+
test: check_version
3637
go test -v ./...
3738

39+
# Release process
3840
release:
3941
@if [ -z "$(release_version)" ]; then \
4042
echo "ERROR: You must provide a release version. Example: make release v0.0.15"; \
@@ -44,5 +46,6 @@ release:
4446
git push origin $(release_version)
4547
gh release create $(release_version) --title "$(release_version)" --notes "Release notes for version $(release_version)"
4648

49+
# Catch-all target
4750
%:
4851
@:

flags/flag.go

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package flags
2+
3+
import "strings"
4+
5+
var EnabledFlags string
6+
7+
type FeatureFlag string
8+
9+
const (
10+
MinitiaLaunch FeatureFlag = "minitia_launch"
11+
OPInitBotsExecutor FeatureFlag = "opinit-bots-executor"
12+
Relayer FeatureFlag = "relayer"
13+
)
14+
15+
func IsEnabled(flag FeatureFlag) bool {
16+
return strings.Contains(EnabledFlags, string(flag))
17+
}

models/initia/run_l1_node.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ type RunL1NodeNetworkSelect struct {
2525
type L1NodeNetworkOption string
2626

2727
const (
28-
Mainnet L1NodeNetworkOption = "Mainnet (initia-1)"
29-
Testnet L1NodeNetworkOption = "Testnet (initiation-2)"
28+
Mainnet L1NodeNetworkOption = "Mainnet"
29+
Testnet L1NodeNetworkOption = "Testnet"
3030
Local L1NodeNetworkOption = "Local"
3131
)
3232

0 commit comments

Comments
 (0)