mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
12640bca82
This patch introduces a new Rust crate called `static_prefs`. It also changes generate_static_pref_list.py to generate two new files. - StaticPrefsCGetters.cpp: contains C getters, which are just wrappers around the C++ getters. This is included into Preferences.cpp. - static_prefs.rs: contains declarations for the C getters, plus the `pref!` macro which provides nice syntax for calling the C getters. This is included into static_prefs/src/lib.rs. The new code is only generated for prefs marked with the new `rust` field in the YAML. It's opt-in because there's no point generating additional code for 900+ static prefs when only about 20 are currently used from Rust. This patch only marks a single pref (`browser.display.document_color_use`) with `rust: true`. That pref isn't accessed from Rust code in this patch, but it's necessary because the generated Rust code is invalid if there are zero Rust-accessed prefs. (The next patch will access that pref and others from Rust code. Differential Revision: https://phabricator.services.mozilla.com/D40791 --HG-- extra : moz-landing-system : lando
151 lines
3.2 KiB
Python
151 lines
3.2 KiB
Python
# -*- 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',
|
|
'apz',
|
|
'beacon',
|
|
'browser',
|
|
'canvas',
|
|
'channelclassifier',
|
|
'clipboard',
|
|
'content',
|
|
'device',
|
|
'devtools',
|
|
'dom',
|
|
'editor',
|
|
'extensions',
|
|
'fission',
|
|
'full_screen_api',
|
|
'general',
|
|
'geo',
|
|
'gfx',
|
|
'gl',
|
|
'html5',
|
|
'idle_period',
|
|
'image',
|
|
'intl',
|
|
'javascript',
|
|
'keyword',
|
|
'layers',
|
|
'layout',
|
|
'media',
|
|
'mousewheel',
|
|
'network',
|
|
'nglayout',
|
|
'page_load',
|
|
'plain_text',
|
|
'plugins',
|
|
'preferences',
|
|
'print',
|
|
'privacy',
|
|
'security',
|
|
'slider',
|
|
'svg',
|
|
'telemetry',
|
|
'test',
|
|
'threads',
|
|
'toolkit',
|
|
'ui',
|
|
'view_source',
|
|
'webgl',
|
|
'widget',
|
|
'xul',
|
|
]
|
|
if CONFIG['OS_TARGET'] == 'Android':
|
|
pref_groups += [
|
|
'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)
|
|
|
|
GENERATED_FILES += [gen_all_tuple]
|
|
|
|
static_pref_list = GENERATED_FILES[gen_all_tuple]
|
|
static_pref_list.script = 'init/generate_static_pref_list.py:emit_code'
|
|
static_pref_list.inputs = ['init/StaticPrefList.yaml']
|
|
|
|
PYTHON_UNITTEST_MANIFESTS += [
|
|
'test/python.ini',
|
|
]
|
|
|
|
XPCOM_MANIFESTS += [
|
|
'components.conf',
|
|
]
|
|
|
|
SPHINX_TREES['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_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',
|
|
]
|