Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: packagerChrome.py

Issue 29399569: Issue 5060 - Move require into modules template, make info a module (Closed)
Patch Set: Created March 31, 2017, 5:44 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | packagerEdge.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packagerChrome.py
diff --git a/packagerChrome.py b/packagerChrome.py
index a6555c932a237643011f271336ad7bfe4315f844..bd103da5125b00d76bc740447fcfa8ca84d674f3 100644
--- a/packagerChrome.py
+++ b/packagerChrome.py
@@ -138,18 +138,21 @@ def createManifest(params, files):
return manifest.encode('utf-8')
-def createInfoModule(params):
- if params['type'] == 'gecko-webext':
- template = getTemplate('geckoInfo.js.tmpl')
- else:
- template = getTemplate('chromeInfo.js.tmpl')
- return template.render(params).encode('utf-8')
-
-
def convertJS(params, files):
output_files = collections.OrderedDict()
args = {}
+ info_module = None
+ info_template = {
+ 'chrome': 'chromeInfo.js.tmpl',
+ 'gecko-webext': 'geckoInfo.js.tmpl'
+ }.get(params['type'])
+ if info_template:
+ info_module = getTemplate(info_template).render(
+ basename=params['metadata'].get('general', 'basename'),
+ version=params['metadata'].get('general', 'version')
+ ).decode('utf-8')
+
for item in params['metadata'].items('convert_js'):
name, value = item
filename, arg = re.search(r'^(.*?)(?:\[(.*)\])?$', name).groups()
@@ -172,6 +175,9 @@ def convertJS(params, files):
base_dir = os.path.dirname(origin)
modules = []
+ if 'module' in current_args and info_module:
+ modules.append(('info', info_module))
+
for input_filename in input_files:
module_name = os.path.splitext(os.path.basename(input_filename))[0]
prefix = os.path.basename(os.path.dirname(input_filename))
@@ -183,7 +189,9 @@ def convertJS(params, files):
files[filename] = template.render(
args=current_args,
- modules=modules
+ modules=modules,
+ basename=params['metadata'].get('general', 'basename'),
+ version=params['metadata'].get('general', 'version')
).encode('utf-8')
@@ -396,11 +404,6 @@ def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil
files.read(os.path.join(buildtools.__path__[0], 'chromeDevenvPoller__.js'), relpath='devenvPoller__.js')
files['devenvVersion__'] = str(random.random())
- if (metadata.has_option('general', 'backgroundScripts') and
- 'lib/info.js' in metadata.get('general', 'backgroundScripts').split() and
- 'lib/info.js' not in files):
- files['lib/info.js'] = createInfoModule(params)
-
if metadata.has_option('general', 'testScripts'):
files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmpl',
('general', 'testScripts'))
« no previous file with comments | « no previous file | packagerEdge.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld