Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
b3c2ec70
Commit
b3c2ec70
authored
Mar 15, 2018
by
Fahrzin Hemmati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle multiple outs per input (for plugins)
parent
a6501e4a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
22 deletions
+25
-22
protobuf.bzl
protobuf.bzl
+25
-22
No files found.
protobuf.bzl
View file @
b3c2ec70
...
...
@@ -91,8 +91,10 @@ def _proto_gen_impl(ctx):
),
)
for src
, out in zip(srcs, ctx.outputs.outs)
:
for src
in srcs
:
args = []
src_name = src.basename[:-len("
.
proto
")]
outs = [out for out in ctx.outputs.outs if src_name in out.basename]
in_gen_dir = src.root.path == gen_dir.rstrip('/')
if in_gen_dir:
...
...
@@ -126,27 +128,28 @@ def _proto_gen_impl(ctx):
args += ["
--%
s_out
=%
s
" % (lang, outdir)]
inputs += [plugin]
if in_gen_dir:
orig_command = "
".join(
["
$(
realpath
%
s
)
" % ctx.executable.protoc.path] + args +
import_flags_real + ["
-
I
.
", src.basename])
command = "
;
".join([
'CMD="
%
s
"' % orig_command,
"
cd
%
s
" % src.dirname,
"
${
CMD
}
",
"
cd
-
",
"
mv
%
s
/%
s
%
s
" % (gen_dir, out.basename, out.path)
])
else:
command = "
".join(
[ctx.executable.protoc.path] + args + import_flags + [src.path])
ctx.action(
inputs=inputs + [ctx.executable.protoc],
outputs=[out],
command=command,
mnemonic="
ProtoCompile
",
use_default_shell_env=True,
)
for out in outs:
if in_gen_dir:
orig_command = "
".join(
["
$(
realpath
%
s
)
" % ctx.executable.protoc.path] + args +
import_flags_real + ["
-
I
.
", src.basename])
command = "
;
".join([
'CMD="
%
s
"' % orig_command,
"
cd
%
s
" % src.dirname,
"
${
CMD
}
",
"
cd
-
",
"
mv
%
s
/%
s
%
s
" % (gen_dir, out.basename, out.path)
])
else:
command = "
".join(
[ctx.executable.protoc.path] + args + import_flags + [src.path])
ctx.action(
inputs=inputs + [ctx.executable.protoc],
outputs=[out],
command=command,
mnemonic="
ProtoCompile
",
use_default_shell_env=True,
)
return struct(
proto=struct(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment