2022-06-26 15:00:03 +03:00
|
|
|
from SCons.Action import Action
|
2023-05-03 08:48:49 +03:00
|
|
|
from SCons.Builder import Builder
|
2022-06-26 15:00:03 +03:00
|
|
|
|
|
|
|
|
2023-10-30 18:17:30 +03:00
|
|
|
def _version_emitter(target, source, env):
|
2022-06-26 15:00:03 +03:00
|
|
|
target_dir = target[0]
|
|
|
|
target = [
|
|
|
|
target_dir.File("version.inc.h"),
|
|
|
|
target_dir.File("version.json"),
|
|
|
|
]
|
|
|
|
return target, source
|
|
|
|
|
|
|
|
|
|
|
|
def generate(env):
|
2022-11-02 18:15:40 +03:00
|
|
|
env.SetDefault(
|
|
|
|
VERSION_SCRIPT="${FBT_SCRIPT_DIR}/version.py",
|
|
|
|
)
|
2022-06-26 15:00:03 +03:00
|
|
|
env.Append(
|
|
|
|
BUILDERS={
|
|
|
|
"VersionBuilder": Builder(
|
|
|
|
action=Action(
|
2023-11-15 19:27:35 +03:00
|
|
|
[
|
|
|
|
[
|
|
|
|
"${PYTHON3}",
|
|
|
|
"${VERSION_SCRIPT}",
|
|
|
|
"generate",
|
|
|
|
"-t",
|
|
|
|
"${TARGET_HW}",
|
|
|
|
"--fw-origin",
|
|
|
|
"${FIRMWARE_ORIGIN}",
|
|
|
|
"-o",
|
|
|
|
"${TARGET.dir.posix}",
|
|
|
|
"--dir",
|
|
|
|
"${ROOT_DIR}",
|
|
|
|
]
|
2023-12-01 12:16:48 +03:00
|
|
|
],
|
|
|
|
"${VERSIONCOMSTR}",
|
2022-06-26 15:00:03 +03:00
|
|
|
),
|
2023-10-30 18:17:30 +03:00
|
|
|
emitter=_version_emitter,
|
2022-06-26 15:00:03 +03:00
|
|
|
),
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def exists(env):
|
|
|
|
return True
|