Allow extra library files to be snapshotted
BUG= R=jochen@chromium.org, yangguo@chromium.org Review URL: https://codereview.chromium.org/1113593002 Cr-Commit-Position: refs/heads/master@{#28110}
This commit is contained in:
parent
a2e6f970c7
commit
8a89a4a5ce
@ -31,6 +31,7 @@
|
|||||||
'v8_code': 1,
|
'v8_code': 1,
|
||||||
'v8_random_seed%': 314159265,
|
'v8_random_seed%': 314159265,
|
||||||
'embed_script%': "",
|
'embed_script%': "",
|
||||||
|
'v8_extra_library_files%': [],
|
||||||
'mksnapshot_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)mksnapshot<(EXECUTABLE_SUFFIX)',
|
'mksnapshot_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)mksnapshot<(EXECUTABLE_SUFFIX)',
|
||||||
},
|
},
|
||||||
'includes': ['../../build/toolchain.gypi', '../../build/features.gypi'],
|
'includes': ['../../build/toolchain.gypi', '../../build/features.gypi'],
|
||||||
@ -749,9 +750,9 @@
|
|||||||
'../../src/jsregexp-inl.h',
|
'../../src/jsregexp-inl.h',
|
||||||
'../../src/jsregexp.cc',
|
'../../src/jsregexp.cc',
|
||||||
'../../src/jsregexp.h',
|
'../../src/jsregexp.h',
|
||||||
'../../src/layout-descriptor-inl.h',
|
'../../src/layout-descriptor-inl.h',
|
||||||
'../../src/layout-descriptor.cc',
|
'../../src/layout-descriptor.cc',
|
||||||
'../../src/layout-descriptor.h',
|
'../../src/layout-descriptor.h',
|
||||||
'../../src/list-inl.h',
|
'../../src/list-inl.h',
|
||||||
'../../src/list.h',
|
'../../src/list.h',
|
||||||
'../../src/lithium-allocator-inl.h',
|
'../../src/lithium-allocator-inl.h',
|
||||||
@ -1740,6 +1741,7 @@
|
|||||||
'../../tools/js2c.py',
|
'../../tools/js2c.py',
|
||||||
'<@(library_files)',
|
'<@(library_files)',
|
||||||
'<@(i18n_library_files)',
|
'<@(i18n_library_files)',
|
||||||
|
'<@(v8_extra_library_files)',
|
||||||
],
|
],
|
||||||
'outputs': [
|
'outputs': [
|
||||||
'<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
|
'<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
|
||||||
@ -1751,6 +1753,8 @@
|
|||||||
'CORE',
|
'CORE',
|
||||||
'<@(library_files)',
|
'<@(library_files)',
|
||||||
'<@(i18n_library_files)',
|
'<@(i18n_library_files)',
|
||||||
|
'--extra',
|
||||||
|
'<@(v8_extra_library_files)',
|
||||||
],
|
],
|
||||||
'conditions': [
|
'conditions': [
|
||||||
[ 'v8_use_external_startup_data==1', {
|
[ 'v8_use_external_startup_data==1', {
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
# library.
|
# library.
|
||||||
|
|
||||||
import os, re, sys, string
|
import os, re, sys, string
|
||||||
import optparse
|
import argparse
|
||||||
import jsmin
|
import jsmin
|
||||||
import bz2
|
import bz2
|
||||||
import textwrap
|
import textwrap
|
||||||
@ -531,8 +531,10 @@ def WriteStartupBlob(sources, startup_blob):
|
|||||||
output.close()
|
output.close()
|
||||||
|
|
||||||
|
|
||||||
def JS2C(source, target, native_type, raw_file, startup_blob):
|
def JS2C(source, extraSource, target, native_type, raw_file, startup_blob):
|
||||||
sources = PrepareSources(source)
|
# 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)
|
sources_bytes = "".join(sources.modules)
|
||||||
metadata = BuildMetadata(sources, sources_bytes, native_type)
|
metadata = BuildMetadata(sources, sources_bytes, native_type)
|
||||||
|
|
||||||
@ -552,18 +554,24 @@ def JS2C(source, target, native_type, raw_file, startup_blob):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = optparse.OptionParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_option("--raw", action="store",
|
parser.add_argument("out.cc",
|
||||||
help="file to write the processed sources array to.")
|
help="C code to be generated")
|
||||||
parser.add_option("--startup_blob", action="store",
|
parser.add_argument("type",
|
||||||
help="file to write the startup blob to.")
|
help="type parameter for NativesCollection template")
|
||||||
parser.set_usage("""js2c out.cc type sources.js ...
|
parser.add_argument("sources.js",
|
||||||
out.cc: C code to be generated.
|
help="JS internal sources or macros.py.",
|
||||||
type: type parameter for NativesCollection template.
|
nargs="+")
|
||||||
sources.js: JS internal sources or macros.py.""")
|
parser.add_argument("--raw",
|
||||||
(options, args) = parser.parse_args()
|
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="*")
|
||||||
|
|
||||||
JS2C(args[2:], args[0], args[1], options.raw, options.startup_blob)
|
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__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user