forked from Asana/locheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (45 loc) · 1.46 KB
/
Makefile
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
EXECUTABLE_NAME = locheck
REPO = https://github.com/Asana/locheck
VERSION = 0.9.11
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
BUILD_PATH_PREFIX := .build/apple/Products/Release
endif
ifeq ($(UNAME_S), Linux)
BUILD_PATH_PREFIX := .build/release
endif
PREFIX = /usr/local
INSTALL_PATH = $(PREFIX)/bin/$(EXECUTABLE_NAME)
BUILD_PATH = $(BUILD_PATH_PREFIX)/$(EXECUTABLE_NAME)
CURRENT_PATH = $(PWD)
RELEASE_TAR = $(REPO)/archive/$(VERSION).tar.gz
GIT_STATUS := $(shell git status -s)
.PHONY: install build uninstall format_code release # publish
install: build
mkdir -p $(PREFIX)/bin
cp -f $(BUILD_PATH) $(INSTALL_PATH)
build:
swift build --disable-sandbox -c release --arch arm64 --arch x86_64
uninstall:
rm -f $(INSTALL_PATH)
format_code:
mint run swiftformat Sources Tests
# Homebrew discourages self-submission unless the project is popular, so this is commented out for now.
# publish: zip_binary bump_brew
# echo "published $(VERSION)"
# Homebrew discourages self-submission unless the project is popular, so this is commented out for now.
# bump_brew:
# brew update
# brew bump-formula-pr --url=$(RELEASE_TAR) locheck
zip_binary: build
zip -jr $(EXECUTABLE_NAME).zip $(BUILD_PATH)
release:
git checkout main
ifeq ($(GIT_STATUS),"\n")
sed -E -i '' 's/let version = ".*"/let version = "$(VERSION)"/' Sources/LocheckCommand/main.swift
git add .
git commit -m "Update to $(VERSION)"
git tag $(VERSION)
else
echo "Working directory is not clean"
endif