You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add use_runfiles aspect_hint to include runfiles for specific cc_libr… (#2479)
Fixes#2477
Include all data from cc_libraries as runfiles or resources, depending
on aspect_hints.
Provide aspect_hints for resource collection for all resource targets
(eg, swift_library, cc_library, etc)
By default all data is now included from cc_libraries as runfiles and
follows the expected runfiles folder structure, with files retaining
their nested folders and being placed in
/external/pkg_name/some/file.txt when included from a http_archive or
local_repository.
The default behavior for other resource collecting targets like
swift_library has not changed, and will continue to collect and process
data as resources.
To allow modification of this default behavior, users may add
aspect_hints to the target cc_library/swift_library/etc. There are three
supported aspect_hints:
@build_bazel_rules_apple//apple:use_runfiles
@build_bazel_rules_apple//apple:use_resources
@build_bazel_rules_apple//apple:suppress_resources
##### Example
Here is an example of modifying the default behavior to bundle data.txt
as a resource instead of a runfile.
```
cc_library(
name = "libapp",
srcs = ["main.cpp",],
data = [":data.txt"],
aspect_hints = ["@build_bazel_rules_apple//apple:use_runfiles"],
)
macos_application(
name = "app_macos",
deps = [":libapp"],
)
```
data.txt is bundled in Contents/Resources/data.txt
#### Note
Hints apply only to the target and do not affect transitive deps,
however if a target includes runfiles then all runfiles are bundled
(including transitive runfiles) regardless of the hints applied to
transitive targets.
---------
Co-authored-by: Luis Padron <heyluispadron@gmail.com>
0 commit comments