Carmelo Cascone | be8f4d1 | 2017-06-21 02:08:54 -0400 | [diff] [blame] | 1 | include_defs( |
| 2 | '//bucklets/grpc.bucklet' |
| 3 | ) |
| 4 | |
Carmelo Cascone | 569d4ad | 2017-07-10 16:09:00 -0400 | [diff] [blame^] | 5 | P4RT_PROTOC_VER = '3.0.2' |
Carmelo Cascone | be8f4d1 | 2017-06-21 02:08:54 -0400 | [diff] [blame] | 6 | P4RT_GRPC_VER = '1.3.0' |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 7 | |
Carmelo Cascone | 569d4ad | 2017-07-10 16:09:00 -0400 | [diff] [blame^] | 8 | PI_COMMIT = 'f110570ca0c8ddc5feaf5028b08a0f477ceb4eea' |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 9 | PI_BASEURL = 'https://github.com/p4lang/PI.git' |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 10 | |
Carmelo Cascone | be8f4d1 | 2017-06-21 02:08:54 -0400 | [diff] [blame] | 11 | # Wondering which .proto files to build? Check p4runtime's Makefile: |
| 12 | # https://github.com/p4lang/PI/blob/master/proto/Makefile.am |
| 13 | PROTO_SRCS = [ |
| 14 | '/proto/p4/p4runtime.proto', |
| 15 | '/proto/p4/config/p4info.proto', |
| 16 | '/proto/google/rpc/status.proto', |
| 17 | '/proto/google/rpc/code.proto', |
| 18 | '/proto/p4/tmp/p4config.proto', |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 19 | ] |
| 20 | |
Carmelo Cascone | 569d4ad | 2017-07-10 16:09:00 -0400 | [diff] [blame^] | 21 | COMPILE_DEPS = [ |
| 22 | '//lib:CORE_DEPS', |
| 23 | '//incubator/grpc-dependencies:grpc-core-repkg-' + P4RT_GRPC_VER, |
| 24 | '//lib:grpc-stub-' + P4RT_GRPC_VER, |
| 25 | '//lib:grpc-protobuf-' + P4RT_GRPC_VER, |
| 26 | '//lib:protobuf-java-' + P4RT_PROTOC_VER, |
| 27 | ] |
| 28 | |
Carmelo Cascone | be8f4d1 | 2017-06-21 02:08:54 -0400 | [diff] [blame] | 29 | genrule( |
| 30 | name = 'p4lang-pi-repo-' + PI_COMMIT, |
| 31 | bash = 'git clone --quiet ' + PI_BASEURL + ' $OUT > /dev/null && ' |
Carmelo Cascone | 569d4ad | 2017-07-10 16:09:00 -0400 | [diff] [blame^] | 32 | + 'cd $OUT && ' |
| 33 | + 'git checkout --quiet -b buck-build ' + PI_COMMIT + ' > /dev/null && ' |
| 34 | + 'git submodule update --quiet --init --recursive > /dev/null', |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 35 | out = 'repo', |
| 36 | ) |
| 37 | |
Carmelo Cascone | be8f4d1 | 2017-06-21 02:08:54 -0400 | [diff] [blame] | 38 | def get_proto_src_string(): |
| 39 | proto_srcs = map(lambda x: "$(location :p4lang-pi-repo-%s)%s" % (PI_COMMIT, x), PROTO_SRCS) |
| 40 | return " ".join(proto_srcs) |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 41 | |
Carmelo Cascone | be8f4d1 | 2017-06-21 02:08:54 -0400 | [diff] [blame] | 42 | grpc_jar( |
| 43 | src_string = get_proto_src_string(), |
| 44 | proto_paths = [ |
| 45 | '$(location :p4lang-pi-repo-' + PI_COMMIT + ')/proto', |
| 46 | ], |
| 47 | protoc_version = P4RT_PROTOC_VER, |
| 48 | plugin_version = P4RT_GRPC_VER, |
| 49 | deps = COMPILE_DEPS, |
| 50 | include_std_lib = True, |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 51 | ) |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 52 | |
| 53 | project_config( |
| 54 | src_target = ':onos-drivers-p4runtime-proto' |
| 55 | ) |