1
+ # Use bash, and immediately exit on failure
2
+ SHELL := bash
3
+ .SHELLFLAGS := -ceu
4
+
5
+ # This doesn't work on directories.
6
+ # See https://stackoverflow.com/questions/25752543/make-delete-on-error-for-directory-targets
7
+ .DELETE_ON_ERROR :
8
+
1
9
ifdef CI
2
10
LINTFLAGS := --reporter github-actions-logging
3
11
FMTFLAGS := --lint --reporter github-actions-log
@@ -11,18 +19,26 @@ XCPROJECT := Coder\ Desktop/Coder\ Desktop.xcodeproj
11
19
SCHEME := Coder\ Desktop
12
20
SWIFT_VERSION := 6.0
13
21
22
+ MUTAGEN_RESOURCES := mutagen-agents.tar.gz mutagen-darwin-arm64 mutagen-darwin-amd64
23
+ ifndef MUTAGEN_VERSION
24
+ MUTAGEN_VERSION: =$(shell grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$$' $(PROJECT ) /Resources/.mutagenversion)
25
+ endif
26
+ ifeq ($(strip $(MUTAGEN_VERSION ) ) ,)
27
+ $(error MUTAGEN_VERSION must be a valid version)
28
+ endif
29
+
14
30
ifndef CURRENT_PROJECT_VERSION
15
- CURRENT_PROJECT_VERSION:=$(shell git describe --match 'v[0-9]*' --dirty='.devel' --always --tags)
31
+ CURRENT_PROJECT_VERSION: =$(shell git describe --match 'v[0-9]* ' --dirty='.devel' --always --tags)
16
32
endif
17
33
ifeq ($(strip $(CURRENT_PROJECT_VERSION ) ) ,)
18
- $(error CURRENT_PROJECT_VERSION cannot be empty)
34
+ $(error CURRENT_PROJECT_VERSION cannot be empty)
19
35
endif
20
36
21
37
ifndef MARKETING_VERSION
22
- MARKETING_VERSION:=$(shell git describe --match 'v[0-9]*' --tags --abbrev=0 | sed 's/^v//' | sed 's/-.*$$//')
38
+ MARKETING_VERSION: =$(shell git describe --match 'v[0-9]* ' --tags --abbrev=0 | sed 's/^v//' | sed 's/-.* $$//')
23
39
endif
24
40
ifeq ($(strip $(MARKETING_VERSION ) ) ,)
25
- $(error MARKETING_VERSION cannot be empty)
41
+ $(error MARKETING_VERSION cannot be empty)
26
42
endif
27
43
28
44
# Define the keychain file name first
@@ -32,10 +48,16 @@ APP_SIGNING_KEYCHAIN := $(if $(wildcard $(KEYCHAIN_FILE)),$(shell realpath $(KEY
32
48
33
49
.PHONY : setup
34
50
setup : \
51
+ $(addprefix $(PROJECT ) /Resources/,$(MUTAGEN_RESOURCES ) ) \
35
52
$(XCPROJECT ) \
36
53
$(PROJECT ) /VPNLib/vpn.pb.swift \
37
54
$(PROJECT ) /VPNLib/FileSync/daemon.pb.swift
38
55
56
+ # Mutagen resources
57
+ $(addprefix $(PROJECT ) /Resources/,$(MUTAGEN_RESOURCES ) ) : $(PROJECT ) /Resources/.mutagenversion
58
+ curl -sL " https://storage.googleapis.com/coder-desktop/mutagen/$( MUTAGEN_VERSION) /$$ (basename " $@ " )" -o " $@ "
59
+ chmod +x " $@ "
60
+
39
61
$(XCPROJECT ) : $(PROJECT ) /project.yml
40
62
cd $(PROJECT ) ; \
41
63
SWIFT_VERSION=$(SWIFT_VERSION ) \
@@ -113,7 +135,7 @@ lint/actions: ## Lint GitHub Actions
113
135
zizmor .
114
136
115
137
.PHONY : clean
116
- clean : clean/project clean/keychain clean/build # # Clean project and artifacts
138
+ clean : clean/project clean/keychain clean/build clean/mutagen # # Clean project and artifacts
117
139
118
140
.PHONY : clean/project
119
141
clean/project :
@@ -136,6 +158,10 @@ clean/keychain:
136
158
clean/build :
137
159
rm -rf build/ release/ $$ out
138
160
161
+ .PHONY : clean/mutagen
162
+ clean/mutagen :
163
+ find $(PROJECT ) /Resources -name ' mutagen-*' -delete
164
+
139
165
.PHONY : proto
140
166
proto : $(PROJECT ) /VPNLib/vpn.pb.swift $(PROJECT ) /VPNLib/FileSync/daemon.pb.swift # # Generate Swift files from protobufs
141
167
0 commit comments