modules/libpref/moz.build
author Drew Willcoxon <adw@mozilla.com>
Mon, 29 Nov 2021 17:26:15 +0000
changeset 600399 408b89a2e02cccd63dbe5c451ac1c6b248379534
parent 589878 3e615329b0a3a5aa2029c68dd84bfd5eb2acaeda
permissions -rw-r--r--
Bug 1741479 - Turn on Merino as a Firefox Suggest source. r=nanj,webdriver-reviewers,whimboo We only need to default `browser.urlbar.merino.enabled` to true. If the user has opted in (either through the modal or by toggling on the data collection pref in the prefs UI), then `quicksuggest.dataCollection.enabled` will also be true and we'll fetch Merino suggestions. Otherwise it will be false and we won't fetch Merino suggestions. That logic is implemented here: https://searchfox.org/mozilla-central/rev/9a5f36b0ddb9cb8ae556fc5b45f8ccea0f0da6f8/browser/components/urlbar/UrlbarProviderQuickSuggest.jsm#144 Note this defaults the pref to true for everyone, even users in offline. It make senses now that we have a separate toggle for data collection in the preferences UI. Even offline users can opt in to Merino and data collection. I also updated the various sets of prefs for test suites so that the Merino endpoint URL is empty when running tests so they don't hit the network. I could have forced `merino.enabled` to false instead, but setting the endpoint URL has a couple of benefits, although admittedly they're very small: * It runs a little more of the Merino code path (i.e., calls `_fetchMerinoSuggestions`) * It lets Merino tests set only one pref, the endpoint URL, instead of two, both the endpoint pref and enabled pref Differential Revision: https://phabricator.services.mozilla.com/D131988

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.

with Files("**"):
    BUG_COMPONENT = ("Core", "Preferences: Backend")

if CONFIG["ENABLE_TESTS"]:
    DIRS += ["test/gtest"]

XPCSHELL_TESTS_MANIFESTS += [
    "test/unit/xpcshell.ini",
    "test/unit_ipc/xpcshell.ini",
]

XPIDL_SOURCES += [
    "nsIPrefBranch.idl",
    "nsIPrefLocalizedString.idl",
    "nsIPrefService.idl",
    "nsIRelativeFilePref.idl",
]

XPIDL_MODULE = "pref"

pref_groups = [
    "accessibility",
    "alerts",
    "apz",
    "beacon",
    "bidi",
    "browser",
    "canvas",
    "channelclassifier",
    "clipboard",
    "content",
    "converter",
    "datareporting",
    "device",
    "devtools",
    "docshell",
    "dom",
    "editor",
    "extensions",
    "findbar",
    "fission",
    "font",
    "full_screen_api",
    "general",
    "geo",
    "gfx",
    "gl",
    "html5",
    "idle_period",
    "image",
    "intl",
    "javascript",
    "layers",
    "layout",
    "mathml",
    "media",
    "mousewheel",
    "network",
    "nglayout",
    "page_load",
    "permissions",
    "plain_text",
    "plugin",
    "plugins",
    "preferences",
    "print",
    "privacy",
    "prompts",
    "security",
    "signon",
    "slider",
    "storage",
    "svg",
    "telemetry",
    "test",
    "threads",
    "timer",
    "toolkit",
    "ui",
    "urlclassifier",
    "view_source",
    "webgl",
    "widget",
    "xul",
    "zoom",
]
if CONFIG["OS_TARGET"] == "Android":
    pref_groups += [
        "android",
        "consoleservice",
    ]
if CONFIG["FUZZING"]:
    pref_groups += ["fuzzing"]
pref_groups = tuple(sorted(pref_groups))

# Note: generate_static_pref_list.py relies on StaticPrefListAll.h being first.
gen_h = ["init/StaticPrefListAll.h"]
gen_h += ["StaticPrefsAll.h"]
gen_h += ["init/StaticPrefList_{}.h".format(pg) for pg in pref_groups]
gen_h += ["StaticPrefs_{}.h".format(pg) for pg in pref_groups]

gen_cpp = ["init/StaticPrefsCGetters.cpp"]

gen_rs = ["static_prefs.rs"]

EXPORTS.mozilla += [
    "init/StaticPrefListBegin.h",
    "init/StaticPrefListEnd.h",
    "nsRelativeFilePref.h",
    "Preferences.h",
    "StaticPrefsBase.h",
]
EXPORTS.mozilla += sorted(["!" + g for g in gen_h])

UNIFIED_SOURCES += [
    "Preferences.cpp",
    "SharedPrefMap.cpp",
]

gen_all_tuple = tuple(gen_h + gen_cpp + gen_rs)

GeneratedFile(
    *gen_all_tuple,
    script="init/generate_static_pref_list.py",
    entry_point="emit_code",
    inputs=["init/StaticPrefList.yaml"]
)

PYTHON_UNITTEST_MANIFESTS += [
    "test/python.ini",
]

XPCOM_MANIFESTS += [
    "components.conf",
]

SPHINX_TREES["/modules/libpref"] = "docs"

include("/ipc/chromium/chromium-config.mozbuild")

FINAL_LIBRARY = "xul"

DEFINES["OS_ARCH"] = CONFIG["OS_ARCH"]
DEFINES["MOZ_WIDGET_TOOLKIT"] = CONFIG["MOZ_WIDGET_TOOLKIT"]

if CONFIG["MOZ_SERVICES_SYNC"]:
    DEFINES["MOZ_SERVICES_SYNC"] = True

if CONFIG["MOZ_BUILD_APP"] == "browser":
    DEFINES["MOZ_BUILD_APP_IS_BROWSER"] = True

if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
    if not CONFIG["MOZ_ANDROID_FAT_AAR_ARCHITECTURES"]:
        FINAL_TARGET_PP_FILES[CONFIG["ANDROID_CPU_ARCH"]] += [
            "greprefs.js",
        ]
    else:
        for arch in CONFIG["MOZ_ANDROID_FAT_AAR_ARCHITECTURES"]:
            FINAL_TARGET_FILES[arch] += [
                "!/dist/fat-aar/output/{arch}/greprefs.js".format(arch=arch),
            ]
else:
    FINAL_TARGET_PP_FILES += [
        "greprefs.js",
    ]

if CONFIG["MOZ_BACKGROUNDTASKS"]:
    DEFINES["MOZ_BACKGROUNDTASKS"] = True

REQUIRES_UNIFIED_BUILD = True