[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()
),
),
distenv.Install(
f"#/dist/{dist_dir}/apps",
"#/assets/resources/apps",
*(
distenv.Install(
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(

View file

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

View file

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

View file

@ -2,8 +2,11 @@
#include <gui/canvas.h>
#include <gui/elements.h>
#include <lib/toolbox/float_tools.h>
#include <m-array.h>
#include <furi.h>
#include <inttypes.h>
#include <stdint.h>
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));
canvas_draw_str(canvas, 6, 60, model->message);
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);
canvas_draw_str_aligned(canvas, 124, 60, AlignRight, AlignBottom, info_str);
}
} else if(model->state == BtTestStateStopped) {
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);
} 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);
}
}
@ -153,7 +156,7 @@ static bool bt_test_input_callback(InputEvent* event, void* context) {
}
void bt_test_process_up(BtTest* bt_test) {
with_view_model(
with_view_model( // -V658
bt_test->view,
BtTestModel * model,
{

View file

@ -48,7 +48,7 @@ FileBrowserApp* file_browser_app_alloc(char* arg) {
app->file_path = furi_string_alloc();
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(
app->view_dispatcher, FileBrowserAppViewStart, widget_get_view(app->widget));

View file

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

View file

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

View file

@ -7,7 +7,7 @@ from SCons.Node import NodeList
import SCons.Warnings
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.util import extract_abs_dir_path
@ -234,11 +234,18 @@ def GetExtAppFromPath(env, app_dir):
return app_artifacts
def fap_dist_emitter(target, source, env):
def resources_fap_dist_emitter(target, source, env):
target_dir = target[0]
target = []
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)
target.append(
target_dir.Dir(app_artifacts.app.fap_category).File(
@ -249,7 +256,7 @@ def fap_dist_emitter(target, source, env):
return (target, source)
def fap_dist_action(target, source, env):
def resources_fap_dist_action(target, source, env):
# FIXME
target_dir = env.Dir("#/assets/resources/apps")
@ -282,10 +289,10 @@ def generate(env, **kw):
BUILDERS={
"FapDist": Builder(
action=Action(
fap_dist_action,
resources_fap_dist_action,
"$FAPDISTCOMSTR",
),
emitter=fap_dist_emitter,
emitter=resources_fap_dist_emitter,
),
"EmbedAppMetadata": Builder(
action=[

View file

@ -43,9 +43,11 @@ fbtenv_restore_env()
PYTHONNOUSERSITE="$SAVED_PYTHONNOUSERSITE";
PYTHONPATH="$SAVED_PYTHONPATH";
PYTHONHOME="$SAVED_PYTHONHOME";
unset SAVED_PYTHONNOUSERSITE;
unset SAVED_PYTHONPATH;
unset SAVED_PYTHONHOME;
unset SCRIPT_PATH;
unset FBT_TOOLCHAIN_VERSION;
@ -69,7 +71,7 @@ fbtenv_check_sourced()
return 1;
}
fbtenv_chck_many_source()
fbtenv_check_if_sourced_multiple_times()
{
if ! echo "${PS1:-""}" | grep -qF "[fbt]"; then
if ! echo "${PROMPT:-""}" | grep -qF "[fbt]"; then
@ -275,7 +277,7 @@ fbtenv_main()
fbtenv_restore_env;
return 0;
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_download_toolchain || return 1;
fbtenv_set_shell_prompt;
@ -283,12 +285,14 @@ fbtenv_main()
PATH="$TOOLCHAIN_ARCH_DIR/bin:$PATH";
PATH="$TOOLCHAIN_ARCH_DIR/protobuf/bin:$PATH";
PATH="$TOOLCHAIN_ARCH_DIR/openocd/bin:$PATH";
SAVED_PYTHONNOUSERSITE="${PYTHONNOUSERSITE:-""}";
SAVED_PYTHONPATH="${PYTHONPATH:-""}";
SAVED_PYTHONHOME="${PYTHONHOME:-""}";
PYTHONNOUSERSITE=1;
PYTHONPATH=;
PYTHONHOME=;
}
fbtenv_main "${1:-""}";

View file

@ -81,16 +81,6 @@ vars.AddVariables(
"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",
"Suffix for binaries in build output for dist targets",
@ -232,6 +222,7 @@ vars.AddVariables(
("applications/system", False),
("applications/debug", False),
("applications/plugins", False),
("applications/examples", False),
("applications_user", False),
],
),

View file

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