mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1793760 - [devtools] Use same URL for development version of react. r=jdescottes
When using --enable-debug-js-modules in mozconfig, today, we ship the modules with different filename and so different URLs. This won't work once the modules will become ES Modules as we would load the modules from a fixed URL and there won't be any way to hack the module loader anymore. So, we should rather have the build system to ship the right file (production or dev version), using the same filename and URL. Unfortunately, I didn't find any easier way to rename a file from moz.build Differential Revision: https://phabricator.services.mozilla.com/D158665
This commit is contained in:
parent
0f9e47bbec
commit
e7aee2779a
21
devtools/client/shared/vendor/moz.build
vendored
21
devtools/client/shared/vendor/moz.build
vendored
@ -9,15 +9,10 @@ DevToolsModules(
|
||||
'immutable.js',
|
||||
'jszip.js',
|
||||
'react-dom-factories.js',
|
||||
'react-dom-server.js',
|
||||
'react-dom-test-utils.js',
|
||||
'react-dom.js',
|
||||
'react-prop-types.js',
|
||||
'react-redux.js',
|
||||
'react-router-dom.js',
|
||||
'react-test-renderer-shallow.js',
|
||||
'react-test-renderer.js',
|
||||
'react.js',
|
||||
'redux.js',
|
||||
'reselect.js',
|
||||
'seamless-immutable.js',
|
||||
@ -27,10 +22,16 @@ DevToolsModules(
|
||||
|
||||
# react dev versions are used if enable-debug-js-modules is set in .mozconfig.
|
||||
if CONFIG['DEBUG_JS_MODULES']:
|
||||
RenamedDevToolsModules('react-dom-dev.js', 'react-dom.js')
|
||||
RenamedDevToolsModules('react-dom-server-dev.js', 'react-dom-server.js')
|
||||
RenamedDevToolsModules('react-dom-test-utils-dev.js', 'react-dom-test-utils.js')
|
||||
RenamedDevToolsModules('react-prop-types-dev.js', 'react-prop-types.js')
|
||||
RenamedDevToolsModules('react-dev.js', 'react.js')
|
||||
else:
|
||||
DevToolsModules(
|
||||
'react-dev.js',
|
||||
'react-dom-dev.js',
|
||||
'react-dom-server-dev.js',
|
||||
'react-dom-test-utils-dev.js',
|
||||
'react-prop-types-dev.js',
|
||||
'react-dom-server.js',
|
||||
'react-dom-test-utils.js',
|
||||
'react-dom.js',
|
||||
'react-prop-types.js',
|
||||
'react.js'
|
||||
)
|
||||
|
11
devtools/rename.py
Normal file
11
devtools/rename.py
Normal file
@ -0,0 +1,11 @@
|
||||
# -*- 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/.
|
||||
|
||||
# Put the content of `filenames[0]` file into `output` file pointer
|
||||
def main(output, *filenames):
|
||||
with open(filenames[0], "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
output.write(content)
|
@ -29,3 +29,20 @@ def DevToolsModules(*modules):
|
||||
for dir in RELATIVEDIR.split('/'):
|
||||
base = base[dir]
|
||||
base += [m for m in modules]
|
||||
|
||||
|
||||
@template
|
||||
def RenamedDevToolsModules(source, target):
|
||||
''' Helper function to ship a file (source) with a distinct name (target).
|
||||
This will ship the file the same way DevToolsModule does it, to resource://devtools/'''
|
||||
|
||||
base = FINAL_TARGET_FILES.chrome.devtools.modules
|
||||
for dir in RELATIVEDIR.split("/"):
|
||||
base = base[dir]
|
||||
base += ["!%s" % target]
|
||||
|
||||
GeneratedFile(
|
||||
target,
|
||||
script="/devtools/rename.py",
|
||||
inputs=[source],
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user