Skip to content

Commit 0177505

Browse files
authored
Improvements to Protobuf.Makefile (#356)
Improvements to `Protobuf.Makefile`. Also see apple/container#821.
1 parent 0732556 commit 0177505

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

Protobuf.Makefile

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
1+
# Copyright © 2025 Apple Inc. and the Containerization project authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
LOCAL_DIR := $(ROOT_DIR)/.local
2-
LOCALBIN := $(LOCAL_DIR)/bin
16+
LOCAL_BIN_DIR := $(LOCAL_DIR)/bin
317

4-
## Versions
5-
PROTOC_VERSION=26.1
18+
# Versions
19+
PROTOC_VERSION := 26.1
620

7-
# protoc binary installation
8-
PROTOC_ZIP = protoc-$(PROTOC_VERSION)-osx-universal_binary.zip
9-
PROTOC = $(LOCALBIN)/protoc@$(PROTOC_VERSION)/protoc
21+
# Protoc binary installation
22+
PROTOC_ZIP := protoc-$(PROTOC_VERSION)-osx-universal_binary.zip
23+
PROTOC := $(LOCAL_BIN_DIR)/protoc@$(PROTOC_VERSION)/protoc
1024
$(PROTOC):
1125
@echo Downloading protocol buffers...
1226
@mkdir -p $(LOCAL_DIR)
@@ -16,14 +30,13 @@ $(PROTOC):
1630
@unzip -o $(PROTOC_ZIP) 'include/*' -d $(dir $@)
1731
@rm -f $(PROTOC_ZIP)
1832

19-
protoc_gen_grpc_swift:
20-
swift build --product protoc-gen-grpc-swift
21-
33+
.PHONY: protoc-gen-swift
2234
protoc-gen-swift:
23-
swift build --product protoc-gen-swift
35+
@$(SWIFT) build --product protoc-gen-swift
36+
@$(SWIFT) build --product protoc-gen-grpc-swift
2437

2538
.PHONY: protos
26-
protos: $(PROTOC) protoc_gen_grpc_swift protoc-gen-swift
39+
protos: $(PROTOC) protoc-gen-swift
2740
@echo Generating protocol buffers source code...
2841
@$(PROTOC) Sources/Containerization/SandboxContext/SandboxContext.proto \
2942
--plugin=protoc-gen-grpc-swift=$(BUILD_BIN_DIR)/protoc-gen-grpc-swift \
@@ -35,3 +48,8 @@ protos: $(PROTOC) protoc_gen_grpc_swift protoc-gen-swift
3548
--swift_opt=Visibility=Public \
3649
-I.
3750
@"$(MAKE)" update-licenses
51+
52+
.PHONY: clean-proto-tools
53+
clean-proto-tools:
54+
@echo Cleaning proto tools...
55+
@rm -rf $(LOCAL_DIR)/bin/protoc*

licenserc.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ headerPath = "scripts/license-header.txt"
44

55
includes = [
66
"Makefile",
7+
"*.Makefile",
78
"*.swift",
89
"*.h",
910
"*.cpp",

0 commit comments

Comments
 (0)