-
Notifications
You must be signed in to change notification settings - Fork 30
Fix building binaries #40
Fix building binaries #40
Conversation
|
Actually, could you just remove the Thanks for this! Should have done a better job of double checking. I assumed that the "build" would have taken care of it... |
|
Removed. However, this gives me a warning: |
|
Hmm, that does seem bad. @alexcrichton do you have any recommendations for what this configuration is supposed to look like? |
|
In fact, achieved to build the project, but running bin (without path specified in When path is specified it works ok: Anyway, waiting for Alex to comment on this, if there is no better way to achieve this, then I can revert the last commit. |
|
Weird! That sounds like it may be a bug in Cargo... |
|
@jmatraszek okay so, let's revert that last commit to get rid of the warning for now, and maybe we'll end up filing a cargo bug. sorry that this simple PR has taken so long. |
|
@jmatraszek actually, don't worry about it; I did some work on those binaries in #53 and so just rolled all the commits except the last one into there. Thank you so much again! |
|
Hi @steveklabnik, @alexcrichton, |
Fix building multiple binaries that do not have path spacified in Cargo.toml When multiple binaries are specified in Cargo.toml, the binaries that do not have `path` specified are build from `src/main.rs`. Discovered here: rust-lang-nursery/thanks#40 (comment). This was caused by setting for a binary a main layout here https://github.com/rust-lang/cargo/blob/master/src/cargo/util/toml.rs#L478, which caused `normalize` to not fallback to default binary path here https://github.com/rust-lang/cargo/blob/master/src/cargo/util/toml.rs#L1149 (as `bin.path` was always `Some("/path/to/main.rs")`. Added a test and fixed this by not using `layout.main()`, so right now for bins without `path` specified we fallback to default path inferred from bin's name (e.g. `src/bin/foo.rs`), test if the file exists and only if it doesn't -- fallback to `src/main.rs`. I do not have any knowledge about Cargo's design, so I am not sure if this is the proper place to test for file existence.
Fixing. Was broken by 2930ab8