aboutsummaryrefslogtreecommitdiff
path: root/protobuf.bzl
diff options
context:
space:
mode:
authorFahrzin Hemmati <fahhem@appliedintuition.com>2018-03-26 19:09:08 -0700
committerFahrzin Hemmati <fahhem@appliedintuition.com>2018-05-07 15:40:31 -0700
commit2cfa7612b2e8226c66977b7f91b5b65d874276bb (patch)
tree638ce6ca2641265090fc8d171acab1c8162bf19f /protobuf.bzl
parent0d68b29ac49e48519afbaeaaa14c82a9e086b691 (diff)
downloadprotobuf-2cfa7612b2e8226c66977b7f91b5b65d874276bb.tar.gz
protobuf-2cfa7612b2e8226c66977b7f91b5b65d874276bb.tar.bz2
protobuf-2cfa7612b2e8226c66977b7f91b5b65d874276bb.zip
Fix moving generated files onto themselves
Diffstat (limited to 'protobuf.bzl')
-rw-r--r--protobuf.bzl8
1 files changed, 5 insertions, 3 deletions
diff --git a/protobuf.bzl b/protobuf.bzl
index 2b9d65fb..511df772 100644
--- a/protobuf.bzl
+++ b/protobuf.bzl
@@ -72,7 +72,7 @@ def _proto_gen_impl(ctx):
deps = []
deps += ctx.files.srcs
source_dir = _SourceDir(ctx)
- gen_dir = _GenDir(ctx)
+ gen_dir = _GenDir(ctx).rstrip('/')
if source_dir:
import_flags = ["-I" + source_dir, "-I" + gen_dir]
else:
@@ -94,7 +94,7 @@ def _proto_gen_impl(ctx):
for src in srcs:
args = []
- in_gen_dir = src.root.path == gen_dir.rstrip('/')
+ in_gen_dir = src.root.path == gen_dir
if in_gen_dir:
import_flags_real = []
for f in depset(import_flags):
@@ -148,8 +148,10 @@ def _proto_gen_impl(ctx):
"cd %s" % src.dirname,
"${CMD}",
"cd -",
- "mv %s/%s %s" % (gen_dir, out.basename, out.path)
])
+ generated_out = '/'.join([gen_dir, out.basename])
+ if generated_out != out.path:
+ command += ";mv %s %s" % (generated_out, out.path)
ctx.action(
inputs=inputs + [ctx.executable.protoc],
outputs=[out],