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

feat: production build #354

Merged
merged 8 commits into from
Dec 4, 2024
Merged

Conversation

Daanvdplas
Copy link
Collaborator

@Daanvdplas Daanvdplas commented Nov 27, 2024

Adds the build profile to pop cli

use super::*;
use cli::MockCli;
use strum::VariantArray;

fn add_production_profile(project: &Path) -> anyhow::Result<()> {
Copy link
Collaborator Author

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.

Copy link
Collaborator

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

Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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.

Copy link
Contributor

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.

Copy link
Collaborator Author

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

@Daanvdplas Daanvdplas requested review from AlexD10S and al3mart and removed request for AlexD10S November 27, 2024 19:32
Copy link
Contributor

@al3mart al3mart left a 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.

crates/pop-cli/src/commands/build/mod.rs Show resolved Hide resolved
crates/pop-cli/src/commands/build/spec.rs Outdated Show resolved Hide resolved
crates/pop-cli/src/commands/build/spec.rs Outdated Show resolved Hide resolved
crates/pop-cli/src/commands/build/spec.rs Outdated Show resolved Hide resolved
crates/pop-cli/src/commands/build/mod.rs Show resolved Hide resolved
Copy link
Collaborator

@AlexD10S AlexD10S left a 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.

crates/pop-cli/src/commands/build/mod.rs Outdated Show resolved Hide resolved
Base automatically changed from daan/feat-use_chain_spec_file to fix/build-spec November 29, 2024 14:52
@al3mart
Copy link
Contributor

al3mart commented Nov 29, 2024

I'll do the rebase here

@al3mart al3mart force-pushed the daan/feat-production_build branch from d5d5bc0 to 7e46a67 Compare November 29, 2024 17:06
// All commands originating from root command are valid
BuildParachainCommand {
path: args.path,
package: args.package,
release: args.release,
profile: Some(profile),
Copy link
Collaborator Author

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.

Copy link
Contributor

@al3mart al3mart left a 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.

Copy link
Collaborator

@AlexD10S AlexD10S left a 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.

crates/pop-cli/src/commands/build/mod.rs Outdated Show resolved Hide resolved
crates/pop-common/src/manifest.rs Outdated Show resolved Hide resolved
@AlexD10S AlexD10S self-requested a review December 3, 2024 13:50
@Daanvdplas Daanvdplas merged commit 6ba8d0f into fix/build-spec Dec 4, 2024
@Daanvdplas Daanvdplas deleted the daan/feat-production_build branch December 4, 2024 12:39
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.

4 participants