diff --git a/embuilder.py b/embuilder.py index 076d58a39f23..7179bb92ae75 100755 --- a/embuilder.py +++ b/embuilder.py @@ -13,6 +13,7 @@ """ import argparse +import fnmatch import logging import sys import time @@ -120,7 +121,7 @@ def get_help(): - all_tasks = get_system_tasks()[1] + PORTS + all_tasks = get_all_tasks() all_tasks.sort() return ''' Available targets: @@ -163,6 +164,10 @@ def get_system_tasks(): return system_libraries, system_tasks +def get_all_tasks(): + return get_system_tasks()[1] + PORTS + + def main(): all_build_start_time = time.time() @@ -239,7 +244,10 @@ def main(): for name, targets in task_targets.items(): if targets is None: # Use target name as task - tasks.append(name) + if '*' in name: + tasks.extend(fnmatch.filter(get_all_tasks(), name)) + else: + tasks.append(name) else: # There are some ports that we don't want to build as part # of ALL since the are not well tested or widely used: diff --git a/test/test_sanity.py b/test/test_sanity.py index 41465a59f503..0fb4d55a80b2 100644 --- a/test/test_sanity.py +++ b/test/test_sanity.py @@ -3,6 +3,7 @@ # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. +import glob import os import platform import shutil @@ -729,9 +730,9 @@ def test_embuilder_auto_tasks(self): # Unless --force is specified self.assertContained('Building targets: zlib', self.do([EMBUILDER, 'build', 'zlib', 'MINIMAL', '--force'])) - def test_embuilder_wasm_backend(self): + def test_embuilder(self): restore_and_set_up() - # the --lto flag makes us build wasm-bc + # the --lto flag makes us build LTO libraries self.clear_cache() self.run_process([EMBUILDER, 'build', 'libemmalloc']) self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten')) @@ -739,6 +740,14 @@ def test_embuilder_wasm_backend(self): self.run_process([EMBUILDER, 'build', 'libemmalloc', '--lto']) self.assertExists(os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'lto')) + def test_embuilder_wildcards(self): + restore_and_set_up() + glob_match = os.path.join(config.CACHE, 'sysroot', 'lib', 'wasm32-emscripten', 'libwebgpu*.a') + self.run_process([EMBUILDER, 'clear', 'libwebgpu*']) + self.assertFalse(glob.glob(glob_match)) + self.run_process([EMBUILDER, 'build', 'libwebgpu*']) + self.assertGreater(len(glob.glob(glob_match)), 3) + def test_binaryen_version(self): restore_and_set_up() with open(EM_CONFIG, 'a') as f: