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 Cargo Arguments and Cross-Architecture Support #1777

Merged
merged 7 commits into from
Jan 2, 2024

Conversation

Bennett-Petzold
Copy link
Contributor

@Bennett-Petzold Bennett-Petzold commented Jan 2, 2024

Changes apply for the CLI actions build, bundle, and serve. Adds -- [CARGO_FLAGS] and --platform-triple.

Cargo arguments can now be passed through after -- (e.g. dx build -- --timings) via escaped conditionals. This does lock out that space for any later usage without a breaking change to the CLI, but I can't think of any other necessary use for post-argument parsing on this tool.

Since the --target flag is currently taken, a --platform-triple flag allows alternative values for cargo build --target. This can't be done directly in passthrough, since dioxus-cli needs to know the output folder. If reasonable, the existing --target flag should probably be renamed so we can be 1:1 with cargo naming.

If the codebase has any other instances where bundled anyhow errors are flattened by "{}" they should probably be replaced with "{:?}" or "{:#?}" -- this caused a lot of confusion trying to bundle my first Dioxus project.

Closes #1693, closes #1347

@ealmloff
Copy link
Member

ealmloff commented Jan 2, 2024

Since the --target flag is currently taken, a --platform-triple flag allows alternative values for cargo build --target. This can't be done directly in passthrough, since dioxus-cli needs to know the output folder. If reasonable, the existing --target flag should probably be renamed so we can be 1:1 with cargo naming.

We can use the target flag for the target triple for parity with the cargo commands. It is breaking, but it would make it a lot easier to use coming from cargo. --target is also not a very clear name for the index path argument and it looks like it is currently unused. If we expose a different flag to use a different index.html path in the future, it can have a different name

@Bennett-Petzold
Copy link
Contributor Author

I've removed --platform-triple and given it's behavior to --target, so it works the same as cargo now.

@ealmloff ealmloff added enhancement New feature or request cli Related to the dioxus-cli program labels Jan 2, 2024
Copy link
Member

@ealmloff ealmloff left a comment

Choose a reason for hiding this comment

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

Looks good, this changes the --target arg, but because that argument did nothing, I think it is OK to make that change in a minor release.

Thank you!

@ealmloff ealmloff merged commit 80a8e1f into DioxusLabs:master Jan 2, 2024
9 of 10 checks passed
@Bennett-Petzold Bennett-Petzold deleted the cargo_passthrough branch January 2, 2024 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the dioxus-cli program enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support cross compilation in dioxus-CLI dx build: add no-default-features
2 participants