From 19bd2115d04fcc6196e504a4f07d99b6f16be7d7 Mon Sep 17 00:00:00 2001 From: Mike Kruskal <62662355+mkruskal-google@users.noreply.github.com> Date: Tue, 25 Jun 2024 08:52:05 -0700 Subject: [PATCH] Port windows bootstrapping fix (#17225) --- upb_generator/bootstrap_compiler.bzl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/upb_generator/bootstrap_compiler.bzl b/upb_generator/bootstrap_compiler.bzl index 4a3bd8ccdd..e92fbafe75 100644 --- a/upb_generator/bootstrap_compiler.bzl +++ b/upb_generator/bootstrap_compiler.bzl @@ -126,7 +126,14 @@ def _cmake_staleness_test(name, base_dir, src_files, proto_lib_deps, **kwargs): 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.