Lines Matching +full:- +full:- +full:proto +full:- +full:path
7 # http://www.apache.org/licenses/LICENSE-2.0
42 of strings mapping proto import paths to Go import paths, and importpath is
43 the import path of the Go library being generated.
50 compiler. Typically, these are Well Known Types and proto runtime libraries.""",
65 imports: depset of strings mapping proto import paths to Go import paths.
66 importpath: the import path of the Go library being generated.
76 for proto in protos:
77 desc_sets.append(proto.transitive_descriptor_sets)
78 for src in proto.check_deps_sources.to_list():
79 path = proto_path(src, proto)
80 if path in proto_paths:
81 if proto_paths[path] != src:
82 fail("proto files {} and {} have the same import path, {}".format(
83 src.path,
84 proto_paths[path].path,
85 path,
88 proto_paths[path] = src
92 path = importpath + "/" + src.basename[:-len(".proto")],
97 outpath = out.dirname[:-len(importpath)]
102 args.add("-protoc", compiler.internal.protoc)
103 args.add("-importpath", importpath)
104 args.add("-out_path", outpath)
105 args.add("-plugin", compiler.internal.plugin)
108 args.add_all(compiler.internal.options, before_each = "-option")
110 args.add_all([importpath], before_each = "-option", format_each = "import_path=%s")
111 args.add_all(transitive_descriptor_sets, before_each = "-descriptor_set")
112 args.add_all(go_srcs, before_each = "-expected")
113 args.add_all(imports, before_each = "-import")
115 args.use_param_file("-param=%s")
131 # We may need the shell environment (potentially augmented with --action_env)
133 # .dll files in non-default locations that must be in PATH. The target configuration
134 # may not have a C compiler, so we have no idea what PATH should be.
135 use_default_shell_env = "PATH" not in go.env,
139 def proto_path(src, proto):
140 """proto_path returns the string used to import the proto. This is the proto
141 source path within its repository, adjusted by import_prefix and
145 src: the proto source File.
146 proto: the ProtoInfo provider.
149 An import path string.
151 if proto.proto_source_root == ".":
152 # true if proto sources were generated
153 prefix = src.root.path + "/"
154 elif proto.proto_source_root.startswith(src.root.path):
156 prefix = proto.proto_source_root + "/"
159 prefix = paths.join(src.root.path, proto.proto_source_root) + "/"
160 if not src.path.startswith(prefix):
162 return src.path
163 return src.path[len(prefix):]
203 default = "//go/tools/builders:go-protoc",
208 default = "//proto:protoc",
218 plugin = kwargs.pop("plugin", "@com_github_golang_protobuf//protoc-gen-go")