-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
98 lines (89 loc) · 3.32 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
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2020 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
.PHONY:
generate: clean generate-protos
.PHONY:
update: clone-external-protos
# Clone external repositories.
.PHONY:
clone-external-repos:
mkdir -p ExternalRepositories
if [ ! -d ExternalRepositories/remote-apis ]; then \
git -C ExternalRepositories clone --depth 1 https://github.com/bazelbuild/remote-apis; \
else \
git -C ExternalRepositories/remote-apis pull --rebase; \
fi
if [ ! -d ExternalRepositories/googleapis ]; then \
git -C ExternalRepositories clone --depth 1 https://github.com/googleapis/googleapis; \
else \
git -C ExternalRepositories/googleapis pull --rebase; \
fi
.PHONY:
clone-external-protos: clone-external-repos
rm -rf Protos/BazelRemoteAPI
mkdir -p Protos/BazelRemoteAPI
rsync -arv --prune-empty-dirs --include \*/ \
--include LICENSE \
--include \*.proto \
--exclude \* \
ExternalRepositories/remote-apis Protos/BazelRemoteAPI
rsync -arv --prune-empty-dirs --include \*/ \
--include LICENSE \
--include api/annotations.proto \
--include api/client.proto \
--include api/http.proto \
--include bytestream/\*.proto \
--include longrunning/\*.proto \
--include rpc/\*.proto \
--exclude \* \
ExternalRepositories/googleapis Protos/BazelRemoteAPI
# These command should be executed any time the proto definitions change. It is
# not required to be generated as part of a regular `swift build` since we're
# checking in the generated sources.
.PHONY:
generate-protos: proto-toolchain Protos/BazelRemoteAPI
mkdir -p Sources/LLBBuildSystem/Generated
Utilities/tools/bin/protoc \
-I=Protos \
-I=.build/checkouts/swift-tools-support-async/Protos \
--plugin=Utilities/tools/bin/protoc-gen-swift \
--swift_out=Sources/LLBBuildSystem/Generated \
--swift_opt=Visibility=Public \
--swift_opt=ProtoPathModuleMappings=Protos/module_map.asciipb \
$$(find Protos/BuildSystem -name \*.proto)
mkdir -p Sources/llbuild2/Generated
Utilities/tools/bin/protoc \
-I=Protos \
-I=.build/checkouts/swift-tools-support-async/Protos \
--plugin=Utilities/tools/bin/protoc-gen-swift \
--swift_out=Sources/llbuild2/Generated \
--swift_opt=Visibility=Public \
--swift_opt=ProtoPathModuleMappings=Protos/module_map.asciipb \
$$(find Protos/EngineProtocol -name \*.proto)
mkdir -p Sources/BazelRemoteAPI/Generated
Utilities/tools/bin/protoc \
-I=Protos/BazelRemoteAPI/googleapis \
-I=Protos/BazelRemoteAPI/remote-apis \
--plugin=Utilities/tools/bin/protoc-gen-swift \
--plugin=Utilities/tools/bin/protoc-gen-grpc-swift \
--swift_out=Sources/BazelRemoteAPI/Generated \
--swift_opt=Visibility=Public \
--grpc-swift_opt=Visibility=Public \
--grpc-swift_out=Sources/BazelRemoteAPI/Generated \
$$(find Protos/BazelRemoteAPI -name \*.proto)
@# Check the following script for a description of why it exists.
@Utilities/update_artifact.sh
.PHONY:
proto-toolchain:
Utilities/build_proto_toolchain.sh
.PHONY:
clean:
rm -rf Sources/BazelRemoteAPI/Generated
rm -rf Sources/LLBBuildSystem/Generated
rm -rf Sources/llbuild2/Generated
Protos/BazelRemoteAPI: clone-external-protos