-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
112 lines (97 loc) · 2.52 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
# Launch options
HOSTNAME=localhost
PORT=8080
# Paths
WORKSPACE_PATH=./
SERVER_PATH=./Server/servo/
CLIENT_PATH=./Client/ServoClient/
SIMULATOR_PATH=./build/Build/Products/Debug-iphonesimulator/
# Names
WORKSPACE_NAME=SwiftyServoControl
SERVER_NAME=servo
CLIENT_NAME=ServoClient
# File extensions
WORKSPACE_EXTENSION=.xcworkspace
IOS_APP_EXTENSION=.app
# Commands
SWIFT_COMMAND=sudo swift
XCODE_COMMAND=xcodebuild
IOS_SIMULATOR_COMMAND=ios-sim
HOMEBREW_COMMAND=brew
APT_COMMAND=sudo apt
# Schemes
SCHEME_SERVER=servo
SCHEME_CLIENT=ServoClient
# Definition
WORKSPACE=$(WORKSPACE_PATH)$(WORKSPACE_NAME)$(WORKSPACE_EXTENSION)
SERVER=$(SERVER_PATH)
# Open
open:
open $(WORKSPACE)
# Install
install-swift-raspberry-pi-zero:
curl -s https://packagecloud.io/install/repositories/swift-arm/release/script.deb.sh | sudo bash \
&& $(APT_COMMAND) install swift5
install-swift-raspberry-pi-without-zero:
curl -s https://packagecloud.io/install/repositories/swift-arm/release/script.deb.sh | sudo bash \
&& $(APT_COMMAND) install swift4rpi01
install-vapor-cli-tools:
$(HOMEBREW_COMMAND) tap vapor/tap \
&& $(HOMEBREW_COMMAND) install vapor/tap/vapor
# Dependencies
deps-debian:
$(APT_COMMAND) install libssl-dev
deps-macos:
$(HOMEBREW_COMMAND) install libressl ios-sim
cd $(SERVER_PATH) \
&& $(SWIFT_COMMAND) package generate-xcodeproj
# Build
build-server:
$(SWIFT_COMMAND) build --package-path $(SERVER_PATH)
build-client:
$(XCODE_COMMAND) \
-workspace $(WORKSPACE) \
-configuration Debug \
-verbose \
-scheme "$(CLIENT_NAME)"
# Run
run-server:
cd $(SERVER_PATH) \
&& $(SWIFT_COMMAND) run Run --hostname $(HOSTNAME) --port $(PORT)
run-client:
$(XCODE_COMMAND) \
-workspace $(WORKSPACE) \
-configuration Debug \
-scheme "$(SCHEME_CLIENT)" \
-destination "platform=iOS Simulator,OS=12.2,name=iPhone XS Max" \
-derivedDataPath \
build
$(IOS_SIMULATOR_COMMAND) launch $(SIMULATOR_PATH)$(CLIENT_NAME)$(IOS_APP_EXTENSION)/ \
--devicetypeid "iPhone-XS-Max, 12.2"
# Test
test-server:
$(SWIFT_COMMAND) test --package-path $(SERVER_PATH)
test-client:
set -o pipefail
$(XCODE_COMMAND) test \
-workspace $(WORKSPACE) \
-configuration Release \
-verbose \
-scheme "$(SCHEME_CLIENT)" \
-destination "platform=iOS Simulator,OS=12.2,name=iPhone XS Max" \
ONLY_ACTIVE_ARCH=NO | xcpretty
# Clean
clean:
make clean-all
clean-all:
make clean-server
make clean-client
clean-server:
cd $(SERVER_PATH) \
$(SWIFT_COMMAND) package clean
clean-client:
cd $(SERVER_PATH) \
$(XCODE_COMMAND) clean
# Debug
find-simulators:
xcrun simctl list