'v8_code': 1,
'v8_random_seed%': 314159265,
'embed_script%': "",
+ 'v8_extra_library_files%': [],
'mksnapshot_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)mksnapshot<(EXECUTABLE_SUFFIX)',
},
'includes': ['../../build/toolchain.gypi', '../../build/features.gypi'],
'../../src/jsregexp-inl.h',
'../../src/jsregexp.cc',
'../../src/jsregexp.h',
- '../../src/layout-descriptor-inl.h',
- '../../src/layout-descriptor.cc',
- '../../src/layout-descriptor.h',
+ '../../src/layout-descriptor-inl.h',
+ '../../src/layout-descriptor.cc',
+ '../../src/layout-descriptor.h',
'../../src/list-inl.h',
'../../src/list.h',
'../../src/lithium-allocator-inl.h',
'../../tools/js2c.py',
'<@(library_files)',
'<@(i18n_library_files)',
+ '<@(v8_extra_library_files)',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
'CORE',
'<@(library_files)',
'<@(i18n_library_files)',
+ '--extra',
+ '<@(v8_extra_library_files)',
],
'conditions': [
[ 'v8_use_external_startup_data==1', {
# library.
import os, re, sys, string
-import optparse
+import argparse
import jsmin
import bz2
import textwrap
output.close()
-def JS2C(source, target, native_type, raw_file, startup_blob):
- sources = PrepareSources(source)
+def JS2C(source, extraSource, target, native_type, raw_file, startup_blob):
+ # For now we treat source and extraSource the same, but we keep them separate
+ # in the input so that we can start treating them differently in the future.
+ sources = PrepareSources(source + extraSource)
sources_bytes = "".join(sources.modules)
metadata = BuildMetadata(sources, sources_bytes, native_type)
def main():
- parser = optparse.OptionParser()
- parser.add_option("--raw", action="store",
- help="file to write the processed sources array to.")
- parser.add_option("--startup_blob", action="store",
- help="file to write the startup blob to.")
- parser.set_usage("""js2c out.cc type sources.js ...
- out.cc: C code to be generated.
- type: type parameter for NativesCollection template.
- sources.js: JS internal sources or macros.py.""")
- (options, args) = parser.parse_args()
-
- JS2C(args[2:], args[0], args[1], options.raw, options.startup_blob)
+ parser = argparse.ArgumentParser()
+ parser.add_argument("out.cc",
+ help="C code to be generated")
+ parser.add_argument("type",
+ help="type parameter for NativesCollection template")
+ parser.add_argument("sources.js",
+ help="JS internal sources or macros.py.",
+ nargs="+")
+ parser.add_argument("--raw",
+ help="file to write the processed sources array to.")
+ parser.add_argument("--startup_blob",
+ help="file to write the startup blob to.")
+ parser.add_argument("--extra",
+ help="extra JS sources.",
+ nargs="*")
+
+ args = vars(parser.parse_args())
+ JS2C(args["sources.js"], args["extra"] or [], args["out.cc"], args["type"], args["raw"], args["startup_blob"])
if __name__ == "__main__":