mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 04:34:43 +04:00
[FL-3629] fbt: reworked assets & resources handling (#3160)
* fbt: reworking targets & assets handling WIP * fbt: dist fixes * fbt: moved SD card resources to owning apps * unit_tests: moved resources to app folder * github: updated unit_tests paths * github: packaging fixes * unit_tests: fixes * fbt: assets: internal cleanup * fbt: reworked assets handling * github: unit_tests: reintroducing fixes * minor cleanup * fbt: naming changes to reflect private nature of scons tools * fbt: resources: fixed dist archive paths * docs: updated paths * docs: updated more paths * docs: included "resources" parameter in app manifest docs; updated assets readme * updated gitignore for assets * github: updated action versions * unit_tests: restored timeout; scripts: assets: logging changes * gh: don't upload desktop animations for unit test run Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
from fbt.version import get_git_commit_unix_timestamp
|
||||
|
||||
Import("env")
|
||||
|
||||
assetsenv = env.Clone(
|
||||
tools=["fbt_assets"],
|
||||
FW_LIB_NAME="assets",
|
||||
GIT_UNIX_TIMESTAMP=get_git_commit_unix_timestamp(),
|
||||
ASSETS_WORK_DIR=env.Dir("compiled"),
|
||||
ASSETS_SRC_DIR=env.Dir("#/assets"),
|
||||
)
|
||||
assetsenv.ApplyLibFlags()
|
||||
|
||||
icons = assetsenv.CompileIcons(
|
||||
assetsenv.Dir("compiled"), assetsenv.Dir("#/assets/icons")
|
||||
assetsenv["ASSETS_WORK_DIR"],
|
||||
assetsenv["ASSETS_SRC_DIR"].Dir("icons"),
|
||||
)
|
||||
assetsenv.Alias("icons", icons)
|
||||
|
||||
@@ -18,7 +18,7 @@ assetsenv.Alias("icons", icons)
|
||||
# Protobuf .proto -> .c + .h
|
||||
proto_src = assetsenv.Glob("protobuf/*.proto", source=True)
|
||||
proto_options = assetsenv.Glob("protobuf/*.options", source=True)
|
||||
proto = assetsenv.ProtoBuilder(assetsenv.Dir("compiled"), proto_src)
|
||||
proto = assetsenv.ProtoBuilder(assetsenv["ASSETS_WORK_DIR"], proto_src)
|
||||
assetsenv.Depends(proto, proto_options)
|
||||
# Precious(proto)
|
||||
assetsenv.Alias("proto", proto)
|
||||
@@ -27,8 +27,8 @@ assetsenv.Alias("proto", proto)
|
||||
# Internal animations
|
||||
|
||||
dolphin_internal = assetsenv.DolphinSymBuilder(
|
||||
assetsenv.Dir("compiled"),
|
||||
assetsenv.Dir("#/assets/dolphin"),
|
||||
assetsenv["ASSETS_WORK_DIR"],
|
||||
assetsenv["ASSETS_SRC_DIR"].Dir("dolphin"),
|
||||
DOLPHIN_RES_TYPE="internal",
|
||||
)
|
||||
assetsenv.Alias("dolphin_internal", dolphin_internal)
|
||||
@@ -37,8 +37,8 @@ assetsenv.Alias("dolphin_internal", dolphin_internal)
|
||||
# Blocking animations
|
||||
|
||||
dolphin_blocking = assetsenv.DolphinSymBuilder(
|
||||
assetsenv.Dir("compiled"),
|
||||
assetsenv.Dir("#/assets/dolphin"),
|
||||
assetsenv["ASSETS_WORK_DIR"],
|
||||
assetsenv["ASSETS_SRC_DIR"].Dir("dolphin"),
|
||||
DOLPHIN_RES_TYPE="blocking",
|
||||
)
|
||||
assetsenv.Alias("dolphin_blocking", dolphin_blocking)
|
||||
@@ -46,8 +46,8 @@ assetsenv.Alias("dolphin_blocking", dolphin_blocking)
|
||||
|
||||
# Protobuf version meta
|
||||
proto_ver = assetsenv.ProtoVerBuilder(
|
||||
"compiled/protobuf_version.h",
|
||||
"#/assets/protobuf/Changelog",
|
||||
"${ASSETS_WORK_DIR}/protobuf_version.h",
|
||||
assetsenv["ASSETS_SRC_DIR"].File("protobuf/Changelog"),
|
||||
)
|
||||
assetsenv.Depends(proto_ver, proto)
|
||||
assetsenv.Alias("proto_ver", proto_ver)
|
||||
@@ -61,41 +61,19 @@ assetsenv.Install("${LIB_DIST_DIR}", assetslib)
|
||||
|
||||
|
||||
# Resources for SD card
|
||||
env.SetDefault(FW_RESOURCES=None)
|
||||
if assetsenv["IS_BASE_FIRMWARE"]:
|
||||
dolphin_external_out_dir = assetsenv["ASSETS_WORK_DIR"].Dir("dolphin")
|
||||
# External dolphin animations
|
||||
dolphin_external = assetsenv.DolphinExtBuilder(
|
||||
assetsenv.Dir("#/assets/resources/dolphin"),
|
||||
assetsenv.Dir("#/assets/dolphin"),
|
||||
dolphin_external_out_dir,
|
||||
assetsenv["ASSETS_SRC_DIR"].Dir("dolphin"),
|
||||
DOLPHIN_RES_TYPE="external",
|
||||
)
|
||||
if assetsenv["FORCE"]:
|
||||
assetsenv.AlwaysBuild(dolphin_external)
|
||||
assetsenv.Alias("dolphin_ext", dolphin_external)
|
||||
assetsenv.Clean(dolphin_external, assetsenv.Dir("#/assets/resources/dolphin"))
|
||||
assetsenv.Clean(dolphin_external, dolphin_external_out_dir)
|
||||
|
||||
# Resources manifest
|
||||
resources = assetsenv.Command(
|
||||
"#/assets/resources/Manifest",
|
||||
assetsenv.GlobRecursive(
|
||||
"*",
|
||||
assetsenv.Dir("resources").srcnode(),
|
||||
exclude=["Manifest"],
|
||||
),
|
||||
action=Action(
|
||||
'${PYTHON3} "${ASSETS_COMPILER}" manifest "${TARGET.dir.posix}" --timestamp=${GIT_UNIX_TIMESTAMP}',
|
||||
"${RESMANIFESTCOMSTR}",
|
||||
),
|
||||
)
|
||||
assetsenv.Precious(resources)
|
||||
assetsenv.AlwaysBuild(resources)
|
||||
assetsenv.Clean(
|
||||
resources,
|
||||
assetsenv.Dir("#/assets/resources/apps"),
|
||||
)
|
||||
|
||||
# Exporting resources node to external environment
|
||||
env.Replace(FW_RESOURCES=resources)
|
||||
assetsenv.Alias("resources", resources)
|
||||
env.Replace(DOLPHIN_EXTERNAL_OUT_DIR=dolphin_external_out_dir)
|
||||
|
||||
Return("assetslib")
|
||||
|
||||
Reference in New Issue
Block a user