blob: 6216be6e678cb9957834568198b4d2ec3c63c2bb [file] [log] [blame]
Carmelo Casconebe8f4d12017-06-21 02:08:54 -04001include_defs(
2 '//bucklets/grpc.bucklet'
3)
4
Carmelo Casconedda88d02017-07-19 22:42:01 -04005PROTOBUF_VER = '3.0.2'
6GRPC_VER = '1.3.0'
Andrea Campanella378e21a2017-06-07 12:09:59 +02007
Carmelo Casconefb76b042017-07-17 19:42:00 -04008PI_COMMIT = '8051d54c9c3415ca800db232a226189fd17ad60a'
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 = [
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 Campanella378e21a2017-06-07 12:09:59 +020019]
20
Carmelo Cascone04d09392017-07-19 08:49:08 -040021COMPILE_DEPS =[
22 '//lib:CORE_DEPS',
Carmelo Casconedda88d02017-07-19 22:42:01 -040023 '//incubator/grpc-dependencies:grpc-core-repkg-' + GRPC_VER,
24 '//lib:grpc-stub-' + GRPC_VER,
25 '//lib:grpc-protobuf-' + GRPC_VER,
26 '//lib:protobuf-java-' + PROTOBUF_VER,
Carmelo Cascone569d4ad2017-07-10 16:09:00 -040027]
28
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040029genrule(
30 name = 'p4lang-pi-repo-' + PI_COMMIT,
31 bash = 'git clone --quiet ' + PI_BASEURL + ' $OUT > /dev/null && '
Carmelo Cascone04d09392017-07-19 08:49:08 -040032 + 'cd $OUT && '
33 + 'git checkout --quiet -b buck-build ' + PI_COMMIT + ' > /dev/null && '
34 + 'git submodule update --quiet --init --recursive > /dev/null',
Andrea Campanella378e21a2017-06-07 12:09:59 +020035 out = 'repo',
36)
37
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040038def 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 Campanella378e21a2017-06-07 12:09:59 +020041
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040042grpc_jar(
43 src_string = get_proto_src_string(),
44 proto_paths = [
45 '$(location :p4lang-pi-repo-' + PI_COMMIT + ')/proto',
46 ],
Carmelo Casconedda88d02017-07-19 22:42:01 -040047 protoc_version = PROTOBUF_VER,
48 plugin_version = GRPC_VER,
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040049 deps = COMPILE_DEPS,
50 include_std_lib = True,
Andrea Campanella378e21a2017-06-07 12:09:59 +020051)
Andrea Campanella378e21a2017-06-07 12:09:59 +020052
53project_config(
Carmelo Casconef7aa3f92017-07-06 23:56:50 -040054 src_target = ':onos-protocols-p4runtime-proto'
Andrea Campanella378e21a2017-06-07 12:09:59 +020055)