Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

FNX-14633 ⁃ For #162 - Add OSS build flavor. #13453

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Pre-requisites:
2. **Import** the project into Android Studio **or** build on the command line:

```shell
./gradlew clean app:assembleDebug
./gradlew clean app:assembleFenixDebug
```

If this errors out, make sure that you have an `ANDROID_SDK_ROOT` environment
Expand Down
50 changes: 36 additions & 14 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,27 @@ android {
animationsDisabled = true
}

flavorDimensions "engine"
flavorDimensions "flavor"
productFlavors {
fenix {
dimension "flavor"
buildConfigField "boolean", "OSS_FLAVOR", "false"
}
fenixOss {
dimension "flavor"
applicationIdSuffix ".oss"
versionNameSuffix "-oss"
buildConfigField "boolean", "OSS_FLAVOR", "true"
}
}

sourceSets {
fenix {
java.srcDirs += ['src/nonOss']
}
fenixOss {
java.srcDirs += ['src/oss']
}
androidTest {
resources.srcDirs += ['src/androidTest/resources']
}
Expand Down Expand Up @@ -332,9 +350,6 @@ dependencies {
implementation Deps.sentry
implementation Deps.osslicenses_library

implementation Deps.leanplum_core
implementation Deps.leanplum_fcm

implementation Deps.mozilla_concept_engine
implementation Deps.mozilla_concept_menu
implementation Deps.mozilla_concept_push
Expand Down Expand Up @@ -412,7 +427,6 @@ dependencies {
implementation Deps.mozilla_ui_widgets

implementation Deps.mozilla_lib_crash
implementation Deps.mozilla_lib_push_firebase
implementation Deps.mozilla_lib_dataprotect
debugImplementation Deps.leakcanary

Expand Down Expand Up @@ -441,7 +455,10 @@ dependencies {
implementation Deps.adjust
implementation Deps.installreferrer // Required by Adjust

implementation Deps.google_ads_id // Required for the Google Advertising ID
fenixImplementation Deps.leanplum_core
fenixImplementation Deps.leanplum_fcm
fenixImplementation Deps.mozilla_lib_push_firebase
fenixImplementation Deps.google_ads_id // Required for the Google Advertising ID

androidTestImplementation Deps.uiautomator
// Removed pending AndroidX fixes
Expand Down Expand Up @@ -545,17 +562,22 @@ task printVariants {
fileName: it.outputFileName,
]},
build_type: it.buildType.name,
build_flavor: it.getFlavorName(),
name: it.name,
]}
// AndroidTest is a special case not included above
variants.add([
apks: [[
abi: 'noarch',
fileName: 'app-debug-androidTest.apk',
]],
build_type: 'androidTest',
name: 'androidTest',
])
android.productFlavors.all { flavor ->
def flavorName = flavor.name
variants.add([
apks: [[
abi: 'noarch',
fileName: "app-${flavorName}-debug-androidTest.apk",
]],
build_type: 'androidTest',
build_flavor: flavorName,
name: flavorName + 'AndroidTest',
])
}
println 'variants: ' + groovy.json.JsonOutput.toJson(variants)
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
android:exported="false" />

<service
android:name=".push.FirebasePushService"
android:name=".push.FirebasePushServiceImpl"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/mozilla/fenix/components/Analytics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.mozilla.fenix.R
import org.mozilla.fenix.ReleaseChannel
import org.mozilla.fenix.components.metrics.AdjustMetricsService
import org.mozilla.fenix.components.metrics.GleanMetricsService
import org.mozilla.fenix.components.metrics.LeanplumMetricsService
import org.mozilla.fenix.components.metrics.LeanplumMetricsServiceImpl
import org.mozilla.fenix.components.metrics.MetricController
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.utils.Mockable
Expand Down Expand Up @@ -84,7 +84,7 @@ class Analytics(
)
}

val leanplumMetricsService by lazy { LeanplumMetricsService(context as Application) }
val leanplumMetricsService by lazy { LeanplumMetricsServiceImpl(context as Application) }

val metrics: MetricController by lazy {
MetricController.create(
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/mozilla/fenix/components/Push.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import mozilla.components.feature.push.PushConfig
import mozilla.components.lib.crash.CrashReporter
import mozilla.components.support.base.log.logger.Logger
import org.mozilla.fenix.R
import org.mozilla.fenix.push.FirebasePushService
import org.mozilla.fenix.push.FirebasePushServiceImpl

/**
* Component group for push services. These components use services that strongly depend on
Expand Down Expand Up @@ -42,5 +42,5 @@ class Push(context: Context, crashReporter: CrashReporter) {
PushConfig(projectId)
}

private val pushService by lazy { FirebasePushService() }
private val pushService by lazy { FirebasePushServiceImpl() }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.fenix.components.metrics

import android.content.Context

interface AdvertisingID {
/**
* Query the Google Advertising API to get the Google Advertising ID.
*
* This is meant to be used off the main thread. The API will throw an
* exception and we will print a log message otherwise.
*
* @return a String containing the Google Advertising ID or null.
*/
fun query(context: Context): String?
}
Loading