-
Notifications
You must be signed in to change notification settings - Fork 69
/
Makefile
131 lines (109 loc) · 3.76 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
.PHONY: build
build:
@tools/bazel build \
--disk_cache=$(HOME)/Library/Caches/Bazel \
--spawn_strategy=local \
--use_top_level_targets_for_symlinks \
:RepoTools :Compiler
@ditto bazel-bin/RepoTools bin/RepoTools
@ditto bazel-bin/Compiler bin/Compiler
# There are a few issues with SwiftPackageManager and incremental builds
clean:
rm -rf .build
tools/bazel clean
compiler: release
repo-tools: release
# Update the gold master directory
goldmaster: build
@./MakeGoldMaster.sh
unit-test:
tools/bazel test :PodToBUILDTests --test_strategy=standalone
# Running this is non trival from within the SwiftTest - do it here.
install-bazel:
./tools/bazel info
SANDBOX=/var/tmp/PodTestSandbox
init-sandbox: install-bazel release
rm -rf $(SANDBOX)
mkdir -p $(SANDBOX)
# This command ensures that cocoapods is installed on the host
pod_test:
pod --version
# There's a few issues running these tests under Bazel, some functionality will
# be different and have issues as Bazel doesn't run so well recursivly.
# For now:
# - build out a binary release
# - copy it to tmp so the examples can load it
# - run Bazel for all the examples
.PHONY: build-test
build-test: pod_test build archive init-sandbox
cd Examples/BasiciOS && make all
cd Examples/PINRemoteImage && make all
cd Examples/Texture && make all
cd Examples/ChildPodspec && make all
cd Examples/ArcSplitting && make all
cd Examples/React && make all
cd Examples/SwiftSubspec && make all
cd Examples/FBSDK && make all
cd Examples/SnapSDK && make all
cd Examples/AmazonIVSPlayer && make all
build-example: EXAMPLE=Examples/PINCache.podspec.json
build-example: CONFIG = debug
build-example: build
@ditto .build/$(CONFIG)/Compiler bin/Compiler
@ditto .build/$(CONFIG)/RepoTools bin/RepoTools
stat $(EXAMPLE) || exit 1
bin/Compiler $(EXAMPLE)
integration-test: release
for i in $$(seq 1 10); do ./IntegrationTests/RunTests.sh; done
test: build-test unit-test integration-test
# Run the BUILD compiler on an example
example: build
.build/debug/Compiler Examples/$(POD)* --always_split_rules
# We're running into issues with SwiftPackageManager's
# Build system on the CI. Blow away it's state
ci: clean
$(MAKE) unit-test
$(MAKE) integration-test
$(MAKE) build-test
release:
@tools/bazel build \
--disk_cache=$(HOME)/Library/Caches/Bazel \
--spawn_strategy=local \
--use_top_level_targets_for_symlinks \
-c opt \
--swiftcopt=-whole-module-optimization :RepoTools :Compiler
@ditto bazel-bin/RepoTools bin/RepoTools
@ditto bazel-bin/Compiler bin/Compiler
TESTED_BAZEL_VERSION=6.3.2
# Make a binary archive of PodToBUILD with the official github cli `hub`
github_release:
@which hub || (echo "this command relies on the hub tool. https://github.com/github/hub or 'brew install hub'." && exit 1)
@git checkout master
@git pull --rebase origin master
@echo "creating release: $(TESTED_BAZEL_VERSION)-$(shell git rev-parse --short HEAD)"
$(MAKE) release
$(MAKE) archive
@hub release create -p -a PodToBUILD.zip \
-m "PodToBUILD $(TESTED_BAZEL_VERSION)-$(shell git rev-parse --short HEAD)" \
$(TESTED_BAZEL_VERSION)-$(shell git rev-parse --short HEAD)
# Create an archive of `rules_pods`.
# There should be no behaviorial differences between this package and a source
# checkout, other than the not building.
archive:
$(eval BUILD_DIR=$(shell mktemp -d))
@echo "Archiving to $(BUILD_DIR).."
@ditto bin $(BUILD_DIR)/bin
@ditto BazelExtensions $(BUILD_DIR)/BazelExtensions
@echo "release:\n\t@echo 'skipping build..'" > $(BUILD_DIR)/Makefile
@touch $(BUILD_DIR)/WORKSPACE
@echo "alias(name = 'update_pods', actual = '//bin:update_pods')" \
> $(BUILD_DIR)/BUILD
@ditto LICENSE $(BUILD_DIR)/
@cd $(BUILD_DIR) && zip -r \
$(PWD)/PodToBUILD.zip \
bin/* \
BazelExtensions \
Makefile \
WORKSPACE \
BUILD \
LICENSE