Bug 1339559 - Identify script that resulted in non-structured-clonable data r=kmag
[gecko.git] / devtools / templates.mozbuild
blob002cbf5c9d0af3f5db2fda91204debfb925b407d
1 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2 # vim: set filetype=python:
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 @template
8 def DevToolsModules(*modules):
9     '''Installs JS modules at a resource:// path that corresponds directly to
10     their source tree location.
12     For this to work as intended, a moz.build file should be placed in each
13     source directory which uses this template to install only the JS files in
14     its own directory.  Subdirectories should use their own moz.build.
16     By following this pattern, there's less magic to require() and resource://
17     paths, since they now match the source tree.
19     Currently `DevToolsModules` can only be called once per moz.build, so we
20     build a list manually above.  Bug 1198013 tracks fixing this to make it more
21     like other moz.build constructs.'''
23     for m in modules:
24         if '/' in m:
25             error('DevToolsModules must be used from the same directory as ' +
26                   'the files to be installed.')
28     # jar.mn manifest files are typically used to install files to chrome
29     # locations.  Instead of doing this, use this DevToolsModules syntax via
30     # moz.build files to do the installation so that we can enforce correct
31     # paths based on source tree location.
32     base = FINAL_TARGET_FILES.chrome.devtools.modules
33     for dir in RELATIVEDIR.split('/'):
34         base = base[dir]
35     base += [m for m in modules]