-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (77 loc) · 2.65 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
.PHONY: open
open: fix
open:
xed Package.swift
.PHONY: fix
fix: XCSHAREDDATA = .swiftpm/xcode/package.xcworkspace/xcshareddata
fix:
@mkdir -p $(XCSHAREDDATA)
@/usr/libexec/PlistBuddy -c \
"Delete :FILEHEADER" \
"$(XCSHAREDDATA)/IDETemplateMacros.plist" >/dev/null 2>&1 || true
@header=$$'\n// All Contributions by Match Group\n//\n// Copyright © ___YEAR___ Tinder (Match Group, LLC)\n//\n// Licensed under the Match Group Modified 3-Clause BSD License.\n// See https://github.com/Tinder/Layout/blob/main/LICENSE for license information.\n//'; \
/usr/libexec/PlistBuddy -c \
"Add :FILEHEADER string $$header" \
"$(XCSHAREDDATA)/IDETemplateMacros.plist" >/dev/null 2>&1
.PHONY: lint
lint: format ?= emoji
lint:
@swift package plugin \
swiftlint lint --strict --progress --reporter "$(format)"
.PHONY: analyze
analyze: target ?= Layout
analyze: destination ?= generic/platform=iOS
analyze: format ?= emoji
analyze:
@DERIVED_DATA="$$(mktemp -d)"; \
XCODEBUILD_LOG="$$DERIVED_DATA/xcodebuild.log"; \
xcodebuild \
-scheme "$(target)-Package" \
-destination "$(destination)" \
-derivedDataPath "$$DERIVED_DATA" \
-configuration "Debug" \
CODE_SIGNING_ALLOWED="NO" \
> "$$XCODEBUILD_LOG"; \
swift package plugin \
swiftlint analyze --strict --progress --reporter "$(format)" --compiler-log-path "$$XCODEBUILD_LOG"
.PHONY: delete-snapshots
delete-snapshots:
@for snapshots in $$(find Tests -type d -name "__Snapshots__"); \
do \
rm -rf "$$snapshots"; \
echo "Deleted $$snapshots"; \
done
.PHONY: site
site: target ?= Layout
site: prefix ?= $(shell pwd)
site: DOCC_PATH = $(shell xcrun --find docc)
site: ARCHIVE_PATH = .build/documentation/archive
site:
@make docs open="no"
"$(DOCC_PATH)" process-archive \
transform-for-static-hosting \
"$(ARCHIVE_PATH)/$(target).doccarchive" \
--hosting-base-path "/$(target)" \
--output-path "$(prefix)/_site"
cp docs.html "$(prefix)/_site/index.html"
cp docs.html "$(prefix)/_site/documentation/index.html"
mkdir -p "$(prefix)/_site/cheatsheet"
cp cheatsheet.html "$(prefix)/_site/cheatsheet/index.html"
.PHONY: docs
docs: target ?= Layout
docs: destination ?= generic/platform=iOS
docs: open ?= OPEN
docs: DERIVED_DATA_PATH = .build/documentation/data
docs: ARCHIVE_PATH = .build/documentation/archive
docs:
@mkdir -p "$(DERIVED_DATA_PATH)" "$(ARCHIVE_PATH)"
xcodebuild docbuild \
-scheme "$(target)" \
-destination "$(destination)" \
-derivedDataPath "$(DERIVED_DATA_PATH)" \
OTHER_DOCC_FLAGS="--warnings-as-errors"
@find "$(DERIVED_DATA_PATH)" \
-type d \
-name "$(target).doccarchive" \
-exec cp -R {} "$(ARCHIVE_PATH)/" \;
$(if $(filter $(open),OPEN),@open "$(ARCHIVE_PATH)/$(target).doccarchive",)