forked from kickstarter/ios-oss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
160 lines (126 loc) · 4.32 KB
/
Makefile
File metadata and controls
160 lines (126 loc) · 4.32 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
XCODEBUILD := xcodebuild
BUILD_FLAGS = -scheme $(SCHEME) -destination $(DESTINATION)
SCHEME ?= $(TARGET)-$(PLATFORM)
TARGET ?= Kickstarter-Framework
PLATFORM ?= iOS
RELEASE ?= beta
IOS_VERSION ?= 11.3
IPHONE_NAME ?= iPhone 8
BRANCH ?= master
DIST_BRANCH = $(RELEASE)-dist
OPENTOK_VERSION ?= 2.10.2
COMMIT ?= $(CIRCLE_SHA1)
ifeq ($(PLATFORM),iOS)
DESTINATION ?= 'platform=iOS Simulator,name=$(IPHONE_NAME),OS=$(IOS_VERSION)'
endif
XCPRETTY :=
ifneq ($(CIRCLE_ARTIFACTS),)
XCPRETTY += | tee $${CIRCLE_ARTIFACTS}/xcode_raw_$(SCHEME).log
endif
ifneq ($(shell type -p xcpretty),)
XCPRETTY += | xcpretty -c && exit $${PIPESTATUS[0]}
endif
build: dependencies
$(XCODEBUILD) $(BUILD_FLAGS) $(XCPRETTY)
test-all:
PLATFORM=iOS "$(MAKE)" test
PLATFORM=iOS TARGET=Library "$(MAKE)" test
test: bootstrap
$(XCODEBUILD) test $(BUILD_FLAGS) $(XCPRETTY)
clean:
$(XCODEBUILD) clean $(BUILD_FLAGS) $(XCPRETTY)
dependencies: submodules configs secrets opentok
bootstrap: hooks dependencies
brew update || brew update
brew unlink swiftlint || true
brew install swiftlint
brew link --overwrite swiftlint
submodules:
git submodule sync --recursive || true
git submodule update --init --recursive || true
configs = $(basename $(wildcard Kickstarter-iOS/Configs/*.example))
$(configs):
cp $@.example $@
configs: $(configs)
hooks = $(addprefix .git/,$(wildcard hooks/*))
$(hooks):
@test -d .git/hooks && ln -fnsv $(patsubst .git/%,$(PWD)/%,$@) $@ \
|| echo "skipping git hook installation: .git/hooks does not exist" >&2 1>/dev/null
hooks: $(hooks)
deploy:
@echo "Deploying private/$(BRANCH) to $(RELEASE)..."
@git fetch oss
@git fetch private
@if test -n "`git rev-list private/$(BRANCH)..oss/$(BRANCH)`"; \
then \
echo "There are commits in oss/$(BRANCH) that are not in private/$(BRANCH). Please sync the remotes before deploying."; \
exit 1; \
fi
@if test "$(RELEASE)" != "beta" && test "$(RELEASE)" != "itunes"; \
then \
echo "RELEASE must be 'beta' or 'itunes'."; \
exit 1; \
fi
@if test "$(RELEASE)" = "itunes" && test "$(BRANCH)" != "master"; \
then \
echo "BRANCH must be 'master' for iTunes releases."; \
exit 1; \
fi
@git branch -f $(DIST_BRANCH) private/$(BRANCH)
@git push -f private $(DIST_BRANCH)
@git branch -d $(DIST_BRANCH)
@echo "Deploy has been kicked off to CircleCI!"
alpha:
@echo "Adding remotes..."
@git remote add oss https://github.com/kickstarter/ios-oss
@git remote add private https://github.com/kickstarter/ios-private
@echo "Deploying private/alpha-dist-$(COMMIT)..."
@git branch -f alpha-dist-$(COMMIT)
@git push -f private alpha-dist-$(COMMIT)
@git branch -d alpha-dist-$(COMMIT)
@echo "Deploy has been kicked off to CircleCI!"
sync:
@echo "Syncing oss and private remotes..."
@git checkout oss $(BRANCH)
@git pull oss $(BRANCH)
@git push private $(BRANCH)
@echo "private and oss remotes are now synced!"
cleanup:
@echo "Adding remotes..."
@git remote add oss https://github.com/kickstarter/ios-oss
@git remote add private https://github.com/kickstarter/ios-private
@echo "Deleting temporary branch: $(CIRCLE_BRANCH)"
@git push -d private $(CIRCLE_BRANCH)
lint:
swiftlint lint --reporter json --strict
strings:
cat Frameworks/native-secrets/ios/Secrets.swift bin/strings.swift \
| xcrun -sdk macosx swift -
secrets:
-@rm -rf Frameworks/native-secrets
-@git clone https://github.com/kickstarter/native-secrets Frameworks/native-secrets 2>/dev/null || echo '(Skipping secrets.)'
if [ ! -d Frameworks/native-secrets ]; \
then \
mkdir -p Frameworks/native-secrets/ios \
&& cp -n Configs/Secrets.swift.example Frameworks/native-secrets/ios/Secrets.swift \
|| true; \
fi
VERSION_FILE = Frameworks/OpenTok/version
CURRENT_OPENTOK_VERSION = $(shell cat $(VERSION_FILE))
ifeq ($(CURRENT_OPENTOK_VERSION),)
CURRENT_OPENTOK_VERSION = first
endif
opentok:
@if [ $(OPENTOK_VERSION) != $(CURRENT_OPENTOK_VERSION) ]; \
then \
echo "Downloading OpenTok v$(OPENTOK_VERSION)"; \
mkdir -p Frameworks/OpenTok; \
curl -s -N -L https://tokbox.com/downloads/opentok-ios-sdk-$(OPENTOK_VERSION) \
| tar -xz --strip 1 --directory Frameworks/OpenTok OpenTok-iOS-$(OPENTOK_VERSION)/OpenTok.framework \
|| true; \
fi
@if [ -e Frameworks/OpenTok/OpenTok.framework ]; \
then \
echo "$(OPENTOK_VERSION)" > $(VERSION_FILE); \
fi
.PHONY: test-all test clean dependencies submodules deploy lint secrets strings opentok