shorebirdtech / shorebird

Code Push for Flutter and other tools for Flutter businesses.
https://shorebird.dev
Other
1.97k stars 118 forks source link

fix: shorebird create invalid flavor when using multi dimension flavors on android #1961

Open erickzanardo opened 3 weeks ago

erickzanardo commented 3 weeks ago

Description

shorebird init creates ambiguous flavors in multi dimensional android projects.

Steps To Reproduce

  1. In an android project with the following flavor setup:
    flavorDimensions "track", "country"
    productFlavors {
        internal {
            dimension "track"
            applicationIdSuffix ".internal"
            manifestPlaceholders = [applicationLabel: "[Internal] Shorebird Example"]
        }
        stable {
            dimension "track"
            manifestPlaceholders = [applicationLabel: "Shorebird Example"]
        }
        global {
            applicationIdSuffix ".gl"
            dimension "country"
            manifestPlaceholders = [applicationLabel: "Shorebird Example"]
        }
        playStore {
            applicationIdSuffix ".pl"
            dimension "country"
            manifestPlaceholders = [applicationLabel: "Shorebird Example"]
        }
        local {
            applicationIdSuffix ".lcl"
            dimension "country"
            manifestPlaceholders = [applicationLabel: "Shorebird Example"]
        }
    }

    Run shorebird init

It will create a shorebird configuration like:

app_id: 5171ee3d-1a4d-4bdd-91c3-64cef78fe41c
flavors:
  internal: 5171ee3d-1a4d-4bdd-91c3-64cef78fe41c # <-- this one shouldn't exist
  internalGlobal: 5487a0d3-8c5a-4178-86ef-5295588e89bd
  internalLocal: acb850fb-a9e3-45fb-86c0-705bb265d1e4
  internalPlayStore: c8cfaff9-d94e-4767-9055-50c4f0b25ddd
  stable: 666541bc-0eda-477d-8ad5-ec97760435e6
  stableGlobal: 6ceb59f3-8d0e-45c2-965d-6bf554f331d0
  stableLocal: d9f3396e-f503-45f9-bb05-7ac5d4b060b0
  stablePlayStore: ca70dd3f-7357-4a04-bb77-4d6fe38a15b1
  1. Now try running shorebird release android --flavor internal
  2. See the error:
    
    shorebird release android --flavor internal
    ✗ Failed to build:
    FAILURE: Build failed with an exception.

Expected Behavior

the ambiguous flavor should not have been created