Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FL-3629] fbt: reworked assets & resources handling #3160

Merged
merged 23 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8fc60a7
fbt: reworking targets & assets handling WIP
hedger Oct 19, 2023
e6a5fd9
fbt: dist fixes
hedger Oct 19, 2023
7e2e0a6
fbt: moved SD card resources to owning apps
hedger Oct 19, 2023
2c3f979
unit_tests: moved resources to app folder
hedger Oct 19, 2023
2684fd8
github: updated unit_tests paths
hedger Oct 19, 2023
9182b46
github: packaging fixes
hedger Oct 19, 2023
6ce486f
unit_tests: fixes
hedger Oct 20, 2023
4529774
fbt: assets: internal cleanup
hedger Oct 24, 2023
d36e43f
fbt: reworked assets handling
hedger Oct 25, 2023
64c7dad
Merge branch 'dev' into hedger/3630-targets_rework
hedger Oct 25, 2023
3079eeb
github: unit_tests: reintroducing fixes
hedger Oct 25, 2023
54e8711
minor cleanup
hedger Oct 25, 2023
1ad55b2
fbt: naming changes to reflect private nature of scons tools
hedger Oct 25, 2023
7f8435a
fbt: resources: fixed dist archive paths
hedger Oct 25, 2023
732c05c
docs: updated paths
hedger Oct 25, 2023
c01e631
docs: updated more paths
hedger Oct 25, 2023
a6eee24
docs: included "resources" parameter in app manifest docs; updated as…
hedger Oct 25, 2023
1d25680
updated gitignore for assets
hedger Oct 25, 2023
e2fed94
github: updated action versions
hedger Oct 25, 2023
fdfdb77
unit_tests: restored timeout; scripts: assets: logging changes
hedger Oct 25, 2023
f898ed5
Merge remote-tracking branch 'origin/dev' into hedger/3630-targets_re…
hedger Oct 28, 2023
84a24e3
gh: don't upload desktop animations for unit test run
hedger Oct 29, 2023
1370558
Merge branch 'dev' into hedger/3630-targets_rework
skotopes Oct 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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

Expand All @@ -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" \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_compact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -46,7 +46,7 @@ jobs:
echo "hw-target-code=$TARGET" >> $GITHUB_OUTPUT

- name: Deploy uFBT with SDK
uses: flipperdevices/[email protected].0
uses: flipperdevices/[email protected]
with:
task: setup
sdk-file: ${{ steps.build-fw.outputs.sdk-file }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint_and_submodule_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/merge_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pvs_studio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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}}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/updater_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
34 changes: 20 additions & 14 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
[
Expand All @@ -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,
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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")),
)


Expand Down Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions applications/debug/unit_tests/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ App(
cdefines=["APP_UNIT_TESTS"],
requires=["system_settings"],
provides=["delay_test"],
resources="resources",
order=100,
)

Expand Down
2 changes: 1 addition & 1 deletion applications/debug/unit_tests/manifest/manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions applications/main/bad_usb/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions applications/main/infrared/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ App(
icon="A_Infrared_14",
stack_size=3 * 1024,
order=40,
resources="resources",
fap_libs=["assets"],
fap_icon="icon.png",
fap_category="Infrared",
Expand Down
1 change: 1 addition & 0 deletions applications/main/nfc/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ App(
icon="A_NFC_14",
stack_size=5 * 1024,
order=30,
resources="resources",
fap_libs=["assets"],
fap_icon="icon.png",
fap_category="NFC",
Expand Down
1 change: 1 addition & 0 deletions applications/main/subghz/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ App(
icon="A_Sub1ghz_14",
stack_size=3 * 1024,
order=10,
resources="resources",
fap_libs=["assets", "hwdrivers"],
fap_icon="icon.png",
fap_category="Sub-GHz",
Expand Down
1 change: 1 addition & 0 deletions applications/main/u2f/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ App(
stack_size=2 * 1024,
icon="A_U2F_14",
order=80,
resources="resources",
fap_libs=["assets"],
fap_category="USB",
fap_icon="icon.png",
Expand Down
2 changes: 1 addition & 1 deletion applications/services/loader/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static FlipperInternalApplication const* loader_find_application_by_name_in_list
const FlipperInternalApplication* list,
const uint32_t n_apps) {
for(size_t i = 0; i < n_apps; i++) {
if(strcmp(name, list[i].name) == 0) {
if((strcmp(name, list[i].name) == 0) || (strcmp(name, list[i].appid) == 0)) {
return &list[i];
}
}
Expand Down
4 changes: 2 additions & 2 deletions applications/services/loader/loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef struct {
/**
* @brief Start application
* @param[in] instance loader instance
* @param[in] name application name
* @param[in] name application name or id
* @param[in] args application arguments
* @param[out] error_message detailed error message, can be NULL
* @return LoaderStatus
Expand All @@ -40,7 +40,7 @@ LoaderStatus
/**
* @brief Start application with GUI error message
* @param[in] instance loader instance
* @param[in] name application name
* @param[in] name application name or id
* @param[in] args application arguments
* @return LoaderStatus
*/
Expand Down
1 change: 0 additions & 1 deletion applications/system/snake_game/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ App(
entry_point="snake_game_app",
requires=["gui"],
stack_size=1 * 1024,
targets=["f7"],
fap_version="1.0",
fap_description="Classic Snake Game",
fap_icon="snake_10px.png",
Expand Down
4 changes: 0 additions & 4 deletions assets/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
/core2_firmware
/resources/Manifest
/resources/apps/*
/resources/dolphin/*
/resources/apps_data/**/*.fal
3 changes: 0 additions & 3 deletions assets/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ Good starting point: https://docs.unrealengine.com/4.27/en-US/ProductionPipeline
Don't include assets that you are not using, compiler is not going to strip unused assets.

# Structure
- `compiled` - Output folder made for compiled assets, after building project, in `build` directory.
- `dolphin` - Dolphin game assets sources. Goes to `compiled` and `resources` folders in `build` directory.
- `icons` - Icons sources. Goes to `compiled` folder in `build` directory.
- `protobuf` - Protobuf sources. Goes to `compiled` folder in `build` directory.
- `resources` - Assets that is going to be provisioned to SD card.
- `slideshow` - One-time slideshows for desktop
- `unit_tests` - Some pre-defined signals for testing purposes.
Loading