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

Flavors support #30

Merged
merged 2 commits into from
Sep 15, 2022
Merged

Flavors support #30

merged 2 commits into from
Sep 15, 2022

Conversation

mohamadk
Copy link
Contributor

@mohamadk mohamadk commented Sep 14, 2022

supporting variants (Flavor+buildTypes) in Grazel

With this PR grazel will create all bazel targets for all available build variants(including unit tests) in the application.

It supports flavored configurations like:

flavor1Implementation project(path: ':sample-library-flavor1')
testImplementation ....
etc...

targets are created in BUILD.bazel file with the following naming convention
"target-name-flavor1-debug"
for example
sample-android-flavor1-debug

Resources are also managed based on the variant and will be added to their respective bazel targets.

resource_files = glob([
        "src/main/res/**",
    ]) + custom_res(
        dir_name = "res-debug",
        resource_files = glob([
            "src/main/res-debug/values/strings.xml",
        ]),
        target = "sample-android-flavor1-debug",
    ) + GOOGLE_SERVICES_XML,

Internal project dependencies are managed based on

  1. The type of the project (android library or kotlin/java Library)
  2. availability of the requested flavor in the dependent module
    for example in the following graph
    A (with flavor [googleplay, hwi] ) -> B
    if B is an android project it should have the respective flavors or at least the same build types, otherwise, the bazel target cannot be linked, and migration will fail. (if B is a java/Kotlin library it will be added as a dependency simply)

Known Issues:

  • At the moment load macros are unnecessarily repeated

  • external dependencies with flavor support with the usage of maven classifier is not supported yet
    implementation "com.grab:library-name:version:classifier"

@arunkumar9t2 arunkumar9t2 changed the title adding flavors support Flavors support Sep 15, 2022
@minkuan88 minkuan88 merged commit 588ff75 into grab:master Sep 15, 2022
akshay-grabtaxi pushed a commit that referenced this pull request Jun 28, 2023
* add flavors support

* fix variant filter

Co-authored-by: mohammad.khaleghi <mohammad.khaleghi@grabtaxi.com>
akshay-grabtaxi pushed a commit that referenced this pull request Jun 28, 2023
* add flavors support

* fix variant filter

Co-authored-by: mohammad.khaleghi <mohammad.khaleghi@grabtaxi.com>
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

Successfully merging this pull request may close these issues.

4 participants