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 billing and infrastructure flavor dimensions #4684

Merged
merged 7 commits into from
Sep 21, 2023

Conversation

albin-mullvad
Copy link
Collaborator

@albin-mullvad albin-mullvad commented May 12, 2023

This PR changes the build configuration from only relying on build types to also rely on two flavor dimensions.

Flavor dimensions:

  • billing - used to build separate artifacts where (1) different policies are followed and (2) different dependencies are used. This dimension will initially have the following flavors: oss, play.
  • infrastructure - used to enable development and testing against non-production environments. This dimension will initially have the following flavors: prod, devmole.

This is the full set of enabled variants:

Build variant Full distribution artifact name Application id
ossProdRelease MullvadVPN-<version>.apk net.mullvad.mullvadvpn
ossProdDebug MullvadVPN-<version>.debug.apk net.mullvad.mullvadvpn
ossProdFdroid MullvadVPN-<version>.fdroid.apk net.mullvad.mullvadvpn
ossProdLeakCanary MullvadVPN-<version>.leakCanary.apk net.mullvad.mullvadvpn.leakcanary
playProdRelease MullvadVPN-<version>.play.(apk|aab) net.mullvad.mullvadvpn
playProdDebug MullvadVPN-<version>.play.debug.(apk|aab) net.mullvad.mullvadvpn
playDevmoleRelease MullvadVPN-<version>.play.devmole.(apk|aab) net.mullvad.mullvadvpn.devmole
playDevmoleDebug MullvadVPN-<version>.play.devmole.debug.(apk|aab) net.mullvad.mullvadvpn.devmole

NOTE: The artifacts only listed as *.apk can also be explicitly built as bundles, but those will not be used since only play* variants will be uploaded to Google Play.

TODO:

  • Verify/update the F-Droid build instructions in the F-Droid metadata repository.

This change is Reviewable

@linear
Copy link

linear bot commented May 12, 2023

DROID-18 Improve gradle variant configuration

The current gradle configuration is not suitable for a multi-project setup and also doesn't differentiate between Google Play and GitHub builds. We should use:

Build types: debug , release

Flavors: play , fdroid , oss

@Pururun Pururun added the Android Issues related to Android label May 16, 2023
@albin-mullvad albin-mullvad force-pushed the improve-gradle-variant-configuration-droid-18 branch from c0d7bce to 006bb93 Compare September 21, 2023 07:55
@albin-mullvad albin-mullvad marked this pull request as ready for review September 21, 2023 08:34
@albin-mullvad albin-mullvad self-assigned this Sep 21, 2023
Copy link
Contributor

@Pururun Pururun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 33 of 33 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @albin-mullvad)


android/lib/build.gradle.kts line 1 at r1 (raw file):

I guess this was part of the formatting, but this looks a bit odd?


android/test/build.gradle.kts line 1 at r1 (raw file):

Same as above

Copy link
Collaborator Author

@albin-mullvad albin-mullvad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


android/lib/build.gradle.kts line 1 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

I guess this was part of the formatting, but this looks a bit odd?

Yes, part of the formatting, but I agree


android/test/build.gradle.kts line 1 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

Same as above

Yes, part of the formatting, but I agree

@albin-mullvad albin-mullvad changed the title Improve gradle variant configuration Add billing and infrastructure flavor dimensions Sep 21, 2023
Copy link
Contributor

@Rawa Rawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @albin-mullvad)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/StringExtensions.kt line 5 at r1 (raw file):

import net.mullvad.mullvadvpn.constant.IS_PLAY_BUILD

fun String.appendHideNavOnReleaseBuild(): String =

I saw that this was just moved and that the name hasn't changed but maybe we should rename this to appendHideNavOnPlayBuild or something along those lines?

Copy link
Collaborator Author

@albin-mullvad albin-mullvad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 29 of 33 files reviewed, 1 unresolved discussion (waiting on @Pururun and @Rawa)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/StringExtensions.kt line 5 at r1 (raw file):

Previously, Rawa (David Göransson) wrote…

I saw that this was just moved and that the name hasn't changed but maybe we should rename this to appendHideNavOnPlayBuild or something along those lines?

Good catch! Done 🙂

@albin-mullvad albin-mullvad requested a review from Rawa September 21, 2023 10:52
Copy link
Contributor

@Pururun Pururun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Rawa)

Copy link
Contributor

@Rawa Rawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 29 of 33 files at r1, 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion

@albin-mullvad albin-mullvad force-pushed the improve-gradle-variant-configuration-droid-18 branch 2 times, most recently from dd2742c to cc4d7f3 Compare September 21, 2023 15:33
Copy link
Contributor

@sabercodic sabercodic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 29 of 33 files at r1, 4 of 4 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Rawa)

Copy link
Contributor

@sabercodic sabercodic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Rawa)

Copy link
Collaborator Author

@albin-mullvad albin-mullvad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dismissed @Rawa from a discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Flavor dimension usage:
* `billing` - used to build separate artifacts where (1) different
  policies are followed and (2) different dependencies are used.
* `infrastructure` - used to improve development and testing
  against non-production environments.
This fix makes sure that both `*.play.aab` and `*.aab`
bundles are supported and get the correct names.

Ideally the `sed` command which this commit touches
would be able to add the suffix using a small tweak
to the pattern like this:
`(MullvadVPN-.*-dev-.*)(\.apk|\.play\.aab|\.aab)`

However, that pattern would result in the suffix
being incorrectly placed due the greedy nature
of `sed` like the "incorrect" one below:
MullvadVPN-<version>.play+suffix.aab (incorrect)
MullvadVPN-<version>+suffix.play.aab (correct)
@albin-mullvad albin-mullvad force-pushed the improve-gradle-variant-configuration-droid-18 branch from cc4d7f3 to 62d94a2 Compare September 21, 2023 16:31
@albin-mullvad albin-mullvad merged commit 90ef9de into main Sep 21, 2023
17 checks passed
@albin-mullvad albin-mullvad deleted the improve-gradle-variant-configuration-droid-18 branch September 21, 2023 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Issues related to Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants