blob: aa3d8d3c3fdbac1b37d1df5e9a9a064708f40532 [file] [log] [blame]
Carmelo Casconebe8f4d12017-06-21 02:08:54 -04001include_defs(
2 '//bucklets/grpc.bucklet'
3)
4
Andrea Campanella8bcd5862017-12-11 11:34:45 +01005PROTOBUF_VER = '3.2.0'
Carmelo Casconeb1936bd2017-12-12 14:42:27 -08006GRPC_VER = '1.3.1'
Andrea Campanella378e21a2017-06-07 12:09:59 +02007
Carmelo Cascone81929aa2018-04-07 01:38:55 -07008PI_COMMIT = '219b3d67299ec09b49f433d7341049256ab5f512'
Andrea Campanella378e21a2017-06-07 12:09:59 +02009PI_BASEURL = 'https://github.com/p4lang/PI.git'
Andrea Campanella378e21a2017-06-07 12:09:59 +020010
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040011# Wondering which .proto files to build? Check p4runtime's Makefile:
12# https://github.com/p4lang/PI/blob/master/proto/Makefile.am
13PROTO_SRCS = [
Carmelo Cascone81929aa2018-04-07 01:38:55 -070014 '/proto/p4/p4types.proto',
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040015 '/proto/p4/p4runtime.proto',
16 '/proto/p4/config/p4info.proto',
17 '/proto/google/rpc/status.proto',
18 '/proto/google/rpc/code.proto',
19 '/proto/p4/tmp/p4config.proto',
Andrea Campanella378e21a2017-06-07 12:09:59 +020020]
21
Carmelo Cascone04d09392017-07-19 08:49:08 -040022COMPILE_DEPS =[
23 '//lib:CORE_DEPS',
Carmelo Casconedda88d02017-07-19 22:42:01 -040024 '//incubator/grpc-dependencies:grpc-core-repkg-' + GRPC_VER,
25 '//lib:grpc-stub-' + GRPC_VER,
26 '//lib:grpc-protobuf-' + GRPC_VER,
27 '//lib:protobuf-java-' + PROTOBUF_VER,
Carmelo Cascone569d4ad2017-07-10 16:09:00 -040028]
29
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040030genrule(
31 name = 'p4lang-pi-repo-' + PI_COMMIT,
32 bash = 'git clone --quiet ' + PI_BASEURL + ' $OUT > /dev/null && '
Carmelo Cascone04d09392017-07-19 08:49:08 -040033 + 'cd $OUT && '
34 + 'git checkout --quiet -b buck-build ' + PI_COMMIT + ' > /dev/null && '
35 + 'git submodule update --quiet --init --recursive > /dev/null',
Andrea Campanella378e21a2017-06-07 12:09:59 +020036 out = 'repo',
37)
38
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040039def get_proto_src_string():
40 proto_srcs = map(lambda x: "$(location :p4lang-pi-repo-%s)%s" % (PI_COMMIT, x), PROTO_SRCS)
41 return " ".join(proto_srcs)
Andrea Campanella378e21a2017-06-07 12:09:59 +020042
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040043grpc_jar(
44 src_string = get_proto_src_string(),
45 proto_paths = [
46 '$(location :p4lang-pi-repo-' + PI_COMMIT + ')/proto',
47 ],
Carmelo Casconedda88d02017-07-19 22:42:01 -040048 protoc_version = PROTOBUF_VER,
49 plugin_version = GRPC_VER,
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040050 deps = COMPILE_DEPS,
51 include_std_lib = True,
Andrea Campanella378e21a2017-06-07 12:09:59 +020052)
Andrea Campanella378e21a2017-06-07 12:09:59 +020053
54project_config(
Carmelo Casconef7aa3f92017-07-06 23:56:50 -040055 src_target = ':onos-protocols-p4runtime-proto'
Yuta HIGUCHIb1aec662017-11-15 14:20:13 -080056)