1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 21:22:10 +00:00

build(core): rebuild appropriate parts when translation data changes

fixes #3535
This commit is contained in:
matejcik 2024-03-15 11:56:00 +01:00 committed by matejcik
parent b61ed7c02a
commit 9569968459
5 changed files with 33 additions and 6 deletions

View File

@ -107,16 +107,16 @@ mocks_check: ## check validity of mock python headers
flake8 core/mocks/generated
templates: icons ## rebuild coin lists from definitions in common
./core/tools/build_templates
make -C core templates
templates_check: ## check that coin lists are up to date
./core/tools/build_templates --check
make -C core templates_check
solana_templates: ## rebuild Solana instruction template file
./core/tools/build_solana_templates
make -C core solana_templates
solana_templates_check: ## check that Solana instruction template file is up to date
./core/tools/build_solana_templates --check
make -C core solana_templates_check
icons: ## generate FIDO service icons
python3 core/tools/build_icons.py

View File

@ -211,12 +211,20 @@ clippy:
## code generation:
templates: ## render Mako templates (for lists of coins, tokens, etc.)
templates: translations ## render Mako templates (for lists of coins, tokens, etc.)
./tools/build_templates
templates_check: ## check that Mako-rendered files match their templates
templates_check: translations_check ## check that Mako-rendered files match their templates
./tools/build_templates --check
translations: ## update translations
python ./translations/order.py
python ./translations/cli.py gen
translations_check: ## check that translations are up to date
# spits out error if the stored merkle root is not up to date
python ./translations/cli.py merkle-root > /dev/null
solana_templates: ## rebuild Solana instruction template file
./tools/build_solana_templates
@ -455,3 +463,5 @@ coverage: ## generate coverage report
unused: ## find unused micropython code
vulture src src/_vulture_ignore.txt --exclude "messages.py,*/enums/*"
.PHONY: templates translations templates_check translations_check

View File

@ -367,6 +367,12 @@ if FEATURE_FLAGS["SYSTEM_VIEW"]:
CPPDEFINES_MOD += ['SYSTEM_VIEW']
CCFLAGS_MOD += '-DSYSTEM_VIEW '
TRANSLATION_DATA = [
"translations/en.json",
"translations/order.json",
]
# fonts
tools.add_font('NORMAL', FONT_NORMAL, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD)
@ -749,6 +755,7 @@ rust = env.Command(
source='',
action=cargo_build(), )
env.Depends(rust, protobuf_blobs)
env.Depends(rust, TRANSLATION_DATA)
env.Append(LINKFLAGS=f' -L{RUST_LIBDIR}')
env.Append(LINKFLAGS=f' -l{RUST_LIB}')

View File

@ -417,6 +417,12 @@ if DMA2D:
]
TRANSLATION_DATA = [
"translations/en.json",
"translations/order.json",
]
# fonts
tools.add_font('NORMAL', FONT_NORMAL, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD)
@ -833,6 +839,7 @@ rust = env.Command(
source='',
action=cargo_build(), )
env.Depends(rust, protobuf_blobs)
env.Depends(rust, TRANSLATION_DATA)
env.Append(LINKFLAGS=f'-L{RUST_LIBDIR}')

View File

@ -1,5 +1,6 @@
from __future__ import annotations
import json
import os
from pathlib import Path
@ -29,6 +30,8 @@ def generate_new_order() -> None:
old_order[new_index] = item
output_file.write_text(json.dumps(old_order, indent=2) + "\n")
stat = language_file.stat()
os.utime(output_file, ns=(stat.st_atime_ns, stat.st_mtime_ns))
else:
print("No new items found.")