Skip to content
Norbel AMBANUMBEN edited this page Jul 10, 2024 · 1 revision

Flavor Dimensions

Flavor dimensions are used to define different categories of flavors. Each product flavor belongs to one of these dimensions.

  1. brand
  2. testing
  3. license

Each dimension can have multiple flavors, and combinations of these flavors across dimensions can be built to create different variants of the application.

Product Flavors

Brand Dimension

This dimension categorizes flavors based on branding.

  1. ooni

    • Dimension: brand
    • Description: This is the default branding flavor for the OONI Probe application.
  2. dw

    • Dimension: brand
    • Description: This flavor customizes the app for a specific partner, Deutsche Welle (DW ~ News Media Scan).

Testing Dimension

This dimension categorizes flavors based on the testing stage of the application.

  1. stable

    • Dimension: testing
    • Description: Represents the stable release version of the application.
    • Properties:
      • 'String', 'BASE_SOFTWARE_NAME', '"ooniprobe-android"': Sets a build configuration field for the base software name.
      • 'String', 'OONI_API_BASE_URL', '"https://api.prod.ooni.io"': Sets a build configuration field for the production API base URL.
  2. dev

    • Dimension: testing
    • Description: Represents the development version with specific configurations for development and testing.
    • Properties:
      • applicationIdSuffix: '.dev': Appends a suffix to the application ID for the development version.
      • versionNameSuffix: resolveVersionSuffix('beta'): Appends a suffix to the version name, resolved using a custom function.
      • versionCode: resolveVersionCode(): Sets the version code using a custom function.
      • 'BASE_SOFTWARE_NAME', '"ooniprobe-android-dev"': Sets a build configuration field for the base software name.
      • 'OONI_API_BASE_URL', '"https://api.dev.ooni.io"': Sets a build configuration field for the development API base URL.
  3. experimental

    • Dimension: testing
    • Description: Represents the experimental version for testing new features.
    • Properties:
      • applicationIdSuffix: '.experimental': Appends a suffix to the application ID for the experimental version.
      • versionNameSuffix: resolveVersionSuffix('experimental'): Appends a suffix to the version name, resolved using a custom function.
      • versionCode: resolveVersionCode(): Sets the version code using a custom function.
      • 'BASE_SOFTWARE_NAME', '"ooniprobe-android-experimental"': Sets a build configuration field for the base software name.
      • 'OONI_API_BASE_URL', '"https://api.dev.ooni.io"': Sets a build configuration field for the development API base URL.

License Dimension

This dimension categorizes flavors based on licensing and distribution requirements.

  1. fdroid

    • Dimension: license
    • Description: Main differences from the full version may include the absence of Google Services, Logging and crash reporting.
  2. full

    • Dimension: license
    • Description: Full-featured version, possibly including all features.

Summary

The build.gradle file uses flavor dimensions to organize various product flavors, allowing for the creation of multiple app variants with different configurations. This setup enables targeting different branding, testing stages, and licensing requirements efficiently.

  • Brand Dimension: Differentiates flavors based on the organization or partner (e.g., ooni, dw).
  • Testing Dimension: Differentiates flavors based on the development and testing stages (e.g., stable, dev, experimental).
  • License Dimension: Differentiates flavors based on licensing and distribution channels (e.g., fdroid, full).

Each flavor can define its own unique properties, such as applicationId, versionNameSuffix, versionCode, buildConfigField, and resValue, to customize the build and behavior of the app for different use cases.

Variants

The different combinations of flavors across dimensions create various app variants. For example, the ooniStableFullDebug variant represents the stable release version of the OONI Probe app with full features enabled for debugging. The variant names are therefore:

  • ooniExperimentalFullDebug
  • ooniExperimentalFullRelease
  • ooniDevFullDebug
  • ooniDevFullRelease
  • ooniStableFullDebug
  • ooniStableFullRelease
  • dwExperimentalFullDebug
  • dwExperimentalFullRelease
  • dwDevFullDebug
  • dwDevFullRelease
  • dwStableFullDebug
  • dwStableFullRelease

We additionally have ooniStableFdroidDebug, ooniStableFdroidRelease, dwStableFdroidDebug and dwStableFdroidRelease.