Skip to content

Commit 0b82ef9

Browse files
authoredAug 4, 2021
chore(api): Using Makefile to pull dependency proto (kubeflow#6223)
* update api/makefile * add back "make clean all"
1 parent 36b815b commit 0b82ef9

File tree

3 files changed

+47
-52
lines changed

3 files changed

+47
-52
lines changed
 

‎api/Makefile

+29-5
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,39 @@
1515
# Contact one of Bobgy, capri-xiyue or zijianjoy if this remote image needs an update.
1616
PREBUILT_REMOTE_IMAGE=gcr.io/ml-pipeline-test/api-generator:latest
1717

18-
# Generate proto packages using a pre-built api-generator image.
1918
.PHONY: all
20-
all: v2alpha1/*.proto
19+
all: golang python
20+
21+
.PHONY: clean
22+
clean: clean-go clean-python
23+
24+
# Generate proto packages using a pre-built api-generator image.
25+
.PHONY: golang
26+
golang: v2alpha1/*.proto
2127
docker run --interactive --rm \
2228
--user $$(id -u):$$(id -g) \
2329
--mount type=bind,source="$$(pwd)/..",target=/go/src/github.com/kubeflow/pipelines \
2430
$(PREBUILT_REMOTE_IMAGE) \
2531
sh -c 'cd /go/src/github.com/kubeflow/pipelines/api && make generate'
2632

2733
# Delete all generated proto go packages.
28-
.PHONY: clean
29-
clean:
34+
.PHONY: clean-go
35+
clean-go:
3036
rm -rf v2alpha1/go
37+
rm -f v2alpha1/google/rpc/status.proto
38+
39+
# Generate Python package.
40+
.PHONY: python
41+
python: v2alpha1/pipeline_spec.proto v2alpha1/google/rpc/status.proto
42+
cd v2alpha1/python && python3 setup.py bdist_wheel
43+
44+
# Delete all generated Python packages
45+
.PHONY: clean-python
46+
clean-python:
47+
rm -rf v2alpha1/python/build
48+
rm -rf v2alpha1/python/dist
49+
rm -f v2alpha1/python/kfp/pipeline_spec/pipeline_spec_pb2.py
50+
rm -f v2alpha1/google/rpc/status.proto
3151

3252
##########################
3353
# The following are IMPLEMENTATION DETAILS.
@@ -39,7 +59,7 @@ clean:
3959
.PHONY: generate
4060
generate: go_pipelinespec go_cachekey
4161

42-
go_pipelinespec: v2alpha1/pipeline_spec.proto
62+
go_pipelinespec: v2alpha1/pipeline_spec.proto v2alpha1/google/rpc/status.proto
4363
mkdir -p v2alpha1/go/pipelinespec
4464
cd v2alpha1 && protoc -I=. \
4565
--go_out=go/pipelinespec \
@@ -53,6 +73,10 @@ go_cachekey: v2alpha1/pipeline_spec.proto v2alpha1/cache_key.proto
5373
--go_opt=paths=source_relative \
5474
cache_key.proto
5575

76+
# Fetch dependency proto
77+
v2alpha1/google/rpc/status.proto:
78+
wget -O v2alpha1/google/rpc/status.proto https://raw.githubusercontent.com/googleapis/googleapis/047d3a8ac7f75383855df0166144f891d7af08d9/google/rpc/status.proto
79+
5680
# protoc-gen-go is already installed in api-generator image
5781
.PHONY: protoc-gen-go
5882
protoc-gen-go:

‎api/README.md

+18
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@
44

55
Generate golang proto code:
66

7+
```bash
8+
make clean-go golang
9+
```
10+
11+
## Generate Python proto package
12+
13+
Generate kfp-pipeline-spec:
14+
15+
Update `VERSION` in [v2alpha1/python/setup.py](https://github.com/kubeflow/pipelines/blob/master/api/v2alpha1/python/setup.py) if applicable.
16+
17+
```bash
18+
make clean-python python
19+
```
20+
21+
## Generate both Python and golang proto code
22+
23+
Generate both Python and golang proto:
24+
725
```bash
826
make clean all
927
```

‎api/v2alpha1/google/rpc/status.proto

-47
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.