2
2
# Copyright (C) 2022 Intel Corporation
3
3
# Copyright (c) 2022 Dell Inc, or its subsidiaries.
4
4
5
- all :
6
- rm -rf ./v1/{autogen.md,gen}
7
- mkdir -p ./v1/gen/{go,cpp,python}
5
+ # Make a variable named ','. Used to pass arguments with commas to protoc_compile.
6
+ , := ,
8
7
9
- docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs -v "${PWD}/../common/v1":/common namely/protoc-all:1.47_2 -i /common --lint -d v1 -l go -o ./v1/gen/go/ --go-source-relative
10
- docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs -v "${PWD}/../common/v1":/common namely/protoc-all:1.47_2 -i /common --lint -d v1 -l cpp -o ./v1/gen/cpp/ --go-source-relative
11
- docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}":/defs -v "${PWD}/../common/v1":/common namely/protoc-all:1.47_2 -i /common --lint -d v1 -l python -o ./v1/gen/python/ --go-source-relative
8
+ CURRENT_VERSION := v1
12
9
13
- # protoc-gen-doc doesn't support proto include paths parameter so we have to copy
14
- # common included files to the proto directory
15
- cp ../common/v1/uuid.proto "${PWD}"/v1
16
- cp ../common/v1/object_key.proto "${PWD}"/v1
10
+ define protoc_compile
11
+ mkdir -p $(CURRENT_VERSION ) /gen/$(1 )
12
+ protoc --proto_path=../common/$(CURRENT_VERSION ) --proto_path=$(CURRENT_VERSION ) \
13
+ --$(1 ) _out=$(CURRENT_VERSION ) /gen/$(1 ) \
14
+ $(2 ) \
15
+ $(CURRENT_VERSION ) /*.proto
16
+ endef
17
17
18
- docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}"/v1/:/out -v "${PWD}"/v1:/protos pseudomuto/protoc-gen-doc --doc_opt=markdown,autogen.md
19
- docker run --user=$$(id -u):$$(id -g) --rm -v "${PWD}"/v1/:/out -w /out --entrypoint=sh ghcr.io/docker-multiarch/google-api-linter:1.36.0 -c "api-linter /out/*.proto --output-format summary"
18
+ all : python cpp go doc lint
20
19
21
- # remove common included files from the proto directory
22
- rm "${PWD}"/v1/uuid.proto
23
- rm "${PWD}"/v1/object_key.proto
20
+ python :
21
+ $(call protoc_compile,python,)
22
+
23
+ cpp :
24
+ $(call protoc_compile,cpp,)
25
+
26
+ go :
27
+ $(call protoc_compile,go,)
28
+
29
+ doc :
30
+ $(call protoc_compile,doc,--doc_opt=markdown$(, ) autogen.md)
31
+
32
+ lint :
33
+ $(call protoc_compile,lint)
34
+
35
+ clean :
36
+ rm -rf gen
0 commit comments