Skip to content
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

Add xtask for cross-compiling and running over an SSH target #164

Merged
merged 8 commits into from
Mar 8, 2023

Conversation

MatteoNardi
Copy link
Contributor

I've added an xtask which, given a target triplet, cross compiles a binary and executes it over an SSH target.
This is just a shortcut for commonly executed commands.

$ cargo xtask cross --help
Cross compile and run on the specified target

Usage: xtask cross [OPTIONS] <COMMAND>

Commands:
  build  Build binary and copy it to destination folder
  run    Run over the given SSH connection

Options:
      --target <TARGET>  Target architecture [default: x86_64-unknown-linux-musl]
      --binary <BINARY>  Binary to compile [default: test-suite]
  -h, --help             Print help

It's just a shortcut for running cross, llvm-strip, scp and executing the binary over ssh.

I have

  • run cargo fmt;
  • run cargo clippy;
  • run cargo testand all tests pass;
  • linked to the originating issue (if applicable).

Building things with cross cause file changes also in `target/debug`, not
only in `target/<cross-target>`. This causes unecessary rebuilds when
cycling `cross build` and `cargo build`.

In particular, running `cargo xtask cross` always caused a rebuild and
took unacceptable long times.

The work-around is to use a different folder for cross builds:
`./target/cross/`
Copy link
Member

@banditopazzo banditopazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for keeping you waiting for the review so long

src/pulsard/mod.rs Show resolved Hide resolved
test-suite/src/main.rs Show resolved Hide resolved
xtask/src/cross.rs Outdated Show resolved Hide resolved
xtask/src/cross.rs Outdated Show resolved Hide resolved
xtask/src/cross.rs Outdated Show resolved Hide resolved
Copy link
Member

@banditopazzo banditopazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MatteoNardi MatteoNardi merged commit 5c8eddf into main Mar 8, 2023
@MatteoNardi MatteoNardi deleted the xtask_testeroot branch March 8, 2023 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants