-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(crit): move pb.go files to separate dirs
Using the new Python script, the protobuf bindings are now generated in independent packages. This commit refactors CRIT to work with the new organisation of files. It does not change the implementation of CRIT in any way apart from resolving the imports correctly. Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
- Loading branch information
Showing
86 changed files
with
977 additions
and
941 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,9 @@ | ||
GO ?= go | ||
|
||
# The import path that protoc will use if a proto file imports another one | ||
import_path := github.com/checkpoint-restore/go-criu/crit/images | ||
# Path to .proto source files | ||
proto_path := ./images | ||
# Generate string of all .proto filenames | ||
proto_files := $(sort $(subst $(proto_path)/,,$(wildcard $(proto_path)/*.proto))) | ||
# Generate M flag to specify import path for all .proto files | ||
# and replace all spaces with commas to use with go_opt flag | ||
comma := , | ||
proto_opts := $(subst $() $(),$(comma),$(patsubst %,M%=$(import_path),$(proto_files))) | ||
GIT_BRANCH := master | ||
|
||
all: gen-proto bin/crit | ||
|
||
update-proto: | ||
rm ./images/*.proto || true | ||
git clone --depth 1 --branch $(GIT_BRANCH) https://github.com/checkpoint-restore/criu criu-temp | ||
cp criu-temp/images/*.proto ./images/ | ||
# rpc.proto is not an image and it is used only to communicate criu-service and swrk. | ||
rm -rf criu-temp images/rpc.proto | ||
# To prevent namespace conflict with proto files | ||
# in github.com/letsencrypt/boulder, we prepend | ||
# a prefix to the filenames. | ||
mv ./images/sa.proto ./images/criu-sa.proto | ||
sed -i 's/sa\.proto/criu-sa\.proto/g' images/*.proto | ||
mv ./images/core.proto ./images/criu-core.proto | ||
sed -i 's/core\.proto/criu-core\.proto/g' images/*.proto | ||
|
||
gen-proto: | ||
rm -f ./images/*.pb.go | ||
@protoc \ | ||
--proto_path=$(proto_path) \ | ||
--go_out=$(proto_path) \ | ||
--go_opt=paths=source_relative,$(proto_opts) \ | ||
$(proto_files) | ||
|
||
bin/crit: cmd/cli.go | ||
$(GO) build -o $@ $^ | ||
|
||
clean: | ||
rm -f bin/crit | ||
|
||
.PHONY: all gen-proto update-proto clean | ||
.PHONY: clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.