Web Inspector: generated backend commands should reflect build system ENABLE settings
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Mar 2014 23:09:25 +0000 (23:09 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Mar 2014 23:09:25 +0000 (23:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=130111

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* CMakeLists.txt:

Combine only the Inspector domains listed in INSPECTOR_DOMAINS,
instead of globbing any .json file.

* DerivedSources.make:

Force the combined inspector protocol file to be regenerated if
the content or list of domains itself changes.

Source/WebCore:

Add guards for conditional inspector domains.

For Makefile-based build systems, force regeneration of the
combined file if the list of domains has changed.

Combine only the Inspector domains listed in INSPECTOR_DOMAINS,
instead of globbing any .json file.

* CMakeLists.txt:
* DerivedSources.make:
* GNUmakefile.am:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165714 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/DerivedSources.make
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/GNUmakefile.am

index 0b6b6f7..c0c35fa 100644 (file)
@@ -831,18 +831,18 @@ ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/parser/Lexer.cpp ${DERIVED_S
 set(JavaScriptCore_INSPECTOR_SCRIPTS_DIR "${JAVASCRIPTCORE_DIR}/inspector/scripts")
 
 set(JavaScriptCore_INSPECTOR_DOMAINS
-    inspector/protocol/Console.json
-    inspector/protocol/Debugger.json
-    inspector/protocol/GenericTypes.json
-    inspector/protocol/InspectorDomain.json
-    inspector/protocol/Runtime.json
+    ${JAVASCRIPTCORE_DIR}/inspector/protocol/Console.json
+    ${JAVASCRIPTCORE_DIR}/inspector/protocol/Debugger.json
+    ${JAVASCRIPTCORE_DIR}/inspector/protocol/GenericTypes.json
+    ${JAVASCRIPTCORE_DIR}/inspector/protocol/InspectorDomain.json
+    ${JAVASCRIPTCORE_DIR}/inspector/protocol/Runtime.json
 )
 
 add_custom_command(
     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJS.json
     MAIN_DEPENDENCY ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/generate-combined-inspector-json.py
     DEPENDS ${JavaScriptCore_INSPECTOR_DOMAINS}
-    COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/generate-combined-inspector-json.py ${JAVASCRIPTCORE_DIR}/inspector/protocol > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJS.json
+    COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_INSPECTOR_SCRIPTS_DIR}/generate-combined-inspector-json.py ${JavaScriptCore_INSPECTOR_DOMAINS} > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InspectorJS.json
     VERBATIM)
 
 # Inspector Backend Dispatchers, Frontend Dispatchers, Type Builders
index fd496ed..4ad463a 100644 (file)
@@ -1,5 +1,22 @@
 2014-03-16  Brian Burg  <bburg@apple.com>
 
+        Web Inspector: generated backend commands should reflect build system ENABLE settings
+        https://bugs.webkit.org/show_bug.cgi?id=130111
+
+        Reviewed by Timothy Hatcher.
+
+        * CMakeLists.txt:
+
+        Combine only the Inspector domains listed in INSPECTOR_DOMAINS,
+        instead of globbing any .json file.
+
+        * DerivedSources.make:
+
+        Force the combined inspector protocol file to be regenerated if
+        the content or list of domains itself changes.
+
+2014-03-16  Brian Burg  <bburg@apple.com>
+
         Web Inspector: vended backend commands file should be generated as part of the build
         https://bugs.webkit.org/show_bug.cgi?id=130110
 
index 5740d97..f99dede 100644 (file)
@@ -110,29 +110,26 @@ INSPECTOR_DOMAINS = \
     $(JavaScriptCore)/inspector/protocol/Runtime.json \
 #
 
-INPUT_GENERATOR_SCRIPTS = \
-    $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputs.py \
-    $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputsTemplates.py \
-#
-
 INSPECTOR_GENERATOR_SCRIPTS = \
        $(JavaScriptCore)/inspector/scripts/CodeGeneratorInspector.py \
        $(JavaScriptCore)/inspector/scripts/CodeGeneratorInspectorStrings.py \
 #
 
-INPUT_GENERATOR_SPECIFICATIONS = \
-    $(JavaScriptCore)/replay/JSInputs.json \
-#
-
 all : \
     InspectorJS.json \
     InspectorJSFrontendDispatchers.h \
     InjectedScriptSource.h \
-       JSReplayInputs.h \
 #
 
-InspectorJS.json : inspector/scripts/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS)
-       python $(JavaScriptCore)/inspector/scripts/generate-combined-inspector-json.py $(JavaScriptCore)/inspector/protocol > ./InspectorJS.json
+# The combined JSON file depends on the actual set of domains and their file contents, so that
+# adding, modifying, or removing domains will trigger regeneration of inspector files.
+
+.PHONY: force
+EnabledInspectorDomains : force
+       echo '$(INSPECTOR_DOMAINS)' | cmp -s - $@ || echo '$(INSPECTOR_DOMAINS)' > $@
+
+InspectorJS.json : inspector/scripts/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) EnabledInspectorDomains
+       python $(JavaScriptCore)/inspector/scripts/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) > ./InspectorJS.json
 
 # Inspector Backend Dispatchers, Frontend Dispatchers, Type Builders
 InspectorJSFrontendDispatchers.h : InspectorJS.json $(INSPECTOR_GENERATOR_SCRIPTS)
@@ -145,6 +142,16 @@ InjectedScriptSource.h : inspector/InjectedScriptSource.js $(JavaScriptCore)/ins
 
 # Web Replay inputs generator
 
+INPUT_GENERATOR_SCRIPTS = \
+    $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputs.py \
+    $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputsTemplates.py \
+#
+
+INPUT_GENERATOR_SPECIFICATIONS = \
+    $(JavaScriptCore)/replay/JSInputs.json \
+#
+
+all : JSReplayInputs.h
+
 JSReplayInputs.h : $(INPUT_GENERATOR_SPECIFICATIONS) $(INPUT_GENERATOR_SCRIPTS)
        python $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputs.py --outputDir . --framework JavaScriptCore $(INPUT_GENERATOR_SPECIFICATIONS)
-
index 8075e21..7111e1a 100644 (file)
@@ -755,22 +755,21 @@ set(WebCore_IDL_FILES
 set(WebCore_INSPECTOR_SCRIPTS_DIR "${JAVASCRIPTCORE_DIR}/inspector/scripts")
 
 set(WebCore_INSPECTOR_DOMAINS
-    inspector/protocol/ApplicationCache.json
-    inspector/protocol/CSS.json
-    inspector/protocol/Canvas.json
-    inspector/protocol/DOM.json
-    inspector/protocol/DOMDebugger.json
-    inspector/protocol/DOMStorage.json
-    inspector/protocol/Database.json
-    inspector/protocol/HeapProfiler.json
-    inspector/protocol/IndexedDB.json
-    inspector/protocol/Input.json
-    inspector/protocol/LayerTree.json
-    inspector/protocol/Network.json
-    inspector/protocol/Page.json
-    inspector/protocol/Profiler.json
-    inspector/protocol/Timeline.json
-    inspector/protocol/Worker.json
+    ${WEBCORE_DIR}/inspector/protocol/ApplicationCache.json
+    ${WEBCORE_DIR}/inspector/protocol/CSS.json
+    ${WEBCORE_DIR}/inspector/protocol/Canvas.json
+    ${WEBCORE_DIR}/inspector/protocol/DOM.json
+    ${WEBCORE_DIR}/inspector/protocol/DOMDebugger.json
+    ${WEBCORE_DIR}/inspector/protocol/DOMStorage.json
+    ${WEBCORE_DIR}/inspector/protocol/HeapProfiler.json
+    ${WEBCORE_DIR}/inspector/protocol/IndexedDB.json
+    ${WEBCORE_DIR}/inspector/protocol/Input.json
+    ${WEBCORE_DIR}/inspector/protocol/LayerTree.json
+    ${WEBCORE_DIR}/inspector/protocol/Network.json
+    ${WEBCORE_DIR}/inspector/protocol/Page.json
+    ${WEBCORE_DIR}/inspector/protocol/Profiler.json
+    ${WEBCORE_DIR}/inspector/protocol/Timeline.json
+    ${WEBCORE_DIR}/inspector/protocol/Worker.json
 )
 
 set(WebCore_SOURCES
@@ -2601,6 +2600,10 @@ if (ENABLE_SQL_DATABASE)
     list(APPEND WebCore_IDL_FILES
         Modules/webdatabase/WorkerGlobalScopeWebDatabase.idl
     )
+
+    list(APPEND WebCore_INSPECTOR_DOMAINS
+        ${WEBCORE_DIR}/inspector/protocol/Database.json
+    )
 endif ()
 
 if (ENABLE_NETSCAPE_PLUGIN_API)
@@ -3016,7 +3019,7 @@ add_custom_command(
     OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWeb.json
     MAIN_DEPENDENCY ${WebCore_INSPECTOR_SCRIPTS_DIR}/generate-combined-inspector-json.py
     DEPENDS ${WebCore_INSPECTOR_DOMAINS}
-    COMMAND ${PYTHON_EXECUTABLE} ${WebCore_INSPECTOR_SCRIPTS_DIR}/generate-combined-inspector-json.py ${WEBCORE_DIR}/inspector/protocol > ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWeb.json
+    COMMAND ${PYTHON_EXECUTABLE} ${WebCore_INSPECTOR_SCRIPTS_DIR}/generate-combined-inspector-json.py ${WebCore_INSPECTOR_DOMAINS} > ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorWeb.json
     VERBATIM)
 
 # All Web Inspector generated files are created with this one call to CodeGeneratorInspector.pm
index 47f9f75..3ad525d 100644 (file)
@@ -1,3 +1,22 @@
+2014-03-16  Brian Burg  <bburg@apple.com>
+
+        Web Inspector: generated backend commands should reflect build system ENABLE settings
+        https://bugs.webkit.org/show_bug.cgi?id=130111
+
+        Reviewed by Timothy Hatcher.
+
+        Add guards for conditional inspector domains.
+
+        For Makefile-based build systems, force regeneration of the
+        combined file if the list of domains has changed.
+
+        Combine only the Inspector domains listed in INSPECTOR_DOMAINS,
+        instead of globbing any .json file.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * GNUmakefile.am:
+
 2014-03-16  David Kilzer  <ddkilzer@apple.com>
 
         Follow-up: Double values passed to fabsf() in maxScaleFromTransform()
index e4869f6..a783db0 100644 (file)
@@ -1115,19 +1115,28 @@ INSPECTOR_DOMAINS = \
     $(WebCore)/inspector/protocol/DOM.json \
     $(WebCore)/inspector/protocol/DOMDebugger.json \
     $(WebCore)/inspector/protocol/DOMStorage.json \
-    $(WebCore)/inspector/protocol/Database.json \
     $(WebCore)/inspector/protocol/HeapProfiler.json \
-    $(WebCore)/inspector/protocol/IndexedDB.json \
     $(WebCore)/inspector/protocol/Input.json \
     $(WebCore)/inspector/protocol/LayerTree.json \
     $(WebCore)/inspector/protocol/Network.json \
     $(WebCore)/inspector/protocol/Page.json \
     $(WebCore)/inspector/protocol/Profiler.json \
-    $(WebCore)/inspector/protocol/Replay.json \
     $(WebCore)/inspector/protocol/Timeline.json \
     $(WebCore)/inspector/protocol/Worker.json \
 #
 
+ifeq ($(findstring ENABLE_SQL_DATABASE,$(FEATURE_DEFINES)), ENABLE_SQL_DATABASE)
+    INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(WebCore)/inspector/protocol/Database.json
+endif
+
+ifeq ($(findstring ENABLE_INDEXED_DATABASE,$(FEATURE_DEFINES)), ENABLE_INDEXED_DATABASE)
+    INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(WebCore)/inspector/protocol/IndexedDB.json
+endif
+
+ifeq ($(findstring ENABLE_WEB_REPLAY,$(FEATURE_DEFINES)), ENABLE_WEB_REPLAY)
+    INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(WebCore)/inspector/protocol/Replay.json
+endif
+
 INSPECTOR_GENERATOR_SCRIPTS = \
        $(InspectorScripts)/CodeGeneratorInspector.py \
        $(InspectorScripts)/CodeGeneratorInspectorStrings.py \
@@ -1135,8 +1144,15 @@ INSPECTOR_GENERATOR_SCRIPTS = \
 
 all : InspectorWeb.json
 
-InspectorWeb.json : $(InspectorScripts)/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS)
-       python $(InspectorScripts)/generate-combined-inspector-json.py $(WebCore)/inspector/protocol > ./InspectorWeb.json
+# The combined JSON file depends on the actual set of domains and their file contents, so that
+# adding, modifying, or removing domains will trigger regeneration of inspector files.
+
+.PHONY: force
+EnabledInspectorDomains : force
+       echo '$(INSPECTOR_DOMAINS)' | cmp -s - $@ || echo '$(INSPECTOR_DOMAINS)' > $@
+
+InspectorWeb.json : $(InspectorScripts)/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) EnabledInspectorDomains
+       python $(InspectorScripts)/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) > ./InspectorWeb.json
 
 all : InspectorWebFrontendDispatchers.h
 
index 40df2c9..af1a7c5 100644 (file)
@@ -346,9 +346,7 @@ WebCore_INSPECTOR_DOMAINS := \
     $(WebCore)/inspector/protocol/DOM.json \
     $(WebCore)/inspector/protocol/DOMDebugger.json \
     $(WebCore)/inspector/protocol/DOMStorage.json \
-    $(WebCore)/inspector/protocol/Database.json \
     $(WebCore)/inspector/protocol/HeapProfiler.json \
-    $(WebCore)/inspector/protocol/IndexedDB.json \
     $(WebCore)/inspector/protocol/Input.json \
     $(WebCore)/inspector/protocol/LayerTree.json \
     $(WebCore)/inspector/protocol/Network.json \
@@ -357,7 +355,23 @@ WebCore_INSPECTOR_DOMAINS := \
     $(WebCore)/inspector/protocol/Timeline.json \
     $(WebCore)/inspector/protocol/Worker.json
 
-DerivedSources/WebCore/InspectorWeb.json: $(INSPECTOR_SCRIPTS_DIR)/generate-combined-inspector-json.py $(WebCore_INSPECTOR_DOMAINS)
+
+if ENABLE_SQL_DATABASE
+    WebCore_INSPECTOR_DOMAINS += $(WebCore)/inspector/protocol/Database.json
+endif
+
+if ENABLE_INDEXED_DATABASE
+    WebCore_INSPECTOR_DOMAINS += $(WebCore)/inspector/protocol/IndexedDB.json
+endif
+
+# The combined JSON file depends on the actual set of domains and their file contents, so that
+# adding, modifying, or removing domains will trigger regeneration of inspector files.
+
+.PHONY: force
+EnabledInspectorDomains: force
+       echo '$(WebCore_INSPECTOR_DOMAINS)' | cmp -s - $@ || echo '$(WebCore_INSPECTOR_DOMAINS)' > $@
+
+DerivedSources/WebCore/InspectorWeb.json: $(INSPECTOR_SCRIPTS_DIR)/generate-combined-inspector-json.py $(WebCore_INSPECTOR_DOMAINS) EnabledInspectorDomains
        $(AM_V_GEN)$(PYTHON) $(INSPECTOR_SCRIPTS_DIR)/generate-combined-inspector-json.py $(WebCore)/inspector/protocol > $(GENSOURCES_WEBCORE)/InspectorWeb.json
 
 # All Web Inspector generated files are created with this one call to CodeGeneratorInspector.py