2022-06-26 15:00:03 +03:00
|
|
|
Import("env")
|
|
|
|
|
2022-09-29 14:00:22 +03:00
|
|
|
from fbt.version import get_git_commit_unix_timestamp
|
|
|
|
|
2022-06-26 15:00:03 +03:00
|
|
|
assetsenv = env.Clone(
|
|
|
|
tools=["fbt_assets"],
|
|
|
|
FW_LIB_NAME="assets",
|
2022-09-29 14:00:22 +03:00
|
|
|
GIT_UNIX_TIMESTAMP=get_git_commit_unix_timestamp(),
|
2022-06-26 15:00:03 +03:00
|
|
|
)
|
|
|
|
assetsenv.ApplyLibFlags()
|
|
|
|
|
2022-10-06 16:55:57 +03:00
|
|
|
icons = assetsenv.CompileIcons(
|
|
|
|
assetsenv.Dir("compiled"), assetsenv.Dir("#/assets/icons")
|
2022-09-14 19:11:38 +03:00
|
|
|
)
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Alias("icons", icons)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Protobuf .proto -> .c + .h
|
2022-06-30 19:06:12 +03:00
|
|
|
proto_src = assetsenv.Glob("protobuf/*.proto", source=True)
|
|
|
|
proto_options = assetsenv.Glob("protobuf/*.options", source=True)
|
|
|
|
proto = assetsenv.ProtoBuilder(assetsenv.Dir("compiled"), proto_src)
|
|
|
|
assetsenv.Depends(proto, proto_options)
|
2022-06-26 15:00:03 +03:00
|
|
|
# Precious(proto)
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Alias("proto", proto)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Internal animations
|
|
|
|
|
|
|
|
dolphin_internal = assetsenv.DolphinSymBuilder(
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Dir("compiled"),
|
|
|
|
assetsenv.Dir("#/assets/dolphin"),
|
2022-06-26 15:00:03 +03:00
|
|
|
DOLPHIN_RES_TYPE="internal",
|
|
|
|
)
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Alias("dolphin_internal", dolphin_internal)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Blocking animations
|
|
|
|
|
|
|
|
dolphin_blocking = assetsenv.DolphinSymBuilder(
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Dir("compiled"),
|
|
|
|
assetsenv.Dir("#/assets/dolphin"),
|
2022-06-26 15:00:03 +03:00
|
|
|
DOLPHIN_RES_TYPE="blocking",
|
|
|
|
)
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Alias("dolphin_blocking", dolphin_blocking)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Protobuf version meta
|
|
|
|
proto_ver = assetsenv.ProtoVerBuilder(
|
|
|
|
"compiled/protobuf_version.h",
|
|
|
|
"#/assets/protobuf/Changelog",
|
|
|
|
)
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Depends(proto_ver, proto)
|
|
|
|
assetsenv.Alias("proto_ver", proto_ver)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
# Gather everything into a static lib
|
|
|
|
assets_parts = (icons, proto, dolphin_blocking, dolphin_internal, proto_ver)
|
2023-01-17 15:55:49 +03:00
|
|
|
env.Replace(FW_ASSETS_HEADERS=assets_parts)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
assetslib = assetsenv.Library("${FW_LIB_NAME}", assets_parts)
|
|
|
|
assetsenv.Install("${LIB_DIST_DIR}", assetslib)
|
|
|
|
|
|
|
|
|
|
|
|
# Resources for SD card
|
2023-01-17 15:55:49 +03:00
|
|
|
env.SetDefault(FW_RESOURCES=None)
|
2022-06-26 15:00:03 +03:00
|
|
|
if assetsenv["IS_BASE_FIRMWARE"]:
|
|
|
|
# External dolphin animations
|
|
|
|
dolphin_external = assetsenv.DolphinExtBuilder(
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Dir("#/assets/resources/dolphin"),
|
|
|
|
assetsenv.Dir("#/assets/dolphin"),
|
2022-06-26 15:00:03 +03:00
|
|
|
DOLPHIN_RES_TYPE="external",
|
|
|
|
)
|
|
|
|
if assetsenv["FORCE"]:
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.AlwaysBuild(dolphin_external)
|
|
|
|
assetsenv.Alias("dolphin_ext", dolphin_external)
|
2022-10-26 01:15:02 +03:00
|
|
|
assetsenv.Clean(dolphin_external, assetsenv.Dir("#/assets/resources/dolphin"))
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
# Resources manifest
|
|
|
|
resources = assetsenv.Command(
|
|
|
|
"#/assets/resources/Manifest",
|
2022-10-26 01:15:02 +03:00
|
|
|
assetsenv.GlobRecursive(
|
|
|
|
"*", assetsenv.Dir("resources").srcnode(), exclude="Manifest"
|
|
|
|
),
|
2022-06-26 15:00:03 +03:00
|
|
|
action=Action(
|
2022-09-29 14:00:22 +03:00
|
|
|
'${PYTHON3} "${ASSETS_COMPILER}" manifest "${TARGET.dir.posix}" --timestamp=${GIT_UNIX_TIMESTAMP}',
|
2022-06-26 15:00:03 +03:00
|
|
|
"${RESMANIFESTCOMSTR}",
|
|
|
|
),
|
|
|
|
)
|
2022-09-29 14:00:22 +03:00
|
|
|
assetsenv.Precious(resources)
|
2022-08-02 16:29:16 +03:00
|
|
|
assetsenv.AlwaysBuild(resources)
|
2022-09-14 19:11:38 +03:00
|
|
|
assetsenv.Clean(
|
|
|
|
resources,
|
|
|
|
assetsenv.Dir("#/assets/resources/apps"),
|
|
|
|
)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
# Exporting resources node to external environment
|
2023-01-17 15:55:49 +03:00
|
|
|
env.Replace(FW_RESOURCES=resources)
|
2022-06-30 19:06:12 +03:00
|
|
|
assetsenv.Alias("resources", resources)
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
Return("assetslib")
|