objdiff.json output fixes
Ensures that most unit fields are written even when missing the source file or auto-generated
This commit is contained in:
parent
f54d479e6f
commit
2f052e0982
|
@ -1236,14 +1236,19 @@ def generate_objdiff_config(
|
|||
"target_path": obj_path,
|
||||
"metadata": {
|
||||
"auto_generated": build_obj["autogenerated"],
|
||||
"progress_categories": progress_categories,
|
||||
},
|
||||
}
|
||||
|
||||
obj = objects.get(obj_name)
|
||||
if obj is None or not obj.src_path or not obj.src_path.exists():
|
||||
if obj is None:
|
||||
objdiff_config["units"].append(unit_config)
|
||||
return
|
||||
|
||||
src_exists = obj.src_path is not None and obj.src_path.exists()
|
||||
if src_exists:
|
||||
unit_config["base_path"] = obj.src_obj_path
|
||||
|
||||
cflags = obj.options["cflags"]
|
||||
reverse_fn_order = False
|
||||
if type(cflags) is list:
|
||||
|
@ -1263,12 +1268,14 @@ def generate_objdiff_config(
|
|||
cflags = list(filter(keep_flag, cflags))
|
||||
|
||||
# Add appropriate lang flag
|
||||
if obj.src_path.suffix in (".cp", ".cpp"):
|
||||
cflags.insert(0, "-lang=c++")
|
||||
else:
|
||||
cflags.insert(0, "-lang=c")
|
||||
if obj.src_path is not None and not any(
|
||||
flag.startswith("-lang") for flag in cflags
|
||||
):
|
||||
if obj.src_path.suffix in (".cp", ".cpp"):
|
||||
cflags.insert(0, "-lang=c++")
|
||||
else:
|
||||
cflags.insert(0, "-lang=c")
|
||||
|
||||
unit_config["base_path"] = obj.src_obj_path
|
||||
compiler_version = COMPILER_MAP.get(obj.options["mw_version"])
|
||||
if compiler_version is None:
|
||||
print(f"Missing scratch compiler mapping for {obj.options['mw_version']}")
|
||||
|
@ -1281,20 +1288,27 @@ def generate_objdiff_config(
|
|||
"platform": "gc_wii",
|
||||
"compiler": compiler_version,
|
||||
"c_flags": cflags_str,
|
||||
"ctx_path": obj.ctx_path,
|
||||
"build_ctx": True,
|
||||
}
|
||||
if src_exists:
|
||||
unit_config["scratch"].update(
|
||||
{
|
||||
"ctx_path": obj.ctx_path,
|
||||
"build_ctx": True,
|
||||
}
|
||||
)
|
||||
category_opt: List[str] | str = obj.options["progress_category"]
|
||||
if isinstance(category_opt, list):
|
||||
progress_categories.extend(category_opt)
|
||||
elif category_opt is not None:
|
||||
progress_categories.append(category_opt)
|
||||
unit_config["metadata"].update({
|
||||
"complete": obj.completed,
|
||||
"reverse_fn_order": reverse_fn_order,
|
||||
"source_path": obj.src_path,
|
||||
"progress_categories": progress_categories,
|
||||
})
|
||||
unit_config["metadata"].update(
|
||||
{
|
||||
"complete": obj.completed,
|
||||
"reverse_fn_order": reverse_fn_order,
|
||||
"source_path": obj.src_path,
|
||||
"progress_categories": progress_categories,
|
||||
}
|
||||
)
|
||||
objdiff_config["units"].append(unit_config)
|
||||
|
||||
# Add DOL units
|
||||
|
|
Loading…
Reference in New Issue