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: allow to enable abi splitting via env var for local builds #511

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Fuzzyma
Copy link

@Fuzzyma Fuzzyma commented Feb 9, 2025

  • EAS_BUILD_ENABLE_ABI_SPLITTING enables abi splitting for all abis
  • EAS_BUILD_ABI_LIST lets you select which abis to build (e.g. "armeabi-v7a,arm64-v8a"

Why

In the early phases of development (especially in hobby projects), you end up sending around your apks quite a bit.
The more features you add, the bigger your apks become and it is quite cumbersome to send them around easily.

Abi splitting helps in that regard by only including the abi that is needed.

It was also requested here: https://expo.canny.io/feature-requests/p/build-only-one-abi-during-development-android-only

How

I edited the gradle file to include an abi split section when some env vars are set.
For later it would be obviously better to have that setting anchored in the eas.json schema. But for now, env vars were the simple simultion. If somone tells me, where the settings are read, we could translate it to an env there (?)

Test Plan

Simply pass the corresponding env vars in your eas.json:

    "preview": {
      "distribution": "internal",
      "env": {
        "EAS_BUILD_ENABLE_ABI_SPLITTING": "true",
        "EAS_BUILD_ABI_LIST": "armeabi-v7a,arm64-v8a" // optional. Will build all abis by default
      }
    },

And then do a local build. When only using a single abi, the resulting apk should be places as usual into your output dir. When specifying multple abis, a tar.gz package with all abis is created instead

- `EAS_BUILD_ENABLE_ABI_SPLITTING` enables abi splitting for all abis
- `EAS_BUILD_ABI_LIST` lets you select which abis to build (e.g. "armeabi-v7a,arm64-v8a"
Copy link
Member

@szdziedzic szdziedzic left a comment

Choose a reason for hiding this comment

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

Hey, thank you very much for contributing!

This eas-build.gradle script is our way of injecting credentials and signing config and server-side set app versions into the project's build.gradle. The EAS-specific script like this is not the correct place to add a project-specific ABI splitting logic in my opinion. I believe the best place to handle it would be in the project's build.gradle file. One way to do so when being on the managed workflow/CNG would be to use config plugins and mods: https://docs.expo.dev/config-plugins/plugins-and-mods/. This way you can create your config plugin that can do exactly what you want here for your project. Does it make sense to you?

@Fuzzyma
Copy link
Author

Fuzzyma commented Feb 19, 2025

Lets see! If I understood correctly, I would use the mods.android.projectBuildGradle or the corresponding plugin withProjectBuildGradle to load the project gradle and do string manipulation to add the abi splitting. Is that correct?

Thanks for your feedback!

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