Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -15078,14 +15078,14 @@ def test_empath_split(self):
void foo() { std::cout << "foo" << std::endl; }
''')
create_file('path_list.txt', r'''
myapp
myapp:
main.cpp
foo.cpp

lib1
lib1:
/emsdk/emscripten/system

lib2
lib2:
/emsdk/emscripten/system/lib/libc/musl
/emsdk/emscripten/system/lib/libcxx
''')
Expand Down
13 changes: 9 additions & 4 deletions tools/empath-split.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
to split modules. The format is similar to the manifest file for wasm-split, but
with paths instead of function names. A module is defined by a name on a line,
followed by paths on subsequent lines. Modules are separated by empty lines.
Module names be written with a colon (:).
For example:
module1
module1:
path/to/a
path/to/b

module2
module2:
path/to/c

This will create two modules, 'module1' and 'module2'. 'module1' will contain
Expand Down Expand Up @@ -276,7 +277,11 @@ def parse_paths_file(paths_file_content):
continue

if not cur_module:
cur_module = line
if line[-1] != ':':
exit_with_error(f"Module name should end with a colon: {line}")
if len(line) == 1:
exit_with_error("Module name is empty")
cur_module = line[:-1]
else:
path = normalize_path(line)
if path in path_to_module:
Expand Down Expand Up @@ -337,7 +342,7 @@ def main():
print(' ' + func)
print()

f.write(f'{module}\n')
f.write(f'{module}:\n')
for func in funcs:
f.write(func + '\n')
f.close()
Expand Down