mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 20:38:10 +00:00
build(core): rebuild appropriate parts when translation data changes
fixes #3535
This commit is contained in:
parent
b61ed7c02a
commit
9569968459
8
Makefile
8
Makefile
@ -107,16 +107,16 @@ mocks_check: ## check validity of mock python headers
|
|||||||
flake8 core/mocks/generated
|
flake8 core/mocks/generated
|
||||||
|
|
||||||
templates: icons ## rebuild coin lists from definitions in common
|
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
|
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
|
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
|
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
|
icons: ## generate FIDO service icons
|
||||||
python3 core/tools/build_icons.py
|
python3 core/tools/build_icons.py
|
||||||
|
@ -211,12 +211,20 @@ clippy:
|
|||||||
|
|
||||||
## code generation:
|
## 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
|
./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
|
./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
|
solana_templates: ## rebuild Solana instruction template file
|
||||||
./tools/build_solana_templates
|
./tools/build_solana_templates
|
||||||
|
|
||||||
@ -455,3 +463,5 @@ coverage: ## generate coverage report
|
|||||||
unused: ## find unused micropython code
|
unused: ## find unused micropython code
|
||||||
vulture src src/_vulture_ignore.txt --exclude "messages.py,*/enums/*"
|
vulture src src/_vulture_ignore.txt --exclude "messages.py,*/enums/*"
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: templates translations templates_check translations_check
|
||||||
|
@ -367,6 +367,12 @@ if FEATURE_FLAGS["SYSTEM_VIEW"]:
|
|||||||
CPPDEFINES_MOD += ['SYSTEM_VIEW']
|
CPPDEFINES_MOD += ['SYSTEM_VIEW']
|
||||||
CCFLAGS_MOD += '-DSYSTEM_VIEW '
|
CCFLAGS_MOD += '-DSYSTEM_VIEW '
|
||||||
|
|
||||||
|
TRANSLATION_DATA = [
|
||||||
|
"translations/en.json",
|
||||||
|
"translations/order.json",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# fonts
|
# fonts
|
||||||
tools.add_font('NORMAL', FONT_NORMAL, CPPDEFINES_MOD, SOURCE_MOD)
|
tools.add_font('NORMAL', FONT_NORMAL, CPPDEFINES_MOD, SOURCE_MOD)
|
||||||
tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD)
|
tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD)
|
||||||
@ -749,6 +755,7 @@ rust = env.Command(
|
|||||||
source='',
|
source='',
|
||||||
action=cargo_build(), )
|
action=cargo_build(), )
|
||||||
env.Depends(rust, protobuf_blobs)
|
env.Depends(rust, protobuf_blobs)
|
||||||
|
env.Depends(rust, TRANSLATION_DATA)
|
||||||
|
|
||||||
env.Append(LINKFLAGS=f' -L{RUST_LIBDIR}')
|
env.Append(LINKFLAGS=f' -L{RUST_LIBDIR}')
|
||||||
env.Append(LINKFLAGS=f' -l{RUST_LIB}')
|
env.Append(LINKFLAGS=f' -l{RUST_LIB}')
|
||||||
|
@ -417,6 +417,12 @@ if DMA2D:
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
TRANSLATION_DATA = [
|
||||||
|
"translations/en.json",
|
||||||
|
"translations/order.json",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# fonts
|
# fonts
|
||||||
tools.add_font('NORMAL', FONT_NORMAL, CPPDEFINES_MOD, SOURCE_MOD)
|
tools.add_font('NORMAL', FONT_NORMAL, CPPDEFINES_MOD, SOURCE_MOD)
|
||||||
tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD)
|
tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD)
|
||||||
@ -833,6 +839,7 @@ rust = env.Command(
|
|||||||
source='',
|
source='',
|
||||||
action=cargo_build(), )
|
action=cargo_build(), )
|
||||||
env.Depends(rust, protobuf_blobs)
|
env.Depends(rust, protobuf_blobs)
|
||||||
|
env.Depends(rust, TRANSLATION_DATA)
|
||||||
|
|
||||||
|
|
||||||
env.Append(LINKFLAGS=f'-L{RUST_LIBDIR}')
|
env.Append(LINKFLAGS=f'-L{RUST_LIBDIR}')
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@ -29,6 +30,8 @@ def generate_new_order() -> None:
|
|||||||
old_order[new_index] = item
|
old_order[new_index] = item
|
||||||
|
|
||||||
output_file.write_text(json.dumps(old_order, indent=2) + "\n")
|
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:
|
else:
|
||||||
print("No new items found.")
|
print("No new items found.")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user