Skip to content

Commit

Permalink
Revert of DevTools: Avoid build errors when dynamic module and applic…
Browse files Browse the repository at this point in the history
…ation names clash (patchset #2 id:20001 of https://codereview.chromium.org/607893002/)

Reason for revert:
This patch makes the "build_applications" target always dirty.

Original issue's description:
> DevTools: Avoid build errors when dynamic module and application names clash
> 
> This is a provisional fix that should let developers name
> dynamically loaded modules the same as existing applications.
> 
> Drive-by:
> - Clean up devtools.gypi
> - Stop generating obsolete code when concatenating workers
> 
> R=dgozman, pfeldman, yurys
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=182769

[email protected],[email protected],[email protected]
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/607113002

git-svn-id: svn://svn.chromium.org/blink/trunk@182775 bbb929c8-8fbe-4397-9dbb-9b2b20218538
  • Loading branch information
[email protected] committed Sep 26, 2014
1 parent e48d3d4 commit 6254fdf
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 68 deletions.
50 changes: 24 additions & 26 deletions Source/devtools/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,20 @@ gypi_values = exec_script(
# Some of the files in the .gypi use GYP variable expansions, go through and
# fix them.
devtools_core_base_files = gypi_values.devtools_core_base_files - [
"<@(devtools_main_js_files)",
"<@(devtools_standalone_files)",
] + gypi_values.devtools_standalone_files
] + gypi_values.devtools_main_js_files + gypi_values.devtools_standalone_files

devtools_core_files =
devtools_core_base_files +
gypi_values.devtools_bindings_js_files +
gypi_values.devtools_common_js_files +
gypi_values.devtools_sdk_js_files +
gypi_values.devtools_ui_js_files +
gypi_values.devtools_components_js_files +
gypi_values.devtools_host_js_files +
gypi_values.devtools_main_js_files +
gypi_values.devtools_sdk_js_files +
gypi_values.devtools_screencast_js_files +
gypi_values.devtools_toolbox_js_files +
gypi_values.devtools_toolbox_bootstrap_js_files +
gypi_values.devtools_ui_js_files +
gypi_values.devtools_workspace_js_files
gypi_values.devtools_toolbox_bootstrap_js_files

devtools_extensions_js_files = gypi_values.devtools_extensions_js_files -
[ "<@(devtools_extension_api_files)" ] +
Expand Down Expand Up @@ -74,24 +72,24 @@ action("generate_devtools_grd") {
"$root_out_dir/resources/inspector/toolbox.css",
"$root_out_dir/resources/inspector/toolbox.html",
"$root_out_dir/resources/inspector/toolbox.js",
"$root_out_dir/resources/inspector/audits_module.js",
"$root_out_dir/resources/inspector/console_module.js",
"$root_out_dir/resources/inspector/devices_module.js",
"$root_out_dir/resources/inspector/documentation_module.js",
"$root_out_dir/resources/inspector/elements_module.js",
"$root_out_dir/resources/inspector/extensions_module.js",
"$root_out_dir/resources/inspector/heap_snapshot_worker_module.js",
"$root_out_dir/resources/inspector/layers_module.js",
"$root_out_dir/resources/inspector/network_module.js",
"$root_out_dir/resources/inspector/profiler_module.js",
"$root_out_dir/resources/inspector/promises_module.js",
"$root_out_dir/resources/inspector/resources_module.js",
"$root_out_dir/resources/inspector/script_formatter_worker_module.js",
"$root_out_dir/resources/inspector/settings_module.js",
"$root_out_dir/resources/inspector/source_frame_module.js",
"$root_out_dir/resources/inspector/sources_module.js",
"$root_out_dir/resources/inspector/temp_storage_shared_worker_module.js",
"$root_out_dir/resources/inspector/timeline_module.js",
"$root_out_dir/resources/inspector/audits.js",
"$root_out_dir/resources/inspector/console.js",
"$root_out_dir/resources/inspector/devices.js",
"$root_out_dir/resources/inspector/documentation.js",
"$root_out_dir/resources/inspector/elements.js",
"$root_out_dir/resources/inspector/extensions.js",
"$root_out_dir/resources/inspector/heap_snapshot_worker.js",
"$root_out_dir/resources/inspector/layers.js",
"$root_out_dir/resources/inspector/network.js",
"$root_out_dir/resources/inspector/profiler.js",
"$root_out_dir/resources/inspector/promises.js",
"$root_out_dir/resources/inspector/resources.js",
"$root_out_dir/resources/inspector/script_formatter_worker.js",
"$root_out_dir/resources/inspector/settings.js",
"$root_out_dir/resources/inspector/source_frame.js",
"$root_out_dir/resources/inspector/sources.js",
"$root_out_dir/resources/inspector/temp_storage_shared_worker.js",
"$root_out_dir/resources/inspector/timeline.js",
"$root_out_dir/resources/inspector/devtools_extension_api.js",
] + gypi_values.devtools_standalone_files + gypi_values.devtools_cm_css_files

Expand Down Expand Up @@ -290,7 +288,7 @@ template("concatenate_module_scripts") {
input = "front_end/" + module_name + "/module.json"
inputs = [ input ] + invoker.imported_files

output = "$root_out_dir/resources/inspector/" + module_name + "_module.js"
output = "$root_out_dir/resources/inspector/" + module_name + ".js"
outputs = [ output ]

args = [
Expand Down
72 changes: 36 additions & 36 deletions Source/devtools/devtools.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -131,24 +131,24 @@
'<(PRODUCT_DIR)/resources/inspector/toolbox.css',
'<(PRODUCT_DIR)/resources/inspector/toolbox.html',
'<(PRODUCT_DIR)/resources/inspector/toolbox.js',
'<(PRODUCT_DIR)/resources/inspector/audits_module.js',
'<(PRODUCT_DIR)/resources/inspector/console_module.js',
'<(PRODUCT_DIR)/resources/inspector/devices_module.js',
'<(PRODUCT_DIR)/resources/inspector/documentation_module.js',
'<(PRODUCT_DIR)/resources/inspector/elements_module.js',
'<(PRODUCT_DIR)/resources/inspector/extensions_module.js',
'<(PRODUCT_DIR)/resources/inspector/heap_snapshot_worker_module.js',
'<(PRODUCT_DIR)/resources/inspector/layers_module.js',
'<(PRODUCT_DIR)/resources/inspector/network_module.js',
'<(PRODUCT_DIR)/resources/inspector/profiler_module.js',
'<(PRODUCT_DIR)/resources/inspector/promises_module.js',
'<(PRODUCT_DIR)/resources/inspector/resources_module.js',
'<(PRODUCT_DIR)/resources/inspector/script_formatter_worker_module.js',
'<(PRODUCT_DIR)/resources/inspector/settings_module.js',
'<(PRODUCT_DIR)/resources/inspector/source_frame_module.js',
'<(PRODUCT_DIR)/resources/inspector/sources_module.js',
'<(PRODUCT_DIR)/resources/inspector/temp_storage_shared_worker_module.js',
'<(PRODUCT_DIR)/resources/inspector/timeline_module.js',
'<(PRODUCT_DIR)/resources/inspector/audits.js',
'<(PRODUCT_DIR)/resources/inspector/console.js',
'<(PRODUCT_DIR)/resources/inspector/devices.js',
'<(PRODUCT_DIR)/resources/inspector/documentation.js',
'<(PRODUCT_DIR)/resources/inspector/elements.js',
'<(PRODUCT_DIR)/resources/inspector/extensions.js',
'<(PRODUCT_DIR)/resources/inspector/heap_snapshot_worker.js',
'<(PRODUCT_DIR)/resources/inspector/layers.js',
'<(PRODUCT_DIR)/resources/inspector/network.js',
'<(PRODUCT_DIR)/resources/inspector/profiler.js',
'<(PRODUCT_DIR)/resources/inspector/promises.js',
'<(PRODUCT_DIR)/resources/inspector/resources.js',
'<(PRODUCT_DIR)/resources/inspector/script_formatter_worker.js',
'<(PRODUCT_DIR)/resources/inspector/settings.js',
'<(PRODUCT_DIR)/resources/inspector/source_frame.js',
'<(PRODUCT_DIR)/resources/inspector/sources.js',
'<(PRODUCT_DIR)/resources/inspector/temp_storage_shared_worker.js',
'<(PRODUCT_DIR)/resources/inspector/timeline.js',
'<(PRODUCT_DIR)/resources/inspector/devtools_extension_api.js',
'<@(devtools_standalone_files)',
'<@(devtools_cm_css_files)',
Expand Down Expand Up @@ -432,7 +432,7 @@
'<@(_input_file)',
'<@(devtools_audits_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/audits_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/audits.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -463,7 +463,7 @@
'<@(_input_file)',
'<@(devtools_console_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/console_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/console.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -494,7 +494,7 @@
'<@(_input_file)',
'<@(devtools_devices_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/devices_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/devices.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -525,7 +525,7 @@
'<@(_input_file)',
'<@(devtools_documentation_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/documentation_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/documentation.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -556,7 +556,7 @@
'<@(_input_file)',
'<@(devtools_elements_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/elements_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/elements.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -587,7 +587,7 @@
'<@(_input_file)',
'<@(devtools_extensions_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/extensions_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/extensions.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -618,7 +618,7 @@
'<@(_input_file)',
'<@(devtools_heap_snapshot_worker_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/heap_snapshot_worker_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/heap_snapshot_worker.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -649,7 +649,7 @@
'<@(_input_file)',
'<@(devtools_layers_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/layers_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/layers.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -680,7 +680,7 @@
'<@(_input_file)',
'<@(devtools_network_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/network_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/network.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -711,7 +711,7 @@
'<@(_input_file)',
'<@(devtools_profiler_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/profiler_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/profiler.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -742,7 +742,7 @@
'<@(_input_file)',
'<@(devtools_promises_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/promises_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/promises.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -773,7 +773,7 @@
'<@(_input_file)',
'<@(devtools_resources_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/resources_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/resources.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -805,7 +805,7 @@
'<@(devtools_script_formatter_worker_js_files)',
'<@(devtools_uglify_files)'
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/script_formatter_worker_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/script_formatter_worker.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -843,7 +843,7 @@
'<@(_input_file)',
'<@(devtools_settings_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/settings_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/settings.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -875,7 +875,7 @@
'<@(devtools_source_frame_js_files)',
'<@(devtools_cm_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/source_frame_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/source_frame.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
'copies': [
Expand Down Expand Up @@ -921,7 +921,7 @@
'<@(_input_file)',
'<@(devtools_sources_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/sources_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/sources.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -952,7 +952,7 @@
'<@(_input_file)',
'<@(devtools_temp_storage_shared_worker_js_files)'
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/temp_storage_shared_worker_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/temp_storage_shared_worker.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down Expand Up @@ -983,7 +983,7 @@
'<@(_input_file)',
'<@(devtools_timeline_js_files)',
],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/timeline_module.js'],
'outputs': ['<(PRODUCT_DIR)/resources/inspector/timeline.js'],
'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_outputs)'],
}],
},
Expand Down
4 changes: 2 additions & 2 deletions Source/devtools/devtools.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
'<@(devtools_components_js_files)',
'<@(devtools_core_base_files)',
'<@(devtools_host_js_files)',
'<@(devtools_main_js_files)',
'<@(devtools_screencast_js_files)',
'<@(devtools_sdk_js_files)',
'<@(devtools_toolbox_bootstrap_js_files)',
Expand All @@ -65,6 +64,7 @@
'front_end/splitView.css',
'front_end/suggestBox.css',
'front_end/tabbedPane.css',
'<@(devtools_main_js_files)',
'<@(devtools_standalone_files)',
],
'devtools_common_js_files': [
Expand Down Expand Up @@ -454,6 +454,7 @@
'front_end/cm/xml.js',
'front_end/common/WebInspector.js',
'front_end/common/utilities.js',
'front_end/common/utilities.js',
'front_end/script_formatter_worker/CSSFormatter.js',
'front_end/script_formatter_worker/JavaScriptFormatter.js',
'front_end/script_formatter_worker/ScriptFormatterWorker.js',
Expand Down Expand Up @@ -575,7 +576,6 @@
'<@(devtools_promises_js_files)',
'<@(devtools_resources_js_files)',
'<@(devtools_script_formatter_worker_js_files)',
'<@(devtools_settings_js_files)',
'<@(devtools_source_frame_js_files)',
'<@(devtools_sources_js_files)',
'<@(devtools_temp_storage_shared_worker_js_files)',
Expand Down
6 changes: 3 additions & 3 deletions Source/devtools/front_end/Runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Runtime.isReleaseMode = function()
Runtime.startSharedWorker = function(moduleName, workerName)
{
if (Runtime.isReleaseMode())
return new SharedWorker(moduleName + "_module.js", workerName);
return new SharedWorker(moduleName + ".js", workerName);

var content = loadResource(moduleName + "/module.json");
if (!content)
Expand All @@ -185,7 +185,7 @@ Runtime.startSharedWorker = function(moduleName, workerName)
Runtime.startWorker = function(moduleName)
{
if (Runtime.isReleaseMode())
return new Worker(moduleName + "_module.js");
return new Worker(moduleName + ".js");

var content = loadResource(moduleName + "/module.json");
if (!content)
Expand Down Expand Up @@ -670,7 +670,7 @@ Runtime.Module.prototype = {
this._manager.loadModule(dependencies[i]);
if (this._descriptor.scripts) {
if (Runtime.isReleaseMode()) {
loadScript(this._name + "_module.js");
loadScript(this._name + ".js");
} else {
var scripts = this._descriptor.scripts;
for (var i = 0; i < scripts.length; ++i)
Expand Down
8 changes: 7 additions & 1 deletion Source/devtools/scripts/concatenate_application_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def concatenate_worker(module_name, descriptors, application_dir, output_dir, mi
if not scripts:
return
worker_dir = path.join(application_dir, module_name)
output_file_path = path.join(output_dir, module_name, module_name + '_module.js')
output_file_path = path.join(output_dir, module_name, module_name + '.js')

output = StringIO()
output.write('/* Worker %s */\n' % module_name)
Expand All @@ -96,6 +96,12 @@ def concatenate_worker(module_name, descriptors, application_dir, output_dir, mi
output.write('\n/* Module %s */\n' % dep_name)
modular_build.concatenate_scripts(scripts, path.join(application_dir, dep_name), output_dir, output)

output.write('\n/* Initialize worker */\n')
# Tell Runtime we are in the compiled mode.
output.write('allDescriptors = ')
output.write(json.dumps(dep_descriptors))
output.write(';\nRuntime.initializeWorker("%s");' % module_name)

write_file(output_file_path, minify_if_needed(output.getvalue(), minify))
output.close()

Expand Down

0 comments on commit 6254fdf

Please sign in to comment.