[fix] build_guest_package
didn't target any specific package, there was no way to build examples with it
#1114
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.
In order to fix it, the signature was also changed. Now
cargo build
--name
flag,--bin <name>
or--example <name>
flags (as opposed to previous--bin
and--name
),--bin <name>
looks for packages with name exactly<name>
, as opposed to previous behaviour where it was looking for packages with substring<name>
(similar to howcargo test
works); the same about--example <name>
.Copilot:
This pull request introduces significant changes to the build process and command-line interface (CLI) for building guest packages. The main focus is on enhancing the flexibility of target filtering and improving the handling of example targets.
Enhancements to Target Filtering:
crates/cli/src/commands/build.rs
: Modified theBuildArgs
andBinTypeFilter
structs to replace boolean flags with optional string fields for specifying target names directly. This change allows for more precise filtering of target builds. [1] [2]crates/toolchain/build/src/lib.rs
: Updated theTargetFilter
struct to use exact target names instead of substrings and adjusted thebuild_guest_package
function to accept an optionalTargetFilter
. This improves the specificity of target selection during the build process. [1] [2] [3]Handling of Example Targets:
crates/toolchain/build/src/lib.rs
: Enhanced theget_dir_with_profile
function to include an additional parameter for handling example targets, ensuring that the correct directory structure is used for examples.crates/toolchain/tests/src/utils.rs
: Updated thebuild_example_program_at_path_with_features
function to utilize the newTargetFilter
for building example programs, providing better support for example-specific builds.Code Adjustments and Refactoring:
benchmarks/src/utils.rs
: Adjusted thebuild_bench_program
function to pass the optionalTargetFilter
when building guest packages, aligning with the new filtering mechanism.crates/sdk/src/lib.rs
: Modified theSdk
implementation to handle the optionalTargetFilter
when building guest packages, ensuring compatibility with the updated build process.Import Updates:
crates/toolchain/tests/src/utils.rs
: Added theTargetFilter
import to support the updated target filtering logic in test utilities.