Ignore:
Timestamp:
Jul 10, 2017, 6:19:55 AM (8 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.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • 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__':
Note: See TracChangeset for help on using the changeset viewer.