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

Unified Diff: packagerChrome.py

Issue 29600577: Issue 5997 - Avoid including qunit files in release builds (Closed)
Patch Set: Avoid bundling tests if testScripts option is missing Created Nov. 7, 2017, 4:04 p.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') | tests/test_packagerWebExt.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packagerChrome.py
diff --git a/packagerChrome.py b/packagerChrome.py
index be749d697775900fc42f64a454ca5e7a01e54775..95b0118921719bb5c0d7d763f4dee7a8c394d12f 100644
--- a/packagerChrome.py
+++ b/packagerChrome.py
@@ -150,7 +150,7 @@ def toJson(data):
).encode('utf-8') + '\n'
-def create_bundles(params, files):
+def create_bundles(params, files, bundle_tests):
base_extension_path = params['baseDir']
info_templates = {
'chrome': 'chromeInfo.js.tmpl',
@@ -191,6 +191,15 @@ def create_bundles(params, files):
'entry_points': entry_files,
})
+ if bundle_tests:
+ qunit_path = os.path.join(base_extension_path, 'qunit')
+ qunit_files = ([os.path.join(qunit_path, 'common.js')] +
+ glob.glob(os.path.join(qunit_path, 'tests', '*.js')))
+ configuration['bundles'].append({
+ 'bundle_name': 'qunit/tests.js',
+ 'entry_points': qunit_files
+ })
+
cmd = ['node', os.path.join(os.path.dirname(__file__), 'webpack_runner.js')]
process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stdin=subprocess.PIPE)
@@ -364,7 +373,8 @@ def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil
files.read(baseDir, skip=[opt for opt, _ in mapped])
if metadata.has_section('bundles'):
- create_bundles(params, files)
+ bundle_tests = devenv and metadata.has_option('general', 'testScripts')
+ create_bundles(params, files, bundle_tests)
if metadata.has_section('preprocess'):
files.preprocess(
« no previous file with comments | « no previous file | packagerEdge.py » ('j') | tests/test_packagerWebExt.py » ('J')

Powered by Google App Engine
This is Rietveld