Make genrule portable for windows (#9889)

* Make genrule portable for windows

Using this does remove a user dependency on a bash under windows

* Use portable genrule for zlib dependency
pull/9891/head
FaBrand 3 years ago committed by GitHub
parent c4ddd84918
commit 244bbd6f95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      protobuf.bzl
  2. 6
      third_party/zlib.BUILD

@ -477,10 +477,12 @@ def internal_copied_filegroup(name, srcs, strip_prefix, dest, **kwargs):
name = name + "_genrule", name = name + "_genrule",
srcs = srcs, srcs = srcs,
outs = outs, outs = outs,
cmd = " && ".join( cmd_bash = " && ".join(
["cp $(location %s) $(location %s)" % ["cp $(location %s) $(location %s)" %
(s, _RelativeOutputPath(s, strip_prefix, dest)) for s in srcs], (s, _RelativeOutputPath(s, strip_prefix, dest)) for s in srcs]),
), cmd_bat = " && ".join(
["@copy /Y $(location %s) $(location %s) >NUL" %
(s, _RelativeOutputPath(s, strip_prefix, dest)) for s in srcs]),
) )
native.filegroup( native.filegroup(

@ -27,7 +27,11 @@ genrule(
name = "copy_public_headers", name = "copy_public_headers",
srcs = _ZLIB_HEADERS, srcs = _ZLIB_HEADERS,
outs = _ZLIB_PREFIXED_HEADERS, outs = _ZLIB_PREFIXED_HEADERS,
cmd = "cp $(SRCS) $(@D)/zlib/include/", cmd_bash = "cp $(SRCS) $(@D)/zlib/include/",
cmd_bat = " && ".join(
["@copy /Y $(location %s) $(@D)\\zlib\\include\\ >NUL" %
s for s in _ZLIB_HEADERS],
),
) )
cc_library( cc_library(

Loading…
Cancel
Save