JSC build should use unified sources for derived sources
authorkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Sep 2017 15:34:19 +0000 (15:34 +0000)
committerkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Sep 2017 15:34:19 +0000 (15:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177421

Reviewed by JF Bastien.

.:

* Source/cmake/WebKitMacros.cmake:

Source/JavaScriptCore:

This patch make a couple of changes:

1) Make derived sources added to relevant bundles. I was going to add JSCBuiltins.cpp
to runtime but that kept breaking the windows build. I'll get back to it later
2) Move the derived location of some sources both for clarity and for ease of use.
3) Make auto generator scripts able to create directories if needed.
4) Move some scripts from the top level of the JavaScriptCore directory to a
more appropriate directory.
5) Move some CMake generation commands around for clarity.

* CMakeLists.txt:
* DerivedSources.make:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Scripts/lazywriter.py:
(LazyFileWriter.close):
* Sources.txt:
* inspector/scripts/generate-inspector-protocol-bindings.py:
(IncrementalFileWriter.close):
* yarr/create_regex_tables: Renamed from Source/JavaScriptCore/create_regex_tables.
* yarr/generateYarrCanonicalizeUnicode: Renamed from Source/JavaScriptCore/generateYarrCanonicalizeUnicode.

Source/WTF:

The script now needs to determine if a file is from a derived
source. This is only relevant for the CMake build since the
script needs to provide a list of the bundled source files. If the
script does not provide the full path for derived sources then
CMake will be unable to find them and the build will fail.

Additionally, I move the error message for the Xcode build outside
the main loop. This means that the error message will contain all
the files you need to add to Xcode and all those files will now be
written in DerivedSources so they should be easier to add.

* Scripts/generate-unified-source-bundles.rb:

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

13 files changed:
ChangeLog
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/DerivedSources.make
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/Scripts/lazywriter.py
Source/JavaScriptCore/Sources.txt
Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
Source/JavaScriptCore/yarr/create_regex_tables [moved from Source/JavaScriptCore/create_regex_tables with 97% similarity]
Source/JavaScriptCore/yarr/generateYarrCanonicalizeUnicode [moved from Source/JavaScriptCore/generateYarrCanonicalizeUnicode with 98% similarity]
Source/WTF/ChangeLog
Source/WTF/Scripts/generate-unified-source-bundles.rb
Source/cmake/WebKitMacros.cmake

index 13a680d8d7dec3bd01d9d28333ececc2d684547b..d64b2c53ffb242c2a1a0751d6876e581e9665f04 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-09-24  Keith Miller  <keith_miller@apple.com>
+
+        JSC build should use unified sources for derived sources
+        https://bugs.webkit.org/show_bug.cgi?id=177421
+
+        Reviewed by JF Bastien.
+
+        * Source/cmake/WebKitMacros.cmake:
+
 2017-09-26  Zan Dobersek  <zdobersek@igalia.com>
 
         [CMake] Use implicit include directories for Clang as well
index 942d3f88020ed8c5601ffe43cb1357c86d7fa64c..f9d6b232b8345f74de59dde68a6ed372ee7e0738 100644 (file)
@@ -40,6 +40,8 @@ set(JavaScriptCore_INCLUDE_DIRECTORIES
     "${FORWARDING_HEADERS_DIR}"
     "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}"
     "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector"
+    "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/runtime"
+    "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr"
 )
 
 set(JavaScriptCore_SYSTEM_INCLUDE_DIRECTORIES
@@ -356,24 +358,20 @@ GENERATE_HASH_LUT(${CMAKE_CURRENT_SOURCE_DIR}/parser/Keywords.table ${DERIVED_SO
 
 #GENERATOR: "RegExpJitTables.h": tables used by Yarr
 add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
-    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables
-    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
+    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr/RegExpJitTables.h
+    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/yarr/create_regex_tables
+    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/yarr/create_regex_tables ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr/RegExpJitTables.h
     VERBATIM)
-list(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h)
-WEBKIT_ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h)
+list(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr/RegExpJitTables.h)
+WEBKIT_ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr/RegExpJitTables.h)
 
 add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/YarrCanonicalizeUnicode.cpp
-    MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/generateYarrCanonicalizeUnicode
+    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr/YarrCanonicalizeUnicode.cpp
+    MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/yarr/generateYarrCanonicalizeUnicode
     DEPENDS ${JAVASCRIPTCORE_DIR}/ucd/CaseFolding.txt
-    COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/generateYarrCanonicalizeUnicode ${JAVASCRIPTCORE_DIR}/ucd/CaseFolding.txt ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/YarrCanonicalizeUnicode.cpp
+    COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/yarr/generateYarrCanonicalizeUnicode ${JAVASCRIPTCORE_DIR}/ucd/CaseFolding.txt ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/yarr/YarrCanonicalizeUnicode.cpp
     VERBATIM)
 
-list(APPEND JavaScriptCore_SOURCES
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/YarrCanonicalizeUnicode.cpp
-)
-
 #GENERATOR: "KeywordLookup.h": keyword decision tree used by the lexer
 add_custom_command(
     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
@@ -521,19 +519,6 @@ set(JavaScriptCore_BUILTINS_SOURCES
     ${JAVASCRIPTCORE_DIR}/builtins/TypedArrayPrototype.js
 )
 
-add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcode.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcodeGenerated.h
-    MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/b3/air/AirOpcode.opcodes
-    DEPENDS ${JAVASCRIPTCORE_DIR}/b3/air/opcode_generator.rb
-    COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/b3/air/opcode_generator.rb ${JAVASCRIPTCORE_DIR}/b3/air/AirOpcode.opcodes VERBATIM
-    WORKING_DIRECTORY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}
-)
-
-list(APPEND JavaScriptCore_HEADERS
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcode.h
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcodeGenerated.h
-)
-
 add_custom_command(
     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.h
     MAIN_DEPENDENCY ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins.py
@@ -541,13 +526,6 @@ add_custom_command(
     COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_SCRIPTS_DIR}/generate-js-builtins.py --framework JavaScriptCore --output-directory ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR} --combined ${JavaScriptCore_BUILTINS_SOURCES}
     VERBATIM)
 
-list(APPEND JavaScriptCore_SOURCES
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendDispatchers.cpp
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorFrontendDispatchers.cpp
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorProtocolObjects.cpp
-    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.cpp
-)
-
 list(APPEND JavaScriptCore_HEADERS
     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendDispatchers.h
     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorFrontendDispatchers.h
@@ -555,6 +533,19 @@ list(APPEND JavaScriptCore_HEADERS
     ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/JSCBuiltins.h
 )
 
+add_custom_command(
+    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcode.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcodeGenerated.h
+    MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/b3/air/AirOpcode.opcodes
+    DEPENDS ${JAVASCRIPTCORE_DIR}/b3/air/opcode_generator.rb
+    COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/b3/air/opcode_generator.rb ${JAVASCRIPTCORE_DIR}/b3/air/AirOpcode.opcodes VERBATIM
+    WORKING_DIRECTORY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}
+)
+
+list(APPEND JavaScriptCore_HEADERS
+    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcode.h
+    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/AirOpcodeGenerated.h
+)
+
 add_custom_command(
     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InjectedScriptSource.h ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InjectedScriptSource.min.js
     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/inspector/InjectedScriptSource.js
index 2b5cb73a06b61660cb30a486dd5085eb94ebf6d8..b4841e90670866eb0d357806f98401053bf5346b 100644 (file)
@@ -1,3 +1,31 @@
+2017-09-24  Keith Miller  <keith_miller@apple.com>
+
+        JSC build should use unified sources for derived sources
+        https://bugs.webkit.org/show_bug.cgi?id=177421
+
+        Reviewed by JF Bastien.
+
+        This patch make a couple of changes:
+
+        1) Make derived sources added to relevant bundles. I was going to add JSCBuiltins.cpp
+        to runtime but that kept breaking the windows build. I'll get back to it later
+        2) Move the derived location of some sources both for clarity and for ease of use.
+        3) Make auto generator scripts able to create directories if needed.
+        4) Move some scripts from the top level of the JavaScriptCore directory to a
+        more appropriate directory.
+        5) Move some CMake generation commands around for clarity.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * Scripts/lazywriter.py:
+        (LazyFileWriter.close):
+        * Sources.txt:
+        * inspector/scripts/generate-inspector-protocol-bindings.py:
+        (IncrementalFileWriter.close):
+        * yarr/create_regex_tables: Renamed from Source/JavaScriptCore/create_regex_tables.
+        * yarr/generateYarrCanonicalizeUnicode: Renamed from Source/JavaScriptCore/generateYarrCanonicalizeUnicode.
+
 2017-09-26  Zan Dobersek  <zdobersek@igalia.com>
 
         Support building JavaScriptCore with the Bionic C library
index 789f60cf5982332351e6fa4a399b0acc89439194..d97306e5c8560396971445d7913542e253d58fba 100644 (file)
@@ -56,13 +56,13 @@ all : \
     CombinedDomains.json \
     InitBytecodes.asm \
     InjectedScriptSource.h \
-    InspectorFrontendDispatchers.h \
+    inspector/InspectorFrontendDispatchers.h \
     JSCBuiltins.h \
     Lexer.lut.h \
     KeywordLookup.h \
     RegExpJitTables.h \
     AirOpcode.h \
-    YarrCanonicalizeUnicode.cpp \
+    yarr/YarrCanonicalizeUnicode.cpp \
     WasmOps.h \
     WasmValidateInlines.h \
     WasmB3IRGeneratorInlines.h \
@@ -196,7 +196,7 @@ Lexer.lut.h: Keywords.table $(JavaScriptCore)/create_hash_table
 
 # character tables for Yarr
 
-RegExpJitTables.h: create_regex_tables
+RegExpJitTables.h: yarr/create_regex_tables
        $(PYTHON) $^ > $@
 
 KeywordLookup.h: KeywordLookupGenerator.py Keywords.table
@@ -281,8 +281,8 @@ CombinedDomains.json : $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector
        $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) > ./CombinedDomains.json
 
 # Inspector Backend Dispatchers, Frontend Dispatchers, Type Builders
-InspectorFrontendDispatchers.h : CombinedDomains.json $(INSPECTOR_GENERATOR_SCRIPTS)
-       $(PYTHON) $(JavaScriptCore)/inspector/scripts/generate-inspector-protocol-bindings.py --framework JavaScriptCore --outputDir . ./CombinedDomains.json
+inspector/InspectorFrontendDispatchers.h : CombinedDomains.json $(INSPECTOR_GENERATOR_SCRIPTS) inspector
+       $(PYTHON) $(JavaScriptCore)/inspector/scripts/generate-inspector-protocol-bindings.py --framework JavaScriptCore --outputDir inspector ./CombinedDomains.json
 
 InjectedScriptSource.h : inspector/InjectedScriptSource.js $(JavaScriptCore_SCRIPTS_DIR)/jsmin.py $(JavaScriptCore_SCRIPTS_DIR)/xxd.pl
        echo "//# sourceURL=__InjectedScript_InjectedScriptSource.js" > ./InjectedScriptSource.min.js
@@ -293,8 +293,8 @@ InjectedScriptSource.h : inspector/InjectedScriptSource.js $(JavaScriptCore_SCRI
 AirOpcode.h: $(JavaScriptCore)/b3/air/opcode_generator.rb $(JavaScriptCore)/b3/air/AirOpcode.opcodes
        $(RUBY) $^
 
-YarrCanonicalizeUnicode.cpp: $(JavaScriptCore)/generateYarrCanonicalizeUnicode $(JavaScriptCore)/ucd/CaseFolding.txt
-       $(PYTHON) $(JavaScriptCore)/generateYarrCanonicalizeUnicode $(JavaScriptCore)/ucd/CaseFolding.txt ./YarrCanonicalizeUnicode.cpp
+yarr/YarrCanonicalizeUnicode.cpp: $(JavaScriptCore)/yarr/generateYarrCanonicalizeUnicode $(JavaScriptCore)/ucd/CaseFolding.txt
+       $(PYTHON) $(JavaScriptCore)/yarr/generateYarrCanonicalizeUnicode $(JavaScriptCore)/ucd/CaseFolding.txt ./yarr/YarrCanonicalizeUnicode.cpp
 
 WasmOps.h: $(JavaScriptCore)/wasm/generateWasmOpsHeader.py $(JavaScriptCore)/wasm/generateWasm.py $(JavaScriptCore)/wasm/wasm.json
        $(PYTHON) $(JavaScriptCore)/wasm/generateWasmOpsHeader.py $(JavaScriptCore)/wasm/wasm.json ./WasmOps.h
index 5762f68df8d6b483a0107fe38e875c11f33a9012..feb7401474b95965b4e6e59a5e83778404b54dc5 100644 (file)
                534E03581E53BF2F00213F64 /* GetterSetterAccessCase.h in Headers */ = {isa = PBXBuildFile; fileRef = 534E03571E53BF2F00213F64 /* GetterSetterAccessCase.h */; };
                53529A4C1C457B75000B49C6 /* APIUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 53529A4B1C457B75000B49C6 /* APIUtils.h */; };
                535557141D9D9EA5006D583B /* WasmMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 535557131D9D9EA5006D583B /* WasmMemory.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               535C24611F78928E006EC40E /* create_regex_tables in Headers */ = {isa = PBXBuildFile; fileRef = A718F8211178EB4B002465A7 /* create_regex_tables */; };
+               535C24691F7A1624006EC40E /* JSCBuiltins.cpp in Headers */ = {isa = PBXBuildFile; fileRef = A7D801A61880D6A80026C39B /* JSCBuiltins.cpp */; };
+               535C246C1F7A1778006EC40E /* UnifiedSource136.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 535C246B1F7A1777006EC40E /* UnifiedSource136.cpp */; };
                536B310C1F71C5990037FC33 /* UnifiedSource119.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 536B30871F71C5380037FC33 /* UnifiedSource119.cpp */; };
                536B310D1F71C5990037FC33 /* UnifiedSource125.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 536B30881F71C5380037FC33 /* UnifiedSource125.cpp */; };
                536B310E1F71C5990037FC33 /* UnifiedSource131.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 536B30891F71C5380037FC33 /* UnifiedSource131.cpp */; };
                53E777E41E92E265007CBEC4 /* WasmModuleInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 53E777E21E92E265007CBEC4 /* WasmModuleInformation.h */; };
                53E9E0AC1EAE83DF00FEE251 /* WasmMachineThreads.h in Headers */ = {isa = PBXBuildFile; fileRef = 53E9E0AA1EAE83DE00FEE251 /* WasmMachineThreads.h */; };
                53E9E0AF1EAEC45700FEE251 /* WasmTierUpCount.h in Headers */ = {isa = PBXBuildFile; fileRef = 53E9E0AE1EAEC45700FEE251 /* WasmTierUpCount.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               53F1B5421F6A14A500E2D043 /* InspectorFrontendDispatchers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A532438318568317002ED692 /* InspectorFrontendDispatchers.cpp */; };
-               53F1B5431F6A14AC00E2D043 /* InspectorProtocolObjects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A532438518568317002ED692 /* InspectorProtocolObjects.cpp */; };
-               53F1B5441F6A14BC00E2D043 /* JSCBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D801A61880D6A80026C39B /* JSCBuiltins.cpp */; };
-               53F1B5451F6A14D000E2D043 /* YarrCanonicalizeUnicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65A946141C8E9F6F00A7209A /* YarrCanonicalizeUnicode.cpp */; };
-               53F1B5481F6A157700E2D043 /* InspectorBackendDispatchers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A532438118568317002ED692 /* InspectorBackendDispatchers.cpp */; };
                53F40E851D58F9770099A1B6 /* WasmSections.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F40E841D58F9770099A1B6 /* WasmSections.h */; };
                53F40E8B1D5901BB0099A1B6 /* WasmFunctionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F40E8A1D5901BB0099A1B6 /* WasmFunctionParser.h */; };
                53F40E8D1D5901F20099A1B6 /* WasmParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 53F40E8C1D5901F20099A1B6 /* WasmParser.h */; };
                53529A4B1C457B75000B49C6 /* APIUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIUtils.h; sourceTree = "<group>"; };
                535557131D9D9EA5006D583B /* WasmMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmMemory.h; sourceTree = "<group>"; };
                535557151D9DFA32006D583B /* WasmMemory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WasmMemory.cpp; sourceTree = "<group>"; };
+               535C246B1F7A1777006EC40E /* UnifiedSource136.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource136.cpp; sourceTree = "<group>"; };
                536B30871F71C5380037FC33 /* UnifiedSource119.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource119.cpp; sourceTree = "<group>"; };
                536B30881F71C5380037FC33 /* UnifiedSource125.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource125.cpp; sourceTree = "<group>"; };
                536B30891F71C5380037FC33 /* UnifiedSource131.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource131.cpp; sourceTree = "<group>"; };
                658D3A5519638268003C45D6 /* VMEntryRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = VMEntryRecord.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
                65987F2C167FE84B003C2F8D /* DFGOSRExitCompilationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGOSRExitCompilationInfo.h; path = dfg/DFGOSRExitCompilationInfo.h; sourceTree = "<group>"; };
                65987F2F16828A7E003C2F8D /* UnusedPointer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnusedPointer.h; sourceTree = "<group>"; };
-               65A946131C8E9F2000A7209A /* generateYarrCanonicalizeUnicode */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = generateYarrCanonicalizeUnicode; sourceTree = "<group>"; };
+               65A946131C8E9F2000A7209A /* generateYarrCanonicalizeUnicode */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; name = generateYarrCanonicalizeUnicode; path = yarr/generateYarrCanonicalizeUnicode; sourceTree = "<group>"; };
                65A946141C8E9F6F00A7209A /* YarrCanonicalizeUnicode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YarrCanonicalizeUnicode.cpp; sourceTree = "<group>"; };
                65B8392C1BACA92A0044E824 /* CachedRecovery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedRecovery.h; sourceTree = "<group>"; };
                65B8392D1BACA9D30044E824 /* CachedRecovery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedRecovery.cpp; sourceTree = "<group>"; };
                A709F2F117A0AC2A00512E98 /* CommonSlowPaths.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommonSlowPaths.cpp; sourceTree = "<group>"; };
                A71236E41195F33C00BD2174 /* JITOpcodes32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITOpcodes32_64.cpp; sourceTree = "<group>"; };
                A718F61A11754A21002465A7 /* RegExpJitTables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpJitTables.h; sourceTree = "<group>"; };
-               A718F8211178EB4B002465A7 /* create_regex_tables */ = {isa = PBXFileReference; explicitFileType = text.script.python; fileEncoding = 4; path = create_regex_tables; sourceTree = "<group>"; };
+               A718F8211178EB4B002465A7 /* create_regex_tables */ = {isa = PBXFileReference; explicitFileType = text.script.python; fileEncoding = 4; name = create_regex_tables; path = yarr/create_regex_tables; sourceTree = "<group>"; };
                A72028B41797601E0098028C /* JSCTestRunnerUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCTestRunnerUtils.cpp; sourceTree = "<group>"; };
                A72028B51797601E0098028C /* JSCTestRunnerUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCTestRunnerUtils.h; sourceTree = "<group>"; };
                A72028B91797603D0098028C /* JSFunctionInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFunctionInlines.h; sourceTree = "<group>"; };
                0867D691FE84028FC02AAC07 /* JavaScriptCore */ = {
                        isa = PBXGroup;
                        children = (
-                               65A946131C8E9F2000A7209A /* generateYarrCanonicalizeUnicode */,
                                8604F4F2143A6C4400B295F5 /* ChangeLog */,
                                F68EBB8C0255D4C601FF60F7 /* config.h */,
                                F692A8540255597D01FF60F7 /* create_hash_table */,
-                               A718F8211178EB4B002465A7 /* create_regex_tables */,
                                937B63CC09E766D200A671DD /* DerivedSources.make */,
                                0F93275A1C20BCDF00CF6564 /* dynbench.cpp */,
                                6529FB3018B2D63900C61102 /* generate-bytecode-files */,
                        name = accessCase;
                        sourceTree = "<group>";
                };
-               536B30861F71C5380037FC33 /* unified-souces */ = {
+               535C24651F789389006EC40E /* inspector */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A5EA710D19F6DF810098F5EC /* InspectorAlternateBackendDispatchers.h */,
+                               A53243961856A475002ED692 /* InspectorBackendCommands.js */,
+                               A532438118568317002ED692 /* InspectorBackendDispatchers.cpp */,
+                               A532438218568317002ED692 /* InspectorBackendDispatchers.h */,
+                               A532438318568317002ED692 /* InspectorFrontendDispatchers.cpp */,
+                               A532438418568317002ED692 /* InspectorFrontendDispatchers.h */,
+                               A532438518568317002ED692 /* InspectorProtocolObjects.cpp */,
+                               A532438618568317002ED692 /* InspectorProtocolObjects.h */,
+                       );
+                       path = inspector;
+                       sourceTree = "<group>";
+               };
+               535C24661F789452006EC40E /* runtime */ = {
+                       isa = PBXGroup;
+                       children = (
+                       );
+                       path = runtime;
+                       sourceTree = "<group>";
+               };
+               535C24671F7894A2006EC40E /* yarr */ = {
+                       isa = PBXGroup;
+                       children = (
+                               65A946141C8E9F6F00A7209A /* YarrCanonicalizeUnicode.cpp */,
+                       );
+                       path = yarr;
+                       sourceTree = "<group>";
+               };
+               536B30861F71C5380037FC33 /* unified-sources */ = {
                        isa = PBXGroup;
                        children = (
                                536B30DA1F71C5380037FC33 /* UnifiedSource1.cpp */,
                                536B30981F71C5380037FC33 /* UnifiedSource133.cpp */,
                                536B31971F735E5B0037FC33 /* UnifiedSource134.cpp */,
                                536B31991F735E5D0037FC33 /* UnifiedSource135.cpp */,
+                               535C246B1F7A1777006EC40E /* UnifiedSource136.cpp */,
                                536B30F71F71C5380037FC33 /* UnifiedSource14.cpp */,
                                536B30F81F71C5380037FC33 /* UnifiedSource15.cpp */,
                                536B30F11F71C5380037FC33 /* UnifiedSource16.cpp */,
                                536B30E51F71C5380037FC33 /* UnifiedSource98.cpp */,
                                536B30DE1F71C5380037FC33 /* UnifiedSource99.cpp */,
                        );
-                       path = "unified-souces";
+                       path = "unified-sources";
                        sourceTree = "<group>";
                };
                650FDF8D09D0FCA700769E54 /* Derived Sources */ = {
                        isa = PBXGroup;
                        children = (
-                               536B30861F71C5380037FC33 /* unified-souces */,
+                               535C24651F789389006EC40E /* inspector */,
+                               535C24661F789452006EC40E /* runtime */,
+                               536B30861F71C5380037FC33 /* unified-sources */,
+                               535C24671F7894A2006EC40E /* yarr */,
                                0F6183321C45F35C0072450B /* AirOpcode.h */,
                                0F6183341C45F3B60072450B /* AirOpcodeGenerated.h */,
                                0F6183351C45F3B60072450B /* AirOpcodeUtils.h */,
                                70B791901C0246CE002481E2 /* GeneratorPrototype.lut.h */,
                                6514F21818B3E1670098FF8B /* InitBytecodes.asm */,
                                A513E5C6185F9436007E95AD /* InjectedScriptSource.h */,
-                               A5EA710D19F6DF810098F5EC /* InspectorAlternateBackendDispatchers.h */,
-                               A53243961856A475002ED692 /* InspectorBackendCommands.js */,
-                               A532438118568317002ED692 /* InspectorBackendDispatchers.cpp */,
-                               A532438218568317002ED692 /* InspectorBackendDispatchers.h */,
-                               A532438318568317002ED692 /* InspectorFrontendDispatchers.cpp */,
-                               A532438418568317002ED692 /* InspectorFrontendDispatchers.h */,
                                E33B3E251B7ABD750048DB2E /* InspectorInstrumentationObject.lut.h */,
-                               A532438518568317002ED692 /* InspectorProtocolObjects.cpp */,
-                               A532438618568317002ED692 /* InspectorProtocolObjects.h */,
                                A18193E11B4E0CDB00FC1029 /* IntlCollatorConstructor.lut.h */,
                                A18193E21B4E0CDB00FC1029 /* IntlCollatorPrototype.lut.h */,
                                A1587D731B4DC1C600D69849 /* IntlDateTimeFormatConstructor.lut.h */,
                                AD2FCC131DB59C5900B3E736 /* WebAssemblyRuntimeErrorPrototype.lut.h */,
                                AD2FCC141DB59C5900B3E736 /* WebAssemblyTableConstructor.lut.h */,
                                AD2FCC151DB59C5900B3E736 /* WebAssemblyTablePrototype.lut.h */,
-                               65A946141C8E9F6F00A7209A /* YarrCanonicalizeUnicode.cpp */,
                        );
                        name = "Derived Sources";
                        path = DerivedSources/JavaScriptCore;
                86EAC48C0F93E8B9008EC948 /* yarr */ = {
                        isa = PBXGroup;
                        children = (
+                               A718F8211178EB4B002465A7 /* create_regex_tables */,
+                               65A946131C8E9F2000A7209A /* generateYarrCanonicalizeUnicode */,
                                A57D23EB1891B5540031C7FA /* RegularExpression.cpp */,
                                A57D23EC1891B5540031C7FA /* RegularExpression.h */,
                                451539B812DC994500EF7AC4 /* Yarr.h */,
                                C4F4B6F31A05C944005CAB76 /* cpp_generator_templates.py in Headers */,
                                0F30D7C01D95D6320053089D /* CPU.h in Headers */,
                                5DE6E5B30E1728EC00180407 /* create_hash_table in Headers */,
+                               535C24611F78928E006EC40E /* create_regex_tables in Headers */,
                                9959E92B1BD17FA4001AA413 /* cssmin.py in Headers */,
                                2A111246192FCE79005EE18D /* CustomGetterSetter.h in Headers */,
                                0F426A4B1460CD6E00131F8F /* DataFormat.h in Headers */,
                                BC18C41B0E16F5CD00B34460 /* JSCallbackObject.h in Headers */,
                                BC18C41C0E16F5CD00B34460 /* JSCallbackObjectFunctions.h in Headers */,
                                657CF45919BF6662004ACBF2 /* JSCallee.h in Headers */,
+                               535C24691F7A1624006EC40E /* JSCBuiltins.cpp in Headers */,
                                A7D801A91880D6A80026C39B /* JSCBuiltins.h in Headers */,
                                BC1167DA0E19BCC9008066DD /* JSCell.h in Headers */,
                                0F9749711687ADE400A4FF6A /* JSCellInlines.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "set -e\n\ncd $SRCROOT\n\nif [ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]; then\n    BUILD_SCRIPTS_DIR=\"${SDKROOT}/usr/local/include/wtf/Scripts\"\nelse\n    BUILD_SCRIPTS_DIR=\"${BUILT_PRODUCTS_DIR}/usr/local/include/wtf/Scripts\"\nfi\n\nUnifiedSourceCppFileCount=135\nUnifiedSourceMmFileCount=135\n\n/usr/bin/env ruby \"${BUILD_SCRIPTS_DIR}/generate-unified-source-bundles.rb\" \"--derived-sources-path\" \"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\" \"--max-cpp-bundle-count\" \"${UnifiedSourceCppFileCount}\" \"--max-obj-c-bundle-count\" \"${UnifiedSourceMmFileCount}\" \"Sources.txt\" \"SourcesMac.txt\" > /dev/null\n";
+                       shellScript = "set -e\n\ncd $SRCROOT\n\nif [ \"${DEPLOYMENT_LOCATION}\" == \"YES\" ]; then\n    BUILD_SCRIPTS_DIR=\"${SDKROOT}/usr/local/include/wtf/Scripts\"\nelse\n    BUILD_SCRIPTS_DIR=\"${BUILT_PRODUCTS_DIR}/usr/local/include/wtf/Scripts\"\nfi\n\nUnifiedSourceCppFileCount=136\nUnifiedSourceMmFileCount=2\n\n/usr/bin/env ruby \"${BUILD_SCRIPTS_DIR}/generate-unified-source-bundles.rb\" \"--derived-sources-path\" \"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\" \"--source-tree-path\" \"${SRCROOT}\" \"--max-cpp-bundle-count\" \"${UnifiedSourceCppFileCount}\" \"--max-obj-c-bundle-count\" \"${UnifiedSourceMmFileCount}\" \"Sources.txt\" \"SourcesMac.txt\" > /dev/null\n";
                };
                5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables and Externals */ = {
                        isa = PBXShellScriptBuildPhase;
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               53F1B5481F6A157700E2D043 /* InspectorBackendDispatchers.cpp in Sources */,
-                               53F1B5421F6A14A500E2D043 /* InspectorFrontendDispatchers.cpp in Sources */,
-                               53F1B5431F6A14AC00E2D043 /* InspectorProtocolObjects.cpp in Sources */,
-                               53F1B5441F6A14BC00E2D043 /* JSCBuiltins.cpp in Sources */,
                                536B319E1F735F160037FC33 /* LowLevelInterpreter.cpp in Sources */,
                                0FF4274A158EBE91004CB9FF /* udis86.c in Sources */,
                                0FF42740158EBE8B004CB9FF /* udis86_decode.c in Sources */,
                                536B311D1F71C5990037FC33 /* UnifiedSource133.cpp in Sources */,
                                536B319C1F735E7D0037FC33 /* UnifiedSource134.cpp in Sources */,
                                536B319D1F735E7D0037FC33 /* UnifiedSource135.cpp in Sources */,
+                               535C246C1F7A1778006EC40E /* UnifiedSource136.cpp in Sources */,
                                536B317C1F71C5990037FC33 /* UnifiedSource14.cpp in Sources */,
                                536B317D1F71C5990037FC33 /* UnifiedSource15.cpp in Sources */,
                                536B31761F71C5990037FC33 /* UnifiedSource16.cpp in Sources */,
                                536B31361F71C5990037FC33 /* UnifiedSource97.cpp in Sources */,
                                536B316A1F71C5990037FC33 /* UnifiedSource98.cpp in Sources */,
                                536B31631F71C5990037FC33 /* UnifiedSource99.cpp in Sources */,
-                               53F1B5451F6A14D000E2D043 /* YarrCanonicalizeUnicode.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index f93a2c697cacbd7741fe998ef190eb1cd6f24539..f8ccf9c675f75fcc90e3800fc69a5a445977f9b4 100644 (file)
@@ -26,6 +26,7 @@
 
 # A writer that only updates file if it actually changed.
 
+import os
 
 class LazyFileWriter:
     def __init__(self, filepath, force_output):
@@ -53,6 +54,9 @@ class LazyFileWriter:
             pass
 
         if text_changed or self.force_output:
+            dirname = os.path.dirname(self._filepath)
+            if not os.path.isdir(dirname):
+                os.makedirs(dirname)
             out_file = open(self._filepath, "w")
             out_file.write(self._output)
             out_file.close()
index fd526b2846311550117e6f49ed60ee8e8a528a74..41455db0fb2673e9dfa5c780e4d1c1816b7306db 100644 (file)
@@ -545,6 +545,11 @@ inspector/ScriptCallStack.cpp
 inspector/ScriptCallStackFactory.cpp
 inspector/ScriptDebugServer.cpp
 
+# Derived Sources
+inspector/InspectorBackendDispatchers.cpp
+inspector/InspectorFrontendDispatchers.cpp
+inspector/InspectorProtocolObjects.cpp
+
 inspector/agents/InspectorAgent.cpp
 inspector/agents/InspectorConsoleAgent.cpp
 inspector/agents/InspectorDebuggerAgent.cpp
@@ -915,6 +920,10 @@ runtime/WeakMapPrototype.cpp
 runtime/WeakSetConstructor.cpp
 runtime/WeakSetPrototype.cpp
 
+# Derived Sources
+# FIXME: We should move this to runtime but it kept breaking the Windows build in weird ways... https://bugs.webkit.org/show_bug.cgi?id=177486
+JSCBuiltins.cpp
+
 tools/CellList.cpp
 tools/CodeProfile.cpp
 tools/CodeProfiling.cpp
@@ -989,3 +998,6 @@ yarr/YarrInterpreter.cpp
 yarr/YarrJIT.cpp
 yarr/YarrPattern.cpp
 yarr/YarrSyntaxChecker.cpp
+
+# Derived Sources
+yarr/YarrCanonicalizeUnicode.cpp
index d6dab5231edcfa8164290b2f8e2dbb16a8a6a60d..448ab7a5e96d07039dadc6045481ed002366da4f 100755 (executable)
@@ -27,7 +27,7 @@
 # This script generates JS, Objective C, and C++ bindings for the inspector protocol.
 # Generators for individual files are located in the codegen/ directory.
 
-import os.path
+import os
 import re
 import sys
 import string
@@ -103,6 +103,9 @@ class IncrementalFileWriter:
             pass
 
         if text_changed or self.force_output:
+            dirname = os.path.dirname(self._filepath)
+            if not os.path.isdir(dirname):
+                os.makedirs(dirname)
             out_file = open(self._filepath, "w")
             out_file.write(self._output)
             out_file.close()
similarity index 97%
rename from Source/JavaScriptCore/create_regex_tables
rename to Source/JavaScriptCore/yarr/create_regex_tables
index ac9378db27573f9ce67e7fcad7f56b5d56ad5046..4c3dbbe3fbd494a23824b33418942a7a61ab78bc 100644 (file)
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 # Copyright (C) 2010, 2013-2017 Apple Inc. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or without
@@ -21,6 +23,7 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 
+import os
 import sys
 
 types = {
@@ -117,7 +120,11 @@ for name, classes in types.items():
     functions += function
 
 if (len(sys.argv) > 1):
-    f = open(sys.argv[-1], "w")
+    path = sys.argv[-1]
+    dirname = os.path.dirname(path)
+    if not os.path.isdir(dirname):
+        os.makedirs(dirname)
+    f = open(path, "w")
     f.write(arrays)
     f.write(functions)
     f.close()
similarity index 98%
rename from Source/JavaScriptCore/generateYarrCanonicalizeUnicode
rename to Source/JavaScriptCore/yarr/generateYarrCanonicalizeUnicode
index c78860a465a8dafb1d9a7d3c734a8c4edb15e020..b55d892964eb010b92cfe7d0c98127eb7fabdb00 100644 (file)
@@ -28,6 +28,7 @@
 # "21.2.2.8.2 Runtime Semantics: Canonicalize()", step 2.
 
 import optparse
+import os
 import re
 import sys
 from sets import Set
@@ -74,6 +75,9 @@ commonAndSimpleLinesRE = re.compile(r"(?P<code>[0-9A-F]+)\s*;\s*[CS]\s*;\s*(?P<m
 
 def openOrExit(path, mode):
     try:
+        dirname = os.path.dirname(path)
+        if not os.path.isdir(dirname):
+            os.makedirs(dirname)
         return open(path, mode)
     except IOError as e:
         print "I/O error opening {0}, ({1}): {2}".format(path, e.errno, e.strerror)
index 07d490551f31d8299f26130e7f38bef4e8dd5df2..61ffb637dc49bc5cb262be53e217fce70374c35e 100644 (file)
@@ -1,3 +1,23 @@
+2017-09-24  Keith Miller  <keith_miller@apple.com>
+
+        JSC build should use unified sources for derived sources
+        https://bugs.webkit.org/show_bug.cgi?id=177421
+
+        Reviewed by JF Bastien.
+
+        The script now needs to determine if a file is from a derived
+        source. This is only relevant for the CMake build since the
+        script needs to provide a list of the bundled source files. If the
+        script does not provide the full path for derived sources then
+        CMake will be unable to find them and the build will fail.
+
+        Additionally, I move the error message for the Xcode build outside
+        the main loop. This means that the error message will contain all
+        the files you need to add to Xcode and all those files will now be
+        written in DerivedSources so they should be easier to add.
+
+        * Scripts/generate-unified-source-bundles.rb:
+
 2017-09-26  Zan Dobersek  <zdobersek@igalia.com>
 
         Support building JavaScriptCore with the Bionic C library
index 86753f7395b2f3352ddc98bdb77a12f43a81310a..b8a8e2fe7bf6da338a8f17881691b2abd3bcfd41 100644 (file)
@@ -29,13 +29,17 @@ SCRIPT_NAME = File.basename($0)
 COMMENT_REGEXP = /#/
 
 def usage
-    puts "usage: #{SCRIPT_NAME} [options] -p <desination-path> <sources-file>"
+    puts "usage: #{SCRIPT_NAME} [options] <sources-file>"
     puts "--help                          (-h) Print this message"
     puts "--verbose                       (-v) Adds extra logging to stderr."
+    puts "Required arguments:"
+    puts "--source-tree-path              (-s) Path to the root of the source directory."
+    puts "--derived-sources-path          (-d) Path to the directory where the unified source files should be placed."
+    puts
+    puts "Optional arguments:"
     puts "--print-bundled-sources              Print bundled sources rather than generating sources"
     puts
     puts "Generation options:"
-    puts "--derived-sources-path          (-p) Path to the directory where the unified source files should be placed. This argument is required."
     puts "--max-cpp-bundle-count               Sets the limit on the number of cpp bundles that can be generated"
     puts "--max-obj-c-bundle-count             Sets the limit on the number of Obj-C bundles that can be generated"
     exit 1
@@ -43,6 +47,8 @@ end
 
 MAX_BUNDLE_SIZE = 8
 $derivedSourcesPath = nil
+$unifiedSourceOutputPath = nil
+$sourceTreePath = nil
 $verbose = false
 $mode = :GenerateBundles
 $maxCppBundleCount = 100000
@@ -54,8 +60,9 @@ end
 
 GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT],
                ['--verbose', '-v', GetoptLong::NO_ARGUMENT],
+               ['--derived-sources-path', '-d', GetoptLong::REQUIRED_ARGUMENT],
+               ['--source-tree-path', '-s', GetoptLong::REQUIRED_ARGUMENT],
                ['--print-bundled-sources', GetoptLong::NO_ARGUMENT],
-               ['--derived-sources-path', '-p', GetoptLong::REQUIRED_ARGUMENT],
                ['--max-cpp-bundle-count', GetoptLong::REQUIRED_ARGUMENT],
                ['--max-obj-c-bundle-count', GetoptLong::REQUIRED_ARGUMENT]).each {
     | opt, arg |
@@ -64,11 +71,15 @@ GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT],
         usage
     when '--verbose'
         $verbose = true
-    when "--print-bundled-sources"
-        $mode = :PrintBundledSources
     when '--derived-sources-path'
-        $derivedSourcesPath = Pathname.new(arg) + Pathname.new("unified-souces")
-        FileUtils.mkdir($derivedSourcesPath) if !$derivedSourcesPath.exist?
+        $derivedSourcesPath = Pathname.new(arg)
+        $unifiedSourceOutputPath = $derivedSourcesPath + Pathname.new("unified-sources")
+        FileUtils.mkdir($unifiedSourceOutputPath) if !$unifiedSourceOutputPath.exist?
+    when '--source-tree-path'
+        $sourceTreePath = Pathname.new(arg)
+        usage if !$sourceTreePath.exist?
+    when '--print-bundled-sources'
+        $mode = :PrintBundledSources
     when '--max-cpp-bundle-count'
         $maxCppBundleCount = arg.to_i
     when '--max-obj-c-bundle-count'
@@ -76,10 +87,9 @@ GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT],
     end
 }
 
-if $mode == :GenerateBundles
-    usage if !$derivedSourcesPath
-    log("putting unified sources in #{$derivedSourcesPath}")
-end
+usage if !$unifiedSourceOutputPath || !$sourceTreePath
+log("putting unified sources in #{$unifiedSourceOutputPath}")
+
 usage if ARGV.length == 0
 $generatedSources = []
 
@@ -104,6 +114,19 @@ class SourceFile < Pathname
 
         super(file)
     end
+
+    def derived?
+        return @derived if @derived != nil
+        @derived = !($sourceTreePath + self).exist?
+    end
+
+    def display
+        if $mode == :GenerateBundles || !derived?
+            self.to_s
+        else
+            ($derivedSourcesPath + self).to_s
+        end
+    end
 end
 
 class BundleManager
@@ -117,19 +140,18 @@ class BundleManager
         @maxCount = max
     end
 
+    def bundleFileName(number)
+        "UnifiedSource#{number}.#{extension}"
+    end
+
     def flush
         # No point in writing an empty bundle file
         return if @currentBundleText == ""
 
         @bundleCount += 1
-        bundleFileName = "UnifiedSource#{@bundleCount}.#{extension}"
-
-        if @bundleCount > @maxCount
-            raise "number of bundles for #{extension} sources, #{@bundleCount}, exceeded limit, #{@maxCount}. Please add #{bundleFileName} to Xcode then update UnifiedSource#{extension.capitalize}FileCount"
-        end
-
-        bundleFile = $derivedSourcesPath + bundleFileName
+        bundleFile = $unifiedSourceOutputPath + bundleFileName(@bundleCount)
         $generatedSources << bundleFile
+
         if (!bundleFile.exist? || IO::read(bundleFile) != @currentBundleText)
             log("writing bundle #{bundleFile} with: \n#{@currentBundleText}")
             IO::write(bundleFile, @currentBundleText)
@@ -183,7 +205,6 @@ ARGV.each {
 
     log("found #{sources.length} source files in #{sourcesFile}")
 
-    currentDirectory = nil
     sources.sort.each {
         | file |
 
@@ -199,7 +220,21 @@ ARGV.each {
     $bundleManagers.each_value { |x| x.flush } if $mode == :GenerateBundles
 }
 
+$bundleManagers.each_value {
+    | manager |
+
+    maxCount = manager.maxCount
+    bundleCount = manager.bundleCount
+    extension = manager.extension
+    if bundleCount > maxCount
+        filesToAdd = ((maxCount+1)..bundleCount).map { |x| manager.bundleFileName(x) }.join(", ")
+        raise "number of bundles for #{extension} sources, #{bundleCount}, exceeded limit, #{maxCount}. Please add #{filesToAdd} to Xcode then update UnifiedSource#{extension.capitalize}FileCount"
+    end
+}
+
 # We use stdout to report our unified source list to CMake.
 # Add trailing semicolon since CMake seems dislikes not having it.
 # Also, make sure we use print instead of puts because CMake will think the \n is a source file and fail to build.
+
+$generatedSources.map! { |path| path.display } if $mode == :PrintBundledSources
 print($generatedSources.join(";") + ";")
index ca712b286dd4ef5d5409c6de91bc6033b736673b..8f4ac81c3577165c5c5071e931ecbd9bae06d492 100644 (file)
@@ -17,6 +17,8 @@ macro(WEBKIT_COMPUTE_SOURCES _framework)
     endif ()
 
     execute_process(COMMAND ${RUBY_EXECUTABLE} ${WTF_SCRIPTS_DIR}/generate-unified-source-bundles.rb
+        "--derived-sources-path" "${DERIVED_SOURCES_DIR}/${_framework}"
+        "--source-tree-path" ${CMAKE_CURRENT_SOURCE_DIR}
         "--print-bundled-sources"
         ${CMAKE_CURRENT_SOURCE_DIR}/Sources.txt
         ${_platformSourcesFile}
@@ -35,6 +37,7 @@ macro(WEBKIT_COMPUTE_SOURCES _framework)
 
     execute_process(COMMAND ${RUBY_EXECUTABLE} ${WTF_SCRIPTS_DIR}/generate-unified-source-bundles.rb
         "--derived-sources-path" "${DERIVED_SOURCES_DIR}/${_framework}"
+        "--source-tree-path" ${CMAKE_CURRENT_SOURCE_DIR}
         ${CMAKE_CURRENT_SOURCE_DIR}/Sources.txt
         ${_platformSourcesFile}
         RESULT_VARIABLE  _resultTmp