Changeset 219289 in webkit


Ignore:
Timestamp:
Jul 10, 2017 6:19:55 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

Move make-js-file-arrays.py from WebCore to JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=174024

Reviewed by Michael Catanzaro.

.:

Make MAKE_JS_FILE_ARRAYS independent of WebCore and update it to use make-js-file-arrays.py from
JavaScriptCore. It's no longer needed to set PYTHON_PATH to find jsmin.py.

  • Source/cmake/WebKitMacros.cmake:

Source/JavaScriptCore:

It's currently used only by WebCore, but it depends on other JavaScriptCore scripts and it's not WebCore
specific at all. I plan to use it to compile the JavaScript atoms used by the WebDriver implementation.
Added command line option to pass the namespace to use instead of using WebCore.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Scripts/make-js-file-arrays.py: Renamed from Source/WebCore/Scripts/make-js-file-arrays.py.

(main):

Source/WebCore:

  • CMakeLists.txt: Explicitly add files generated by MAKE_JS_FILE_ARRAYS to the build, since the macro no longer

does it.

  • DerivedSources.make: Updated to use make-js-file-arrays.py from JavaScriptCore. It's no longer needed to set

PYTHON_PATH to find jsmin.py.

Location:
trunk
Files:
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r219276 r219289  
     12017-07-10  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Move make-js-file-arrays.py from WebCore to JavaScriptCore
     4        https://bugs.webkit.org/show_bug.cgi?id=174024
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Make MAKE_JS_FILE_ARRAYS independent of WebCore and update it to use make-js-file-arrays.py from
     9        JavaScriptCore. It's no longer needed to set PYTHON_PATH to find jsmin.py.
     10
     11        * Source/cmake/WebKitMacros.cmake:
     12
    1132017-07-08  Yusuke Suzuki  <utatane.tea@gmail.com>
    214
  • trunk/Source/JavaScriptCore/ChangeLog

    r219285 r219289  
     12017-07-10  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Move make-js-file-arrays.py from WebCore to JavaScriptCore
     4        https://bugs.webkit.org/show_bug.cgi?id=174024
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        It's currently used only by WebCore, but it depends on other JavaScriptCore scripts and it's not WebCore
     9        specific at all. I plan to use it to compile the JavaScript atoms used by the WebDriver implementation.
     10        Added command line option to pass the namespace to use instead of using WebCore.
     11
     12        * JavaScriptCore.xcodeproj/project.pbxproj:
     13        * Scripts/make-js-file-arrays.py: Renamed from Source/WebCore/Scripts/make-js-file-arrays.py.
     14        (main):
     15
    1162017-07-09  Yusuke Suzuki  <utatane.tea@gmail.com>
    217
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r219009 r219289  
    19011901                A5EA710C19F6DE820098F5EC /* objc_generator.py in Headers */ = {isa = PBXBuildFile; fileRef = A5EA70F819F6DE5A0098F5EC /* objc_generator.py */; settings = {ATTRIBUTES = (Private, ); }; };
    19021902                A5EA710E19F6DF810098F5EC /* InspectorAlternateBackendDispatchers.h in Headers */ = {isa = PBXBuildFile; fileRef = A5EA710D19F6DF810098F5EC /* InspectorAlternateBackendDispatchers.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1903                A5EF13F91F073204000F0442 /* make-js-file-arrays.py in Headers */ = {isa = PBXBuildFile; fileRef = A5EF13F71F0731B4000F0442 /* make-js-file-arrays.py */; settings = {ATTRIBUTES = (Private, ); }; };
    19031904                A5EF9B141A1D43F600702E90 /* generate_cpp_backend_dispatcher_header.py in Headers */ = {isa = PBXBuildFile; fileRef = C4F4B6D11A05C76F005CAB76 /* generate_cpp_backend_dispatcher_header.py */; settings = {ATTRIBUTES = (Private, ); }; };
    19041905                A5EF9B151A1D43FA00702E90 /* generate_cpp_backend_dispatcher_implementation.py in Headers */ = {isa = PBXBuildFile; fileRef = C4F4B6D21A05C76F005CAB76 /* generate_cpp_backend_dispatcher_implementation.py */; settings = {ATTRIBUTES = (Private, ); }; };
     
    45334534                A5EA70F819F6DE5A0098F5EC /* objc_generator.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = objc_generator.py; sourceTree = "<group>"; };
    45344535                A5EA710D19F6DF810098F5EC /* InspectorAlternateBackendDispatchers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAlternateBackendDispatchers.h; sourceTree = "<group>"; };
     4536                A5EF13F71F0731B4000F0442 /* make-js-file-arrays.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = "make-js-file-arrays.py"; sourceTree = "<group>"; };
    45354537                A5FC84B01D1DDAC8006B5C46 /* DebuggerLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DebuggerLocation.cpp; sourceTree = "<group>"; };
    45364538                A5FC84B11D1DDAC8006B5C46 /* DebuggerLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerLocation.h; sourceTree = "<group>"; };
     
    78287830                                9959E9291BD17FA0001AA413 /* jsmin.py */,
    78297831                                99DA00AD1BD5993E00F4575C /* lazywriter.py */,
     7832                                A5EF13F71F0731B4000F0442 /* make-js-file-arrays.py */,
    78307833                                99DA00AE1BD5993E00F4575C /* UpdateContents.py */,
    78317834                                9959E92A1BD17FA0001AA413 /* xxd.pl */,
     
    92229225                                860161E50F3A83C100F84710 /* MacroAssemblerX86_64.h in Headers */,
    92239226                                860161E60F3A83C100F84710 /* MacroAssemblerX86Common.h in Headers */,
     9227                                A5EF13F91F073204000F0442 /* make-js-file-arrays.py in Headers */,
    92249228                                A700873A17CBE85300C3E643 /* MapConstructor.h in Headers */,
    92259229                                A74DEF94182D991400522C22 /* MapIteratorPrototype.h in Headers */,
  • trunk/Source/JavaScriptCore/Scripts/make-js-file-arrays.py

    r219288 r219289  
    4242
    4343def main():
    44     parser = OptionParser(usage="usage: %prog [--no-minify] header source [input [input...]]")
     44    parser = OptionParser(usage="usage: %prog [options] header source [input [input...]]")
    4545    parser.add_option('--no-minify', action='store_true', help='Do not run the input files through jsmin')
     46    parser.add_option('-n', '--namespace', help='Namespace to use')
    4647    (options, arguments) = parser.parse_args()
     48    if not options.namespace:
     49        print 'Error: must provide a namespace'
     50        parser.print_usage()
     51        exit(-1)
    4752    if len(arguments) < 3:
    4853        print 'Error: must provide at least 3 arguments'
     
    5055        exit(-1)
    5156
     57    namespace = options.namespace
    5258    headerPath = arguments[0]
    5359    sourcePath = arguments[1]
     
    5561
    5662    headerFile = open(headerPath, 'w')
    57     print >> headerFile, 'namespace WebCore {'
     63    print >> headerFile, 'namespace {0:s} {{'.format(namespace)
    5864
    5965    sourceFile = open(sourcePath, 'w')
    6066    print >> sourceFile, '#include "{0:s}"'.format(os.path.basename(headerPath))
    61     print >> sourceFile, 'namespace WebCore {'
     67    print >> sourceFile, 'namespace {0:s} {{'.format(namespace)
    6268
    6369    jsm = JavascriptMinify()
     
    8591        print >> sourceFile, '};'
    8692
    87     print >> headerFile, '}'
    88     print >> sourceFile, '}'
     93    print >> headerFile, '}} // namespace {0:s}'.format(namespace)
     94    print >> sourceFile, '}} // namespace {0:s}'.format(namespace)
    8995
    9096if __name__ == '__main__':
  • trunk/Source/WebCore/CMakeLists.txt

    r219229 r219289  
    37493749        ${DERIVED_SOURCES_WEBCORE_DIR}/UserAgentScriptsData.cpp
    37503750        ${DERIVED_SOURCES_WEBCORE_DIR}/UserAgentScripts.h
     3751        WebCore
    37513752        WebCore_USER_AGENT_SCRIPTS
    37523753        WebCore_USER_AGENT_SCRIPTS_DEPENDENCIES
    37533754    )
     3755    list(APPEND WebCore_DERIVED_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/UserAgentScriptsData.cpp)
    37543756endif ()
    37553757
     
    37653767        ${DERIVED_SOURCES_WEBCORE_DIR}/SDPProcessorScriptsData.cpp
    37663768        ${DERIVED_SOURCES_WEBCORE_DIR}/SDPProcessorScriptsData.h
     3769        WebCore
    37673770        WebCore_SDP_PROCESSOR_SCRIPTS
    37683771        WebCore_SDP_PROCESSOR_SCRIPTS_DEPENDENCIES
    37693772    )
     3773    list(APPEND WebCore_DERIVED_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/SDPProcessorScriptsData.cpp)
    37703774endif ()
    37713775
  • trunk/Source/WebCore/ChangeLog

    r219288 r219289  
     12017-07-10  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Move make-js-file-arrays.py from WebCore to JavaScriptCore
     4        https://bugs.webkit.org/show_bug.cgi?id=174024
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        * CMakeLists.txt: Explicitly add files generated by MAKE_JS_FILE_ARRAYS to the build, since the macro no longer
     9        does it.
     10        * DerivedSources.make: Updated to use make-js-file-arrays.py from JavaScriptCore. It's no longer needed to set
     11        PYTHON_PATH to find jsmin.py.
     12
    1132017-07-10  Charlie Turner  <cturner@igalia.com>
    214
  • trunk/Source/WebCore/DerivedSources.make

    r218529 r219289  
    11101110all : SDPProcessorScriptsData.h
    11111111
    1112 SDPProcessorScriptsData.h : Scripts/make-js-file-arrays.py $(WEBCORE_SDP_PROCESSOR_SCRIPTS)
    1113         PYTHONPATH=$(JavaScriptCore_SCRIPTS_DIR) $(PYTHON) $< $@ SDPProcessorScriptsData.cpp $(WEBCORE_SDP_PROCESSOR_SCRIPTS)
     1112SDPProcessorScriptsData.h : $(JavaScriptCore_SCRIPTS_DIR)/make-js-file-arrays.py $(WEBCORE_SDP_PROCESSOR_SCRIPTS)
     1113        $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/make-js-file-arrays.py -n WebCore $@ SDPProcessorScriptsData.cpp $(WEBCORE_SDP_PROCESSOR_SCRIPTS)
    11141114endif
    11151115
     
    11651165all : UserAgentScripts.h
    11661166
    1167 UserAgentScripts.h : Scripts/make-js-file-arrays.py $(USER_AGENT_SCRIPTS)
    1168         PYTHONPATH=$(JavaScriptCore_SCRIPTS_DIR) $(PYTHON) $< $@ UserAgentScriptsData.cpp $(USER_AGENT_SCRIPTS)
     1167UserAgentScripts.h : $(JavaScriptCore_SCRIPTS_DIR)/make-js-file-arrays.py $(USER_AGENT_SCRIPTS)
     1168        $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/make-js-file-arrays.py -n WebCore $@ UserAgentScriptsData.cpp $(USER_AGENT_SCRIPTS)
    11691169endif
    11701170
  • trunk/Source/cmake/WebKitMacros.cmake

    r219228 r219289  
    397397endmacro()
    398398
    399 macro(MAKE_JS_FILE_ARRAYS _output_cpp _output_h _scripts _scripts_dependencies)
    400     if (NOT CMAKE_VERSION VERSION_LESS 3.1)
    401         set(_python_path ${CMAKE_COMMAND} -E env "PYTHONPATH=${JavaScriptCore_SCRIPTS_DIR}")
    402     elseif (WIN32)
    403         set(_python_path set "PYTHONPATH=${JavaScriptCore_SCRIPTS_DIR}" &&)
    404     else ()
    405         set(_python_path "PYTHONPATH=${JavaScriptCore_SCRIPTS_DIR}")
    406     endif ()
    407 
     399macro(MAKE_JS_FILE_ARRAYS _output_cpp _output_h _namespace _scripts _scripts_dependencies)
    408400    add_custom_command(
    409401        OUTPUT ${_output_h} ${_output_cpp}
    410         MAIN_DEPENDENCY ${WEBCORE_DIR}/Scripts/make-js-file-arrays.py
    411         DEPENDS ${${_scripts}}
    412         COMMAND ${_python_path} ${PYTHON_EXECUTABLE} ${WEBCORE_DIR}/Scripts/make-js-file-arrays.py ${_output_h} ${_output_cpp} ${${_scripts}}
    413         VERBATIM)
    414     list(APPEND WebCore_DERIVED_SOURCES ${_output_cpp})
     402        DEPENDS ${JavaScriptCore_SCRIPTS_DIR}/make-js-file-arrays.py ${${_scripts}}
     403        COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_SCRIPTS_DIR}/make-js-file-arrays.py -n ${_namespace} ${_output_h} ${_output_cpp} ${${_scripts}}
     404        VERBATIM)
    415405    ADD_SOURCE_DEPENDENCIES(${${_scripts_dependencies}} ${_output_h} ${_output_cpp})
    416406endmacro()
Note: See TracChangeset for help on using the changeset viewer.