Update the temporary detekt ktlint aliases with top-level detekt plugin. With current implementation, the mach instances are overwriting and corrupting the same objdir causing failures even without touching code. This is not caught by try as it runs subproject linters sequentially. Differential Revision: https://phabricator.services.mozilla.com/D311097
136 lines
6.7 KiB
Groovy
136 lines
6.7 KiB
Groovy
import org.gradle.tooling.events.FinishEvent
|
|
import org.gradle.tooling.events.OperationCompletionListener
|
|
|
|
pluginManagement {
|
|
if (!gradle.root.hasProperty("mozconfig")){
|
|
apply from: file('mobile/android/gradle/mozconfig.gradle')
|
|
} else {
|
|
gradle.ext.mozconfig = gradle.root.mozconfig
|
|
gradle.ext.configureMavenRepositories = gradle.root.ext.configureMavenRepositories
|
|
}
|
|
|
|
repositories {
|
|
gradle.configureMavenRepositories(delegate)
|
|
}
|
|
|
|
includeBuild("${rootProject.projectDir.absolutePath}/mobile/android/gradle/plugins/conventions")
|
|
includeBuild("${rootProject.projectDir.absolutePath}/mobile/android/android-components/plugins/config")
|
|
includeBuild("${rootProject.projectDir.absolutePath}/mobile/android/android-components/plugins/dependencies")
|
|
includeBuild("${rootProject.projectDir.absolutePath}/mobile/android/android-components/plugins/publicsuffixlist")
|
|
includeBuild("${rootProject.projectDir.absolutePath}/mobile/android/fenix/plugins/apksize")
|
|
includeBuild("${rootProject.projectDir.absolutePath}/mobile/android/gradle/plugins/apilint")
|
|
includeBuild("${rootProject.projectDir.absolutePath}/mobile/android/gradle/plugins/nimbus-gradle-plugin")
|
|
}
|
|
|
|
plugins {
|
|
id 'org.mozilla.conventions.settings'
|
|
id 'mozac.DependenciesPlugin'
|
|
}
|
|
|
|
// You might think topsrcdir is '.', but that's not true when the Gradle build
|
|
// is launched from within IntelliJ.
|
|
ext.topsrcdir = rootProject.projectDir.absolutePath
|
|
|
|
apply from: "${topsrcdir}/mobile/android/shared-settings.gradle"
|
|
|
|
if (gradle.ext.mozconfig.substs.MOZ_APPSERVICES_IN_TREE) {
|
|
apply from: "${topsrcdir}/third_party/application-services/settings.gradle"
|
|
}
|
|
|
|
// Set the Android SDK location. This is the *least specific* mechanism, which
|
|
// is unfortunate: we'd prefer to use the *most specific* mechanism. That is,
|
|
// local.properties (first 'sdk.dir', then 'android.dir') and then the
|
|
// environment variable ANDROID_HOME will override this. That's unfortunate,
|
|
// but it's hard to automatically arrange better.
|
|
System.setProperty('android.home', gradle.mozconfig.substs.ANDROID_SDK_ROOT)
|
|
|
|
include ':annotations', ':messaging_example', ':port_messaging_example'
|
|
include ':geckoview'
|
|
include ':android-components'
|
|
|
|
project(':annotations').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/annotations")
|
|
project(':geckoview').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/geckoview")
|
|
project(':android-components').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/android-components")
|
|
|
|
if (!gradle.mozconfig.substs.MOZ_ANDROID_SUBPROJECT || gradle.mozconfig.substs.MOZ_ANDROID_SUBPROJECT == "fenix") {
|
|
include ':fenix'
|
|
project(':fenix').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/fenix/app")
|
|
include ':mozilla-detekt-rules'
|
|
project(':mozilla-detekt-rules').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/fenix/mozilla-detekt-rules")
|
|
include ':fenix:longfox'
|
|
project(':fenix:longfox').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/fenix/app/longfox")
|
|
include ':fenix:benchmark'
|
|
project(':fenix:benchmark').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/fenix/benchmark")
|
|
}
|
|
if (!gradle.mozconfig.substs.MOZ_ANDROID_SUBPROJECT || gradle.mozconfig.substs.MOZ_ANDROID_SUBPROJECT == "focus") {
|
|
include ':focus-android'
|
|
project(':focus-android').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/focus-android/app")
|
|
}
|
|
if (!gradle.mozconfig.substs.MOZ_ANDROID_SUBPROJECT || gradle.mozconfig.substs.MOZ_ANDROID_SUBPROJECT == "geckoview_example") {
|
|
include ':components:samples-acorn-components'
|
|
include ':components:samples-browser'
|
|
include ':components:samples-compose-browser'
|
|
include ':components:samples-toolbar'
|
|
include ':geckoview_example'
|
|
include ':test_runner'
|
|
project(':test_runner').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/test_runner")
|
|
project(':geckoview_example').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/geckoview_example")
|
|
project(':components:samples-acorn-components').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/android-components/samples/acorn-components")
|
|
project(':components:samples-browser').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/android-components/samples/browser")
|
|
project(':components:samples-compose-browser').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/android-components/samples/compose-browser")
|
|
project(':components:samples-toolbar').projectDir = new File("${gradle.mozconfig.topsrcdir}/mobile/android/android-components/samples/toolbar")
|
|
}
|
|
|
|
if (hasProperty("androidFormatLintTest")) {
|
|
include ':androidFormatLintTest'
|
|
project(':androidFormatLintTest').projectDir = new File("${gradle.mozconfig.topsrcdir}/tools/lint/test/files/android-format")
|
|
}
|
|
|
|
project(':messaging_example').projectDir = new File('mobile/android/examples/messaging_example/app')
|
|
project(':port_messaging_example').projectDir = new File('mobile/android/examples/port_messaging_example/app')
|
|
|
|
// Print BUILDSTATUS lines for build profile markers.
|
|
//
|
|
// Listeners configured here are "more" global: they get events for (isolated)
|
|
// projects that use `includeBuild`.
|
|
//
|
|
// In addition, build events listeners implemented as build services are
|
|
// "configuration cache friendly"; task actions (`doFirst`, `doLast`, etc) are
|
|
// not.
|
|
|
|
def now() {
|
|
Instant now = Instant.now();
|
|
return BigDecimal.valueOf(now.getNano(), 9).add(now.getEpochSecond());
|
|
}
|
|
|
|
abstract class BuildStatusListener implements BuildService<BuildStatusListener.Params>, OperationCompletionListener {
|
|
interface Params extends BuildServiceParameters {
|
|
}
|
|
|
|
void onFinish(FinishEvent event) {
|
|
def operationResult = event.result
|
|
println("BUILDSTATUS ${BigDecimal.valueOf(operationResult.startTime, 3)} START_gradle-task ${event.descriptor.name}")
|
|
println("BUILDSTATUS ${BigDecimal.valueOf(operationResult.endTime, 3)} END_gradle-task ${event.descriptor.name}")
|
|
}
|
|
}
|
|
|
|
def shouldPrintBuildStatus = System.getenv("MACH") && !System.getenv("NO_BUILDSTATUS_MESSAGES")
|
|
|
|
if (shouldPrintBuildStatus) {
|
|
gradle.services.get(BuildEventsListenerRegistry).onTaskCompletion(
|
|
gradle.sharedServices.registerIfAbsent("buildStatus", BuildStatusListener.class) {}
|
|
)
|
|
|
|
gradle.addProjectEvaluationListener(new ProjectEvaluationListener() {
|
|
@Override
|
|
void beforeEvaluate(Project p) {
|
|
println("BUILDSTATUS ${now()} START_gradle:evaluate-project ${p.name}")
|
|
}
|
|
|
|
@Override
|
|
void afterEvaluate(Project p, ProjectState projectState) {
|
|
println("BUILDSTATUS ${now()} END_gradle:evaluate-project ${p.name}")
|
|
}
|
|
})
|
|
}
|