forked from pointfreeco/swift-dependencies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (65 loc) · 1.9 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
CONFIG = debug
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS 17,iPhone \d\+ Pro [^M])
PLATFORM_MACOS = macOS
PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS 17,TV)
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS 10,Watch)
default: test
build-all-platforms:
for platform in \
"$(PLATFORM_IOS)" \
"$(PLATFORM_MACOS)" \
"$(PLATFORM_MAC_CATALYST)" \
"$(PLATFORM_TVOS)" \
"$(PLATFORM_WATCHOS)"; \
do \
xcrun xcodebuild build \
-workspace Dependencies.xcworkspace \
-scheme Dependencies \
-configuration $(CONFIG) \
-destination platform="$$platform" || exit 1; \
done;
test-swift:
swift test
swift test -c release
test-linux:
docker run \
--rm \
-v "$(PWD):$(PWD)" \
-w "$(PWD)" \
swift:5.9-focal \
bash -c 'apt-get update && apt-get -y install make && make test-swift'
build-for-static-stdlib:
@swift build -c debug --static-swift-stdlib
@swift build -c release --static-swift-stdlib
test-integration:
xcrun xcodebuild test \
-scheme "Integration" \
-destination platform="$(PLATFORM_IOS)" || exit 1; \
build-for-library-evolution:
swift build \
-c release \
--target Dependencies \
-Xswiftc -emit-module-interface \
-Xswiftc -enable-library-evolution
build-for-static-stdlib-docker:
@docker run \
-v "$(PWD):$(PWD)" \
-w "$(PWD)" \
swift:5.9-focal \
bash -c "swift build -c debug --static-swift-stdlib"
@docker run \
-v "$(PWD):$(PWD)" \
-w "$(PWD)" \
swift:5.9-focal \
bash -c "swift build -c release --static-swift-stdlib"
format:
swift format \
--ignore-unparsable-files \
--in-place \
--recursive \
./Package.swift ./Sources ./Tests/DependenciesTests
.PHONY: test test-swift test-linux build-for-library-evolution format
define udid_for
$(shell xcrun simctl list devices available '$(1)' | grep '$(2)' | sort -r | head -1 | awk -F '[()]' '{ print $$(NF-3) }')
endef