Handle inter-module dependencies

This commit is contained in:
flysand7 2023-07-28 21:52:12 +11:00
parent 3abf5e3f7f
commit 76904bd19b
2 changed files with 10 additions and 3 deletions

View File

@ -161,19 +161,25 @@ try:
ciabatta_header.write(f'#include <{include}>\n') ciabatta_header.write(f'#include <{include}>\n')
ciabatta_header.write('\n') ciabatta_header.write('\n')
# Write module sources # Write module sources
mod_exports = []
for api in library_config['apis']: for api in library_config['apis']:
api_name = api['name'] api_name = api['name']
api_path = api['path'] api_path = api['path']
tinyrt_satisfied = True reqs_satisfied = True
# Check API dependencies
for req in api['reqs']: for req in api['reqs']:
if not (req in tinyrt_apis): if not (req in tinyrt_apis):
tinyrt_satisfied = False reqs_satisfied = False
break break
if not tinyrt_satisfied: if not (req in mod_exports):
reqs_satisfied = False
break
if not reqs_satisfied:
print(f" -> Not exporting API '{api_name}'") print(f" -> Not exporting API '{api_name}'")
else: else:
print(f" * Exporting API '{api_name}'") print(f" * Exporting API '{api_name}'")
ciabatta_header.write(f'// Module {api_name}\n') ciabatta_header.write(f'// Module {api_name}\n')
mod_exports.append(api_name)
for include in api['includes']: for include in api['includes']:
ciabatta_header.write(f'#include "{api_path}/{include}"\n') ciabatta_header.write(f'#include "{api_path}/{include}"\n')
except Exception as error: except Exception as error:

View File

@ -74,6 +74,7 @@ apis: [
], ],
reqs: [ reqs: [
"rt_api_program", "rt_api_program",
"cia_memory",
] ]
}, },
{ {