Carmelo Cascone | be8f4d1 | 2017-06-21 02:08:54 -0400 | [diff] [blame] | 1 | include_defs( |
| 2 | '//bucklets/grpc.bucklet' |
| 3 | ) |
| 4 | |
Andrea Campanella | 8bcd586 | 2017-12-11 11:34:45 +0100 | [diff] [blame] | 5 | PROTOBUF_VER = '3.2.0' |
Carmelo Cascone | b1936bd | 2017-12-12 14:42:27 -0800 | [diff] [blame] | 6 | GRPC_VER = '1.3.1' |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 7 | |
Carmelo Cascone | f645e84 | 2018-07-16 18:31:52 +0200 | [diff] [blame] | 8 | PI_COMMIT = '7e94b025bac6db63bc8534e5dd21a008984e38bc' |
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 = [ |
Carmelo Cascone | 6af4e17 | 2018-06-15 16:01:30 +0200 | [diff] [blame] | 14 | '/proto/p4/v1/p4runtime.proto', |
| 15 | '/proto/p4/v1/p4data.proto', |
| 16 | '/proto/p4/config/v1/p4info.proto', |
| 17 | '/proto/p4/config/v1/p4types.proto', |
| 18 | '/proto/p4/tmp/p4config.proto', |
Carmelo Cascone | be8f4d1 | 2017-06-21 02:08:54 -0400 | [diff] [blame] | 19 | '/proto/google/rpc/status.proto', |
| 20 | '/proto/google/rpc/code.proto', |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 21 | ] |
| 22 | |
Carmelo Cascone | 04d0939 | 2017-07-19 08:49:08 -0400 | [diff] [blame] | 23 | COMPILE_DEPS =[ |
| 24 | '//lib:CORE_DEPS', |
Carmelo Cascone | dda88d0 | 2017-07-19 22:42:01 -0400 | [diff] [blame] | 25 | '//incubator/grpc-dependencies:grpc-core-repkg-' + GRPC_VER, |
| 26 | '//lib:grpc-stub-' + GRPC_VER, |
| 27 | '//lib:grpc-protobuf-' + GRPC_VER, |
| 28 | '//lib:protobuf-java-' + PROTOBUF_VER, |
Carmelo Cascone | 569d4ad | 2017-07-10 16:09:00 -0400 | [diff] [blame] | 29 | ] |
| 30 | |
Carmelo Cascone | be8f4d1 | 2017-06-21 02:08:54 -0400 | [diff] [blame] | 31 | genrule( |
| 32 | name = 'p4lang-pi-repo-' + PI_COMMIT, |
| 33 | bash = 'git clone --quiet ' + PI_BASEURL + ' $OUT > /dev/null && ' |
Carmelo Cascone | 04d0939 | 2017-07-19 08:49:08 -0400 | [diff] [blame] | 34 | + 'cd $OUT && ' |
| 35 | + 'git checkout --quiet -b buck-build ' + PI_COMMIT + ' > /dev/null && ' |
| 36 | + 'git submodule update --quiet --init --recursive > /dev/null', |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 37 | out = 'repo', |
| 38 | ) |
| 39 | |
Carmelo Cascone | be8f4d1 | 2017-06-21 02:08:54 -0400 | [diff] [blame] | 40 | def get_proto_src_string(): |
| 41 | proto_srcs = map(lambda x: "$(location :p4lang-pi-repo-%s)%s" % (PI_COMMIT, x), PROTO_SRCS) |
| 42 | return " ".join(proto_srcs) |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 43 | |
Carmelo Cascone | be8f4d1 | 2017-06-21 02:08:54 -0400 | [diff] [blame] | 44 | grpc_jar( |
| 45 | src_string = get_proto_src_string(), |
| 46 | proto_paths = [ |
| 47 | '$(location :p4lang-pi-repo-' + PI_COMMIT + ')/proto', |
| 48 | ], |
Carmelo Cascone | dda88d0 | 2017-07-19 22:42:01 -0400 | [diff] [blame] | 49 | protoc_version = PROTOBUF_VER, |
| 50 | plugin_version = GRPC_VER, |
Carmelo Cascone | be8f4d1 | 2017-06-21 02:08:54 -0400 | [diff] [blame] | 51 | deps = COMPILE_DEPS, |
| 52 | include_std_lib = True, |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 53 | ) |
Andrea Campanella | 378e21a | 2017-06-07 12:09:59 +0200 | [diff] [blame] | 54 | |
| 55 | project_config( |
Carmelo Cascone | f7aa3f9 | 2017-07-06 23:56:50 -0400 | [diff] [blame] | 56 | src_target = ':onos-protocols-p4runtime-proto' |
Yuta HIGUCHI | b1aec66 | 2017-11-15 14:20:13 -0800 | [diff] [blame] | 57 | ) |