blob: f547699ef01fa114fd225de6200cf3a728385deb [file] [log] [blame]
Carmelo Casconebe8f4d12017-06-21 02:08:54 -04001include_defs(
2 '//bucklets/grpc.bucklet'
3)
4
Andrea Campanella378e21a2017-06-07 12:09:59 +02005COMPILE_DEPS = [
6 '//lib:CORE_DEPS',
Carmelo Casconebe8f4d12017-06-21 02:08:54 -04007 '//lib:GRPC_1.3',
8 '//lib:protobuf-java-3.2.0',
Andrea Campanella378e21a2017-06-07 12:09:59 +02009]
10
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040011P4RT_PROTOC_VER = '3.2.0'
12P4RT_GRPC_VER = '1.3.0'
Andrea Campanella378e21a2017-06-07 12:09:59 +020013
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040014PI_COMMIT = '99aaf492036b1ecb195d40d5e05d48aea881fbc8'
Andrea Campanella378e21a2017-06-07 12:09:59 +020015PI_BASEURL = 'https://github.com/p4lang/PI.git'
Andrea Campanella378e21a2017-06-07 12:09:59 +020016
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040017# Wondering which .proto files to build? Check p4runtime's Makefile:
18# https://github.com/p4lang/PI/blob/master/proto/Makefile.am
19PROTO_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 Campanella378e21a2017-06-07 12:09:59 +020025]
26
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040027genrule(
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 Campanella378e21a2017-06-07 12:09:59 +020032 + 'git submodule update --quiet --init --recursive > /dev/null',
33 out = 'repo',
34)
35
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040036def 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 Campanella378e21a2017-06-07 12:09:59 +020039
Carmelo Casconebe8f4d12017-06-21 02:08:54 -040040grpc_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 Campanella378e21a2017-06-07 12:09:59 +020049)
Andrea Campanella378e21a2017-06-07 12:09:59 +020050
51project_config(
52 src_target = ':onos-drivers-p4runtime-proto'
53)