AngeloAvv / flutter_flavorizr

A flutter utility to easily create flavors in your flutter application
https://pub.dev/packages/flutter_flavorizr
MIT License
456 stars 81 forks source link

Move flavor dimensions to another file #254

Open vinifig opened 5 months ago

vinifig commented 5 months ago

Hello!

I have an application with more than 30 flavors, there's some automations I'm doing via flavorizr + local scripts so I can structure it better.

Recently I'm having a lot of trouble solving Git conflicts in the application build.gradle due to the size of these flavors config + our application dependencies.

I think that creating an product-flavors.gradle and applying it on build.gradle would organize it better and make it simpler to do Android changes in the project.

Do you guys have an suggestion of how I can organize it or examples in big projects like mine?

If you think it's plausible I can open a PR with this change

vinifig commented 5 months ago

example:

product-flavors.gradle:

android {
    flavorDimensions "flavor-type"
    productFlavors {
        dev {
            dimension "flavor-type"
            applicationId "com.app.dev"
            resValue "string", "app_name", "app dev"
        }
        hml {
            dimension "flavor-type"
            applicationId "com.app.hml"
            resValue "string", "app_name", "app hml"
        }
        prd {
            dimension "flavor-type"
            applicationId "com.app.dev"
            resValue "string", "app_name", "app hml"
        }
    }
}

build.gradle:

// ----- BEGIN flavorDimensions (autogenerated by flutter_flavorizr) -----
apply from: 'product-flavors.gradle'
// ----- END flavorDimensions (autogenerated by flutter_flavorizr) -----
vinifig commented 5 months ago

I have an android project tha does it exactly like this. It's far easier to manage and we can separate the Library changes from the application changes