forked from kickstarter/ios-oss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
90 lines (70 loc) · 2.32 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
XCODEBUILD := xcodebuild
BUILD_FLAGS = -scheme $(SCHEME) -destination $(DESTINATION)
SCHEME ?= $(TARGET)-$(PLATFORM)
TARGET ?= Kickstarter-Framework
PLATFORM ?= iOS
RELEASE ?= beta
BRANCH ?= master
DIST_BRANCH = $(RELEASE)-dist
ifeq ($(PLATFORM),iOS)
DESTINATION ?= 'platform=iOS Simulator,name=iPhone 6,OS=9.3'
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: dependencies
$(XCODEBUILD) test $(BUILD_FLAGS) $(XCPRETTY)
clean:
$(XCODEBUILD) clean $(BUILD_FLAGS) $(XCPRETTY)
dependencies: submodules configs secrets
bootstrap: hooks dependencies
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 [email protected] $@
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:
@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 fetch origin
git branch -f $(DIST_BRANCH) origin/$(BRANCH)
git push -f origin $(DIST_BRANCH)
git branch -d $(DIST_BRANCH)
lint:
swiftlint lint --reporter json
strings:
cat Frameworks/ios-ksapi/Frameworks/native-secrets/ios/Secrets.swift bin/strings.swift | swift -
secrets:
git clone https://github.com/kickstarter/native-secrets Frameworks/ios-ksapi/Frameworks/native-secrets \
|| mkdir -p Frameworks/ios-ksapi/Frameworks/native-secrets/ios \
&& cp -n Configs/Secrets.swift.example Frameworks/ios-ksapi/Frameworks/native-secrets/ios/Secrets.swift \
|| true
.PHONY: test-all test clean dependencies submodules deploy lint secrets strings