-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
158 lines (143 loc) Β· 4.52 KB
/
Makefile
File metadata and controls
158 lines (143 loc) Β· 4.52 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Makefile for Visual Agent macOS App
# Variables
APP_NAME = VisualAgent
SCHEME = VisualAgent
PROJECT = VisualAgent.xcodeproj
BUILD_DIR = build
ARCHIVE_PATH = $(BUILD_DIR)/$(APP_NAME).xcarchive
APP_PATH = $(ARCHIVE_PATH)/Products/Applications/$(APP_NAME).app
DMG_PATH = $(BUILD_DIR)/$(APP_NAME).dmg
DMG_VOLUME_NAME = "Visual Agent"
# Configuration
CONFIGURATION = Release
DERIVED_DATA_PATH = $(BUILD_DIR)/DerivedData
# Version info (will be extracted from Info.plist)
VERSION := $(shell /usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" VisualAgent/Info.plist 2>/dev/null || echo "1.0")
BUILD_NUMBER := $(shell /usr/libexec/PlistBuddy -c "Print :CFBundleVersion" VisualAgent/Info.plist 2>/dev/null || echo "1")
.PHONY: all clean build archive dmg release help install-deps
# Default target
all: dmg
# Help target
help:
@echo "Visual Agent Build System"
@echo "========================="
@echo ""
@echo "Targets:"
@echo " make build - Build the app"
@echo " make archive - Create an archive"
@echo " make dmg - Create a DMG installer (default)"
@echo " make release - Create a GitHub release with DMG"
@echo " make clean - Clean build artifacts"
@echo " make install-deps- Install dependencies (create-dmg)"
@echo ""
@echo "Current version: $(VERSION) (build $(BUILD_NUMBER))"
# Install dependencies
install-deps:
@echo "π¦ Installing dependencies..."
@command -v create-dmg >/dev/null 2>&1 || { \
echo "Installing create-dmg via Homebrew..."; \
brew install create-dmg; \
}
@echo "β
Dependencies installed"
# Clean build artifacts
clean:
@echo "π§Ή Cleaning build artifacts..."
rm -rf $(BUILD_DIR)
rm -rf ~/Library/Developer/Xcode/DerivedData/$(APP_NAME)-*
@echo "β
Clean complete"
# Build the app
build:
@echo "π¨ Building $(APP_NAME)..."
xcodebuild \
-project $(PROJECT) \
-scheme $(SCHEME) \
-configuration $(CONFIGURATION) \
-derivedDataPath $(DERIVED_DATA_PATH) \
build
@echo "β
Build complete"
# Create archive
archive: clean
@echo "π¦ Creating archive..."
mkdir -p $(BUILD_DIR)
xcodebuild \
-project $(PROJECT) \
-scheme $(SCHEME) \
-configuration $(CONFIGURATION) \
-archivePath $(ARCHIVE_PATH) \
archive
@echo "β
Archive created at $(ARCHIVE_PATH)"
# Create DMG
dmg: archive install-deps
@echo "πΏ Creating DMG installer..."
@mkdir -p $(BUILD_DIR)/dmg
@cp -R $(APP_PATH) $(BUILD_DIR)/dmg/
@echo "Using create-dmg to build DMG..."
create-dmg \
--volname $(DMG_VOLUME_NAME) \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 100 \
--icon "$(APP_NAME).app" 200 190 \
--hide-extension "$(APP_NAME).app" \
--app-drop-link 600 185 \
--no-internet-enable \
"$(DMG_PATH)" \
"$(BUILD_DIR)/dmg/" \
|| true
@if [ -f "$(DMG_PATH)" ]; then \
echo "β
DMG created successfully at $(DMG_PATH)"; \
echo "π DMG size: $$(du -h $(DMG_PATH) | cut -f1)"; \
else \
echo "β DMG creation failed"; \
exit 1; \
fi
# Create GitHub release and upload DMG
release: dmg
@echo "π Creating GitHub release..."
@if [ -z "$(GITHUB_TOKEN)" ]; then \
echo "β Error: GITHUB_TOKEN environment variable not set"; \
echo "Set it with: export GITHUB_TOKEN=your_token_here"; \
exit 1; \
fi
@if ! command -v gh >/dev/null 2>&1; then \
echo "β Error: GitHub CLI (gh) not found"; \
echo "Install with: brew install gh"; \
exit 1; \
fi
@echo "Creating release v$(VERSION)..."
@gh release create "v$(VERSION)" \
--title "Visual Agent v$(VERSION)" \
--notes "Release notes for version $(VERSION)" \
--draft \
$(DMG_PATH)
@echo "β
Release created! Edit at: https://github.com/$$(git config --get remote.origin.url | sed 's/.*://;s/.git$$//')/releases"
@echo "π Don't forget to:"
@echo " 1. Edit release notes"
@echo " 2. Publish the draft release"
# Quick development build (no archive, just build)
dev:
@echo "π¨ Quick development build..."
xcodebuild \
-project $(PROJECT) \
-scheme $(SCHEME) \
-configuration Debug \
build
@echo "β
Development build complete"
# Open the built app
open: build
@echo "π Opening $(APP_NAME)..."
@open $(DERIVED_DATA_PATH)/Build/Products/$(CONFIGURATION)/$(APP_NAME).app
# Show build info
info:
@echo "π Build Information"
@echo "==================="
@echo "App Name: $(APP_NAME)"
@echo "Version: $(VERSION)"
@echo "Build Number: $(BUILD_NUMBER)"
@echo "Configuration: $(CONFIGURATION)"
@echo "Project: $(PROJECT)"
@echo "Scheme: $(SCHEME)"
@echo "Build Directory: $(BUILD_DIR)"
@echo ""
@echo "Xcode Version:"
@xcodebuild -version