Debian Codegraph @

testing/mozharness/scripts/fx_desktop_build.py

raw
1 #!/usr/bin/env python
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 # You can obtain one at http://mozilla.org/MPL/2.0/.
5 """fx_desktop_build.py.
6
7 script harness to build nightly firefox within Mozilla's build environment
8 and developer machines alike
9 """
10
11 import os
12 import sys
13
14 # load modules from parent dir
15 sys.path.insert(1, os.path.dirname(sys.path[0]))
16
17 import mozharness.base.script as script
18 from mozharness.mozilla.building.buildbase import (
19 BUILD_BASE_CONFIG_OPTIONS,
20 BuildingConfig,
21 BuildScript,
22 )
23
24
25 class FxDesktopBuild(BuildScript):
26 def __init__(self):
27 buildscript_kwargs = {
28 "config_options": BUILD_BASE_CONFIG_OPTIONS,
29 "all_actions": [
30 "get-secrets",
31 "clobber",
32 "build",
33 "static-analysis-autotest",
34 "valgrind-test",
35 "multi-l10n",
36 "package-source",
37 ],
38 "require_config_file": True,
39 # Default configuration
40 "config": {
41 "is_automation": True,
42 "debug_build": False,
43 # nightly stuff
44 "nightly_build": False,
45 # Seed all clones with mozilla-unified. This ensures subsequent
46 # jobs have a minimal `hg pull`.
47 "clone_upstream_url": "https://hg.mozilla.org/mozilla-unified",
48 "repo_base": "https://hg.mozilla.org",
49 "profile_build_resources_path": "%(upload_path)s/profile_build_resources.json",
50 "nightly_promotion_branches": ["mozilla-central", "mozilla-aurora"],
51 # try will overwrite these
52 "clone_with_purge": False,
53 "clone_by_revision": False,
54 "virtualenv_modules": [
55 "requests==2.8.1",
56 ],
57 "virtualenv_path": "venv",
58 },
59 "ConfigClass": BuildingConfig,
60 }
61 super(FxDesktopBuild, self).__init__(**buildscript_kwargs)
62
63 def query_abs_dirs(self):
64 if self.abs_dirs:
65 return self.abs_dirs
66 abs_dirs = super(FxDesktopBuild, self).query_abs_dirs()
67
68 dirs = {
69 # BuildFactories in factory.py refer to a 'build' dir on the slave.
70 # This contains all the source code/objdir to compile. However,
71 # there is already a build dir in mozharness for every mh run. The
72 # 'build' that factory refers to I named: 'src' so
73 # there is a seperation in mh. for example, rather than having
74 # '{mozharness_repo}/build/build/', I have '{
75 # mozharness_repo}/build/src/'
76 "abs_obj_dir": os.path.join(abs_dirs["abs_work_dir"], self._query_objdir()),
77 "upload_path": self.config["upload_env"]["UPLOAD_PATH"],
78 }
79 abs_dirs.update(dirs)
80 self.abs_dirs = abs_dirs
81 return self.abs_dirs
82
83 # Actions {{{2
84
85 @script.PreScriptRun
86 def suppress_windows_modal_dialogs(self, *args, **kwargs):
87 if self._is_windows():
88 # Suppress Windows modal dialogs to avoid hangs
89 import ctypes
90
91 ctypes.windll.kernel32.SetErrorMode(0x8001)
92
93
94 if __name__ == "__main__":
95 fx_desktop_build = FxDesktopBuild()
96 fx_desktop_build.run_and_exit()