[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:
hedger 2023-10-30 19:17:30 +04:00 committed by GitHub
parent 176fb21f5f
commit 917410a0a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
345 changed files with 466 additions and 394 deletions

4
.github/CODEOWNERS vendored
View file

@ -42,10 +42,10 @@
/applications/examples/example_thermo/ @skotopes @DrZlo13 @hedger @gsurkov
# Firmware targets
/firmware/ @skotopes @DrZlo13 @hedger @nminaylov
/targets/ @skotopes @DrZlo13 @hedger @nminaylov
# Assets
/assets/resources/infrared/ @skotopes @DrZlo13 @hedger @gsurkov
/applications/main/infrared/resources/ @skotopes @DrZlo13 @hedger @gsurkov
# Documentation
/documentation/ @skotopes @DrZlo13 @hedger @drunkbatya

View file

@ -25,7 +25,7 @@ jobs:
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
- name: 'Checkout code'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
ref: ${{ github.event.pull_request.head.sha }}
@ -51,11 +51,11 @@ jobs:
- name: 'Check API versions for consistency between targets'
run: |
set -e
N_API_HEADER_SIGNATURES=`ls -1 firmware/targets/f*/api_symbols.csv | xargs -I {} sh -c "head -n2 {} | md5sum" | sort -u | wc -l`
N_API_HEADER_SIGNATURES=`ls -1 targets/f*/api_symbols.csv | xargs -I {} sh -c "head -n2 {} | md5sum" | sort -u | wc -l`
if [ $N_API_HEADER_SIGNATURES != 1 ] ; then
echo API versions aren\'t matching for available targets. Please update!
echo API versions are:
head -n2 firmware/targets/f*/api_symbols.csv
head -n2 targets/f*/api_symbols.csv
exit 1
fi
@ -76,7 +76,7 @@ jobs:
mkdir artifacts map_analyser_files
cp dist/${TARGET}-*/* artifacts/ || true
tar czpf "artifacts/flipper-z-${TARGET}-resources-${SUFFIX}.tgz" \
-C assets resources
-C build/latest resources
tar czpf "artifacts/flipper-z-${TARGET}-debugapps-${SUFFIX}.tgz" \
-C dist/${TARGET}-*/apps/Debug .
tar czpf "artifacts/flipper-z-${TARGET}-appsymbols-${SUFFIX}.tgz" \

View file

@ -19,7 +19,7 @@ jobs:
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
- name: 'Checkout code'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: false
@ -46,7 +46,7 @@ jobs:
echo "hw-target-code=$TARGET" >> $GITHUB_OUTPUT
- name: Deploy uFBT with SDK
uses: flipperdevices/flipperzero-ufbt-action@v0.1.0
uses: flipperdevices/flipperzero-ufbt-action@v0.1
with:
task: setup
sdk-file: ${{ steps.build-fw.outputs.sdk-file }}

View file

@ -16,7 +16,7 @@ jobs:
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
- name: 'Checkout code'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2
ref: ${{ github.sha }}

View file

@ -16,7 +16,7 @@ jobs:
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
- name: 'Checkout code'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
ref: ${{ github.event.pull_request.head.sha }}

View file

@ -21,7 +21,7 @@ jobs:
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
- name: 'Checkout code'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
ref: ${{ github.event.pull_request.head.sha }}

View file

@ -17,7 +17,7 @@ jobs:
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
ref: ${{ github.event.pull_request.head.sha }}
@ -32,7 +32,7 @@ jobs:
if: success()
timeout-minutes: 10
run: |
./fbt flash SWD_TRANSPORT_SERIAL=2A0906016415303030303032 LIB_DEBUG=1 FIRMWARE_APP_SET=unit_tests FORCE=1
./fbt resources firmware_latest flash SWD_TRANSPORT_SERIAL=2A0906016415303030303032 LIB_DEBUG=1 FIRMWARE_APP_SET=unit_tests FORCE=1
- name: 'Wait for flipper and format ext'
id: format_ext
@ -50,8 +50,8 @@ jobs:
run: |
source scripts/toolchain/fbtenv.sh
python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} -f send assets/resources /ext
python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} -f send assets/unit_tests /ext/unit_tests
rm -rf build/latest/resources/dolphin
python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} -f send build/latest/resources /ext
python3 scripts/power.py -p ${{steps.device.outputs.flipper}} reboot
python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}

View file

@ -17,7 +17,7 @@ jobs:
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: false
@ -56,7 +56,7 @@ jobs:
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
- name: 'Checkout latest release'
uses: actions/checkout@v3
uses: actions/checkout@v4
if: failure()
with:
fetch-depth: 1

View file

@ -67,22 +67,22 @@ if GetOption("fullenv") or any(
# Target for self-update package
dist_basic_arguments = [
"--bundlever",
'"${UPDATE_VERSION_STRING}"',
"${UPDATE_VERSION_STRING}",
]
dist_radio_arguments = [
"--radio",
'"${ROOT_DIR.abspath}/${COPRO_STACK_BIN_DIR}/${COPRO_STACK_BIN}"',
"${ROOT_DIR.abspath}/${COPRO_STACK_BIN_DIR}/${COPRO_STACK_BIN}",
"--radiotype",
"${COPRO_STACK_TYPE}",
"${COPRO_DISCLAIMER}",
"--obdata",
'"${ROOT_DIR.abspath}/${COPRO_OB_DATA}"',
"${ROOT_DIR.abspath}/${COPRO_OB_DATA}",
"--stackversion",
"${COPRO_CUBE_VERSION}",
]
dist_resource_arguments = [
"-r",
'"${ROOT_DIR.abspath}/assets/resources"',
firmware_env.subst("${RESOURCES_ROOT}"),
]
dist_splash_arguments = (
[
@ -95,7 +95,7 @@ if GetOption("fullenv") or any(
selfupdate_dist = distenv.DistCommand(
"updater_package",
(distenv["DIST_DEPENDS"], firmware_env["FW_RESOURCES"]),
(distenv["DIST_DEPENDS"], firmware_env["FW_RESOURCES_MANIFEST"]),
DIST_EXTRA=[
*dist_basic_arguments,
*dist_radio_arguments,
@ -128,7 +128,8 @@ if GetOption("fullenv") or any(
# Installation over USB & CLI
usb_update_package = distenv.AddUsbFlashTarget(
"#build/usbinstall.flag", (firmware_env["FW_RESOURCES"], selfupdate_dist)
"#build/usbinstall.flag",
(firmware_env["FW_RESOURCES_MANIFEST"], selfupdate_dist),
)
distenv.Alias("flash_usb_full", usb_update_package)
@ -166,16 +167,23 @@ Depends(
list(app_artifact.validator for app_artifact in external_app_list),
)
Alias("fap_dist", fap_dist)
# distenv.Default(fap_dist)
distenv.Depends(firmware_env["FW_RESOURCES"], external_apps_artifacts.resources_dist)
# Copy all faps to device
fap_deploy = distenv.PhonyTarget(
"fap_deploy",
"${PYTHON3} ${FBT_SCRIPT_DIR}/storage.py -p ${FLIP_PORT} send ${SOURCE} /ext/apps",
source=Dir("#/assets/resources/apps"),
[
[
"${PYTHON3}",
"${FBT_SCRIPT_DIR}/storage.py",
"-p",
"${FLIP_PORT}",
"send",
"${SOURCE}",
"/ext/apps",
]
],
source=firmware_env.Dir(("${RESOURCES_ROOT}/apps")),
)
@ -314,9 +322,7 @@ distenv.PhonyTarget(
)
# Start Flipper CLI via PySerial's miniterm
distenv.PhonyTarget(
"cli", "${PYTHON3} ${FBT_SCRIPT_DIR}/serial_cli.py -p ${FLIP_PORT}"
)
distenv.PhonyTarget("cli", "${PYTHON3} ${FBT_SCRIPT_DIR}/serial_cli.py -p ${FLIP_PORT}")
# Update WiFi devboard firmware
distenv.PhonyTarget("devboard_flash", "${PYTHON3} ${FBT_SCRIPT_DIR}/wifi_board.py")

View file

@ -5,6 +5,7 @@ App(
cdefines=["APP_UNIT_TESTS"],
requires=["system_settings"],
provides=["delay_test"],
resources="resources",
order=100,
)

View file

@ -22,7 +22,7 @@ MU_TEST(manifest_iteration_test) {
ResourceManifestReader* manifest_reader = resource_manifest_reader_alloc(storage);
do {
// Open manifest file
if(!resource_manifest_reader_open(manifest_reader, EXT_PATH("unit_tests/Manifest"))) {
if(!resource_manifest_reader_open(manifest_reader, EXT_PATH("unit_tests/Manifest_test"))) {
result = false;
break;
}

View file

@ -6,6 +6,7 @@ App(
stack_size=2 * 1024,
icon="A_BadUsb_14",
order=70,
resources="resources",
fap_libs=["assets"],
fap_icon="icon.png",
fap_category="USB",

Some files were not shown because too many files have changed in this diff Show more