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

CLI can select target arch #270

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sifnoc
Copy link
Collaborator

@sifnoc sifnoc commented Dec 12, 2024

  • mopro-ffi:app_config::ios::build and mopro-ffi:app_config::android::build now require target_arch as an input instead of being hardcoded value inside the function.
  • The build scripts in cli/src/template/init/bin/* and test-e2e/src/bin/* read the target_arch value from the environment variable. If no value is provided, all available architectures are selected by default.
  • Did not add mopro-ffi crate in the cli for only reading *_ARCHS variables. It's too heavy to compile for simple.

@sifnoc sifnoc requested a review from vivianjeng December 12, 2024 10:03
Copy link
Collaborator

@vivianjeng vivianjeng left a comment

Choose a reason for hiding this comment

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

I think ideally only cli/src/build.rs, mopro-ffi/src/app_config/* needs to be changed.
let me know if it is possible to do this 🙏🏻

Comment on lines 3 to +22
fn main() {
let ios_archs: Vec<String> = if let Ok(ios_archs) = std::env::var("IOS_ARCHS") {
ios_archs.split(',').map(|arch| arch.to_string()).collect()
} else {
// Default case: select all supported architectures if none are provided
IOS_ARCHS.iter().map(|&arch| arch.to_string()).collect()
};

// Check 'IOS_ARCH' input validation
for arch in &ios_archs {
assert!(
IOS_ARCHS.contains(&arch.as_str()),
"Unsupported architecture: {}",
arch
);
}

// A simple wrapper around a build command provided by mopro.
// In the future this will likely be published in the mopro crate itself.
mopro_ffi::app_config::ios::build();
mopro_ffi::app_config::ios::build(&ios_archs);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think passing archs as inputs doesn't make much sense to me
and I think letting users maintaining the line 4-18 is too much work
(and we have to maintain double files in template and test-e2e, and also documentation)

if it is in env, it can just let mopro_ffi::app_config::ios::build() to read the env and handle the error assertions?
like the debug/release mode, it is also handled by mopro_ffi::app_config::ios::build()

@sifnoc
Copy link
Collaborator Author

sifnoc commented Dec 13, 2024

This PR will be replace another new PR with https://github.com/zkmopro/mopro/tree/selectable_target_arch

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.

2 participants