Port windows bootstrapping fix (#17225)
diff --git a/upb_generator/bootstrap_compiler.bzl b/upb_generator/bootstrap_compiler.bzl
index 4a3bd8c..e92fbaf 100644
--- a/upb_generator/bootstrap_compiler.bzl
+++ b/upb_generator/bootstrap_compiler.bzl
@@ -126,7 +126,14 @@
name = name + "_copy_gencode_%d" % genrule,
outs = ["generated_sources/" + src],
srcs = [name, name + "_minitable"],
- cmd = "mkdir -p $(@D); for src in $(SRCS); do cp -f $$src $(@D) || echo 'copy failed!'; done",
+ cmd = """
+ mkdir -p $(@D)
+ for src in $(SRCS); do
+ if [[ $$src == *%s ]]; then
+ cp -f $$src $(@D) || echo 'copy failed!'
+ fi
+ done
+ """ % src[src.rfind("/"):],
)
# Keep bazel gencode in sync with our checked-in sources needed for cmake builds.