forked from stephencelis/SQLite.swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (51 loc) · 1.49 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
BUILD_TOOL = xcodebuild
BUILD_SCHEME = SQLite Mac
IOS_SIMULATOR = iPhone 6s
IOS_VERSION = 11.0
ifeq ($(BUILD_SCHEME),SQLite iOS)
BUILD_ARGUMENTS = -scheme "$(BUILD_SCHEME)" -destination "platform=iOS Simulator,name=$(IOS_SIMULATOR),OS=$(IOS_VERSION)"
else
BUILD_ARGUMENTS = -scheme "$(BUILD_SCHEME)"
endif
XCPRETTY := $(shell command -v xcpretty)
SWIFTCOV := $(shell command -v swiftcov)
GCOVR := $(shell command -v gcovr)
TEST_ACTIONS := clean build build-for-testing test-without-building
default: test
build:
$(BUILD_TOOL) $(BUILD_ARGUMENTS)
test:
ifdef XCPRETTY
@set -o pipefail && $(BUILD_TOOL) $(BUILD_ARGUMENTS) $(TEST_ACTIONS) | $(XCPRETTY) -c
else
$(BUILD_TOOL) $(BUILD_ARGUMENTS) $(TEST_ACTIONS)
endif
coverage:
ifdef SWIFTCOV
$(SWIFTCOV) generate --output coverage \
$(BUILD_TOOL) $(BUILD_ARGUMENTS) -configuration Release test \
-- ./SQLite/*.swift
ifdef GCOVR
$(GCOVR) \
--root . \
--use-gcov-files \
--html \
--html-details \
--output coverage/index.html \
--keep
else
@echo gcovr must be installed for HTML output: https://github.com/gcovr/gcovr
endif
else
@echo swiftcov must be installed for coverage: https://github.com/realm/SwiftCov
@exit 1
endif
clean:
$(BUILD_TOOL) $(BUILD_ARGUMENTS) clean
rm -r coverage
repl:
@$(BUILD_TOOL) $(BUILD_ARGUMENTS) -derivedDataPath $(TMPDIR)/SQLite.swift > /dev/null && \
swift -F '$(TMPDIR)/SQLite.swift/Build/Products/Debug'
sloc:
@zsh -c "grep -vE '^ *//|^$$' SQLite/*/*.{swift,h,m} | wc -l"
.PHONY: test coverage clean repl sloc