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

Add config option to disable certain target architectures #50

Open
AlienKevin opened this issue Jan 4, 2024 · 3 comments
Open

Add config option to disable certain target architectures #50

AlienKevin opened this issue Jan 4, 2024 · 3 comments

Comments

@AlienKevin
Copy link

Currently, cargokit always builds for all supported architectures. For example, there are 3 targets for iOS and 4 targets for Android.

However, many devs test primarily on one device during development and only need to build for all architectures during release. This means that a lot of build time is wasted on architectures that the devs don't need, slowing down the development cycle.

It'd be great if devs can whitelist/blacklist target architectures in dev mode to cut down unnecessary build time.

@knopp
Copy link
Contributor

knopp commented Jan 4, 2024

On iOS this is controlled by XCode build. For example during debug on XCode the "Build Active Architecture Only" option is usually set, in which case cargokit should only build one architecture.

On android the target platforms being build are obtained from flutter plugin. I'm not sure if there is a way to adjust that.

@Vedsaga
Copy link

Vedsaga commented Jan 14, 2024

So, it is possible to disable certain arch in flutter android,

android {
   ...
   defaultConfig {
       ...  
       ndk {
          abiFilters "armeabi-v7a", "arm64-v8a"
       }
   }
}

https://stackoverflow.com/questions/42984644/how-to-specify-supported-architectures-for-android-app-in-build-gradle

cc: @knopp

@AlienKevin
Copy link
Author

You can also skip the steps for building extra android architectures by updating cargokit/gradle/plugin.gradle. The following example shows how to only compile for arm64:

            ... 
            def platforms = plugin.getTargetPlatforms().collect()

            // Only compile for arm64 on Android
            platforms = platforms.findAll { it == "android-arm64" }

            // Comment out the following lines which add intel targets in debug mode
            // Same thing addFlutterDependencies does in flutter.gradle
            // if (buildType == "debug") {
            //     platforms.add("android-x86")
            //     platforms.add("android-x64")
            // }

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

No branches or pull requests

3 participants