|
|
@ -85,36 +85,73 @@ def list_target_files(target_name, coredata, builddata): |
|
|
|
sources = [os.path.join(i.subdir, i.fname) for i in sources] |
|
|
|
sources = [os.path.join(i.subdir, i.fname) for i in sources] |
|
|
|
print(json.dumps(sources)) |
|
|
|
print(json.dumps(sources)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def split_options(user_options, suboptions): |
|
|
|
|
|
|
|
main_options = {} |
|
|
|
|
|
|
|
main_suboptions = {} |
|
|
|
|
|
|
|
subproject_options = {} |
|
|
|
|
|
|
|
subproject_suboptions = {} |
|
|
|
|
|
|
|
for k in user_options.keys(): |
|
|
|
|
|
|
|
if ':' in k: |
|
|
|
|
|
|
|
subproject_options[k] = user_options[k] |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
main_options[k] = user_options[k] |
|
|
|
|
|
|
|
for k in suboptions.keys(): |
|
|
|
|
|
|
|
if ':' in k: |
|
|
|
|
|
|
|
subproject_suboptions[k] = suboptions[k] |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
main_suboptions[k] = suboptions[k] |
|
|
|
|
|
|
|
return (main_options, main_suboptions, subproject_options, subproject_suboptions) |
|
|
|
|
|
|
|
|
|
|
|
def list_buildoptions(coredata, builddata): |
|
|
|
def list_buildoptions(coredata, builddata): |
|
|
|
|
|
|
|
(main_options, main_suboptions, subproject_options, subproject_suboptions) = split_options(coredata.user_options, coredata.suboptions) |
|
|
|
all_opt = [{'name' : 'builtin', |
|
|
|
all_opt = [{'name' : 'builtin', |
|
|
|
'description': 'Meson builtin options', |
|
|
|
'description': 'Meson builtin options', |
|
|
|
'type': 'suboption', |
|
|
|
'type': 'suboption', |
|
|
|
'value': get_keys(coredata.builtins), |
|
|
|
'value': get_keys(coredata.builtins), |
|
|
|
}] |
|
|
|
}] |
|
|
|
all_opt.append({'name': 'user', |
|
|
|
all_opt.append({'name': 'base', |
|
|
|
'description' : 'User defined options', |
|
|
|
'description' : 'Base options', |
|
|
|
'type' : 'suboption', |
|
|
|
'type' : 'suboption', |
|
|
|
'value' : build_usertree(coredata.suboptions, coredata.user_options), |
|
|
|
'value' : get_keys(coredata.base_options), |
|
|
|
}) |
|
|
|
}) |
|
|
|
all_opt.append({'name' : 'compilers', |
|
|
|
all_opt.append({'name' : 'compilers', |
|
|
|
'description' : 'Options for compilers', |
|
|
|
'description' : 'Options for compilers', |
|
|
|
'type' : 'suboption', |
|
|
|
'type' : 'suboption', |
|
|
|
'value' : get_keys(coredata.compiler_options), |
|
|
|
'value' : get_keys(coredata.compiler_options), |
|
|
|
}) |
|
|
|
}) |
|
|
|
all_opt.append({'name': 'base', |
|
|
|
all_opt.append({'name': 'user', |
|
|
|
'description' : 'Base options', |
|
|
|
'description' : 'User options', |
|
|
|
'type' : 'suboption', |
|
|
|
'type' : 'suboption', |
|
|
|
'value' : get_keys(coredata.base_options), |
|
|
|
'value' : build_usertree(main_options, main_suboptions), |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
all_opt += build_subprojecttree(subproject_options, subproject_suboptions) |
|
|
|
print(json.dumps(all_opt, indent=2)) |
|
|
|
print(json.dumps(all_opt, indent=2)) |
|
|
|
|
|
|
|
|
|
|
|
def build_usertree(suboptions, user_options, subbranch=None): |
|
|
|
def build_subprojecttree(options, suboptions): |
|
|
|
|
|
|
|
result = [] |
|
|
|
|
|
|
|
sp_names = {} |
|
|
|
|
|
|
|
for n in options.keys(): |
|
|
|
|
|
|
|
sp_names[n.split(':')[0]] = True |
|
|
|
|
|
|
|
for n in suboptions.keys(): |
|
|
|
|
|
|
|
sp_names[n.split(':')[0]] = True |
|
|
|
|
|
|
|
for subproject in sorted(sp_names.keys()): |
|
|
|
|
|
|
|
prefix = subproject + ':' |
|
|
|
|
|
|
|
cur_opt = {x.name : x for x in options.values() if x.name.startswith(prefix)} |
|
|
|
|
|
|
|
cur_subopt = {x.name : x for x in suboptions.values() if x.name.startswith(prefix)} |
|
|
|
|
|
|
|
result.append({'name' : subproject, |
|
|
|
|
|
|
|
'description' : 'Options of subproject: %s' % subproject, |
|
|
|
|
|
|
|
'type' : 'suboption', |
|
|
|
|
|
|
|
'value' : build_usertree(cur_opt, cur_subopt) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def build_usertree(user_options, suboptions, subbranch=None): |
|
|
|
current = [] |
|
|
|
current = [] |
|
|
|
current_suboptions = [x for x in suboptions.values() if x.parent == subbranch] |
|
|
|
current_suboptions = [x for x in suboptions.values() if x.parent == subbranch] |
|
|
|
current_options = [x for x in user_options.values() if x.parent == subbranch] |
|
|
|
current_options = [x for x in user_options.values() if x.parent == subbranch] |
|
|
|
for so in current_suboptions: |
|
|
|
for so in current_suboptions: |
|
|
|
subentry = {'type' : 'subobject', |
|
|
|
subentry = {'type' : 'subobject', |
|
|
|
'value' : build_usertree(suboptions, user_options, so.name), |
|
|
|
'value' : build_usertree(user_options, suboptions, so.name), |
|
|
|
'description' : so.description, |
|
|
|
'description' : so.description, |
|
|
|
'name' : so.name |
|
|
|
'name' : so.name |
|
|
|
} |
|
|
|
} |
|
|
|