Allow building (native) and linting of none bin / example targets#629
Open
DaAlbrecht wants to merge 11 commits intomainfrom
Open
Allow building (native) and linting of none bin / example targets#629DaAlbrecht wants to merge 11 commits intomainfrom
DaAlbrecht wants to merge 11 commits intomainfrom
Conversation
007bb60 to
bc05375
Compare
Cargo does the following for `build` / `check`: https://doc.rust-lang.org/cargo/commands/cargo-build.html > By default, when no package selection options are given, the packages selected depend on the selected manifest file (based on the current working directory if --manifest-path is not given). If the manifest is the root of a workspace then the workspaces default members are selected, otherwise only the package defined by the manifest will be selected. https://doc.rust-lang.org/cargo/commands/cargo-run.html When no target selection options are given, cargo run will run the binary target. If there are multiple binary targets, you must pass a target flag to choose one. Or, the default-run field may be specified in the [package] section of Cargo.toml to choose the name of the binary to run by default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Support building and linting packages that do not contain a binary or example target.
Solution
This was not possible because, in all cases, we were looking for a
BinTarget(a binary or example target). This makes sense for running (and to some extent building) for the web. For native or linting, this has unintentional side effects.Testing
Install the current branch:
Use the test repo:
git@github.com:TimJentzsch/bevy_complex_repo.gitdefault-runnativedefault-runwebLint specific package (this did not work before)
bevy_complex_repo/workspace on main via 🦀 v1.91.0-nightly took 23s ❯ bevy lint -p cplx_core Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.12sLint no specific package selected
Details
This is equivalent to `cargo check`❯ cargo check Checking lint v0.1.0 (/home/squishy/bevy_org/bevy_complex_repo/workspace/bins/lint) Checking package_asset_folder v0.1.0 (/home/squishy/bevy_org/bevy_complex_repo/workspace/bins/package_asset_folder) Checking cplx_teaser v0.1.0 (/home/squishy/bevy_org/bevy_complex_repo/workspace/bins/cplx_teaser) Checking cplx v0.1.0 (/home/squishy/bevy_org/bevy_complex_repo/workspace/bins/cplx) Checking cplx_core v0.1.0 (/home/squishy/bevy_org/bevy_complex_repo/workspace/libs/cplx_core) Checking custom_web_folder v0.1.0 (/home/squishy/bevy_org/bevy_complex_repo/workspace/bins/custom_web_folder) Checking rustflags v0.1.0 (/home/squishy/bevy_org/bevy_complex_repo/workspace/bins/rustflags) Checking cplx_demo v0.1.0 (/home/squishy/bevy_org/bevy_complex_repo/workspace/bins/cplx_demo) Checking wasm_opt v0.1.0 (/home/squishy/bevy_org/bevy_complex_repo/workspace/bins/wasm_opt) Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.21sBuild native no package specified
Build web no package specified
Build Default members native, no package arg
Build Default members web, no package arg
Run Default members native
Run Default members Web
Build all examples (this did not work before)
Follow up
I wanted to implement #622 and got nerdsniped by: #622 (comment) so this sets the foundation for this issue.
I would also like to be able to do the same for the web (maybe behind a
--compile-onlyflag that only runs thecargo buildcommand)