[FL-3081] fbt: removed DEBUG_TOOLS & FAP_EXAMPLES flags (#2291)

* fbt: deprecated DEBUG_TOOLS & FAP_EXAMPLES flags
* fixes for PVS warnings
* scripts: fbt: fixed leaking PYTHONHOME
This commit is contained in:
hedger 2023-01-17 18:07:47 +03:00 committed by GitHub
parent 341610b8a1
commit a0814aab31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 39 additions and 37 deletions

View File

@ -148,9 +148,12 @@ fap_dist = [
for app_artifact in firmware_env["FW_EXTAPPS"].applications.values() for app_artifact in firmware_env["FW_EXTAPPS"].applications.values()
), ),
), ),
distenv.Install( *(
f"#/dist/{dist_dir}/apps", distenv.Install(
"#/assets/resources/apps", f"#/dist/{dist_dir}/apps/{app_artifact.app.fap_category}",
app_artifact.compact[0],
)
for app_artifact in firmware_env["FW_EXTAPPS"].applications.values()
), ),
] ]
Depends( Depends(

View File

@ -31,7 +31,8 @@ void AccessorApp::run(void) {
onewire_host_stop(onewire_host); onewire_host_stop(onewire_host);
} }
AccessorApp::AccessorApp() { AccessorApp::AccessorApp()
: text_store{0} {
notification = static_cast<NotificationApp*>(furi_record_open(RECORD_NOTIFICATION)); notification = static_cast<NotificationApp*>(furi_record_open(RECORD_NOTIFICATION));
onewire_host = onewire_host_alloc(); onewire_host = onewire_host_alloc();
furi_hal_power_enable_otg(); furi_hal_power_enable_otg();

View File

@ -171,9 +171,6 @@ bool WIEGAND::DoWiegandConversion() {
return true; return true;
} else { } else {
_lastWiegand = sysTick; _lastWiegand = sysTick;
_bitCount = 0;
_cardTemp = 0;
_cardTempHigh = 0;
return false; return false;
} }

View File

@ -2,8 +2,11 @@
#include <gui/canvas.h> #include <gui/canvas.h>
#include <gui/elements.h> #include <gui/elements.h>
#include <lib/toolbox/float_tools.h>
#include <m-array.h> #include <m-array.h>
#include <furi.h> #include <furi.h>
#include <inttypes.h>
#include <stdint.h> #include <stdint.h>
struct BtTestParam { struct BtTestParam {
@ -98,16 +101,16 @@ static void bt_test_draw_callback(Canvas* canvas, void* _model) {
elements_scrollbar(canvas, model->position, BtTestParamArray_size(model->params)); elements_scrollbar(canvas, model->position, BtTestParamArray_size(model->params));
canvas_draw_str(canvas, 6, 60, model->message); canvas_draw_str(canvas, 6, 60, model->message);
if(model->state == BtTestStateStarted) { if(model->state == BtTestStateStarted) {
if(model->rssi != 0.0f) { if(!float_is_equal(model->rssi, 0.0f)) {
snprintf(info_str, sizeof(info_str), "RSSI:%3.1f dB", (double)model->rssi); snprintf(info_str, sizeof(info_str), "RSSI:%3.1f dB", (double)model->rssi);
canvas_draw_str_aligned(canvas, 124, 60, AlignRight, AlignBottom, info_str); canvas_draw_str_aligned(canvas, 124, 60, AlignRight, AlignBottom, info_str);
} }
} else if(model->state == BtTestStateStopped) { } else if(model->state == BtTestStateStopped) {
if(model->packets_num_rx) { if(model->packets_num_rx) {
snprintf(info_str, sizeof(info_str), "%ld pack rcv", model->packets_num_rx); snprintf(info_str, sizeof(info_str), "%" PRIu32 " pack rcv", model->packets_num_rx);
canvas_draw_str_aligned(canvas, 124, 60, AlignRight, AlignBottom, info_str); canvas_draw_str_aligned(canvas, 124, 60, AlignRight, AlignBottom, info_str);
} else if(model->packets_num_tx) { } else if(model->packets_num_tx) {
snprintf(info_str, sizeof(info_str), "%ld pack sent", model->packets_num_tx); snprintf(info_str, sizeof(info_str), "%" PRIu32 " pack sent", model->packets_num_tx);
canvas_draw_str_aligned(canvas, 124, 60, AlignRight, AlignBottom, info_str); canvas_draw_str_aligned(canvas, 124, 60, AlignRight, AlignBottom, info_str);
} }
} }
@ -153,7 +156,7 @@ static bool bt_test_input_callback(InputEvent* event, void* context) {
} }
void bt_test_process_up(BtTest* bt_test) { void bt_test_process_up(BtTest* bt_test) {
with_view_model( with_view_model( // -V658
bt_test->view, bt_test->view,
BtTestModel * model, BtTestModel * model,
{ {

View File

@ -48,7 +48,7 @@ FileBrowserApp* file_browser_app_alloc(char* arg) {
app->file_path = furi_string_alloc(); app->file_path = furi_string_alloc();
app->file_browser = file_browser_alloc(app->file_path); app->file_browser = file_browser_alloc(app->file_path);
file_browser_configure(app->file_browser, "*", NULL, true, &I_badusb_10px, true); file_browser_configure(app->file_browser, "*", NULL, true, false, &I_badusb_10px, true);
view_dispatcher_add_view( view_dispatcher_add_view(
app->view_dispatcher, FileBrowserAppViewStart, widget_get_view(app->widget)); app->view_dispatcher, FileBrowserAppViewStart, widget_get_view(app->widget));

View File

@ -1,5 +1,5 @@
App( App(
appid="sample_apps", appid="example_apps",
name="Sample apps bundle", name="Example apps bundle",
apptype=FlipperAppType.METAPACKAGE, apptype=FlipperAppType.METAPACKAGE,
) )

View File

@ -131,9 +131,6 @@ if extra_int_apps := GetOption("extra_int_apps"):
fwenv.Append(APPS=extra_int_apps.split(",")) fwenv.Append(APPS=extra_int_apps.split(","))
if fwenv["FAP_EXAMPLES"]:
fwenv.Append(APPDIRS=[("applications/examples", False)])
for app_dir, _ in env["APPDIRS"]: for app_dir, _ in env["APPDIRS"]:
app_dir_node = env.Dir("#").Dir(app_dir) app_dir_node = env.Dir("#").Dir(app_dir)

View File

@ -7,7 +7,7 @@ from SCons.Node import NodeList
import SCons.Warnings import SCons.Warnings
from fbt.elfmanifest import assemble_manifest_data from fbt.elfmanifest import assemble_manifest_data
from fbt.appmanifest import FlipperApplication, FlipperManifestException from fbt.appmanifest import FlipperApplication, FlipperManifestException, FlipperAppType
from fbt.sdk.cache import SdkCache from fbt.sdk.cache import SdkCache
from fbt.util import extract_abs_dir_path from fbt.util import extract_abs_dir_path
@ -234,11 +234,18 @@ def GetExtAppFromPath(env, app_dir):
return app_artifacts return app_artifacts
def fap_dist_emitter(target, source, env): def resources_fap_dist_emitter(target, source, env):
target_dir = target[0] target_dir = target[0]
target = [] target = []
for _, app_artifacts in env["EXT_APPS"].items(): for _, app_artifacts in env["EXT_APPS"].items():
# We don't deploy example apps & debug tools with SD card resources
if (
app_artifacts.app.apptype == FlipperAppType.DEBUG
or app_artifacts.app.fap_category == "Examples"
):
continue
source.extend(app_artifacts.compact) source.extend(app_artifacts.compact)
target.append( target.append(
target_dir.Dir(app_artifacts.app.fap_category).File( target_dir.Dir(app_artifacts.app.fap_category).File(
@ -249,7 +256,7 @@ def fap_dist_emitter(target, source, env):
return (target, source) return (target, source)
def fap_dist_action(target, source, env): def resources_fap_dist_action(target, source, env):
# FIXME # FIXME
target_dir = env.Dir("#/assets/resources/apps") target_dir = env.Dir("#/assets/resources/apps")
@ -282,10 +289,10 @@ def generate(env, **kw):
BUILDERS={ BUILDERS={
"FapDist": Builder( "FapDist": Builder(
action=Action( action=Action(
fap_dist_action, resources_fap_dist_action,
"$FAPDISTCOMSTR", "$FAPDISTCOMSTR",
), ),
emitter=fap_dist_emitter, emitter=resources_fap_dist_emitter,
), ),
"EmbedAppMetadata": Builder( "EmbedAppMetadata": Builder(
action=[ action=[

View File

@ -43,9 +43,11 @@ fbtenv_restore_env()
PYTHONNOUSERSITE="$SAVED_PYTHONNOUSERSITE"; PYTHONNOUSERSITE="$SAVED_PYTHONNOUSERSITE";
PYTHONPATH="$SAVED_PYTHONPATH"; PYTHONPATH="$SAVED_PYTHONPATH";
PYTHONHOME="$SAVED_PYTHONHOME";
unset SAVED_PYTHONNOUSERSITE; unset SAVED_PYTHONNOUSERSITE;
unset SAVED_PYTHONPATH; unset SAVED_PYTHONPATH;
unset SAVED_PYTHONHOME;
unset SCRIPT_PATH; unset SCRIPT_PATH;
unset FBT_TOOLCHAIN_VERSION; unset FBT_TOOLCHAIN_VERSION;
@ -69,7 +71,7 @@ fbtenv_check_sourced()
return 1; return 1;
} }
fbtenv_chck_many_source() fbtenv_check_if_sourced_multiple_times()
{ {
if ! echo "${PS1:-""}" | grep -qF "[fbt]"; then if ! echo "${PS1:-""}" | grep -qF "[fbt]"; then
if ! echo "${PROMPT:-""}" | grep -qF "[fbt]"; then if ! echo "${PROMPT:-""}" | grep -qF "[fbt]"; then
@ -275,7 +277,7 @@ fbtenv_main()
fbtenv_restore_env; fbtenv_restore_env;
return 0; return 0;
fi fi
fbtenv_chck_many_source; # many source it's just a warning fbtenv_check_if_sourced_multiple_times; # many source it's just a warning
fbtenv_check_script_path || return 1; fbtenv_check_script_path || return 1;
fbtenv_check_download_toolchain || return 1; fbtenv_check_download_toolchain || return 1;
fbtenv_set_shell_prompt; fbtenv_set_shell_prompt;
@ -286,9 +288,11 @@ fbtenv_main()
SAVED_PYTHONNOUSERSITE="${PYTHONNOUSERSITE:-""}"; SAVED_PYTHONNOUSERSITE="${PYTHONNOUSERSITE:-""}";
SAVED_PYTHONPATH="${PYTHONPATH:-""}"; SAVED_PYTHONPATH="${PYTHONPATH:-""}";
SAVED_PYTHONHOME="${PYTHONHOME:-""}";
PYTHONNOUSERSITE=1; PYTHONNOUSERSITE=1;
PYTHONPATH=; PYTHONPATH=;
PYTHONHOME=;
} }
fbtenv_main "${1:-""}"; fbtenv_main "${1:-""}";

View File

@ -81,16 +81,6 @@ vars.AddVariables(
"7", "7",
], ],
), ),
BoolVariable(
"DEBUG_TOOLS",
help="Enable debug tools to be built",
default=False,
),
BoolVariable(
"FAP_EXAMPLES",
help="Enable example applications to be built",
default=False,
),
( (
"DIST_SUFFIX", "DIST_SUFFIX",
"Suffix for binaries in build output for dist targets", "Suffix for binaries in build output for dist targets",
@ -232,6 +222,7 @@ vars.AddVariables(
("applications/system", False), ("applications/system", False),
("applications/debug", False), ("applications/debug", False),
("applications/plugins", False), ("applications/plugins", False),
("applications/examples", False),
("applications_user", False), ("applications_user", False),
], ],
), ),

View File

@ -65,9 +65,8 @@ class FlipperExtAppBuildArtifacts:
apps_to_build_as_faps = [ apps_to_build_as_faps = [
FlipperAppType.PLUGIN, FlipperAppType.PLUGIN,
FlipperAppType.EXTERNAL, FlipperAppType.EXTERNAL,
FlipperAppType.DEBUG,
] ]
if appenv["DEBUG_TOOLS"]:
apps_to_build_as_faps.append(FlipperAppType.DEBUG)
known_extapps = [ known_extapps = [
app app