Skip to content

Commit c509a06

Browse files
authored
Added jerry-ext amalgamation (#5184)
Added option to enable jerry-ext amalgamation The implementation is based on PR #4992. Only applied the requested changes and rebase to master. Co-authored-by: Damiano Mazzella [email protected] JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi [email protected]
1 parent b3fa5e0 commit c509a06

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

tools/amalgam.py

+80
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
JERRY_CORE = os.path.join(ROOT_DIR, 'jerry-core')
2727
JERRY_PORT = os.path.join(ROOT_DIR, 'jerry-port')
2828
JERRY_MATH = os.path.join(ROOT_DIR, 'jerry-math')
29+
JERRY_EXT = os.path.join(ROOT_DIR, 'jerry-ext')
2930

3031

3132
class Amalgamator:
@@ -298,6 +299,79 @@ def amalgamate_jerry_port(output_dir):
298299
)
299300

300301

302+
def amalgamate_jerry_ext(output_dir):
303+
amalgamate(
304+
base_dir=JERRY_EXT,
305+
input_files=[
306+
os.path.join(JERRY_EXT, 'arg', 'arg.c'),
307+
os.path.join(JERRY_EXT, 'arg', 'arg-js-iterator-helper.c'),
308+
os.path.join(JERRY_EXT, 'arg', 'arg-transform-functions.c'),
309+
os.path.join(JERRY_EXT, 'handle-scope', 'handle-scope.c'),
310+
os.path.join(JERRY_EXT, 'handle-scope', 'handle-scope-allocator.c'),
311+
os.path.join(JERRY_EXT, 'module', 'module.c'),
312+
os.path.join(JERRY_EXT, 'util', 'handlers.c'),
313+
os.path.join(JERRY_EXT, 'util', 'print.c'),
314+
os.path.join(JERRY_EXT, 'util', 'properties.c'),
315+
os.path.join(JERRY_EXT, 'util', 'repl.c'),
316+
os.path.join(JERRY_EXT, 'util', 'sources.c'),
317+
os.path.join(JERRY_EXT, 'util', 'test262.c'),
318+
],
319+
output_file=os.path.join(output_dir, 'jerryscript-ext.c'),
320+
append_c_files=True,
321+
remove_includes=[
322+
'jerryscript.h',
323+
'jerryscript-port.h',
324+
'jerryscript-types.h',
325+
'jerryscript-core.h',
326+
'jerryscript-debugger.h',
327+
'jerryscript-debugger-transport.h',
328+
'jerryscript-ext/arg.h',
329+
'jerryscript-ext/debugger.h',
330+
'jerryscript-ext/handlers.h',
331+
'jerryscript-ext/handle-scope.h',
332+
'jerryscript-ext/print.h',
333+
'jerryscript-ext/properties.h',
334+
'jerryscript-ext/module.h',
335+
'jerryscript-ext/repl.h',
336+
'jerryscript-ext/sources.h',
337+
'jerryscript-ext/test262.h',
338+
],
339+
extra_includes=[
340+
'jerryscript.h',
341+
'jerryscript-ext.h',
342+
],
343+
)
344+
345+
amalgamate(
346+
base_dir=JERRY_EXT,
347+
input_files=[
348+
os.path.join(JERRY_EXT, 'common', 'jext-common.h'),
349+
os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'arg.h'),
350+
os.path.join(JERRY_EXT, 'arg', 'arg-internal.h'),
351+
os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'arg.impl.h'),
352+
os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'handlers.h'),
353+
os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'handle-scope.h'),
354+
os.path.join(JERRY_EXT, 'handle-scope', 'handle-scope-internal.h'),
355+
os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'module.h'),
356+
os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'print.h'),
357+
os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'properties.h'),
358+
os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'repl.h'),
359+
os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'sources.h'),
360+
os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'test262.h'),
361+
],
362+
output_file=os.path.join(output_dir, 'jerryscript-ext.h'),
363+
remove_includes=[
364+
'jerryscript.h',
365+
'jerryscript-port.h',
366+
'jerryscript-types.h',
367+
'jerryscript-ext/handle-scope.h'
368+
],
369+
extra_includes=[
370+
'jerryscript.h',
371+
],
372+
)
373+
374+
301375
def amalgamate_jerry_math(output_dir):
302376
amalgamate(
303377
base_dir=JERRY_MATH,
@@ -316,6 +390,8 @@ def main():
316390
help='amalgamate jerry-port files')
317391
parser.add_argument('--jerry-math', action='store_true',
318392
help='amalgamate jerry-math files')
393+
parser.add_argument('--jerry-ext', action='store_true',
394+
help='amalgamate jerry-ext files')
319395
parser.add_argument('--output-dir', metavar='DIR', default='amalgam',
320396
help='output dir (default: %(default)s)')
321397
parser.add_argument('--verbose', '-v', action='store_true',
@@ -340,6 +416,10 @@ def main():
340416
if args.jerry_math:
341417
amalgamate_jerry_math(args.output_dir)
342418

419+
if args.jerry_ext:
420+
amalgamate_jerry_ext(args.output_dir)
421+
422+
343423

344424
if __name__ == '__main__':
345425
main()

0 commit comments

Comments
 (0)