-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
108 lines (96 loc) · 2.74 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
# Sequential operators
.PHONY: clean docs
ifndef VERSION
OPERATOR_COUNT=10
else
OPERATOR_COUNT=25
endif
# clean the project folder from generated files
clean:
$(info Cleaning all generated files.)
rm -rf .build
rm -rf build
rm -f Parsel.json
rm -f $(SEQUENTIAL_OPERATORS_SWIFT_PATH)
rm -rf Parsel.xcodeproj
rm -rf Parsel.playground/Sources/*
rm -rf *.coverage.txt
# OSX only: build and run tests + measure code coverage and upload to codecov
coverage:
$(info Build and run tests + measure coverage afterwards.)
make initial
xcodebuild -version
xcodebuild -scheme Parsel-Package -sdk macosx -skipUnavailableActions build test
curl -s https://codecov.io/bash | bash
# OSX only: generate documentation
docs:
$(info generate documentation)
rm -rf docs
mkdir docs
swift build
sourcekitten doc --spm-module Parsel > Parsel.json
jazzy \
--clean \
--author "Benjamin Herzog" \
--author_url "https://blog.benchr.de" \
--github_url "https://github.com/BenchR267/Parsel" \
--sourcekitten-sourcefile Parsel.json \
--use-safe-filenames \
--no-download-badge \
--output docs/
touch docs/.nojekyll
# generates xcode project and sequential operators
# depends on OPERATOR_COUNT!
generate:
$(info generate Swift source files…)
swift ./Scripts/SequentialOperators.swift $(OPERATOR_COUNT) > ./Sources/Parsel/Core/Operators+Sequential.swift
swift package generate-xcodeproj --enable-code-coverage
make playground
# first command to execute on every machine
initial:
swift package update
make generate
# copy content sources into playground
playground:
mkdir -p ./Parsel.playground/Sources
cp -r ./Sources/Parsel/* ./Parsel.playground/Sources
# run tests
test:
swift build
swift test --parallel
# call this on travis linux machines
travis:
make initial
pod lib lint Parsel.podspec --skip-tests
make test
# OSX only: call this on travis osx machines
travisosx:
make initial
swiftlint lint
make coverage
# release a new version!
ifndef VERSION
release:
$(error VERSION is not set to version. Aborting…)
else
ifneq ($(shell git rev-parse --abbrev-ref HEAD), master)
release:
$(error You can only release while master is checked out, sorry.)
else
release:
make generate
$(info Set version in podspec)
sed -i "" "s/\(.*s\.version[[:space:]]*=[[:space:]]*\'\).*\\('.*\)/\1${VERSION}\2/g" Parsel.podspec
$(info Set version in README)
sed -i "" "s/\(.*\.package.*, from: \"\).*\(\".*\)/\1${VERSION}\2/g" README.md
git add Parsel.podspec
git add README.md
git commit -m "Release version ${VERSION}"
git tag $(VERSION)
git push origin $(VERSION)
git push origin master
pod trunk push Parsel.podspec
git checkout HEAD -- ./Sources/Parsel/Core/Operators+Sequential.swift
$(info Do not forget to add playground to release!)
endif
endif