| OLD | NEW |
| (Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 3 # |
| 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are |
| 6 # met: |
| 7 # |
| 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above |
| 11 # copyright notice, this list of conditions and the following disclaimer |
| 12 # in the documentation and/or other materials provided with the |
| 13 # distribution. |
| 14 # * Neither the name of Google Inc. nor the names of its |
| 15 # contributors may be used to endorse or promote products derived from |
| 16 # this software without specific prior written permission. |
| 17 # |
| 18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 |
| 30 import os |
| 31 import os.path |
| 32 import generate_protocol_externs |
| 33 import shutil |
| 34 import sys |
| 35 import tempfile |
| 36 |
| 37 inspector_path = "Source/WebCore/inspector" |
| 38 inspector_frontend_path = inspector_path + "/front-end" |
| 39 protocol_externs_path = inspector_frontend_path + "/protocol-externs.js" |
| 40 |
| 41 generate_protocol_externs.generate_protocol_externs(protocol_externs_path, inspe
ctor_path + "/Inspector.json") |
| 42 |
| 43 jsmodule_name_prefix = "jsmodule_" |
| 44 modules = [ |
| 45 { |
| 46 "name": "common", |
| 47 "dependencies": [], |
| 48 "sources": [ |
| 49 "Color.js", |
| 50 "DOMExtension.js", |
| 51 "Object.js", |
| 52 "ParsedURL.js", |
| 53 "Progress.js", |
| 54 "Settings.js", |
| 55 "UIString.js", |
| 56 "UserMetrics.js", |
| 57 "utilities.js", |
| 58 ] |
| 59 }, |
| 60 { |
| 61 "name": "sdk", |
| 62 "dependencies": ["common"], |
| 63 "sources": [ |
| 64 "ApplicationCacheModel.js", |
| 65 "CompilerScriptMapping.js", |
| 66 "ConsoleModel.js", |
| 67 "ContentProvider.js", |
| 68 "ContentProviders.js", |
| 69 "CookieParser.js", |
| 70 "CSSMetadata.js", |
| 71 "CSSStyleModel.js", |
| 72 "BreakpointManager.js", |
| 73 "Database.js", |
| 74 "DOMAgent.js", |
| 75 "DOMStorage.js", |
| 76 "DebuggerModel.js", |
| 77 "DebuggerScriptMapping.js", |
| 78 "FileManager.js", |
| 79 "FileMapping.js", |
| 80 "FileSystemMapping.js", |
| 81 "FileSystemModel.js", |
| 82 "FileSystemProjectDelegate.js", |
| 83 "FileUtils.js", |
| 84 "HAREntry.js", |
| 85 "IndexedDBModel.js", |
| 86 "InspectorBackend.js", |
| 87 "IsolatedFileSystemManager.js", |
| 88 "IsolatedFileSystem.js", |
| 89 "Linkifier.js", |
| 90 "NetworkLog.js", |
| 91 "NetworkUISourceCodeProvider.js", |
| 92 "PresentationConsoleMessageHelper.js", |
| 93 "RuntimeModel.js", |
| 94 "SASSSourceMapping.js", |
| 95 "Script.js", |
| 96 "ScriptFormatter.js", |
| 97 "ScriptSnippetModel.js", |
| 98 "SimpleWorkspaceProvider.js", |
| 99 "SnippetStorage.js", |
| 100 "SourceMapping.js", |
| 101 "StylesSourceMapping.js", |
| 102 "TimelineManager.js", |
| 103 "RemoteObject.js", |
| 104 "Resource.js", |
| 105 "DefaultScriptMapping.js", |
| 106 "ResourceScriptMapping.js", |
| 107 "LiveEditSupport.js", |
| 108 "ResourceTreeModel.js", |
| 109 "ResourceType.js", |
| 110 "ResourceUtils.js", |
| 111 "SourceMap.js", |
| 112 "NetworkManager.js", |
| 113 "NetworkRequest.js", |
| 114 "UISourceCode.js", |
| 115 "UserAgentSupport.js", |
| 116 "Workspace.js", |
| 117 "protocol-externs.js", |
| 118 ] |
| 119 }, |
| 120 { |
| 121 "name": "ui", |
| 122 "dependencies": ["common"], |
| 123 "sources": [ |
| 124 "Checkbox.js", |
| 125 "ContextMenu.js", |
| 126 "DOMSyntaxHighlighter.js", |
| 127 "DataGrid.js", |
| 128 "DefaultTextEditor.js", |
| 129 "Dialog.js", |
| 130 "DockController.js", |
| 131 "Drawer.js", |
| 132 "EmptyView.js", |
| 133 "GoToLineDialog.js", |
| 134 "HelpScreen.js", |
| 135 "InspectorView.js", |
| 136 "KeyboardShortcut.js", |
| 137 "Panel.js", |
| 138 "PanelEnablerView.js", |
| 139 "Placard.js", |
| 140 "Popover.js", |
| 141 "ProgressIndicator.js", |
| 142 "PropertiesSection.js", |
| 143 "SearchController.js", |
| 144 "Section.js", |
| 145 "SidebarPane.js", |
| 146 "SidebarTreeElement.js", |
| 147 "ShortcutsScreen.js", |
| 148 "ShowMoreDataGridNode.js", |
| 149 "SidebarOverlay.js", |
| 150 "SoftContextMenu.js", |
| 151 "SourceTokenizer.js", |
| 152 "Spectrum.js", |
| 153 "SplitView.js", |
| 154 "SidebarView.js", |
| 155 "StatusBarButton.js", |
| 156 "SuggestBox.js", |
| 157 "TabbedPane.js", |
| 158 "TextEditor.js", |
| 159 "TextEditorHighlighter.js", |
| 160 "TextEditorModel.js", |
| 161 "TextPrompt.js", |
| 162 "TextUtils.js", |
| 163 "TimelineGrid.js", |
| 164 "Toolbar.js", |
| 165 "UIUtils.js", |
| 166 "View.js", |
| 167 "ViewportControl.js", |
| 168 "treeoutline.js", |
| 169 ] |
| 170 }, |
| 171 { |
| 172 "name": "components", |
| 173 "dependencies": ["sdk", "ui"], |
| 174 "sources": [ |
| 175 "AdvancedSearchController.js", |
| 176 "HandlerRegistry.js", |
| 177 "ConsoleMessage.js", |
| 178 "CookiesTable.js", |
| 179 "DOMBreakpointsSidebarPane.js", |
| 180 "DOMPresentationUtils.js", |
| 181 "ElementsTreeOutline.js", |
| 182 "FontView.js", |
| 183 "ImageView.js", |
| 184 "NativeBreakpointsSidebarPane.js", |
| 185 "ObjectPopoverHelper.js", |
| 186 "ObjectPropertiesSection.js", |
| 187 "SourceFrame.js", |
| 188 "ResourceView.js", |
| 189 ] |
| 190 }, |
| 191 { |
| 192 "name": "elements", |
| 193 "dependencies": ["components"], |
| 194 "sources": [ |
| 195 "CSSNamedFlowCollectionsView.js", |
| 196 "CSSNamedFlowView.js", |
| 197 "ElementsPanel.js", |
| 198 "ElementsPanelDescriptor.js", |
| 199 "EventListenersSidebarPane.js", |
| 200 "MetricsSidebarPane.js", |
| 201 "PropertiesSidebarPane.js", |
| 202 "StylesSidebarPane.js", |
| 203 ] |
| 204 }, |
| 205 { |
| 206 "name": "network", |
| 207 "dependencies": ["components"], |
| 208 "sources": [ |
| 209 "NetworkItemView.js", |
| 210 "RequestCookiesView.js", |
| 211 "RequestHeadersView.js", |
| 212 "RequestHTMLView.js", |
| 213 "RequestJSONView.js", |
| 214 "RequestPreviewView.js", |
| 215 "RequestResponseView.js", |
| 216 "RequestTimingView.js", |
| 217 "RequestView.js", |
| 218 "ResourceWebSocketFrameView.js", |
| 219 "NetworkPanel.js", |
| 220 "NetworkPanelDescriptor.js", |
| 221 ] |
| 222 }, |
| 223 { |
| 224 "name": "resources", |
| 225 "dependencies": ["components"], |
| 226 "sources": [ |
| 227 "ApplicationCacheItemsView.js", |
| 228 "CookieItemsView.js", |
| 229 "DatabaseQueryView.js", |
| 230 "DatabaseTableView.js", |
| 231 "DirectoryContentView.js", |
| 232 "DOMStorageItemsView.js", |
| 233 "FileContentView.js", |
| 234 "FileSystemView.js", |
| 235 "IndexedDBViews.js", |
| 236 "ResourcesPanel.js", |
| 237 ] |
| 238 }, |
| 239 { |
| 240 "name": "workers", |
| 241 "dependencies": ["components"], |
| 242 "sources": [ |
| 243 "WorkerManager.js", |
| 244 ] |
| 245 }, |
| 246 { |
| 247 "name": "scripts", |
| 248 "dependencies": ["components", "workers"], |
| 249 "sources": [ |
| 250 "BreakpointsSidebarPane.js", |
| 251 "CallStackSidebarPane.js", |
| 252 "FilteredItemSelectionDialog.js", |
| 253 "JavaScriptSourceFrame.js", |
| 254 "NavigatorOverlayController.js", |
| 255 "NavigatorView.js", |
| 256 "RevisionHistoryView.js", |
| 257 "ScopeChainSidebarPane.js", |
| 258 "ScriptsNavigator.js", |
| 259 "ScriptsPanel.js", |
| 260 "ScriptsPanelDescriptor.js", |
| 261 "ScriptsSearchScope.js", |
| 262 "SnippetJavaScriptSourceFrame.js", |
| 263 "StyleSheetOutlineDialog.js", |
| 264 "TabbedEditorContainer.js", |
| 265 "UISourceCodeFrame.js", |
| 266 "WatchExpressionsSidebarPane.js", |
| 267 "WorkersSidebarPane.js", |
| 268 ] |
| 269 }, |
| 270 { |
| 271 "name": "console", |
| 272 "dependencies": ["components"], |
| 273 "sources": [ |
| 274 "ConsoleView.js", |
| 275 "ConsolePanel.js", |
| 276 ] |
| 277 }, |
| 278 { |
| 279 "name": "timeline", |
| 280 "dependencies": ["components"], |
| 281 "sources": [ |
| 282 "DOMCountersGraph.js", |
| 283 "MemoryStatistics.js", |
| 284 "NativeMemoryGraph.js", |
| 285 "TimelineModel.js", |
| 286 "TimelineOverviewPane.js", |
| 287 "TimelinePanel.js", |
| 288 "TimelinePanelDescriptor.js", |
| 289 "TimelinePresentationModel.js", |
| 290 "TimelineFrameController.js" |
| 291 ] |
| 292 }, |
| 293 { |
| 294 "name": "audits", |
| 295 "dependencies": ["components"], |
| 296 "sources": [ |
| 297 "AuditCategories.js", |
| 298 "AuditFormatters.js", |
| 299 "AuditLauncherView.js", |
| 300 "AuditResultView.js", |
| 301 "AuditRules.js", |
| 302 "AuditsPanel.js", |
| 303 ] |
| 304 }, |
| 305 { |
| 306 "name": "extensions", |
| 307 "dependencies": ["components"], |
| 308 "sources": [ |
| 309 "ExtensionAPI.js", |
| 310 "ExtensionAuditCategory.js", |
| 311 "ExtensionPanel.js", |
| 312 "ExtensionRegistryStub.js", |
| 313 "ExtensionServer.js", |
| 314 "ExtensionView.js", |
| 315 ] |
| 316 }, |
| 317 { |
| 318 "name": "settings", |
| 319 "dependencies": ["components", "extensions"], |
| 320 "sources": [ |
| 321 "SettingsScreen.js", |
| 322 "OverridesView.js", |
| 323 ] |
| 324 }, |
| 325 { |
| 326 "name": "tests", |
| 327 "dependencies": ["components"], |
| 328 "sources": [ |
| 329 "TestController.js", |
| 330 ] |
| 331 }, |
| 332 { |
| 333 "name": "profiler", |
| 334 "dependencies": ["components", "workers"], |
| 335 "sources": [ |
| 336 "BottomUpProfileDataGridTree.js", |
| 337 "CPUProfileView.js", |
| 338 "CSSSelectorProfileView.js", |
| 339 "HeapSnapshot.js", |
| 340 "HeapSnapshotDataGrids.js", |
| 341 "HeapSnapshotGridNodes.js", |
| 342 "HeapSnapshotLoader.js", |
| 343 "HeapSnapshotProxy.js", |
| 344 "HeapSnapshotView.js", |
| 345 "HeapSnapshotWorker.js", |
| 346 "HeapSnapshotWorkerDispatcher.js", |
| 347 "JSHeapSnapshot.js", |
| 348 "NativeHeapSnapshot.js", |
| 349 "NativeMemorySnapshotView.js", |
| 350 "ProfileDataGridTree.js", |
| 351 "ProfilesPanel.js", |
| 352 "ProfilesPanelDescriptor.js", |
| 353 "ProfileLauncherView.js", |
| 354 "TopDownProfileDataGridTree.js", |
| 355 "CanvasProfileView.js", |
| 356 ] |
| 357 }, |
| 358 { |
| 359 "name": "host_stub", |
| 360 "dependencies": ["components", "profiler", "timeline"], |
| 361 "sources": [ |
| 362 "InspectorFrontendAPI.js", |
| 363 "InspectorFrontendHostStub.js", |
| 364 ] |
| 365 } |
| 366 ] |
| 367 |
| 368 modules_by_name = {} |
| 369 for module in modules: |
| 370 modules_by_name[module["name"]] = module |
| 371 |
| 372 |
| 373 def dump_module(name, recursively, processed_modules): |
| 374 if name in processed_modules: |
| 375 return "" |
| 376 processed_modules[name] = True |
| 377 module = modules_by_name[name] |
| 378 command = "" |
| 379 if recursively: |
| 380 for dependency in module["dependencies"]: |
| 381 command += dump_module(dependency, recursively, processed_modules) |
| 382 command += " \\\n --module " + jsmodule_name_prefix + module["name"] + ":
" |
| 383 command += str(len(module["sources"])) |
| 384 firstDependency = True |
| 385 for dependency in module["dependencies"]: |
| 386 if firstDependency: |
| 387 command += ":" |
| 388 else: |
| 389 command += "," |
| 390 firstDependency = False |
| 391 command += jsmodule_name_prefix + dependency |
| 392 for script in module["sources"]: |
| 393 command += " \\\n --js " + inspector_frontend_path + "/" + script |
| 394 return command |
| 395 |
| 396 modules_dir = tempfile.mkdtemp() |
| 397 compiler_command = "java -jar ~/closure/compiler.jar --summary_detail_level 3 --
compilation_level SIMPLE_OPTIMIZATIONS --warning_level VERBOSE --language_in ECM
ASCRIPT5 --accept_const_keyword --module_output_path_prefix %s/ \\\n" % modules_
dir |
| 398 |
| 399 process_recursively = len(sys.argv) > 1 |
| 400 if process_recursively: |
| 401 module_name = sys.argv[1] |
| 402 if module_name != "all": |
| 403 modules = [] |
| 404 for i in range(1, len(sys.argv)): |
| 405 modules.append(modules_by_name[sys.argv[i]]) |
| 406 for module in modules: |
| 407 command = compiler_command |
| 408 command += " --externs " + inspector_frontend_path + "/externs.js" |
| 409 command += dump_module(module["name"], True, {}) |
| 410 print "Compiling \"" + module["name"] + "\"" |
| 411 os.system(command) |
| 412 else: |
| 413 command = compiler_command |
| 414 command += " --externs " + inspector_frontend_path + "/externs.js" |
| 415 for module in modules: |
| 416 command += dump_module(module["name"], False, {}) |
| 417 os.system(command) |
| 418 |
| 419 if not process_recursively: |
| 420 print "Compiling InjectedScriptSource.js..." |
| 421 os.system("echo \"var injectedScriptValue = \" > " + inspector_path + "/" +
"InjectedScriptSourceTmp.js") |
| 422 os.system("cat " + inspector_path + "/" + "InjectedScriptSource.js" + " >>
" + inspector_path + "/" + "InjectedScriptSourceTmp.js") |
| 423 command = compiler_command |
| 424 command += " --externs " + inspector_path + "/" + "InjectedScriptExterns.
js" + " \\\n" |
| 425 command += " --externs " + protocol_externs_path + " \\\n" |
| 426 command += " --module " + jsmodule_name_prefix + "injected_script" + ":"
+ "1" + " \\\n" |
| 427 command += " --js " + inspector_path + "/" + "InjectedScriptSourceTmp
.js" + " \\\n" |
| 428 command += "\n" |
| 429 os.system(command) |
| 430 os.system("rm " + inspector_path + "/" + "InjectedScriptSourceTmp.js") |
| 431 |
| 432 print "Compiling InjectedScriptCanvasModuleSource.js..." |
| 433 os.system("echo \"var injectedScriptCanvasModuleValue = \" > " + inspector_p
ath + "/" + "InjectedScriptCanvasModuleSourceTmp.js") |
| 434 os.system("cat " + inspector_path + "/" + "InjectedScriptCanvasModuleSource
.js" + " >> " + inspector_path + "/" + "InjectedScriptCanvasModuleSourceTmp.js") |
| 435 command = compiler_command |
| 436 command += " --externs " + inspector_path + "/" + "InjectedScriptExterns.
js" + " \\\n" |
| 437 command += " --externs " + protocol_externs_path + " \\\n" |
| 438 command += " --module " + jsmodule_name_prefix + "injected_script" + ":"
+ "1" + " \\\n" |
| 439 command += " --js " + inspector_path + "/" + "InjectedScriptCanvasMod
uleSourceTmp.js" + " \\\n" |
| 440 command += "\n" |
| 441 os.system(command) |
| 442 os.system("rm " + inspector_path + "/" + "InjectedScriptCanvasModuleSourceTm
p.js") |
| 443 |
| 444 shutil.rmtree(modules_dir) |
| 445 #os.system("rm " + protocol_externs_path) |
| OLD | NEW |