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,26 +163,31 @@ 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']
reqs_satisfied = True if api_name in library_config['export']:
# Check API dependencies reqs_satisfied = True
for req in api['reqs']: # Check API dependencies
if req in tinyrt_apis: for req in api['reqs']:
continue if req in tinyrt_apis:
elif req in mod_exports: continue
continue elif req in mod_exports:
reqs_satisfied = False continue
break reqs_satisfied = False
if not reqs_satisfied: break
print(colors.red, f" * Not exporting API '{api_name}'", colors.reset, sep='') if not reqs_satisfied:
else: print(colors.red, f" * Not exporting API '{api_name}'", colors.reset, sep='')
print(colors.green, f" * Exporting API '{api_name}'", colors.reset, sep='') requirements_satisfied = False
ciabatta_header.write(f'// Module {api_name}\n') else:
mod_exports.append(api_name) print(colors.green, f" * Exporting API '{api_name}'", colors.reset, sep='')
for include in api['includes']: ciabatta_header.write(f'// Module {api_name}\n')
ciabatta_header.write(f'#include "{api_path}/{include}"\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: 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",
] ]