Skip to content

Improve Build Android APK step #33

Open
@compojoom

Description

@compojoom

Currently the Build Android APK step looks like this:

  - run:
      name: Build Android APK
      command: "cd <<parameters.project_path>> && chmod +x gradlew && ./gradlew --build-cache --max-workers 2 --continue assemble<<parameters.build_type>> assembleAndroidTest -DtestBuildType=<<parameters.build_type>> --stacktrace"

In our project we have 3 flavors(develop, staging, production) and 2 build types (debug and release).
if I assemble the app with

gradlew assembleRelease assembleAndroidTest -DtestBuildType=release

gradlew will build all 3 flavors in release type. and it will also build all 3 flavors for androidTest in release type. This takes around 10mins on my machine and a little longer on circleci.

To speed this up we are generally only building specific build variants DevelopDebug, DevelopRelease etc.
To build a detox build we would do:

./gradlew assembleDevelopRelease assembleDevelopReleaseAndroidTest -DtestBuildType=release

this way we only generate developRlease androidTest/developRelease - this is 3 times faster as we generate 3 times less apks that we don't need.

Because of that I would like to propose different job parameters: assemble_build_type, assemble_detox_build_type and test_build_type.

This way one could call rn/android_build like this:

      - rn/android_build:
          assemble_build_type: assembleRelease | assembleDevelopRelease | assembleDebug etc
          assemble_detox_build_type: assembleDevelopReleaseAndroidTest | assembleAndroidTest etc
          test_build_type: release etc

It is a breaking change, but it would also allow for greater flexibility of the build step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions