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

Android cli #103

Merged
merged 9 commits into from
Mar 12, 2024
Merged

Android cli #103

merged 9 commits into from
Mar 12, 2024

Conversation

vivianjeng
Copy link
Collaborator

@vivianjeng vivianjeng commented Mar 11, 2024

  • merge android config and ios config
    [build]
    # For iOS device_type can be x86_64, simulator, device
    ios_device_type = "x86_64" # Options: x86_64, simulator, device
    # For Android device_type can be x86_64, x86, arm, arm64
    android_device_type = "x86_64" # Options: x86_64, x86, arm, arm64
    
  • add android cli
    • mopro init --platforms android
    • mopro prepare
    • mopro build --platforms android
    • mopro export-bindings --platforms android --destination <DESTINATION>
    • update readme
  • close CLI: Android support #94

@vivianjeng vivianjeng marked this pull request as ready for review March 11, 2024 06:38
@vivianjeng vivianjeng requested a review from oskarth March 11, 2024 06:38
Copy link
Collaborator

@oskarth oskarth left a comment

Choose a reason for hiding this comment

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

I like the deduplication for configs! In general it makes sense. Still not 100% sure on all implications but directionally it makes sense to me.

I think some of these interface points relate to how we imagine config and cli options to work and interact. For example, can a user specify everything related to build settings in config file? Can this be overridden with CLI?

As one example: one could imagine user specifying build targets in config, and mopro build picking up on this, as opposed to (easily) forgetting to specify which platforms to build for every time.

I suspect this is a larger conversation re API design, and better to get this merged since it introduces a new capability. But can share initial thoughts so we have a clearer direction for config/CLI options

### Exporting bindings

To export bindings to a different directory:

`mopro export-bindings --destination <DESTINATION_DIR>`
`mopro export-bindings --destination <DESTINATION_DIR> --platforms <IOS_OR_ANDROID>`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I find --platforms here a bit confusing, because it is plurals and in other commands it is meant for multiple platforms at once.

I guess --platform would work?

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 works as previous platforms
it can be one platform or multiple platforms (--platforms ios android)
but I improved it a little bit here: 8d57287

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh right, I was confused because the comment said IOS_OR_ANDROID

@@ -68,6 +68,8 @@ enum Commands {
},
/// Exports platform bindings to some other directory
ExportBindings {
#[arg(long, num_args = 1.., default_value = "ios")]
platforms: Vec<String>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be adjust if we don't allow multiple platforms for export

Alternatively, we could maybe have
--destination-ios
--destination-android?

That way all bindings can be exported in one go. But maybe confusing, not sure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same here
we can export with multiple platforms?
--platforms ios android

# Build process
#----------------------------------------------------------------------------

# Build process for mopro_core
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess this works for now, but I wonder if we can simplify/deduplicate build scripts:

  • build_core
  • build_ios
  • build_android
  • (build ios and android)

Or can we keep it like this, not sure

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

or we can have one entry build script
and separate android, ios...in other file:

  • build.sh
  • android.sh
  • ios.sh
  • ...
    (maybe in the next PR)

@@ -58,6 +59,29 @@ case $DEVICE_TYPE in
;;
esac

case $ANDROID_DEVICE_TYPE in
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does it mean semantically to build Android Device Type for Core (Desktop) only?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

right I just copied from build_android but it does not make much sense here
I removed them 279b6d9

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is all of this normally part of Android app or should it be in gitignore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,185 @@
#!/usr/bin/env sh
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is all of this normally part of Android app or should it be in gitignore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes it can be removed
thank you for finding this
e865227

@oskarth
Copy link
Collaborator

oskarth commented Mar 11, 2024

Also, that was quick! Nice work

@vivianjeng
Copy link
Collaborator Author

As one example: one could imagine user specifying build targets in config, and mopro build picking up on this, as opposed to (easily) forgetting to specify which platforms to build for every time.

yes agree
or we can use CLI to modify config file
so it can be reused between different commands and developers can use cli tool to see what config can be specified

Copy link
Collaborator

@oskarth oskarth left a comment

Choose a reason for hiding this comment

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

Awesome! Thank you

@oskarth oskarth merged commit ad76e92 into main Mar 12, 2024
6 checks passed
@oskarth oskarth deleted the android-cli branch March 12, 2024 02:33
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.

CLI: Android support
2 participants