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

Improve Build Android APK step #33

Open
compojoom opened this issue Jan 14, 2020 · 1 comment
Open

Improve Build Android APK step #33

compojoom opened this issue Jan 14, 2020 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@compojoom
Copy link
Contributor

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.

@compojoom compojoom added the bug Something isn't working label Jan 14, 2020
compojoom added a commit to compojoom/react-native-circleci-orb that referenced this issue Jan 14, 2020
Add more parameters to the android_build command. This allows us to be more explicit with our build variants and it terms will save minutes on circleCI by only specifying the build variantes that we really needs

fixes react-native-community#33
@m2mathew
Copy link

@compojoom Our project also has variants made of flavorBuild (4 flavors and 2 builds so 8 variants). To make this work, I copied over a lot of this orb's code only to change the ./gradlew assemble... shell command to accept our desired variant. Bit of a nuisance, but it seems to be working fine.

@vonovak vonovak added the help wanted Extra attention is needed label Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants