Migrates "raptor" build type to work for chrome-perf-testing, too (#2926)
parent
d285e799b9
commit
62473e5e86
|
@ -21,7 +21,8 @@ android {
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
testInstrumentationRunnerArguments clearPackageData: 'true'
|
testInstrumentationRunnerArguments clearPackageData: 'true'
|
||||||
manifestPlaceholders.isRaptorEnabled = "false"
|
manifestPlaceholders.isRaptorEnabled = "false"
|
||||||
resValue "bool", "IS_DEBUG", "true"
|
resValue "bool", "IS_DEBUG", "false"
|
||||||
|
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "false"
|
||||||
}
|
}
|
||||||
|
|
||||||
def releaseTemplate = {
|
def releaseTemplate = {
|
||||||
|
@ -37,17 +38,19 @@ android {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
applicationIdSuffix ".debug"
|
applicationIdSuffix ".debug"
|
||||||
manifestPlaceholders.isRaptorEnabled = "true"
|
manifestPlaceholders.isRaptorEnabled = "true"
|
||||||
|
resValue "bool", "IS_DEBUG", "true"
|
||||||
}
|
}
|
||||||
raptor releaseTemplate >> { // the ">>" concatenates the raptor-specific options with the template
|
forPerformanceTest releaseTemplate >> { // the ">>" concatenates the raptor-specific options with the template
|
||||||
manifestPlaceholders.isRaptorEnabled = "true"
|
manifestPlaceholders.isRaptorEnabled = "true"
|
||||||
applicationIdSuffix ".raptor"
|
applicationIdSuffix ".performancetest"
|
||||||
|
debuggable true
|
||||||
}
|
}
|
||||||
nightly releaseTemplate >> {
|
nightly releaseTemplate >> {
|
||||||
resValue "bool", "IS_DEBUG", "false"
|
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
|
||||||
}
|
}
|
||||||
beta releaseTemplate >> {
|
beta releaseTemplate >> {
|
||||||
applicationIdSuffix ".beta"
|
applicationIdSuffix ".beta"
|
||||||
resValue "bool", "IS_DEBUG", "false"
|
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,10 +128,10 @@ android.applicationVariants.all { variant ->
|
||||||
|
|
||||||
def buildType = variant.buildType.name
|
def buildType = variant.buildType.name
|
||||||
def versionCode = null
|
def versionCode = null
|
||||||
def releaseChannels = ["nightly", "beta", "release"]
|
def isDebug = variant.buildType.resValues['IS_DEBUG']?.value ?: false
|
||||||
def isReleased = releaseChannels.contains(buildType)
|
def useReleaseVersioning = variant.buildType.buildConfigFields['USE_RELEASE_VERSIONING']?.value ?: false
|
||||||
|
|
||||||
if (isReleased) {
|
if (useReleaseVersioning) {
|
||||||
versionCode = generatedVersionCode
|
versionCode = generatedVersionCode
|
||||||
|
|
||||||
// The Google Play Store does not allow multiple APKs for the same app that all have the
|
// The Google Play Store does not allow multiple APKs for the same app that all have the
|
||||||
|
@ -171,32 +174,29 @@ android.applicationVariants.all { variant ->
|
||||||
}
|
}
|
||||||
|
|
||||||
println("----------------------------------------------")
|
println("----------------------------------------------")
|
||||||
println("Variant name: " + variant.name)
|
println("Variant name: " + variant.name)
|
||||||
println("Build type: " + variant.buildType.name)
|
println("Build type: " + variant.buildType.name)
|
||||||
println("Flavor: " + variant.flavorName)
|
println("Flavor: " + variant.flavorName)
|
||||||
println("Version code: " + (versionCode ?: variant.mergedFlavor.versionCode))
|
println("Version code: " + (versionCode ?: variant.mergedFlavor.versionCode))
|
||||||
|
println("Telemetry enabled: " + !isDebug)
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------
|
||||||
// BuildConfig: Set variables for Sentry, Crash Reporting, and Telemetry
|
// BuildConfig: Set variables for Sentry, Crash Reporting, and Telemetry
|
||||||
// -------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Reading sentry token from local file (if it exists). In a release task on taskcluster it will be available.
|
buildConfigField 'String', 'SENTRY_TOKEN', 'null'
|
||||||
try {
|
if (!isDebug) {
|
||||||
def token = new File("${rootDir}/.sentry_token").text.trim()
|
|
||||||
buildConfigField 'String', 'SENTRY_TOKEN', '"' + token + '"'
|
|
||||||
} catch (FileNotFoundException ignored) {
|
|
||||||
buildConfigField 'String', 'SENTRY_TOKEN', 'null'
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activating crash reporting only if command line parameter was provided (in automation)
|
|
||||||
if (project.hasProperty("crashReports") && project.property("crashReports") == "true") {
|
|
||||||
buildConfigField 'boolean', 'CRASH_REPORTING', 'true'
|
buildConfigField 'boolean', 'CRASH_REPORTING', 'true'
|
||||||
|
// Reading sentry token from local file (if it exists). In a release task on taskcluster it will be available.
|
||||||
|
try {
|
||||||
|
def token = new File("${rootDir}/.sentry_token").text.trim()
|
||||||
|
buildConfigField 'String', 'SENTRY_TOKEN', '"' + token + '"'
|
||||||
|
} catch (FileNotFoundException ignored) {}
|
||||||
} else {
|
} else {
|
||||||
buildConfigField 'boolean', 'CRASH_REPORTING', 'false'
|
buildConfigField 'boolean', 'CRASH_REPORTING', 'false'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activating telemetry only if command line parameter was provided (in automation)
|
if (!isDebug) {
|
||||||
if (project.hasProperty("telemetry") && project.property("telemetry") == "true") {
|
|
||||||
buildConfigField 'boolean', 'TELEMETRY', 'true'
|
buildConfigField 'boolean', 'TELEMETRY', 'true'
|
||||||
} else {
|
} else {
|
||||||
buildConfigField 'boolean', 'TELEMETRY', 'false'
|
buildConfigField 'boolean', 'TELEMETRY', 'false'
|
||||||
|
@ -213,7 +213,7 @@ android.applicationVariants.all { variant ->
|
||||||
|
|
||||||
print("Adjust token: ")
|
print("Adjust token: ")
|
||||||
|
|
||||||
if (isReleased) {
|
if (!isDebug) {
|
||||||
try {
|
try {
|
||||||
def token = new File("${rootDir}/.adjust_token").text.trim()
|
def token = new File("${rootDir}/.adjust_token").text.trim()
|
||||||
buildConfigField 'String', 'ADJUST_TOKEN', '"' + token + '"'
|
buildConfigField 'String', 'ADJUST_TOKEN', '"' + token + '"'
|
||||||
|
@ -249,7 +249,7 @@ android.applicationVariants.all { variant ->
|
||||||
// -------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------
|
||||||
// Feature build flags
|
// Feature build flags
|
||||||
// -------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------
|
||||||
buildConfigField 'Boolean', 'SEND_TAB_ENABLED', (buildType == "nightly" || !isReleased).toString()
|
buildConfigField 'Boolean', 'SEND_TAB_ENABLED', (buildType == "nightly" || isDebug).toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
androidExtensions {
|
androidExtensions {
|
||||||
|
@ -395,10 +395,6 @@ dependencies {
|
||||||
releaseImplementation Deps.flipper_noop
|
releaseImplementation Deps.flipper_noop
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.hasProperty("raptor")) {
|
|
||||||
android.defaultConfig.manifestPlaceholders.isRaptorEnabled = "true"
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------
|
||||||
// Task for printing all build variants to build variants in parallel in automation
|
// Task for printing all build variants to build variants in parallel in automation
|
||||||
// -------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -5,20 +5,21 @@
|
||||||
package org.mozilla.fenix
|
package org.mozilla.fenix
|
||||||
|
|
||||||
enum class ReleaseChannel {
|
enum class ReleaseChannel {
|
||||||
Debug, Nightly, Beta, Release;
|
Debug, Nightly, Beta, Production;
|
||||||
|
|
||||||
val isReleased: Boolean
|
val isReleased: Boolean
|
||||||
get() = when (this) {
|
get() = when (this) {
|
||||||
Release, Beta, Nightly -> true
|
Debug -> false
|
||||||
else -> false
|
else -> true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object Config {
|
object Config {
|
||||||
val channel = when (BuildConfig.BUILD_TYPE) {
|
val channel = when (BuildConfig.BUILD_TYPE) {
|
||||||
"release" -> ReleaseChannel.Release
|
"production" -> ReleaseChannel.Production
|
||||||
"beta" -> ReleaseChannel.Beta
|
"beta" -> ReleaseChannel.Beta
|
||||||
"nightly" -> ReleaseChannel.Nightly
|
"nightly" -> ReleaseChannel.Nightly
|
||||||
else -> ReleaseChannel.Debug
|
"debug" -> ReleaseChannel.Debug
|
||||||
|
else -> ReleaseChannel.Production // Performance-test builds should test production behaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,9 +89,9 @@ def raptor(is_staging):
|
||||||
mozharness_task_id = fetch_mozharness_task_id(geckoview_nightly_version)
|
mozharness_task_id = fetch_mozharness_task_id(geckoview_nightly_version)
|
||||||
gecko_revision = taskcluster.Queue().task(mozharness_task_id)['payload']['env']['GECKO_HEAD_REV']
|
gecko_revision = taskcluster.Queue().task(mozharness_task_id)['payload']['env']['GECKO_HEAD_REV']
|
||||||
|
|
||||||
for variant in [Variant.from_values(abi, False, 'raptor') for abi in ('aarch64', 'arm')]:
|
for variant in [Variant.from_values(abi, False, 'forPerformanceTest') for abi in ('aarch64', 'arm')]:
|
||||||
assemble_task_id = taskcluster.slugId()
|
assemble_task_id = taskcluster.slugId()
|
||||||
build_tasks[assemble_task_id] = BUILDER.craft_assemble_task(variant)
|
build_tasks[assemble_task_id] = BUILDER.craft_assemble_raptor_task(variant)
|
||||||
signing_task_id = taskcluster.slugId()
|
signing_task_id = taskcluster.slugId()
|
||||||
signing_tasks[signing_task_id] = BUILDER.craft_raptor_signing_task(assemble_task_id, variant, is_staging)
|
signing_tasks[signing_task_id] = BUILDER.craft_raptor_signing_task(assemble_task_id, variant, is_staging)
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ class TaskBuilder(object):
|
||||||
|
|
||||||
capitalized_track = upper_case_first_letter(track)
|
capitalized_track = upper_case_first_letter(track)
|
||||||
gradle_commands = (
|
gradle_commands = (
|
||||||
'./gradlew --no-daemon -PcrashReports=true -Ptelemetry=true -PversionName={} clean test assemble{}'.format(
|
'./gradlew --no-daemon -PversionName={} clean test assemble{}'.format(
|
||||||
version_name, capitalized_track),
|
version_name, capitalized_track),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -111,6 +111,30 @@ class TaskBuilder(object):
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def craft_assemble_raptor_task(self, variant):
|
||||||
|
command = ' && '.join((
|
||||||
|
'echo "https://fake@sentry.prod.mozaws.net/368" > .sentry_token',
|
||||||
|
'echo "--" > .adjust_token',
|
||||||
|
'echo "-:-" > .leanplum_token',
|
||||||
|
'./gradlew --no-daemon clean assemble{}'.format(variant.for_gradle_command),
|
||||||
|
))
|
||||||
|
|
||||||
|
return self._craft_build_ish_task(
|
||||||
|
name='assemble: {}'.format(variant.raw),
|
||||||
|
description='Building and testing variant {}'.format(variant.raw),
|
||||||
|
command=command,
|
||||||
|
artifacts=_craft_artifacts_from_variant(variant),
|
||||||
|
treeherder={
|
||||||
|
'groupSymbol': variant.build_type,
|
||||||
|
'jobKind': 'build',
|
||||||
|
'machine': {
|
||||||
|
'platform': variant.platform,
|
||||||
|
},
|
||||||
|
'symbol': 'A',
|
||||||
|
'tier': 1,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
def craft_assemble_task(self, variant):
|
def craft_assemble_task(self, variant):
|
||||||
return self._craft_clean_gradle_task(
|
return self._craft_clean_gradle_task(
|
||||||
name='assemble: {}'.format(variant.raw),
|
name='assemble: {}'.format(variant.raw),
|
||||||
|
@ -379,13 +403,13 @@ class TaskBuilder(object):
|
||||||
):
|
):
|
||||||
staging_prefix = '.staging' if is_staging else ''
|
staging_prefix = '.staging' if is_staging else ''
|
||||||
routes = [
|
routes = [
|
||||||
"index.project.mobile.fenix.v2{}.raptor.{}.{}.{}.latest.{}".format(
|
"index.project.mobile.fenix.v2{}.performance-test.{}.{}.{}.latest.{}".format(
|
||||||
staging_prefix, self.date.year, self.date.month, self.date.day, variant.abi
|
staging_prefix, self.date.year, self.date.month, self.date.day, variant.abi
|
||||||
),
|
),
|
||||||
"index.project.mobile.fenix.v2{}.raptor.{}.{}.{}.revision.{}.{}".format(
|
"index.project.mobile.fenix.v2{}.performance-test.{}.{}.{}.revision.{}.{}".format(
|
||||||
staging_prefix, self.date.year, self.date.month, self.date.day, self.commit, variant.abi
|
staging_prefix, self.date.year, self.date.month, self.date.day, self.commit, variant.abi
|
||||||
),
|
),
|
||||||
"index.project.mobile.fenix.v2{}.raptor.latest.{}".format(staging_prefix, variant.abi),
|
"index.project.mobile.fenix.v2{}.performance-test.latest.{}".format(staging_prefix, variant.abi),
|
||||||
]
|
]
|
||||||
|
|
||||||
return self._craft_signing_task(
|
return self._craft_signing_task(
|
||||||
|
@ -549,7 +573,7 @@ class TaskBuilder(object):
|
||||||
"--cfg=mozharness/configs/raptor/android_hw_config.py",
|
"--cfg=mozharness/configs/raptor/android_hw_config.py",
|
||||||
"--test={}".format(test_name),
|
"--test={}".format(test_name),
|
||||||
"--app=fenix",
|
"--app=fenix",
|
||||||
"--binary=org.mozilla.fenix.raptor",
|
"--binary=org.mozilla.fenix.performancetest",
|
||||||
"--activity=org.mozilla.fenix.browser.BrowserPerformanceTestActivity",
|
"--activity=org.mozilla.fenix.browser.BrowserPerformanceTestActivity",
|
||||||
"--download-symbols=ondemand",
|
"--download-symbols=ondemand",
|
||||||
]],
|
]],
|
||||||
|
|
Loading…
Reference in New Issue