Commit 477ab18
authored
Do not use
Before this PR, Rust rules merge data_runfiles of dependencies into its
default_runfiles (because we used
`[collect_data=True](https://bazel.build/versions/7.1.0/rules/lib/builtins/ctx#runfiles)`).
`cc_libraries` put shared libraries to data_runfiles even when
`cc_library` has a static library equivalent and Bazel is linking
statically. This becomes problematic when packaging binaries - we end up
putting unnecessary shared libraries into the package.
Therefore, this PR removes the use of `collect_data`, and refactors our
runfiles logic to follow the [latest
guidance](https://bazel.build/versions/7.1.0/extending/rules#runfiles).
While at it, I made sure to only put transitive shared libraries to
runfiles when building a binary-like target (bin, staticlib, cdylib).
This way we avoid depset flattenning in libraries.
Added a little regression test.runfiles.collect_data (#3531)1 parent f8f380f commit 477ab18
File tree
2 files changed
+35
-15
lines changed- rust/private
- test/unit/check_runfiles
2 files changed
+35
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1503 | 1503 | | |
1504 | 1504 | | |
1505 | 1505 | | |
1506 | | - | |
1507 | | - | |
1508 | | - | |
1509 | | - | |
1510 | | - | |
1511 | | - | |
1512 | | - | |
1513 | | - | |
1514 | 1506 | | |
1515 | 1507 | | |
1516 | | - | |
1517 | | - | |
1518 | | - | |
| 1508 | + | |
1519 | 1509 | | |
1520 | | - | |
1521 | | - | |
1522 | | - | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
1523 | 1533 | | |
1524 | 1534 | | |
1525 | 1535 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
| |||
28 | 34 | | |
29 | 35 | | |
30 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
31 | 41 | | |
32 | 42 | | |
33 | 43 | | |
34 | 44 | | |
35 | | - | |
| 45 | + | |
36 | 46 | | |
37 | 47 | | |
38 | 48 | | |
| |||
0 commit comments