Changeset 223828 in webkit


Ignore:
Timestamp:
Oct 22, 2017 8:13:33 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

[Settings] Replace current Settings generation with template file based approach
https://bugs.webkit.org/show_bug.cgi?id=178634

Patch by Sam Weinig <sam@webkit.org> on 2017-10-22
Reviewed by Joseph Pecoraro.

This replaces the recently added python based Settings generation with a generator
built in ruby, so we can take advantage of ERB for templating. The result has much
of the logic in the templates and as a result feels much easier to follow and cleaner.

Since I was moving things to ruby, I took the opertunity to switch the Settings definition
file from our .in format to yaml, which is quite a bit easier to read.

  • CMakeLists.txt:
  • DerivedSources.make:
  • Scripts/GenerateSettings: Removed.
  • Scripts/GenerateSettings.py: Removed.
  • Scripts/GenerateSettings.rb: Added.
  • Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py: Removed.
  • Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py: Removed.
  • Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py: Removed.
  • Scripts/GenerateSettings/GenerateSettings.py: Removed.
  • Scripts/GenerateSettings/GenerateSettingsHeaderFile.py: Removed.
  • Scripts/GenerateSettings/GenerateSettingsImplementationFile.py: Removed.
  • Scripts/GenerateSettings/Settings.py: Removed.
  • Scripts/GenerateSettings/init.py: Removed.
  • Scripts/SettingsTemplates: Added.
  • Scripts/SettingsTemplates/InternalSettingsGenerated.cpp.erb: Added.
  • Scripts/SettingsTemplates/InternalSettingsGenerated.h.erb: Added.
  • Scripts/SettingsTemplates/InternalSettingsGenerated.idl.erb: Added.
  • Scripts/SettingsTemplates/Settings.cpp.erb: Added.
  • Scripts/SettingsTemplates/Settings.h.erb: Added.
  • WebCore.xcodeproj/project.pbxproj:
  • WebCoreMacros.cmake:
  • page/Settings.in: Removed.
  • page/Settings.yaml: Added.
Location:
trunk/Source/WebCore
Files:
8 added
3 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r223779 r223828  
    40264026
    40274027
    4028 GENERATE_SETTINGS_MACROS(${WEBCORE_DIR}/page/Settings.in Settings.h)
     4028GENERATE_SETTINGS_MACROS(${WEBCORE_DIR}/page/Settings.yaml Settings.h)
    40294029list(APPEND WebCore_DERIVED_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/Settings.h)
    40304030list(APPEND WebCore_DERIVED_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/Settings.cpp)
  • trunk/Source/WebCore/ChangeLog

    r223826 r223828  
     12017-10-22  Sam Weinig  <sam@webkit.org>
     2
     3        [Settings] Replace current Settings generation with template file based approach
     4        https://bugs.webkit.org/show_bug.cgi?id=178634
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        This replaces the recently added python based Settings generation with a generator
     9        built in ruby, so we can take advantage of ERB for templating. The result has much
     10        of the logic in the templates and as a result feels much easier to follow and cleaner.
     11
     12        Since I was moving things to ruby, I took the opertunity to switch the Settings definition
     13        file from our .in format to yaml, which is quite a bit easier to read.
     14
     15        * CMakeLists.txt:
     16        * DerivedSources.make:
     17        * Scripts/GenerateSettings: Removed.
     18        * Scripts/GenerateSettings.py: Removed.
     19        * Scripts/GenerateSettings.rb: Added.
     20        * Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py: Removed.
     21        * Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py: Removed.
     22        * Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py: Removed.
     23        * Scripts/GenerateSettings/GenerateSettings.py: Removed.
     24        * Scripts/GenerateSettings/GenerateSettingsHeaderFile.py: Removed.
     25        * Scripts/GenerateSettings/GenerateSettingsImplementationFile.py: Removed.
     26        * Scripts/GenerateSettings/Settings.py: Removed.
     27        * Scripts/GenerateSettings/__init__.py: Removed.
     28        * Scripts/SettingsTemplates: Added.
     29        * Scripts/SettingsTemplates/InternalSettingsGenerated.cpp.erb: Added.
     30        * Scripts/SettingsTemplates/InternalSettingsGenerated.h.erb: Added.
     31        * Scripts/SettingsTemplates/InternalSettingsGenerated.idl.erb: Added.
     32        * Scripts/SettingsTemplates/Settings.cpp.erb: Added.
     33        * Scripts/SettingsTemplates/Settings.h.erb: Added.
     34        * WebCore.xcodeproj/project.pbxproj:
     35        * WebCoreMacros.cmake:
     36        * page/Settings.in: Removed.
     37        * page/Settings.yaml: Added.
     38
    1392017-10-22  Joseph Pecoraro  <pecoraro@apple.com>
    240
  • trunk/Source/WebCore/DerivedSources.make

    r223779 r223828  
    13731373
    13741374GENERATE_SETTINGS_SCRIPTS = \
    1375     $(WebCore)/Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py \
    1376     $(WebCore)/Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py \
    1377     $(WebCore)/Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py \
    1378     $(WebCore)/Scripts/GenerateSettings/GenerateSettings.py \
    1379     $(WebCore)/Scripts/GenerateSettings/GenerateSettingsHeaderFile.py \
    1380     $(WebCore)/Scripts/GenerateSettings/GenerateSettingsImplementationFile.py \
    1381     $(WebCore)/Scripts/GenerateSettings/Settings.py \
    1382     $(WebCore)/Scripts/GenerateSettings/__init__.py
     1375    $(WebCore)/Scripts/SettingsTemplates/InternalSettingsGenerated.cpp.erb \
     1376    $(WebCore)/Scripts/SettingsTemplates/InternalSettingsGenerated.idl.erb \
     1377    $(WebCore)/Scripts/SettingsTemplates/InternalSettingsGenerated.h.erb \
     1378    $(WebCore)/Scripts/SettingsTemplates/Settings.cpp.erb \
     1379    $(WebCore)/Scripts/SettingsTemplates/Settings.h.erb
    13831380
    13841381all : InternalSettingsGenerated.idl InternalSettingsGenerated.cpp InternalSettingsGenerated.h Settings.cpp Settings.h
    1385 InternalSettingsGenerated%idl InternalSettingsGenerated%cpp InternalSettingsGenerated%h Settings%cpp Settings%h : $(WebCore)/Scripts/GenerateSettings.py $(GENERATE_SETTINGS_SCRIPTS) page/Settings.in
    1386         $(PYTHON) $< --input $(WebCore)/page/Settings.in
     1382InternalSettingsGenerated%idl InternalSettingsGenerated%cpp InternalSettingsGenerated%h Settings%cpp Settings%h : $(WebCore)/Scripts/GenerateSettings.rb $(GENERATE_SETTINGS_SCRIPTS) page/Settings.yaml
     1383        $(RUBY) $< --input $(WebCore)/page/Settings.yaml
    13871384
    13881385# --------
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r223812 r223828  
    1090910909                7C39C36F1DDBA3E000FEFB29 /* SVGPathSegListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegListValues.h; sourceTree = "<group>"; };
    1091010910                7C39C3701DDBA44000FEFB29 /* SVGPathSegList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathSegList.cpp; sourceTree = "<group>"; };
    10911                 7C3A8C5E1F7D72B400F46E84 /* GenerateSettings */ = {isa = PBXFileReference; lastKnownFileType = folder; name = GenerateSettings; path = Scripts/GenerateSettings; sourceTree = "<group>"; };
    10912                 7C3A8C601F7D72B500F46E84 /* GenerateSettings.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; name = GenerateSettings.py; path = Scripts/GenerateSettings.py; sourceTree = "<group>"; };
    1091310911                7C3A91E51C963B8800D1A7E3 /* ClipboardAccessPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClipboardAccessPolicy.h; sourceTree = "<group>"; };
    1091410912                7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMessageHandler.cpp; sourceTree = "<group>"; };
     
    1112211120                7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderAttachment.cpp; sourceTree = "<group>"; };
    1112311121                7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderAttachment.h; sourceTree = "<group>"; };
     11122                7CDE73961F9BD59500390312 /* Settings.yaml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Settings.yaml; sourceTree = "<group>"; };
    1112411123                7CDE8EBC1F193BC500168FE7 /* CSSStyleDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSStyleDeclaration.cpp; sourceTree = "<group>"; };
    1112511124                7CE191471F2A98AF00272F78 /* FetchRequestInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchRequestInit.h; sourceTree = "<group>"; };
     
    1405214051                BC5823F40C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLElementCustom.cpp; sourceTree = "<group>"; };
    1405314052                BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSStyleDeclarationCustom.cpp; sourceTree = "<group>"; };
    14054                 BC59DEF8169DEDC30016AC34 /* Settings.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = Settings.in; sourceTree = "<group>"; };
    1405514053                BC5A12DD0DC0414800C9AFAD /* CSSReflectValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSReflectValue.cpp; sourceTree = "<group>"; };
    1405614054                BC5A12DE0DC0414800C9AFAD /* CSSReflectValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSReflectValue.h; sourceTree = "<group>"; };
     
    1753317531                        children = (
    1753417532                                F48389791E1DD23A0076B7EA /* EditingHistory */,
    17535                                 7C3A8C5E1F7D72B400F46E84 /* GenerateSettings */,
    1753617533                                3717D7E517ECC3A6003C276D /* extract-localizable-strings.pl */,
    17537                                 7C3A8C601F7D72B500F46E84 /* GenerateSettings.py */,
    1753817534                                37D456FB1A9A50B6003330A1 /* LocalizableStrings.pm */,
    1753917535                        );
     
    1957219568                                974D2DA2146A535D00D51F8B /* SecurityPolicy.cpp */,
    1957319569                                974D2DA3146A535D00D51F8B /* SecurityPolicy.h */,
    19574                                 BC59DEF8169DEDC30016AC34 /* Settings.in */,
     19570                                7CDE73961F9BD59500390312 /* Settings.yaml */,
    1957519571                                7CC6609B1F93057900D500E9 /* SettingsBase.cpp */,
    1957619572                                7CC660991F93057800D500E9 /* SettingsBase.h */,
  • trunk/Source/WebCore/WebCoreMacros.cmake

    r223612 r223828  
    204204
    205205macro(GENERATE_SETTINGS_MACROS _infile _outfile)
    206     set(NAMES_GENERATOR ${WEBCORE_DIR}/Scripts/GenerateSettings.py)
     206    set(NAMES_GENERATOR ${WEBCORE_DIR}/Scripts/GenerateSettings.rb)
    207207
    208208    # Do not list the output in more than one independent target that may
     
    217217
    218218    set(GENERATE_SETTINGS_SCRIPTS
    219         ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py
    220         ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py
    221         ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py
    222         ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateSettingsHeaderFile.py
    223         ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateSettingsImplementationFile.py
    224         ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateSettings.py
    225         ${WEBCORE_DIR}/Scripts/GenerateSettings/Settings.py
    226         ${WEBCORE_DIR}/Scripts/GenerateSettings/__init__.py
     219        ${WEBCORE_DIR}/Scripts/SettingsTemplates/InternalSettingsGenerated.cpp.erb
     220        ${WEBCORE_DIR}/Scripts/SettingsTemplates/InternalSettingsGenerated.idl.erb
     221        ${WEBCORE_DIR}/Scripts/SettingsTemplates/InternalSettingsGenerated.h.erb
     222        ${WEBCORE_DIR}/Scripts/SettingsTemplates/Settings.cpp.erb
     223        ${WEBCORE_DIR}/Scripts/SettingsTemplates/Settings.h.erb
    227224    )
    228225
     
    232229        MAIN_DEPENDENCY ${_infile}
    233230        DEPENDS ${NAMES_GENERATOR} ${GENERATE_SETTINGS_SCRIPTS} ${SCRIPTS_BINDINGS}
    234         COMMAND ${PYTHON_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
     231        COMMAND ${RUBY_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
    235232        VERBATIM ${_args})
    236233endmacro()
Note: See TracChangeset for help on using the changeset viewer.