Commit 9426a38
authored
add buildscript link flags only to parent crate (#448)
@illicitonion Would you mind looking over this and seeing if it's sane? It's modifying code that was added in a previous pull request of yours: #346
I use a crate for creating Python extension modules called pyo3. It has code in it like this:
```
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
pub fn PyNode_Compile(arg1: *mut _node, arg2: *const c_char) -> *mut PyCodeObject;
```
Its build.rs script locates the relevant library name, and spits out a link flag that maps it to the alias:
```
-lpythonXY:python38
```
The pyo3 crate compiles successfully, but when I attempt to compile a crate that depends on pyo3 on Windows, the build fails, complaining that the above alias has been provided but there are no mentions of pythonXY in my crate - because the aliases are only in the pyo3 crate.
When I compile my crate using cargo instead of bazel, I can see that pyo3's build script link flags are not being passed in when compiling my crate - so the current behaviour of rules_rust does not seem to match what cargo is doing.
The change in this PR fixes the issue for me, and hasn't caused any problems here. But your PR specifically mentions transitive deps, so I wonder if I am missing something. Does this change cause a regression in the problem you were originally trying to fix?1 parent 21e090e commit 9426a38
File tree
5 files changed
+50
-8
lines changed- rust/private
- test/transitive_lib
5 files changed
+50
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
735 | | - | |
736 | | - | |
737 | 735 | | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
744 | 739 | | |
745 | 740 | | |
746 | 741 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments