fbt: compile_commands fixes & better latest
directory handling (#1368)
* fbt: fixed linking updater as latest build dir for "flash_usb" * fbt: fixed cdb regeneration logic; refactored build/latest linking logic * fbt: docs update Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -38,11 +38,27 @@ def link_dir(target_path, source_path, is_windows):
|
||||
os.symlink(source_path, target_path)
|
||||
|
||||
|
||||
def random_alnum(length):
|
||||
return "".join(
|
||||
random.choice(string.ascii_letters + string.digits) for _ in range(length)
|
||||
)
|
||||
|
||||
|
||||
def single_quote(arg_list):
|
||||
return " ".join(f"'{arg}'" if " " in arg else str(arg) for arg in arg_list)
|
||||
|
||||
|
||||
def link_elf_dir_as_latest(env, elf_node):
|
||||
elf_dir = elf_node.Dir(".")
|
||||
latest_dir = env.Dir("#build/latest")
|
||||
print(f"Setting {elf_dir} as latest built dir (./build/latest/)")
|
||||
return link_dir(latest_dir.abspath, elf_dir.abspath, env["PLATFORM"] == "win32")
|
||||
|
||||
|
||||
def should_gen_cdb_and_link_dir(env, requested_targets):
|
||||
explicitly_building_updater = False
|
||||
# Hacky way to check if updater-related targets were requested
|
||||
for build_target in requested_targets:
|
||||
if "updater" in str(build_target):
|
||||
explicitly_building_updater = True
|
||||
|
||||
is_updater = not env["IS_BASE_FIRMWARE"]
|
||||
# If updater is explicitly requested, link to the latest updater
|
||||
# Otherwise, link to firmware
|
||||
return (is_updater and explicitly_building_updater) or (
|
||||
not is_updater and not explicitly_building_updater
|
||||
)
|
||||
|
@@ -46,7 +46,6 @@ def AddFwProject(env, base_env, fw_type, fw_env_key):
|
||||
],
|
||||
DIST_DEPENDS=[
|
||||
project_env["FW_ARTIFACTS"],
|
||||
project_env["LINK_DIR_CMD"],
|
||||
],
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user