-
Notifications
You must be signed in to change notification settings - Fork 30
feat: allow to enable abi splitting via env var for local builds #511
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
base: main
Are you sure you want to change the base?
Conversation
- `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"
szdziedzic
left a comment
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.
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?
|
Lets see! If I understood correctly, I would use the Thanks for your feedback! |
|
@szdziedzic so i came up with something and it looks like it should just work ™️ but it doesnt: export const abiList = ["armeabi-v7a", "arm64-v8a", "x86", "x86_64"];
export function withAbiSplitting(config, abiFilters) {
return withAppBuildGradle(config, (config) => {
if (abiFilters && abiFilters.length === 0) {
return config;
}
const abis = [...new Set(...(abiFilters ?? abiList))]
.map((abi) => `'${abi}'`)
.join(", ");
config.modResults.contents += `
android {
splits {
abi {
enable true
reset()
include ${abis}
universalApk false
}
}
}
`;
return config;
});
}Is there any way to see the resulting gradl file? Is this even the correct file? I also tried |
|
@Kudo / @lukmccall - do you think we should expose this through expo-build-properties? @kadikraman shared a link to a discord thread where someone made a config plugin to accomplish this: https://discord.com/channels/695411232856997968/1370401592926535700/1370771024076996770 |
|
is the request to split the APK into multiple APKs for users to download, rather than to optimize build time? that seems like a pretty niche use case. if you’re talking about building a single apk with eas build using an environment variable, the easiest way is like: $ export ORG_GRADLE_PROJECT_reactNativeArchitectures=x86_64 |
EAS_BUILD_ENABLE_ABI_SPLITTINGenables abi splitting for all abisEAS_BUILD_ABI_LISTlets 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:
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