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

[fix] build_guest_package didn't target any specific package, there was no way to build examples with it #1114

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

Golovanov399
Copy link
Contributor

In order to fix it, the signature was also changed. Now cargo build

  • Doesn't have the --name flag,
  • Has either --bin <name> or --example <name> flags (as opposed to previous --bin and --name),
  • Cannot filter just by 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 how cargo 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 the BuildArgs and BinTypeFilter 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 the TargetFilter struct to use exact target names instead of substrings and adjusted the build_guest_package function to accept an optional TargetFilter. 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 the get_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 the build_example_program_at_path_with_features function to utilize the new TargetFilter for building example programs, providing better support for example-specific builds.

Code Adjustments and Refactoring:

  • benchmarks/src/utils.rs: Adjusted the build_bench_program function to pass the optional TargetFilter when building guest packages, aligning with the new filtering mechanism.
  • crates/sdk/src/lib.rs: Modified the Sdk implementation to handle the optional TargetFilter when building guest packages, ensuring compatibility with the updated build process.

Import Updates:

Copy link

Benchmarks

group app_log_blowup app_total_cells_used app_total_cycles app_total_proof_time_ms leaf_log_blowup leaf_total_cells_used leaf_total_cycles leaf_total_proof_time_ms max_segment_length instance alloc
ecrecover_program
2
10,251,804
195,066
(-10.0 [-0.5%])
1,923.0
-
-
-
-
1048476 64cpu-linux-arm64 mimalloc
fibonacci_program
2
51,615,800
3,000,274
(-48.0 [-0.9%])
5,511.0
-
-
-
-
1048476 64cpu-linux-arm64 mimalloc
regex_program
2
238,890,449
8,381,808
(-342.0 [-2.0%])
17,013.0
-
-
-
-
1048476 64cpu-linux-arm64 mimalloc
verify_fibair
2
(-1,990 [-0.0%])
48,126,297
(-160 [-0.0%])
397,134
(+10.0 [+0.3%])
3,158.0
-
-
-
-
1048476 64cpu-linux-arm64 mimalloc

Commit: 24e4500

Benchmark Workflow

Copy link
Contributor

@jonathanpwang jonathanpwang left a comment

Choose a reason for hiding this comment

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

LGTM, is that the only place in the book that's affected?

@Golovanov399
Copy link
Contributor Author

Yes, all --bin, --example and --name in the book are legit now

@Golovanov399 Golovanov399 merged commit 4250ce8 into main Dec 18, 2024
13 checks passed
@Golovanov399 Golovanov399 deleted the fix/cli-build-examples branch December 18, 2024 00:48
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.

3 participants