2019-05-10 00:05:49 +02:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2019-07-12 20:38:15 +02:00
|
|
|
* 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/. */
|
2019-05-10 00:05:49 +02:00
|
|
|
|
|
|
|
package org.mozilla.fenix
|
|
|
|
|
|
|
|
enum class ReleaseChannel {
|
2020-01-10 15:21:30 +01:00
|
|
|
FenixDebug,
|
|
|
|
|
|
|
|
FenixProduction,
|
|
|
|
|
|
|
|
FennecProduction,
|
2020-07-21 16:42:08 +02:00
|
|
|
FennecBeta;
|
2019-05-10 00:05:49 +02:00
|
|
|
|
|
|
|
val isReleased: Boolean
|
|
|
|
get() = when (this) {
|
2019-11-05 21:28:14 +01:00
|
|
|
FenixDebug -> false
|
2019-06-03 16:32:38 +02:00
|
|
|
else -> true
|
2019-05-10 00:05:49 +02:00
|
|
|
}
|
2019-11-05 00:47:46 +01:00
|
|
|
|
2019-12-20 22:08:18 +01:00
|
|
|
/**
|
|
|
|
* True if this is a debug release channel, false otherwise.
|
|
|
|
*
|
|
|
|
* This constant should often be used instead of [BuildConfig.DEBUG], which indicates
|
|
|
|
* if the `debuggable` flag is set which can be true even on released channel builds
|
|
|
|
* (e.g. performance).
|
|
|
|
*/
|
|
|
|
val isDebug: Boolean
|
|
|
|
get() = !this.isReleased
|
|
|
|
|
2019-11-05 00:47:46 +01:00
|
|
|
val isReleaseOrBeta: Boolean
|
|
|
|
get() = when (this) {
|
2020-01-08 13:35:14 +01:00
|
|
|
FennecProduction -> true
|
|
|
|
FennecBeta -> true
|
2019-11-05 21:28:14 +01:00
|
|
|
else -> false
|
|
|
|
}
|
|
|
|
|
2020-01-23 00:12:24 +01:00
|
|
|
val isBeta: Boolean
|
|
|
|
get() = when (this) {
|
|
|
|
FennecBeta -> true
|
|
|
|
else -> false
|
|
|
|
}
|
|
|
|
|
2019-11-05 21:28:14 +01:00
|
|
|
val isNightlyOrDebug: Boolean
|
|
|
|
get() = when (this) {
|
|
|
|
FenixDebug -> true
|
2020-07-01 11:03:10 +02:00
|
|
|
FenixProduction -> true
|
2019-11-05 00:47:46 +01:00
|
|
|
else -> false
|
|
|
|
}
|
2020-01-10 15:21:30 +01:00
|
|
|
|
|
|
|
val isFennec: Boolean
|
|
|
|
get() = this in fennecChannels
|
2020-01-23 17:06:04 +01:00
|
|
|
|
|
|
|
val isFenix: Boolean
|
|
|
|
get() = !isFennec
|
2019-05-10 00:05:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
object Config {
|
|
|
|
val channel = when (BuildConfig.BUILD_TYPE) {
|
2019-11-05 21:28:14 +01:00
|
|
|
"fenixProduction" -> ReleaseChannel.FenixProduction
|
|
|
|
"debug" -> ReleaseChannel.FenixDebug
|
|
|
|
"fennecProduction" -> ReleaseChannel.FennecProduction
|
2020-01-08 13:35:14 +01:00
|
|
|
"fennecBeta" -> ReleaseChannel.FennecBeta
|
2019-12-20 22:13:45 +01:00
|
|
|
|
|
|
|
// 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
|
|
|
|
|
2019-11-05 21:28:14 +01:00
|
|
|
else -> {
|
2019-12-20 22:13:45 +01:00
|
|
|
throw IllegalStateException("Unknown build type: ${BuildConfig.BUILD_TYPE}")
|
2019-11-05 21:28:14 +01:00
|
|
|
}
|
2019-05-10 00:05:49 +02:00
|
|
|
}
|
|
|
|
}
|
2020-01-10 15:21:30 +01:00
|
|
|
|
|
|
|
private val fennecChannels: List<ReleaseChannel> = listOf(
|
|
|
|
ReleaseChannel.FennecBeta,
|
|
|
|
ReleaseChannel.FennecProduction
|
|
|
|
)
|