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

Configure Gradle task dependencies to be architecture-specific #112

Open
AquilesCanta opened this issue Aug 11, 2022 · 2 comments
Open

Configure Gradle task dependencies to be architecture-specific #112

AquilesCanta opened this issue Aug 11, 2022 · 2 comments

Comments

@AquilesCanta
Copy link

I'm building a library which I'd like to make available on every possible platform: arm, arm64, x86, x86_64. However, during development I usually care about a single one. But gradle compiles everything, which takes some extra time.

One option is to manually disable the archs which I don't care about. I can do that by commenting out the undesired archs. Like so:

    targets = [
    //        "arm",
            "arm64",
    //        "x86",
    //        "x86_64"
    ]

But that's inconvenient because (1) the gradle file is checked into the version control system and (2) I need to remember to change this if I change de development device (e.g. I transition from a physical device to an emulator).

I'm wondering if there's a recommended way during development to tell gradle to only compile the right arch for the device we are targeting when we launch the app using the "run" button. I think Android Studio handles this gracefully for regular JNI/C++ code using CMake in Android Studio.

@ncalexan
Copy link
Member

We've not built anything out of the box. Set up your Gradle dependencies differently to have the per-arch build jobs depend on the per-arch cargo tasks like cargoBuild${ARCH}. See #68 and similar tickets.

Alternatively, use local.properties to configure your local environment using targets.

I'll keep this open to track doing better automatically, 'cuz it is possible -- just not easy right now.

@ncalexan ncalexan changed the title Newbie question: How to make Android Studio only compile the right arch automatically Configure Gradle task dependencies to be architecture-specific Aug 11, 2022
@MatrixDev
Copy link

@ncalexan, it should be relatively easy to jsut handle "android.injected.build.abi" property and just filter out targets

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