Commit c93a29f8 authored by Sebastian Kaspari's avatar Sebastian Kaspari
Browse files

Simplify build variants to just: debug, nightly, beta and release.


Co-authored-by: default avatarJohan Lorenzo <jlorenzo@mozilla.com>
parent b9391c14
<?xml version="1.0" encoding="utf-8"?>
<!-- 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/. -->
<resources>
<color name="ic_launcher_background">@color/debug_launcher_background</color>
</resources>
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- 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/. -->
<resources>
<!-- Name of the application -->
<string name="app_name" translatable="false">Firefox Nightly</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<!-- 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/. -->
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="open_new_tab"
android:enabled="true"
android:icon="@drawable/ic_static_shortcut_tab"
android:shortcutShortLabel="@string/home_screen_shortcut_open_new_tab_2"
android:shortcutLongLabel="@string/home_screen_shortcut_open_new_tab_2">
<intent
android:action="org.mozilla.fenix.OPEN_TAB"
android:targetPackage="org.mozilla.fennec_aurora"
android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />
</shortcut>
<shortcut
android:shortcutId="open_new_private_tab"
android:enabled="true"
android:icon="@drawable/ic_static_shortcut_private_tab"
android:shortcutShortLabel="@string/home_screen_shortcut_open_new_private_tab_2"
android:shortcutLongLabel="@string/home_screen_shortcut_open_new_private_tab_2">
<intent
android:action="org.mozilla.fenix.OPEN_PRIVATE_TAB"
android:targetPackage="org.mozilla.fennec_aurora"
android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />
</shortcut>
</shortcuts>
\ No newline at end of file
/* 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/. */
import android.content.Context
import android.os.Bundle
import mozilla.components.browser.engine.gecko.autofill.GeckoLoginDelegateWrapper
import mozilla.components.browser.engine.gecko.glean.GeckoAdapter
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy
import mozilla.components.concept.storage.LoginsStorage
import mozilla.components.lib.crash.handler.CrashHandlerService
import mozilla.components.service.sync.logins.GeckoLoginStorageDelegate
import org.mozilla.fenix.Config
import org.mozilla.fenix.ext.components
import org.mozilla.geckoview.GeckoRuntime
import org.mozilla.geckoview.GeckoRuntimeSettings
object GeckoProvider {
var testConfig: Bundle? = null
private var runtime: GeckoRuntime? = null
@Synchronized
fun getOrCreateRuntime(
context: Context,
storage: Lazy<LoginsStorage>,
trackingProtectionPolicy: TrackingProtectionPolicy
): GeckoRuntime {
if (runtime == null) {
runtime = createRuntime(context, storage, trackingProtectionPolicy)
}
return runtime!!
}
private fun createRuntime(
context: Context,
storage: Lazy<LoginsStorage>,
policy: TrackingProtectionPolicy
): GeckoRuntime {
val builder = GeckoRuntimeSettings.Builder()
testConfig?.let {
builder.extras(it)
.remoteDebuggingEnabled(true)
}
// Use meeee.
policy.hashCode()
val runtimeSettings = builder
.crashHandler(CrashHandlerService::class.java)
.telemetryDelegate(GeckoAdapter())
// TODO: Fix me!
// .contentBlocking(policy.toContentBlockingSetting())
.aboutConfigEnabled(Config.channel.isBeta)
.debugLogging(Config.channel.isDebug)
.build()
val settings = context.components.settings
if (!settings.shouldUseAutoSize) {
runtimeSettings.automaticFontSizeAdjustment = false
val fontSize = settings.fontSizeFactor
runtimeSettings.fontSizeFactor = fontSize
}
val geckoRuntime = GeckoRuntime.create(context, runtimeSettings)
val loginStorageDelegate = GeckoLoginStorageDelegate(storage)
geckoRuntime.loginStorageDelegate = GeckoLoginDelegateWrapper(loginStorageDelegate)
return geckoRuntime
}
}
......@@ -5,14 +5,14 @@
package org.mozilla.fenix
enum class ReleaseChannel {
FenixDebug,
FenixProduction,
FennecProduction,
FennecBeta;
Debug,
Nightly,
Beta,
Release;
val isReleased: Boolean
get() = when (this) {
FenixDebug -> false
Debug -> false
else -> true
}
......@@ -27,51 +27,39 @@ enum class ReleaseChannel {
get() = !this.isReleased
val isReleaseOrBeta: Boolean
get() = when (this) {
FennecProduction -> true
FennecBeta -> true
else -> false
}
get() = this == Release || this == Beta
val isRelease: Boolean
get() = when (this) {
FennecProduction -> true
Release -> true
else -> false
}
val isBeta: Boolean
get() = when (this) {
FennecBeta -> true
else -> false
}
get() = this == Beta
val isNightlyOrDebug: Boolean
get() = when (this) {
FenixDebug -> true
FenixProduction -> true
else -> false
}
get() = this == Debug || this == Nightly
/**
* Is this a build for a release channel that we used to ship Fennec on?
*/
val isFennec: Boolean
get() = this in fennecChannels
/**
* Is this build for a "pure" Fenix channel that we never shipped Fennec on?
*/
val isFenix: Boolean
get() = !isFennec
}
object Config {
val channel = when (BuildConfig.BUILD_TYPE) {
"fenixProduction" -> ReleaseChannel.FenixProduction
"debug" -> ReleaseChannel.FenixDebug
"fennecProduction" -> ReleaseChannel.FennecProduction
"fennecBeta" -> ReleaseChannel.FennecBeta
// Builds for local performance analysis, recording benchmarks, automation, etc.
// This should be treated like a released channel because we want to test
// what users experience and there are performance-impacting changes in debug
// release channels (e.g. logging) that are never intended to be shipped.
"forPerformanceTest" -> ReleaseChannel.FenixProduction
"debug" -> ReleaseChannel.Debug
"nightly" -> ReleaseChannel.Nightly
"beta" -> ReleaseChannel.Beta
"release" -> ReleaseChannel.Release
else -> {
throw IllegalStateException("Unknown build type: ${BuildConfig.BUILD_TYPE}")
}
......@@ -79,6 +67,6 @@ object Config {
}
private val fennecChannels: List<ReleaseChannel> = listOf(
ReleaseChannel.FennecBeta,
ReleaseChannel.FennecProduction
ReleaseChannel.Beta,
ReleaseChannel.Release
)
......@@ -102,9 +102,9 @@ fun isSentryEnabled() = !BuildConfig.SENTRY_TOKEN.isNullOrEmpty()
private fun getSentryProjectUrl(): String? {
val baseUrl = "https://sentry.prod.mozaws.net/operations"
return when (Config.channel) {
ReleaseChannel.FenixProduction -> "$baseUrl/fenix"
ReleaseChannel.FennecProduction -> "$baseUrl/fenix-fennec"
ReleaseChannel.FennecBeta -> "$baseUrl/fenix-fennec-beta"
ReleaseChannel.Nightly -> "$baseUrl/fenix"
ReleaseChannel.Release -> "$baseUrl/fenix-fennec"
ReleaseChannel.Beta -> "$baseUrl/fenix-fennec-beta"
else -> null
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment