Bug 1724782 - Allow substituting GeckoView lite and omni builds. r=nalexander

Differential Revision: https://phabricator.services.mozilla.com/D122142
This commit is contained in:
Agi Sferro 2021-08-10 20:24:33 +00:00
parent 00f5f2fce4
commit 9df33a60f4

View File

@ -28,6 +28,10 @@ def log(message) {
logger.lifecycle("[substitute-local-geckoview] ${message}") logger.lifecycle("[substitute-local-geckoview] ${message}")
} }
def warn(message) {
logger.warn("[substitute-local-geckoview] Warning: ${message}")
}
if (!project.ext.has('topsrcdir')) { if (!project.ext.has('topsrcdir')) {
throw new GradleException("ext.topsrcdir must be specified to substitute for a local GeckoView") throw new GradleException("ext.topsrcdir must be specified to substitute for a local GeckoView")
} }
@ -59,7 +63,7 @@ if (!ext.has('topobjdir')) {
} }
if (mozconfig.substs.MOZ_BUILD_APP != 'mobile/android') { if (mozconfig.substs.MOZ_BUILD_APP != 'mobile/android') {
throw new GradleException("Building with Gradle is only supported for Fennec, i.e., MOZ_BUILD_APP == 'mobile/android'.") throw new GradleException("Building with Gradle is only supported for GeckoView, i.e., MOZ_BUILD_APP == 'mobile/android'.")
} }
log("Will substitute GeckoView (geckoview-{nightly,beta}) with local GeckoView (geckoview-default) from ${topobjdir}/gradle/build/mobile/android/geckoview/maven") log("Will substitute GeckoView (geckoview-{nightly,beta}) with local GeckoView (geckoview-default) from ${topobjdir}/gradle/build/mobile/android/geckoview/maven")
@ -124,11 +128,22 @@ configurations.all { config ->
if (group == 'org.mozilla.geckoview' if (group == 'org.mozilla.geckoview'
&& (geckoviewModules.contains(module) || geckoviewOmniModules.contains(module))) { && (geckoviewModules.contains(module) || geckoviewOmniModules.contains(module))) {
def name = '' def name = ''
if (geckoviewOmniModules.contains(module)) { def isLite = mozconfig.substs.MOZ_ANDROID_GECKOVIEW_LITE
name = 'geckoview-default-omni'
} else { if (isLite) {
name = 'geckoview-default' name = 'geckoview-default'
} else {
name = 'geckoview-default-omni'
} }
if (geckoviewModules.contains(module) && !isLite) {
warn("Substituting a geckoview omni build into a lite dependency. Add ac_add_options --enable-geckoview-lite to ${mozconfig.mozconfig.path} to fix this.")
} else if (geckoviewOmniModules.contains(module) && isLite) {
// Substituting lite into omni is unlikely to work at
// all so we just error out here.
throw new GradleException("Substituting a geckoview lite build into an omni dependency. Remove ac_add_options --enable-geckoview-lite in ${mozconfig.mozconfig.path} to fix this.")
}
log("Substituting ${group}:${dependency.requested.module} with local GeckoView ${group}:${name} in ${config}") log("Substituting ${group}:${dependency.requested.module} with local GeckoView ${group}:${name} in ${config}")
dependency.useTarget([group: group, name: name, version: '+']) dependency.useTarget([group: group, name: name, version: '+'])