forked from getsentry/sentry-cocoa
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
189 lines (153 loc) · 5.37 KB
/
Makefile
File metadata and controls
189 lines (153 loc) · 5.37 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
.PHONY: init
init: init-local init-ci-build init-ci-format
.PHONY: init-local
init-local:
which brew || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew bundle
pre-commit install
rbenv install --skip-existing
rbenv exec gem update bundler
rbenv exec bundle install
# Install the tools needed to update tooling versions locally
$(MAKE) init-ci-format
./scripts/update-tooling-versions.sh
.PHONY: init-ci-build
init-ci-build:
brew bundle --file Brewfile-ci-build
# installs the tools needed to run CI format tasks locally
.PHONY: init-ci-format
init-ci-format:
brew bundle --file Brewfile-ci-format
.PHONY: update-versions
update-versions:
./scripts/update-tooling-versions.sh
.PHONY: check-versions
check-versions:
./scripts/check-tooling-versions.sh
define run-lint-tools
@echo "--> Running Swiftlint and Clang-Format"
./scripts/check-clang-format.py -r Sources Tests
swiftlint --strict $(1)
dprint check "**/*.{md,json,yaml,yml}"
endef
# Get staged Swift files
STAGED_SWIFT_FILES := $(shell git diff --cached --diff-filter=d --name-only | grep '\.swift$$' | awk '{printf "\"%s\" ", $$0}')
lint:
# calling run-lint-tools with no arguments will run swift lint on all files
$(call run-lint-tools)
.PHONY: lint
lint-staged:
$(call run-lint-tools,$(STAGED_SWIFT_FILES))
.PHONY: lint-staged
format: format-clang format-swift-all format-markdown format-json format-yaml
# Format ObjC, ObjC++, C, and C++
format-clang:
@find . -type f \( -name "*.h" -or -name "*.hpp" -or -name "*.c" -or -name "*.cpp" -or -name "*.m" -or -name "*.mm" \) -and \
! \( -path "**.build/*" -or -path "**Build/*" -or -path "**/libs/**" -or -path "**/Pods/**" -or -path "**/*.xcarchive/*" \) \
| xargs clang-format -i -style=file
# Format all Swift files
format-swift-all:
@echo "Running swiftlint --fix on all files"
swiftlint --fix
# Format Swift staged files
.PHONY: format-swift-staged
format-swift-staged:
@echo "Running swiftlint --fix on staged files"
swiftlint --fix $(STAGED_SWIFT_FILES)
# Format Markdown
format-markdown:
dprint fmt "**/*.md"
# Format JSON
format-json:
dprint fmt "**/*.json"
# Format YAML
format-yaml:
dprint fmt "**/*.{yaml,yml}"
generate-public-api:
./scripts/update-api.sh
## Current git reference name
GIT-REF := $(shell git rev-parse --abbrev-ref HEAD)
test:
@echo "--> Running all tests"
./scripts/sentry-xcodebuild.sh \
--platform iOS \
--os 18.4 \
--device "iPhone 16 Pro" \
--ref $(GIT-REF) \
--command test \
--configuration Test
.PHONY: test
run-test-server:
cd ./test-server && swift build
cd ./test-server && swift run &
run-test-server-sync:
cd ./test-server && swift build
cd ./test-server && swift run
.PHONY: run-test-server run-test-server-sync
test-ui-critical:
./scripts/test-ui-critical.sh
analyze:
rm -rf analyzer
set -o pipefail && NSUnbufferedIO=YES xcodebuild analyze \
-workspace Sentry.xcworkspace \
-scheme Sentry \
-configuration Release \
CLANG_ANALYZER_OUTPUT=html \
CLANG_ANALYZER_OUTPUT_DIR=analyzer \
CODE_SIGNING_ALLOWED="NO" 2>&1 | xcbeautify --preserve-unbeautified
@if [[ -n `find analyzer -name "*.html"` ]]; then \
echo "Analyzer found issues:"; \
find analyzer -name "*.html"; \
exit 1; \
fi
build-xcframework:
@echo "--> Creating Sentry xcframework"
./scripts/build-xcframework-local.sh | tee build-xcframework.log
build-signed-xcframework:
@echo "--> Creating Signed Sentry xcframework"
./scripts/build-xcframework-local.sh | tee build-xcframework.log
build-xcframework-sample:
xcodebuild -project "Samples/XCFramework-Validation/XCFramework.xcodeproj" -configuration Release CODE_SIGNING_ALLOWED="NO" build
# call this like `make bump-version TO=5.0.0-rc.0`
bump-version: clean-version-bump
@echo "--> Bumping version from ${TO}"
./Utils/VersionBump/.build/debug/VersionBump --update ${TO}
verify-version: clean-version-bump
@echo "--> Verifying version from ${TO}"
./Utils/VersionBump/.build/debug/VersionBump --verify ${TO}
clean-version-bump:
@echo "--> Clean VersionBump"
cd Utils/VersionBump && rm -rf .build && swift build
release: bump-version git-commit-add
.PHONY: release
pod-lint:
@echo "--> Build local pod"
pod lib lint --verbose
git-commit-add:
@echo "\n\n\n--> Commting git ${TO}"
git commit -am "release: ${TO}"
git tag ${TO}
git push
git push --tags
xcode:
make xcode-ci
open Sentry.xcworkspace
xcode-ci:
xcodegen --spec Samples/SPM/SPM.yml
xcodegen --spec Samples/SentrySampleShared/SentrySampleShared.yml
xcodegen --spec Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.yml
xcodegen --spec Samples/iOS-ObjectiveC/iOS-ObjectiveC.yml
xcodegen --spec Samples/iOS-Swift/iOS-Swift.yml
xcodegen --spec Samples/iOS-Swift6/iOS-Swift6.yml
xcodegen --spec Samples/iOS-SwiftUI/iOS-SwiftUI.yml
xcodegen --spec Samples/iOS-SwiftUI-Widgets/iOS-SwiftUI-Widgets.yml
xcodegen --spec Samples/iOS15-SwiftUI/iOS15-SwiftUI.yml
xcodegen --spec Samples/macOS-SwiftUI/macOS-SwiftUI.yml
xcodegen --spec Samples/macOS-Swift/macOS-Swift.yml
xcodegen --spec Samples/tvOS-Swift/tvOS-Swift.yml
xcodegen --spec Samples/visionOS-Swift/visionOS-Swift.yml
xcodegen --spec Samples/watchOS-Swift/watchOS-Swift.yml
xcodegen --spec TestSamples/SwiftUITestSample/SwiftUITestSample.yml
xcodegen --spec TestSamples/SwiftUICrashTest/SwiftUICrashTest.yml
xcodegen --spec Samples/DistributionSample/DistributionSample.yml
xcodegen --spec Samples/SDK-Size/SDK-Size.yml