-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
90 lines (69 loc) · 3.29 KB
/
makefile
File metadata and controls
90 lines (69 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
.PHONY: help clean build run test test-ur format lint install uninstall release tag version checkGitClean mermaid bump-patch bump-minor bump-major update-packages
.DEFAULT_GOAL := help
APP_NAME = SwiftRoboticVisualizer
BUILD_DIR = .build
BIN_PATH = $(BUILD_DIR)/release/$(APP_NAME)
INSTALL_PATH = /usr/local/bin/$(APP_NAME)
CONFIG=./.swift-format.json
help: ## Show available make commands with descriptions
@awk 'BEGIN {FS = ":.*?## "}; /^[a-zA-Z0-9_-]+:.*?## / {printf "%-20s -> %s\n", $$1, $$2}' $(MAKEFILE_LIST)
clean: ## Clean all build artifacts
swift package clean
rm -rf $(BUILD_DIR)
build: ## Build the project in release mode
swift build -c release
run: ## Run the app
swift run
test: ## Run tests (without simulator)
swift test
test-ur: ## Run tests with UR simulator enabled
ENABLE_SIMULATOR_TESTS=1 swift test
update-packages: ##
swift package update
format: ## Format code using swift-format with explicit config
swift-format --configuration $(CONFIG) format --in-place --recursive Sources
swift-format --configuration $(CONFIG) format --in-place --recursive Tests
bump-patch: ## Bump patch version (e.g., 1.2.3 → 1.2.4)
@CURRENT=$$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.0"); \
MAJOR=$$(echo $$CURRENT | cut -d. -f1); \
MINOR=$$(echo $$CURRENT | cut -d. -f2); \
PATCH=$$(echo $$CURRENT | cut -d. -f3); \
NEW_VERSION="v$$MAJOR.$$MINOR.$$((PATCH + 1))"; \
echo "Bumping to $$NEW_VERSION"; \
git tag -a $$NEW_VERSION -m "Version $$NEW_VERSION"; \
git push origin $$NEW_VERSION
bump-minor: ## Bump minor version (e.g., 1.2.3 → 1.3.0)
@CURRENT=$$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.0"); \
MAJOR=$$(echo $$CURRENT | cut -d. -f1); \
MINOR=$$(echo $$CURRENT | cut -d. -f2); \
# PATCH is not used here but you can still get it if needed: PATCH=$$(echo $$CURRENT | cut -d. -f3); \
NEW_VERSION="v$$MAJOR.$$((MINOR + 1)).0"; \
echo "Bumping to $$NEW_VERSION"; \
git tag -a $$NEW_VERSION -m "Version $$NEW_VERSION"; \
git push origin $$NEW_VERSION
bump-major: ## Bump major version (e.g., 1.2.3 → 2.0.0)
@CURRENT=$$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.0"); \
MAJOR=$$(echo $$CURRENT | cut -d. -f1); \
# MINOR and PATCH are not used here but you can get them if needed: \
# MINOR=$$(echo $$CURRENT | cut -d. -f2); \
# PATCH=$$(echo $$CURRENT | cut -d. -f3); \
NEW_VERSION="v$$((MAJOR + 1)).0.0"; \
echo "Bumping to $$NEW_VERSION"; \
git tag -a $$NEW_VERSION -m "Version $$NEW_VERSION"; \
git push origin $$NEW_VERSION
install: build ## Install binary to /usr/local/bin
cp -f $(BIN_PATH) $(INSTALL_PATH)
chmod +x $(INSTALL_PATH)
uninstall: ## Remove installed binary
rm -f $(INSTALL_PATH)
version: ## Show current version from Git tag
@echo "Current version: $$(git describe --tags --abbrev=0)"
tag: checkGitClean version ## Tag the current version in git
@echo "Tagging version $$(make version)"
git tag -a v$$(make version) -m "Release v$$(make version)"
git push origin v$$(make version)
mermaid: ## Create the mermaid layout for this project
swift package plugin depermaid --direction TD --test --executable --product
release: clean build test install ## Full release process
checkGitClean:
@git diff-index --quiet HEAD -- || (echo "Git working directory not clean" && exit 1)