[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:
		
							parent
							
								
									176fb21f5f
								
							
						
					
					
						commit
						917410a0a8
					
				
							
								
								
									
										4
									
								
								.github/CODEOWNERS
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/CODEOWNERS
									
									
									
									
										vendored
									
									
								
							| @ -42,10 +42,10 @@ | |||||||
| /applications/examples/example_thermo/ @skotopes @DrZlo13 @hedger @gsurkov | /applications/examples/example_thermo/ @skotopes @DrZlo13 @hedger @gsurkov | ||||||
| 
 | 
 | ||||||
| # Firmware targets | # Firmware targets | ||||||
| /firmware/ @skotopes @DrZlo13 @hedger @nminaylov | /targets/ @skotopes @DrZlo13 @hedger @nminaylov | ||||||
| 
 | 
 | ||||||
| # Assets | # Assets | ||||||
| /assets/resources/infrared/ @skotopes @DrZlo13 @hedger @gsurkov | /applications/main/infrared/resources/ @skotopes @DrZlo13 @hedger @gsurkov | ||||||
| 
 | 
 | ||||||
| # Documentation | # Documentation | ||||||
| /documentation/ @skotopes @DrZlo13 @hedger @drunkbatya | /documentation/ @skotopes @DrZlo13 @hedger @drunkbatya | ||||||
|  | |||||||
							
								
								
									
										8
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							| @ -25,7 +25,7 @@ jobs: | |||||||
|         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; |         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; | ||||||
| 
 | 
 | ||||||
|       - name: 'Checkout code' |       - name: 'Checkout code' | ||||||
|         uses: actions/checkout@v3 |         uses: actions/checkout@v4 | ||||||
|         with: |         with: | ||||||
|           fetch-depth: 1 |           fetch-depth: 1 | ||||||
|           ref: ${{ github.event.pull_request.head.sha }} |           ref: ${{ github.event.pull_request.head.sha }} | ||||||
| @ -51,11 +51,11 @@ jobs: | |||||||
|       - name: 'Check API versions for consistency between targets' |       - name: 'Check API versions for consistency between targets' | ||||||
|         run: | |         run: | | ||||||
|           set -e |           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 |           if [ $N_API_HEADER_SIGNATURES != 1 ] ; then | ||||||
|             echo API versions aren\'t matching for available targets. Please update! |             echo API versions aren\'t matching for available targets. Please update! | ||||||
|             echo API versions are: |             echo API versions are: | ||||||
|             head -n2 firmware/targets/f*/api_symbols.csv |             head -n2 targets/f*/api_symbols.csv | ||||||
|             exit 1 |             exit 1 | ||||||
|           fi |           fi | ||||||
| 
 | 
 | ||||||
| @ -76,7 +76,7 @@ jobs: | |||||||
|           mkdir artifacts map_analyser_files |           mkdir artifacts map_analyser_files | ||||||
|           cp dist/${TARGET}-*/* artifacts/ || true |           cp dist/${TARGET}-*/* artifacts/ || true | ||||||
|           tar czpf "artifacts/flipper-z-${TARGET}-resources-${SUFFIX}.tgz" \ |           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" \ |           tar czpf "artifacts/flipper-z-${TARGET}-debugapps-${SUFFIX}.tgz" \ | ||||||
|             -C dist/${TARGET}-*/apps/Debug . |             -C dist/${TARGET}-*/apps/Debug . | ||||||
|           tar czpf "artifacts/flipper-z-${TARGET}-appsymbols-${SUFFIX}.tgz" \ |           tar czpf "artifacts/flipper-z-${TARGET}-appsymbols-${SUFFIX}.tgz" \ | ||||||
|  | |||||||
							
								
								
									
										4
									
								
								.github/workflows/build_compact.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/build_compact.yml
									
									
									
									
										vendored
									
									
								
							| @ -19,7 +19,7 @@ jobs: | |||||||
|         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; |         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; | ||||||
| 
 | 
 | ||||||
|       - name: 'Checkout code' |       - name: 'Checkout code' | ||||||
|         uses: actions/checkout@v3 |         uses: actions/checkout@v4 | ||||||
|         with: |         with: | ||||||
|           fetch-depth: 1 |           fetch-depth: 1 | ||||||
|           submodules: false |           submodules: false | ||||||
| @ -46,7 +46,7 @@ jobs: | |||||||
|           echo "hw-target-code=$TARGET" >> $GITHUB_OUTPUT |           echo "hw-target-code=$TARGET" >> $GITHUB_OUTPUT | ||||||
| 
 | 
 | ||||||
|       - name: Deploy uFBT with SDK |       - name: Deploy uFBT with SDK | ||||||
|         uses: flipperdevices/flipperzero-ufbt-action@v0.1.0 |         uses: flipperdevices/flipperzero-ufbt-action@v0.1 | ||||||
|         with: |         with: | ||||||
|           task: setup |           task: setup | ||||||
|           sdk-file: ${{ steps.build-fw.outputs.sdk-file }} |           sdk-file: ${{ steps.build-fw.outputs.sdk-file }} | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ jobs: | |||||||
|         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; |         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; | ||||||
| 
 | 
 | ||||||
|       - name: 'Checkout code' |       - name: 'Checkout code' | ||||||
|         uses: actions/checkout@v3 |         uses: actions/checkout@v4 | ||||||
|         with: |         with: | ||||||
|           fetch-depth: 2 |           fetch-depth: 2 | ||||||
|           ref: ${{ github.sha }} |           ref: ${{ github.sha }} | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								.github/workflows/merge_report.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/merge_report.yml
									
									
									
									
										vendored
									
									
								
							| @ -16,7 +16,7 @@ jobs: | |||||||
|         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; |         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; | ||||||
| 
 | 
 | ||||||
|       - name: 'Checkout code' |       - name: 'Checkout code' | ||||||
|         uses: actions/checkout@v3 |         uses: actions/checkout@v4 | ||||||
|         with: |         with: | ||||||
|           fetch-depth: 1 |           fetch-depth: 1 | ||||||
|           ref: ${{ github.event.pull_request.head.sha }} |           ref: ${{ github.event.pull_request.head.sha }} | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								.github/workflows/pvs_studio.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/pvs_studio.yml
									
									
									
									
										vendored
									
									
								
							| @ -21,7 +21,7 @@ jobs: | |||||||
|         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; |         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; | ||||||
| 
 | 
 | ||||||
|       - name: 'Checkout code' |       - name: 'Checkout code' | ||||||
|         uses: actions/checkout@v3 |         uses: actions/checkout@v4 | ||||||
|         with: |         with: | ||||||
|           fetch-depth: 1 |           fetch-depth: 1 | ||||||
|           ref: ${{ github.event.pull_request.head.sha }} |           ref: ${{ github.event.pull_request.head.sha }} | ||||||
|  | |||||||
							
								
								
									
										8
									
								
								.github/workflows/unit_tests.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/unit_tests.yml
									
									
									
									
										vendored
									
									
								
							| @ -17,7 +17,7 @@ jobs: | |||||||
|         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; |         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; | ||||||
| 
 | 
 | ||||||
|       - name: Checkout code |       - name: Checkout code | ||||||
|         uses: actions/checkout@v3 |         uses: actions/checkout@v4 | ||||||
|         with: |         with: | ||||||
|           fetch-depth: 1 |           fetch-depth: 1 | ||||||
|           ref: ${{ github.event.pull_request.head.sha }} |           ref: ${{ github.event.pull_request.head.sha }} | ||||||
| @ -32,7 +32,7 @@ jobs: | |||||||
|         if: success() |         if: success() | ||||||
|         timeout-minutes: 10 |         timeout-minutes: 10 | ||||||
|         run: | |         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' |       - name: 'Wait for flipper and format ext' | ||||||
|         id: format_ext |         id: format_ext | ||||||
| @ -50,8 +50,8 @@ jobs: | |||||||
|         run: | |         run: | | ||||||
|           source scripts/toolchain/fbtenv.sh |           source scripts/toolchain/fbtenv.sh | ||||||
|           python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}} |           python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}} | ||||||
|           python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} -f send assets/resources /ext |           rm -rf build/latest/resources/dolphin | ||||||
|           python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} -f send assets/unit_tests /ext/unit_tests |           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/power.py -p ${{steps.device.outputs.flipper}} reboot | ||||||
|           python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}} |           python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}} | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										4
									
								
								.github/workflows/updater_test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/updater_test.yml
									
									
									
									
										vendored
									
									
								
							| @ -17,7 +17,7 @@ jobs: | |||||||
|         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; |         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; | ||||||
| 
 | 
 | ||||||
|       - name: Checkout code |       - name: Checkout code | ||||||
|         uses: actions/checkout@v3 |         uses: actions/checkout@v4 | ||||||
|         with: |         with: | ||||||
|           fetch-depth: 1 |           fetch-depth: 1 | ||||||
|           submodules: false |           submodules: false | ||||||
| @ -56,7 +56,7 @@ jobs: | |||||||
|         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; |         run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; | ||||||
| 
 | 
 | ||||||
|       - name: 'Checkout latest release' |       - name: 'Checkout latest release' | ||||||
|         uses: actions/checkout@v3 |         uses: actions/checkout@v4 | ||||||
|         if: failure() |         if: failure() | ||||||
|         with: |         with: | ||||||
|           fetch-depth: 1 |           fetch-depth: 1 | ||||||
|  | |||||||
							
								
								
									
										34
									
								
								SConstruct
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								SConstruct
									
									
									
									
									
								
							| @ -67,22 +67,22 @@ if GetOption("fullenv") or any( | |||||||
|     # Target for self-update package |     # Target for self-update package | ||||||
|     dist_basic_arguments = [ |     dist_basic_arguments = [ | ||||||
|         "--bundlever", |         "--bundlever", | ||||||
|         '"${UPDATE_VERSION_STRING}"', |         "${UPDATE_VERSION_STRING}", | ||||||
|     ] |     ] | ||||||
|     dist_radio_arguments = [ |     dist_radio_arguments = [ | ||||||
|         "--radio", |         "--radio", | ||||||
|         '"${ROOT_DIR.abspath}/${COPRO_STACK_BIN_DIR}/${COPRO_STACK_BIN}"', |         "${ROOT_DIR.abspath}/${COPRO_STACK_BIN_DIR}/${COPRO_STACK_BIN}", | ||||||
|         "--radiotype", |         "--radiotype", | ||||||
|         "${COPRO_STACK_TYPE}", |         "${COPRO_STACK_TYPE}", | ||||||
|         "${COPRO_DISCLAIMER}", |         "${COPRO_DISCLAIMER}", | ||||||
|         "--obdata", |         "--obdata", | ||||||
|         '"${ROOT_DIR.abspath}/${COPRO_OB_DATA}"', |         "${ROOT_DIR.abspath}/${COPRO_OB_DATA}", | ||||||
|         "--stackversion", |         "--stackversion", | ||||||
|         "${COPRO_CUBE_VERSION}", |         "${COPRO_CUBE_VERSION}", | ||||||
|     ] |     ] | ||||||
|     dist_resource_arguments = [ |     dist_resource_arguments = [ | ||||||
|         "-r", |         "-r", | ||||||
|         '"${ROOT_DIR.abspath}/assets/resources"', |         firmware_env.subst("${RESOURCES_ROOT}"), | ||||||
|     ] |     ] | ||||||
|     dist_splash_arguments = ( |     dist_splash_arguments = ( | ||||||
|         [ |         [ | ||||||
| @ -95,7 +95,7 @@ if GetOption("fullenv") or any( | |||||||
| 
 | 
 | ||||||
|     selfupdate_dist = distenv.DistCommand( |     selfupdate_dist = distenv.DistCommand( | ||||||
|         "updater_package", |         "updater_package", | ||||||
|         (distenv["DIST_DEPENDS"], firmware_env["FW_RESOURCES"]), |         (distenv["DIST_DEPENDS"], firmware_env["FW_RESOURCES_MANIFEST"]), | ||||||
|         DIST_EXTRA=[ |         DIST_EXTRA=[ | ||||||
|             *dist_basic_arguments, |             *dist_basic_arguments, | ||||||
|             *dist_radio_arguments, |             *dist_radio_arguments, | ||||||
| @ -128,7 +128,8 @@ if GetOption("fullenv") or any( | |||||||
| 
 | 
 | ||||||
|     # Installation over USB & CLI |     # Installation over USB & CLI | ||||||
|     usb_update_package = distenv.AddUsbFlashTarget( |     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) |     distenv.Alias("flash_usb_full", usb_update_package) | ||||||
| 
 | 
 | ||||||
| @ -166,16 +167,23 @@ Depends( | |||||||
|     list(app_artifact.validator for app_artifact in external_app_list), |     list(app_artifact.validator for app_artifact in external_app_list), | ||||||
| ) | ) | ||||||
| Alias("fap_dist", fap_dist) | 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 | # Copy all faps to device | ||||||
| 
 | 
 | ||||||
| fap_deploy = distenv.PhonyTarget( | fap_deploy = distenv.PhonyTarget( | ||||||
|     "fap_deploy", |     "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 | # Start Flipper CLI via PySerial's miniterm | ||||||
| distenv.PhonyTarget( | distenv.PhonyTarget("cli", "${PYTHON3} ${FBT_SCRIPT_DIR}/serial_cli.py -p ${FLIP_PORT}") | ||||||
|     "cli", "${PYTHON3} ${FBT_SCRIPT_DIR}/serial_cli.py  -p ${FLIP_PORT}" |  | ||||||
| ) |  | ||||||
| 
 | 
 | ||||||
| # Update WiFi devboard firmware | # Update WiFi devboard firmware | ||||||
| distenv.PhonyTarget("devboard_flash", "${PYTHON3} ${FBT_SCRIPT_DIR}/wifi_board.py") | distenv.PhonyTarget("devboard_flash", "${PYTHON3} ${FBT_SCRIPT_DIR}/wifi_board.py") | ||||||
|  | |||||||
| @ -5,6 +5,7 @@ App( | |||||||
|     cdefines=["APP_UNIT_TESTS"], |     cdefines=["APP_UNIT_TESTS"], | ||||||
|     requires=["system_settings"], |     requires=["system_settings"], | ||||||
|     provides=["delay_test"], |     provides=["delay_test"], | ||||||
|  |     resources="resources", | ||||||
|     order=100, |     order=100, | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -22,7 +22,7 @@ MU_TEST(manifest_iteration_test) { | |||||||
|     ResourceManifestReader* manifest_reader = resource_manifest_reader_alloc(storage); |     ResourceManifestReader* manifest_reader = resource_manifest_reader_alloc(storage); | ||||||
|     do { |     do { | ||||||
|         // Open manifest file
 |         // 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; |             result = false; | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -6,6 +6,7 @@ App( | |||||||
|     stack_size=2 * 1024, |     stack_size=2 * 1024, | ||||||
|     icon="A_BadUsb_14", |     icon="A_BadUsb_14", | ||||||
|     order=70, |     order=70, | ||||||
|  |     resources="resources", | ||||||
|     fap_libs=["assets"], |     fap_libs=["assets"], | ||||||
|     fap_icon="icon.png", |     fap_icon="icon.png", | ||||||
|     fap_category="USB", |     fap_category="USB", | ||||||
|  | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 hedger
						hedger