diff --git a/build.py b/build.py index ff820a4..1ba9869 100755 --- a/build.py +++ b/build.py @@ -163,26 +163,31 @@ try: ciabatta_header.write('\n') # Write module sources mod_exports = [] + requirements_satisfied = True for api in library_config['apis']: api_name = api['name'] api_path = api['path'] - reqs_satisfied = True - # Check API dependencies - for req in api['reqs']: - if req in tinyrt_apis: - continue - elif req in mod_exports: - continue - reqs_satisfied = False - break - if not reqs_satisfied: - print(colors.red, f" * Not exporting API '{api_name}'", colors.reset, sep='') - else: - print(colors.green, f" * Exporting API '{api_name}'", colors.reset, sep='') - ciabatta_header.write(f'// Module {api_name}\n') - mod_exports.append(api_name) - for include in api['includes']: - ciabatta_header.write(f'#include "{api_path}/{include}"\n') + if api_name in library_config['export']: + reqs_satisfied = True + # Check API dependencies + for req in api['reqs']: + if req in tinyrt_apis: + continue + elif req in mod_exports: + continue + reqs_satisfied = False + break + if not reqs_satisfied: + print(colors.red, f" * Not exporting API '{api_name}'", colors.reset, sep='') + requirements_satisfied = False + else: + print(colors.green, f" * Exporting API '{api_name}'", colors.reset, sep='') + ciabatta_header.write(f'// Module {api_name}\n') + mod_exports.append(api_name) + for include in api['includes']: + ciabatta_header.write(f'#include "{api_path}/{include}"\n') + if not requirements_satisfied: + sys.exit(1) except Exception as error: print(colors.red, f" ERROR writing file '{ciabatta_header_path}':", sep='') print(f" {error}", colors.reset) diff --git a/src/library.json b/src/library.json index ad01f0f..07fcd56 100644 --- a/src/library.json +++ b/src/library.json @@ -88,4 +88,14 @@ apis: [ "cia_memory", ] } -] +], + +// Edit this part for a particular build you want +// this contains list of "name" properties for modules +// in the "apis" section + +export: [ + "cia_memory", + "stdlib_program", + "stdlib_file", +] \ No newline at end of file