oleksandr.yashchuk@plvision.eu | 3dbcaaf | 2019-03-13 14:44:46 +0200 | [diff] [blame] | 1 | # Prefix string to remove from proto import statements |
| 2 | IMPORT_PREFIX_COMMON = "github.com/openconfig/gnoi/common/" |
| 3 | IMPORT_PREFIX = "github.com/openconfig/gnoi/" |
| 4 | |
| 5 | proto_library( |
| 6 | name = "gnoi_system_proto", |
| 7 | srcs = [":gnoi_system_sed"], |
| 8 | deps = [ |
| 9 | ":gnoi_types_proto", |
| 10 | ":gnoi_common_proto", |
| 11 | "@com_google_protobuf//:any_proto", |
| 12 | ], |
| 13 | visibility = ["//visibility:public"], |
| 14 | ) |
| 15 | |
| 16 | proto_library( |
| 17 | name = "gnoi_types_proto", |
| 18 | srcs = ["types/types.proto"], |
| 19 | deps = [ |
| 20 | "@com_google_protobuf//:descriptor_proto", |
| 21 | "@com_google_protobuf//:any_proto", |
| 22 | ], |
| 23 | visibility = ["//visibility:public"], |
| 24 | ) |
| 25 | |
| 26 | proto_library( |
| 27 | name = "gnoi_common_proto", |
| 28 | srcs = [":gnoi_common_sed"], |
| 29 | deps = [":gnoi_types_proto"], |
| 30 | visibility = ["//visibility:public"], |
| 31 | ) |
| 32 | |
| 33 | genrule( |
| 34 | name = "gnoi_common_sed", |
| 35 | srcs = ["common/common.proto"], |
| 36 | outs = ["common.proto"], |
| 37 | cmd = "sed -e 's:import \"%s:import \":g' $(location common/common.proto) > \"$@\"" |
| 38 | % IMPORT_PREFIX, |
| 39 | ) |
| 40 | |
| 41 | genrule( |
| 42 | name = "gnoi_system_sed", |
| 43 | srcs = ["system/system.proto"], |
| 44 | outs = ["system.proto"], |
| 45 | cmd = "sed -e 's:import \"%s:import \":g' -e 's:import \"%s:import \":g' $(location system/system.proto) > \"$@\"" |
| 46 | % (IMPORT_PREFIX_COMMON, IMPORT_PREFIX), |
| 47 | ) |