Skip to content

Commit c6e7add

Browse files
committed
validate mutagen version
1 parent fb55513 commit c6e7add

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Makefile

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# Use a single bash shell for each job, and immediately exit on failure
1+
# Use bash and immediately exit on failure
22
SHELL := bash
33
.SHELLFLAGS := -ceu
4-
.ONESHELL:
54

65
# This doesn't work on directories.
76
# See https://stackoverflow.com/questions/25752543/make-delete-on-error-for-directory-targets
@@ -14,11 +13,11 @@ ifndef VERBOSE
1413
endif
1514

1615
ifdef CI
17-
LINTFLAGS := --reporter github-actions-logging
18-
FMTFLAGS := --lint --reporter github-actions-log
16+
LINTFLAGS := --reporter github-actions-logging
17+
FMTFLAGS := --lint --reporter github-actions-log
1918
else
20-
LINTFLAGS :=
21-
FMTFLAGS :=
19+
LINTFLAGS :=
20+
FMTFLAGS :=
2221
endif
2322

2423
PROJECT := Coder\ Desktop
@@ -27,6 +26,12 @@ SCHEME := Coder\ Desktop
2726
SWIFT_VERSION := 6.0
2827

2928
MUTAGEN_RESOURCES := mutagen-agents.tar.gz mutagen-darwin-arm64 mutagen-darwin-amd64
29+
ifndef MUTAGEN_VERSION
30+
MUTAGEN_VERSION:=$(shell grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$$' $(PROJECT)/Resources/.mutagenversion)
31+
endif
32+
ifeq ($(strip $(MUTAGEN_VERSION)),)
33+
$(error MUTAGEN_VERSION must be a valid version)
34+
endif
3035

3136
ifndef CURRENT_PROJECT_VERSION
3237
CURRENT_PROJECT_VERSION:=$(shell git describe --match 'v[0-9]*' --dirty='.devel' --always --tags)
@@ -56,9 +61,7 @@ setup: \
5661

5762
# Mutagen resources
5863
$(addprefix $(PROJECT)/Resources/,$(MUTAGEN_RESOURCES)): $(PROJECT)/Resources/.mutagenversion
59-
version=$$(printf "%s" "$$(cat "$<")")
60-
filename=$$(basename "$@")
61-
url="https://storage.googleapis.com/coder-desktop/mutagen/$${version}/$${filename}"
64+
url="https://storage.googleapis.com/coder-desktop/mutagen/$(MUTAGEN_VERSION)/$$(basename "$@")"
6265
echo "Downloading from $${url}"
6366
curl -sL $${url} -o "$@"
6467
chmod +x "$@"

0 commit comments

Comments
 (0)