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