-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
85 lines (68 loc) · 2 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
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
EFAULT_GOAL := help
HELP_INDENT := "20"
SNIPDIR = $(HOME)/Library/Developer/Xcode/UserData/CodeSnippets/
# ref: https://postd.cc/auto-documented-makefile/
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-$(HELP_INDENT)s\033[0m %s\n", $$1, $$2}'
.PHONY: setup
setup: ## Install requirement development tools to system and setup (not include Xcode 11.3)
brew bundle
pre-commit install
.PHONY: build
build: ## Run build
swift build
.PHONY: test
test: ## Run test (with coverage)
swift test --enable-test-discovery --enable-code-coverage
.PHONY: xcode
xcode: ## swift - generate xcode project
swift package generate-xcodeproj
.PHONY: format
format: ## format sources by SwiftFormat
swiftformat --config .swiftformat --header "\n{file}\nSwiftPrettyPrint\n\nCreated by Yusuke Hosonuma on {created}.\nCopyright (c) {year} Yusuke Hosonuma.\n" .
.PHONY: lint
lint: ## cocoapods - lint podspec
bundle exec pod lib lint --allow-warnings
.PHONY: release
release: ## cocoapods - release
bundle exec pod trunk push SwiftPrettyPrint.podspec --allow-warnings
.PHONY: info
info: ## cocoapods - show trunk information
bundle exec pod trunk info SwiftPrettyPrint
.PHONY: integration-test
integration-test: ## Integration test by Example app
cd ./Example && \
bundle exec pod update && \
bundle exec fastlane test
.PHONY: snippets
snippets: $(SNIPDIR) ## Install code snippets
cp ./.xcode/*.codesnippet $(SNIPDIR)
$(SNIPDIR):
mkdir -p $(SNIPDIR)
#
# for Linux
#
.PHONY: linux
linux: ## Run and login docker container
docker run --rm -it \
--volume "$(CURDIR):/src" \
--workdir "/src" \
swift:5.1
.PHONY: linux-test
linux-test: ## Run tests on linux in docker
docker run --rm \
--volume "$(CURDIR):/src" \
--workdir "/src" \
swift:5.1 \
swift test --enable-test-discovery
# ----------------
# Trouble shooting
# ----------------
#
# When release to CocoaPods are missed:
#
# ```
# $ pod trunk delete SwiftPrettyPrint {version}
# $ make push
# ```