BUILD.gn (2693B)
1 # Copyright 2020 The Chromium Authors 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 import("//chromium/build/config/android/rules.gni") 6 import("//third_party/protobuf/proto_library.gni") 7 8 # The purpose of these targets is test that |deps| satisfies java compilation 9 # dependencies, and that |import_dirs| allows us to deal with various relative 10 # imports to other proto dependencies. Although we should strive to avoid using 11 # |import_dirs| and relative import paths, preferring to use absolute imports 12 # whenever possible. See https://crbug.com/691451. While this target is 13 # primarily to test that the Java proto targets build correctly, also build the 14 # C++ versions of the protos as well. There are currently some configurations of 15 # Java protos that can be built but will not work for C++, see 16 # https://crbug.com/1039014, so make sure we don't create any tests that would 17 # violate that. 18 group("test_build_protos") { 19 deps = [ 20 ":absolute_root_proto", 21 ":absolute_root_proto_java", 22 ":relative_root_proto", 23 ":relative_root_proto_java", 24 ] 25 } 26 27 proto_java_library("absolute_root_proto_java") { 28 proto_path = "//" 29 import_dirs = [ "relative_dep/" ] 30 sources = [ 31 "root/absolute_child.proto", 32 "root/absolute_root.proto", 33 ] 34 deps = [ 35 ":absolute_dep_proto_java", 36 ":relative_dep_proto_java", 37 ] 38 } 39 40 proto_java_library("relative_root_proto_java") { 41 proto_path = "root/" 42 import_dirs = [ 43 "relative_dep/", 44 "//", 45 ] 46 sources = [ 47 "root/relative_child.proto", 48 "root/relative_root.proto", 49 ] 50 deps = [ 51 ":absolute_dep_proto_java", 52 ":relative_dep_proto_java", 53 ] 54 } 55 56 proto_java_library("absolute_dep_proto_java") { 57 proto_path = "//" 58 sources = [ "absolute_dep/absolute_dep.proto" ] 59 } 60 61 proto_java_library("relative_dep_proto_java") { 62 proto_path = "relative_dep/" 63 sources = [ "relative_dep/relative_dep.proto" ] 64 } 65 66 proto_library("absolute_root_proto") { 67 proto_in_dir = "//" 68 import_dirs = [ "relative_dep/" ] 69 sources = [ 70 "root/absolute_child.proto", 71 "root/absolute_root.proto", 72 ] 73 deps = [ 74 ":absolute_dep_proto", 75 ":relative_dep_proto", 76 ] 77 } 78 79 proto_library("relative_root_proto") { 80 proto_in_dir = "root/" 81 import_dirs = [ 82 "relative_dep/", 83 "//", 84 ] 85 sources = [ 86 "root/relative_child.proto", 87 "root/relative_root.proto", 88 ] 89 deps = [ 90 ":absolute_dep_proto", 91 ":relative_dep_proto", 92 ] 93 } 94 95 proto_library("absolute_dep_proto") { 96 proto_in_dir = "//" 97 sources = [ "absolute_dep/absolute_dep.proto" ] 98 } 99 100 proto_library("relative_dep_proto") { 101 proto_in_dir = "relative_dep/" 102 sources = [ "relative_dep/relative_dep.proto" ] 103 }