Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions Protobuf.Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
# Copyright © 2025 Apple Inc. and the Containerization project authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOCAL_DIR := $(ROOT_DIR)/.local
LOCALBIN := $(LOCAL_DIR)/bin
LOCAL_BIN_DIR := $(LOCAL_DIR)/bin

## Versions
PROTOC_VERSION=26.1
# Versions
PROTOC_VERSION := 26.1

# protoc binary installation
PROTOC_ZIP = protoc-$(PROTOC_VERSION)-osx-universal_binary.zip
PROTOC = $(LOCALBIN)/protoc@$(PROTOC_VERSION)/protoc
# Protoc binary installation
PROTOC_ZIP := protoc-$(PROTOC_VERSION)-osx-universal_binary.zip
PROTOC := $(LOCAL_BIN_DIR)/protoc@$(PROTOC_VERSION)/protoc
$(PROTOC):
@echo Downloading protocol buffers...
@mkdir -p $(LOCAL_DIR)
Expand All @@ -16,14 +30,13 @@ $(PROTOC):
@unzip -o $(PROTOC_ZIP) 'include/*' -d $(dir $@)
@rm -f $(PROTOC_ZIP)

protoc_gen_grpc_swift:
swift build --product protoc-gen-grpc-swift

.PHONY: protoc-gen-swift
protoc-gen-swift:
swift build --product protoc-gen-swift
@$(SWIFT) build --product protoc-gen-swift
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SWIFT has to be defined in the environment or the build fails?

I don't see any default definition.

Copy link
Contributor Author

@dkovba dkovba Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Protobuf.Makefile is imported by Makefile, where the variables are defined. Other such variables outside changes in this PR - ROOT_DIR and BUILD_BIN_DIR.

@$(SWIFT) build --product protoc-gen-grpc-swift

.PHONY: protos
protos: $(PROTOC) protoc_gen_grpc_swift protoc-gen-swift
protos: $(PROTOC) protoc-gen-swift
@echo Generating protocol buffers source code...
@$(PROTOC) Sources/Containerization/SandboxContext/SandboxContext.proto \
--plugin=protoc-gen-grpc-swift=$(BUILD_BIN_DIR)/protoc-gen-grpc-swift \
Expand All @@ -35,3 +48,8 @@ protos: $(PROTOC) protoc_gen_grpc_swift protoc-gen-swift
--swift_opt=Visibility=Public \
-I.
@"$(MAKE)" update-licenses

.PHONY: clean-proto-tools
clean-proto-tools:
@echo Cleaning proto tools...
@rm -rf $(LOCAL_DIR)/bin/protoc*
1 change: 1 addition & 0 deletions licenserc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ headerPath = "scripts/license-header.txt"

includes = [
"Makefile",
"*.Makefile",
"*.swift",
"*.h",
"*.cpp",
Expand Down