Bug 1892641 - Add profile markers for gradle project evaluations and task executions to capture execution times in the build profiles. r=florian,glandium

Differential Revision: https://phabricator.services.mozilla.com/D208094
This commit is contained in:
kycn 2024-04-30 08:17:13 +00:00
parent 96e3e43921
commit b0f26d11ff

View file

@ -73,6 +73,34 @@ def getRustVersionFor(packageName) {
} }
allprojects { allprojects {
def shouldPrintBuildStatus =
System.getenv("MACH") && !System.getenv("NO_BUILDSTATUS_MESSAGES")
if (shouldPrintBuildStatus) {
// Adding new line before each line to make sure they're dumped as a separate line.
// Add profile marker to the start of the project evaluation
project.beforeEvaluate {
println "\nBUILDSTATUS START_gradle:evaluate-project ${project.name}"
}
// Add profile marker to the end of the project evaluation
project.afterEvaluate {
println "\nBUILDSTATUS END_gradle:evaluate-project ${project.name}"
}
tasks.configureEach { task ->
// Add profile marker to the start of the gradle task
task.doFirst {
println "\nBUILDSTATUS START_gradle:${project.name}-tasks ${task.name}"
}
// Add profile marker to the end of the gradle task
task.doLast {
println "\nBUILDSTATUS END_gradle:${project.name}-tasks ${task.name}"
}
}
}
// Expose the per-object-directory configuration to all projects. // Expose the per-object-directory configuration to all projects.
ext { ext {
mozconfig = gradle.mozconfig mozconfig = gradle.mozconfig