-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: production build #354
Conversation
use super::*; | ||
use cli::MockCli; | ||
use strum::VariantArray; | ||
|
||
fn add_production_profile(project: &Path) -> anyhow::Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to hear where I can place this function as it now exists in three places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same question in the pop call contract
. The solution was to have a public function in the crate pop_contracts
under a testing module that can be then used by the pop-cli
https://github.com/r0gue-io/pop-cli/pull/306/files#diff-1735e49d7426a2bb8a539485425778554b43ef1ca455b26bd8138b69c69b18aeR27
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we see it can be used in contracts then Ale's suggestion is the best approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be used for parachains and builds, not for smart contracts as far as I'm aware. However, I see no reason not to place it in common.
@AlexD10S your suggestion doesn't use any feature flag? This means it is added to the compilation time of the users which doesn't seem ideal. I suggest we come up with a feature name that we can start to use in the repository
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A random idea; we add it to the templates Cargo.toml
files which makes it a public crate function in general. Adding it will make the pop cli users aware of this possibility and will improve their chain when they go live to production, through this we create awareness for builders, a win.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at what it is actually doing, https://github.com/r0gue-io/pop-cli/blob/main/crates/pop-common/src/manifest.rs might be the best candidate. It arguably should be improved to use the functionality available via the Manifest object - e.g. reading the manifest, checking if the profile already exists and adding if not.
Note: if it is moved to a library crate it should not use anyhow: https://github.com/dtolnay/anyhow?tab=readme-ov-file#comparison-to-thiserror.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a great suggestion, I will not add it to the templates as default, something we can consider in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Way cleaner this way 👍 :
My biggest concern is that by removing the option --release
it forces us to include a deprecation message, an alias or something or some warning in the release notes.
Looks good. Left a few nits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only change requested is based on Ale's feedback about keeping the --release
flag as deprecated.
Here’s how you can handle it:
1- Update the help message for the flag: https://github.com/r0gue-io/pop-cli/blob/main/crates/pop-cli/src/commands/test/contract.rs#L18
2- If the flag is used, display a warning to inform the user: https://github.com/r0gue-io/pop-cli/blob/main/crates/pop-cli/src/commands/test/contract.rs#L50
3- You can set the Profile to release
if the flag was specified.
I'll do the rebase here |
d5d5bc0
to
7e46a67
Compare
chore: feedback and rebase
// All commands originating from root command are valid | ||
BuildParachainCommand { | ||
path: args.path, | ||
package: args.package, | ||
release: args.release, | ||
profile: Some(profile), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Option
requirement should be removed when removing the deprecated parachain build and contract command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the feedback has been now addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for addressing all the changes! I’ve just left a couple of minor comments.
Adds the build profile to pop cli