akaita / easylauncher-gradle-plugin

Add a different ribbon to each of your Android app variants using this gradle plugin. Of course, configure it as you will
Apache License 2.0
959 stars 54 forks source link

Add support for multiple dimensions #13

Open akaita opened 6 years ago

akaita commented 6 years ago

Not sure even if it is possible. If information about dimensions reaches the plugin, support for them should be added. Otherwise, probably not (how to distinguish a flavors which happens to be named with part of another flavor's name? ).

Should at least check the feasibility of this feature to make sure.

gustavkarlsson commented 5 years ago

In the mean time, Is there a way to do this programatically by reading the build variant string?

As mentioned in https://github.com/akaita/easylauncher-gradle-plugin/issues/10#issuecomment-366910195 ribbonizer enables this by exposing the build variant as a String. Is that possible with easylauncher

akaita commented 5 years ago

Afaik I'm not exposing anything to allow you to do this. I had to choose what to expose or not in the DSL, and nothing enabling this made the cut.

gustavkarlsson commented 5 years ago

Afaik I'm not exposing anything to allow you to do this. I had to choose what to expose or not in the DSL, and nothing enabling this made the cut.

I understand, but I think this is important to focus on this. It's the people with the most complex setups (multiple dimensions and build types) that will get the most value from a plugin like this.

akaita commented 5 years ago

@gustavkarlsson tbh I most projects I know about (a few with millions of users) don't really make use of dimensions. They just have one for all. It makes me think this is not a high priority issue. Maybe you could provide an example of a multidimensional project and how a DSL for it could look like? That' dbe a good starting point and could help bring the feature to completion earlier.

gustavkarlsson commented 5 years ago

@gustavkarlsson tbh I most projects I know about (a few with millions of users) don't really make use of dimensions.

Totally with you. Most projects are very simple. But I would argue that because of that, most projects don't have a great need for something like easylauncher. But it's for the the few complex projects out there that easylauncher could REALLY shine.

Maybe you could provide an example of a multidimensional project and how a DSL for it could look like? That' dbe a good starting point and could help bring the feature to completion earlier.

Here are some good candidates for dimensions:

An app with multiple dimensions like these could greatly benefit from having multiple banners indicating how the dimensions are set.

The DSL would just be extended to offer a dimensions block in addition to flavors and variants block.

Something like this:

easylauncher {
    // "manifest application[android:icon]" is automatically added to the list
    iconNames "@mipmap/ic_launcher_foreground" // Traditional launcher icon
    foregroundIconNames "@mipmap/ic_launcher_foreground" // Foreground of adaptive launcher icon

    defaultFlavorNaming = true // Use flavor name for default ribbon, instead of the type name

    dimensions {
        local {}
        qa {}
        staging {}
        production {}
        paid {}
        free {}
        america {}
        europe {}
        asia {}
        africa {}
    }

    buildTypes {
        beta {
            // Add two more filters to all `beta` variants
            filters = [
                    customColorRibbonFilter("#0000FF"),
                    overlayFilter(new File("example-custom/launcherOverlay/beta.png"))
            ]
        }
        canary {
            // Remove ALL filters to `canary` variants
            enable false
        }
        release {}
    }

    variants {
        productionDebug {
            // OVERRIDE all previous filters defined for `productionDebug` variant
            filters = orangeRibbonFilter("custom")
        }
    }
}