2019-10-29 03:53:54 +03:00
|
|
|
# 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/.
|
2020-01-18 22:48:22 +03:00
|
|
|
|
|
|
|
import logging
|
2022-12-20 00:10:08 +03:00
|
|
|
import os
|
2023-07-25 19:20:11 +03:00
|
|
|
import sys
|
2020-01-18 22:48:22 +03:00
|
|
|
from importlib import import_module
|
|
|
|
|
2021-10-06 07:47:46 +03:00
|
|
|
from gecko_taskgraph import GECKO
|
2022-04-04 22:40:07 +03:00
|
|
|
from gecko_taskgraph.optimize.schema import set_optimization_schema # noqa: F401
|
2020-01-18 22:48:22 +03:00
|
|
|
|
2022-12-20 00:10:08 +03:00
|
|
|
from comm_taskgraph.optimize import thunderbird_optimizations
|
|
|
|
|
2020-01-18 22:48:22 +03:00
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
2020-10-30 20:41:24 +03:00
|
|
|
COMM = os.path.join(GECKO, "comm")
|
|
|
|
COMM_SCRIPTS = os.path.join(COMM, "taskcluster", "scripts")
|
2020-01-18 22:48:22 +03:00
|
|
|
|
2021-03-31 23:19:03 +03:00
|
|
|
|
2023-07-25 19:20:11 +03:00
|
|
|
def extend_sys_path(topsrcdir):
|
|
|
|
from mach.requirements import MachEnvRequirements
|
|
|
|
|
|
|
|
requirements = MachEnvRequirements.from_requirements_definition(
|
|
|
|
topsrcdir,
|
|
|
|
True, # is_thunderbird
|
|
|
|
False,
|
|
|
|
os.path.join(topsrcdir, "comm/python/sites/tb_common.txt"),
|
|
|
|
)
|
|
|
|
extend_path = [
|
2023-07-25 21:17:07 +03:00
|
|
|
os.path.normcase(os.path.join(topsrcdir, pth.path))
|
|
|
|
for pth in requirements.pth_requirements
|
|
|
|
]
|
2023-07-25 19:20:11 +03:00
|
|
|
sys.path.extend(extend_path)
|
|
|
|
|
|
|
|
|
2020-01-18 22:48:22 +03:00
|
|
|
def register(graph_config):
|
|
|
|
"""
|
|
|
|
Import all modules that are siblings of this one, triggering decorators in
|
|
|
|
the process.
|
|
|
|
"""
|
2023-07-25 19:20:11 +03:00
|
|
|
extend_sys_path(GECKO)
|
|
|
|
|
2023-08-02 04:47:50 +03:00
|
|
|
from gecko_taskgraph.util import dependencies # noqa: trigger group_by registration
|
|
|
|
|
2022-01-05 19:37:23 +03:00
|
|
|
from comm_taskgraph.parameters import register_parameters
|
|
|
|
|
2020-01-18 22:48:22 +03:00
|
|
|
logger.info("{} path registered".format(__name__))
|
2022-01-05 19:37:23 +03:00
|
|
|
register_parameters()
|
|
|
|
|
2022-07-25 20:38:25 +03:00
|
|
|
set_optimization_schema(thunderbird_optimizations)
|
2022-04-04 22:40:07 +03:00
|
|
|
|
2020-10-30 20:41:24 +03:00
|
|
|
_import_modules(
|
|
|
|
[
|
|
|
|
"documentation",
|
|
|
|
"util.docker",
|
|
|
|
"actions",
|
|
|
|
"target_tasks",
|
|
|
|
"transforms.job.toolchain",
|
|
|
|
]
|
|
|
|
)
|
2020-01-18 22:48:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
def _import_modules(modules):
|
|
|
|
for module in modules:
|
|
|
|
import_module(".{}".format(module), package=__name__)
|