Lines Matching refs:source_file
62 def get_include_directory(source_file):
63 """Returns the include directory path for the source_file. I.e. all of the
64 include statements within the given source_file are calculated relative to
71 source_file: A proto file.
74 The include directory path for the source_file.
76 directory = source_file.path
79 if is_in_virtual_imports(source_file):
80 root, relative = source_file.path.split(_VIRTUAL_IMPORTS, 2)
84 if not source_file.is_source and directory.startswith(source_file.root.path):
85 prefix_len = len(source_file.root.path) + 1
92 return source_file.root.path if source_file.root.path else "."
131 def _get_staged_proto_file(context, source_file):
132 if source_file.dirname == context.label.package or \
133 is_in_virtual_imports(source_file):
134 # Current target and source_file are in same package
135 return source_file
137 # Current target and source_file are in different packages (most
139 copied_proto = context.actions.declare_file(source_file.basename)
141 inputs = [source_file],
143 command = "cp {} {}".format(source_file.path, copied_proto.path),
235 def is_in_virtual_imports(source_file, virtual_folder = _VIRTUAL_IMPORTS):
236 """Determines if source_file is virtual (is placed in _virtual_imports
242 source_file: A proto file.
246 True if source_file is located under _virtual_imports, False otherwise.
248 return not source_file.is_source and virtual_folder in source_file.path