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')
# 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)

View File

@ -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",
]