Add export section to library.json

This commit is contained in:
flysand7 2023-08-01 13:05:10 +11:00
parent e41df0dd4d
commit e041fdd474
2 changed files with 33 additions and 18 deletions

View File

@ -163,9 +163,11 @@ try:
ciabatta_header.write('\n') ciabatta_header.write('\n')
# Write module sources # Write module sources
mod_exports = [] mod_exports = []
requirements_satisfied = True
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']
if api_name in library_config['export']:
reqs_satisfied = True reqs_satisfied = True
# Check API dependencies # Check API dependencies
for req in api['reqs']: for req in api['reqs']:
@ -177,12 +179,15 @@ try:
break break
if not reqs_satisfied: if not reqs_satisfied:
print(colors.red, f" * Not exporting API '{api_name}'", colors.reset, sep='') print(colors.red, f" * Not exporting API '{api_name}'", colors.reset, sep='')
requirements_satisfied = False
else: else:
print(colors.green, f" * Exporting API '{api_name}'", colors.reset, sep='') print(colors.green, f" * Exporting API '{api_name}'", colors.reset, sep='')
ciabatta_header.write(f'// Module {api_name}\n') ciabatta_header.write(f'// Module {api_name}\n')
mod_exports.append(api_name) 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')
if not requirements_satisfied:
sys.exit(1)
except Exception as error: except Exception as error:
print(colors.red, f" ERROR writing file '{ciabatta_header_path}':", sep='') print(colors.red, f" ERROR writing file '{ciabatta_header_path}':", sep='')
print(f" {error}", colors.reset) print(f" {error}", colors.reset)

View File

@ -88,4 +88,14 @@ apis: [
"cia_memory", "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",
] ]