bazel: Fix resource paths as external repo (see #3757)
- Headers that are included by .rc files need to be supplied to `declare_exe` via the `resources_deps` attribute (passed as the `deps attribute to `compile_rc`). The headers must be part of a cc_library target via either the `hdrs` or `srcs` attribute. - File paths for CEF resources are prefixed with "external/<repo>" when CEF is loaded as an external repo. Update `copy_filegroups` to work with these paths.
This commit is contained in:
parent
d38e4ef3ba
commit
31e1459f14
|
@ -10,12 +10,16 @@ def _copy_filegroups_impl(ctx):
|
|||
outputs = []
|
||||
for f in inputs:
|
||||
relative_path = f.path
|
||||
if relative_path.startswith("external/"):
|
||||
# Remove the "external/<repo>" component, if any.
|
||||
relative_path = "/".join(relative_path.split("/")[2:])
|
||||
|
||||
for prefix in remove_prefixes:
|
||||
# Add trailing forward slash if necessary.
|
||||
if prefix[-1] != "/":
|
||||
prefix += "/"
|
||||
if len(prefix) > 0 and f.path.startswith(prefix):
|
||||
relative_path = f.path[len(prefix):]
|
||||
if len(prefix) > 0 and relative_path.startswith(prefix):
|
||||
relative_path = relative_path[len(prefix):]
|
||||
break
|
||||
|
||||
if len(add_prefix) > 0:
|
||||
|
|
|
@ -81,10 +81,10 @@ objc_library(
|
|||
# Windows targets.
|
||||
#
|
||||
|
||||
# Allow access from the declare_exe target.
|
||||
filegroup(
|
||||
# Allow access to resource.h from the declare_exe target.
|
||||
cc_library(
|
||||
name = "ResourceH",
|
||||
srcs = [
|
||||
hdrs = [
|
||||
"browser/resource.h"
|
||||
]
|
||||
)
|
||||
|
|
|
@ -43,12 +43,14 @@ declare_exe(
|
|||
"{}.exe.manifest".format(PRODUCT_NAME),
|
||||
],
|
||||
resources_srcs = [
|
||||
"{}:ResourceH".format(PKG_NAME),
|
||||
"{}:Resources".format(PKG_NAME),
|
||||
"{}.ico".format(PRODUCT_NAME),
|
||||
"small.ico",
|
||||
"//tests/shared:Resources",
|
||||
],
|
||||
resources_deps = [
|
||||
"{}:ResourceH".format(PKG_NAME),
|
||||
],
|
||||
linkopts = [
|
||||
"/SUBSYSTEM:WINDOWS",
|
||||
] + [
|
||||
|
|
|
@ -66,10 +66,10 @@ cc_library(
|
|||
# Windows targets.
|
||||
#
|
||||
|
||||
# Allow access from the declare_exe target.
|
||||
filegroup(
|
||||
# Allow access to resource.h from the declare_exe target.
|
||||
cc_library(
|
||||
name = "ResourceH",
|
||||
srcs = [
|
||||
hdrs = [
|
||||
"resource.h"
|
||||
]
|
||||
)
|
||||
|
|
|
@ -27,10 +27,12 @@ declare_exe(
|
|||
"{}.exe.manifest".format(PRODUCT_NAME),
|
||||
],
|
||||
resources_srcs = [
|
||||
"{}:ResourceH".format(PKG_NAME),
|
||||
"{}.ico".format(PRODUCT_NAME),
|
||||
"small.ico",
|
||||
],
|
||||
resources_deps = [
|
||||
"{}:ResourceH".format(PKG_NAME),
|
||||
],
|
||||
linkopts = [
|
||||
"/SUBSYSTEM:WINDOWS",
|
||||
],
|
||||
|
|
|
@ -81,10 +81,10 @@ objc_library(
|
|||
# Windows targets.
|
||||
#
|
||||
|
||||
# Allow access from the declare_exe target.
|
||||
filegroup(
|
||||
# Allow access to resource.h from the declare_exe target.
|
||||
cc_library(
|
||||
name = "ResourceH",
|
||||
srcs = [
|
||||
hdrs = [
|
||||
"resource.h"
|
||||
]
|
||||
)
|
||||
|
|
|
@ -45,11 +45,13 @@ declare_exe(
|
|||
"{}.exe.manifest".format(PRODUCT_NAME),
|
||||
],
|
||||
resources_srcs = [
|
||||
"{}:ResourceH".format(PKG_NAME),
|
||||
"{}.ico".format(PRODUCT_NAME),
|
||||
"small.ico",
|
||||
"//tests/shared:Resources",
|
||||
],
|
||||
resources_deps = [
|
||||
"{}:ResourceH".format(PKG_NAME),
|
||||
],
|
||||
linkopts = [
|
||||
"/SUBSYSTEM:CONSOLE",
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue