-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
146 lines (108 loc) · 4.57 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
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
SHELL := /bin/bash
.PHONY: help setup submodules
default: help
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
# COLORS
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
RESET := $(shell tput -Txterm sgr0)
## ----- Helper functions ------
# Helper target for declaring an external executable as a recipe dependency.
# For example,
# `my_target: | _program_awk`
# will fail before running the target named `my_target` if the command `awk` is
# not found on the system path.
_program_%: FORCE
@_=$(or $(shell which $* 2> /dev/null),$(error `$*` command not found. Please install `$*` and try again))
# Helper target for declaring required environment variables.
#
# For example,
# `my_target`: | _var_PARAMETER`
#
# will fail before running `my_target` if the variable `PARAMETER` is not declared.
_var_%: FORCE
@_=$(or $($*),$(error `$*` is a required parameter))
## ------ Commmands -----------
TARGET_MAX_CHAR_NUM=20
help:
@echo ''
@echo 'Usage:'
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' \
$(MAKEFILE_LIST)
## Update dependencies (Git submodules and Carthage)
update: \
submodules \
update_carthage_dependencies
## -- Source Code Tasks --
## Update Git submodules
submodules:
$(info Updating submodules…)
git submodule update --init --recursive
## -- Testing --
## [Tests] Run tests on iOS 14.4 using sandbox environment
test_iOS:
ABLY_ENV="sandbox" NAME="ably-iOS" bundle exec fastlane test_iOS16_2
## [Tests] Run tests on tvOS 14.3 using sandbox environment
test_tvOS:
ABLY_ENV="sandbox" NAME="ably-tvOS" bundle exec fastlane test_tvOS16_1
## [Tests] Run tests on macOS using sandbox environment
test_macOS:
ABLY_ENV="sandbox" NAME="ably-macOS" bundle exec fastlane test_macOS
## -- CocoaPods --
## [CocoaPods] Validates Ably pod
pod_lint:
pod lib lint --swift-version=4.2 --allow-warnings
## -- Carthage --
## [Carthage] Make a .zip package of frameworks
carthage_package:
$(info Building and archiving…)
# https://github.com/Carthage/Carthage#archive-prebuilt-frameworks-into-one-zip-file
# From `carthage help build` we are told that `--archive` implies `--no-skip-current`.
./Scripts/carthage-with-workaround-for-issue-3019.sh build --archive --no-use-binaries --platform iOS,macOS,tvOS
# Add LICENSE files (ours and SocketRocket’s).
./Scripts/add-licenses-to-carthage-output.sh
## [Carthage] Clear Carthage caches. Helps with Carthage update issues
carthage_clean:
$(info Deleting Carthage caches…)
rm -rf ~/Library/Caches/org.carthage.CarthageKit/dependencies/
## [Carthage] Update dependencies for all platforms
update_carthage_dependencies:
$(info Updating Carthage dependencies for all platforms…)
carthage update --use-xcframeworks --platform iOS,macOS,tvOS --no-use-binaries
## [Carthage] Update dependencies for just iOS
update_carthage_dependencies_ios:
$(info Updating Carthage dependencies for iOS…)
carthage update --use-xcframeworks --platform iOS --no-use-binaries
## [Carthage] Update dependencies for just tvOS
update_carthage_dependencies_tvos:
$(info Updating Carthage dependencies for tvOS…)
carthage update --use-xcframeworks --platform tvOS --no-use-binaries
## [Carthage] Update dependencies for just macOS
update_carthage_dependencies_macos:
$(info Updating Carthage dependencies for macOS…)
carthage update --use-xcframeworks --platform macOS --no-use-binaries
## -- Version --
## [Version] Bump Patch Version, creating Git commit and tag
bump_patch:
$(info Bumping version Patch type…)
Scripts/set-version.sh `Scripts/get-version.sh | awk -F. '{$$NF = $$NF + 1;} 1' | sed 's/ /./g'`
## [Version] Bump Minor Version, creating Git commit and tag
bump_minor:
$(info Bumping version Minor type…)
Scripts/set-version.sh `Scripts/get-version.sh | awk -F. '{$$(NF-1) = $$(NF-1) + 1;} 1' | sed 's/ /./g' | awk -F. '{$$(NF) = 0;} 1' | sed 's/ /./g' `
## [Version] Bump Major Version, creating Git commit and tag
bump_major:
$(info Bumping version Major type…)
Scripts/set-version.sh `Scripts/get-version.sh | awk -F. '{$$(NF-2) = $$(NF-2) + 1;} 1' | sed 's/ /./g' | awk -F. '{$$(NF-1) = 0;} 1' | sed 's/ /./g' | awk -F. '{$$(NF) = 0;} 1' | sed 's/ /./g' `