-
Notifications
You must be signed in to change notification settings - Fork 410
Support sub project build without parent Cargo.toml. #438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi, I have some project.
This command don't work: This PR fixed this problem. |
src/cli.rs
Outdated
let mut target_dir = None; | ||
let mut sc = None; | ||
let mut all: Vec<String> = Vec::new(); | ||
|
||
{ | ||
let mut args = env::args().skip(1); | ||
while let Some(arg) = args.next() { | ||
if all.last().unwrap_or(&"".to_string()) == "--manifest-path" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why all.last()
when we are using an iterator? Use the same pattern as for the other flags below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix
src/cli.rs
Outdated
} | ||
|
||
pub fn parse(target_list: &TargetList) -> Args { | ||
let mut channel = None; | ||
let mut target = None; | ||
let mut project_dir: Option<String> = None; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a PathBuf
to store this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix
src/cli.rs
Outdated
let mut target_dir = None; | ||
let mut sc = None; | ||
let mut all: Vec<String> = Vec::new(); | ||
|
||
{ | ||
let mut args = env::args().skip(1); | ||
while let Some(arg) = args.next() { | ||
if all.last().unwrap_or(&"".to_string()) == "--manifest-path" { | ||
project_dir = Option::Some(format!("{}/{}", env::current_dir().expect("").to_str().unwrap(), arg.to_string())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Path::join
instead of format!
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix
Can you post the output of the failed command? |
src/cli.rs
Outdated
if let ("+", ch) = arg.split_at(1) { | ||
if arg == "--manifest-path" { | ||
all.push(arg); | ||
let path = args.next().expect("Missing argument in --manifest-path"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use if let Some(..)
for this and also add the case for --manifest-path=
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command don't work:
cross build --manifest-path clients/Cargo.toml --target armv7-linux-androideabi --release
Can you post the output of the failed command?
It is fallback to host cargo and fail in linking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand :-( I am newbies in rust, please help me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at the code below, there it is used in the same way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if let Some(path) = args.next() {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, fix
@@ -26,7 +26,7 @@ impl Subcommand { | |||
_ => true, | |||
} | |||
} | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the trailing whitespace everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whitespace is still there, please remove it.
@@ -26,7 +26,7 @@ impl Subcommand { | |||
_ => true, | |||
} | |||
} | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whitespace is still there, please remove it.
{ | ||
let mut args = env::args().skip(1); | ||
while let Some(arg) = args.next() { | ||
if let ("+", ch) = arg.split_at(1) { | ||
if arg == "--manifest-path" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still needs the case for --manifest-path=
.
@avkviring, any update on this? |
|
I'd be interested in taking this over, if there is no disagreement. Edit: I addressed the outstanding comments in https://github.com/wngr/cross/tree/wngr/master |
Hi, it is very good news :-) |
cross-rs#438 credit: avkviring
No description provided.