diff --git a/fbt_options.py b/fbt_options.py index 6707a2ef6..5c6d523bc 100644 --- a/fbt_options.py +++ b/fbt_options.py @@ -39,6 +39,9 @@ if not os.environ.get("DIST_SUFFIX"): commit_sha = git("rev-parse", "HEAD")[:8] DIST_SUFFIX = "mntm-" + branch_name.replace("/", "_") + "-" + commit_sha +# Skip external apps by default +SKIP_EXTERNAL = False + # Coprocessor firmware COPRO_OB_DATA = "scripts/ob.data" diff --git a/scripts/fbt/appmanifest.py b/scripts/fbt/appmanifest.py index be76a69e4..469248127 100644 --- a/scripts/fbt/appmanifest.py +++ b/scripts/fbt/appmanifest.py @@ -228,12 +228,14 @@ class AppManager: applist: List[str], ext_applist: List[str], hw_target: str, + skip_external: bool = False, ): return AppBuildset( self, hw_target=hw_target, appnames=applist, extra_ext_appnames=ext_applist, + skip_external=skip_external, ) @@ -278,12 +280,14 @@ class AppBuildset: appnames: List[str], *, extra_ext_appnames: List[str], + skip_external: bool = False, message_writer: Callable | None = None, ): self.appmgr = appmgr self.appnames = set(appnames) self.incompatible_extapps, self.extapps = [], [] self._extra_ext_appnames = extra_ext_appnames + self._skip_external = skip_external self._orig_appnames = appnames self.hw_target = hw_target self._writer = message_writer if message_writer else self.print_writer @@ -340,7 +344,11 @@ class AppBuildset: extapps = [ app for (apptype, global_lookup) in self.EXTERNAL_APP_TYPES_MAP.items() - for app in self.get_apps_of_type(apptype, global_lookup) + for app in self.get_apps_of_type( + apptype, + global_lookup + and not (self._skip_external and apptype is FlipperAppType.EXTERNAL), + ) ] extapps.extend(map(self.appmgr.get, self._extra_ext_appnames)) @@ -409,7 +417,10 @@ class AppBuildset: if ( parent_app.apptype in self.BUILTIN_APP_TYPES and parent_app_id in self.appnames - ) or parent_app.apptype not in self.BUILTIN_APP_TYPES: + ) or ( + parent_app.apptype not in self.BUILTIN_APP_TYPES + and parent_app in self.extapps + ): keep_app |= True except FlipperManifestException: diff --git a/scripts/fbt_tools/fbt_apps.py b/scripts/fbt_tools/fbt_apps.py index c122733b4..dbf5fdbf4 100644 --- a/scripts/fbt_tools/fbt_apps.py +++ b/scripts/fbt_tools/fbt_apps.py @@ -142,6 +142,7 @@ def PrepareApplicationsBuild(env): applist=env["APPS"], ext_applist=env["EXTRA_EXT_APPS"], hw_target=env.subst("f${TARGET_HW}"), + skip_external=env.subst("$SKIP_EXTERNAL"), ) except Exception as e: raise StopError(e) diff --git a/site_scons/commandline.scons b/site_scons/commandline.scons index 4b1c2bc23..67e161caf 100644 --- a/site_scons/commandline.scons +++ b/site_scons/commandline.scons @@ -222,6 +222,11 @@ vars.AddVariables( "Application set to use from FIRMWARE_APPS", "default", ), + BoolVariable( + "SKIP_EXTERNAL", + help="Skip external apps unless explicitly selected", + default=False, + ), ( "APPSRC", "Application source directory for app to build & upload",