mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-23 04:53:08 +00:00
Merge branch 'ofw-dev' into dev
This commit is contained in:
commit
35ea46fd13
3 changed files with 38 additions and 2 deletions
|
@ -1,7 +1,8 @@
|
|||
import os
|
||||
import re
|
||||
from dataclasses import dataclass, field
|
||||
from enum import Enum
|
||||
from typing import Callable, List, Optional, Tuple, Union
|
||||
from typing import Callable, ClassVar, List, Optional, Tuple, Union
|
||||
|
||||
|
||||
class FlipperManifestException(Exception):
|
||||
|
@ -23,6 +24,8 @@ class FlipperAppType(Enum):
|
|||
|
||||
@dataclass
|
||||
class FlipperApplication:
|
||||
APP_ID_REGEX: ClassVar[re.Pattern] = re.compile(r"^[a-z0-9_]+$")
|
||||
|
||||
@dataclass
|
||||
class ExternallyBuiltFile:
|
||||
path: str
|
||||
|
@ -84,6 +87,10 @@ class FlipperApplication:
|
|||
def __post_init__(self):
|
||||
if self.apptype == FlipperAppType.PLUGIN:
|
||||
self.stack_size = 0
|
||||
if not self.APP_ID_REGEX.match(self.appid):
|
||||
raise FlipperManifestException(
|
||||
f"Invalid appid '{self.appid}'. Must match regex '{self.APP_ID_REGEX}'"
|
||||
)
|
||||
if isinstance(self.fap_version, str):
|
||||
try:
|
||||
self.fap_version = tuple(int(v) for v in self.fap_version.split("."))
|
||||
|
|
|
@ -3,6 +3,29 @@
|
|||
# Requiremets:
|
||||
# cxxfilt==0.3.0
|
||||
|
||||
# Most part of this code written by Lars-Dominik Braun <lars@6xq.net> https://github.com/PromyLOPh/linkermapviz
|
||||
# and distributes under MIT licence
|
||||
|
||||
# Copyright (c) 2017 Lars-Dominik Braun <lars@6xq.net>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
import sys
|
||||
import re
|
||||
import os
|
||||
|
|
|
@ -75,7 +75,7 @@ from fbt.util import (
|
|||
wrap_tempfile,
|
||||
path_as_posix,
|
||||
)
|
||||
from fbt.appmanifest import FlipperAppType
|
||||
from fbt.appmanifest import FlipperAppType, FlipperApplication
|
||||
from fbt.sdk.cache import SdkCache
|
||||
|
||||
# Base environment with all tools loaded from SDK
|
||||
|
@ -410,6 +410,12 @@ dist_env.Alias("vscode_dist", vscode_dist)
|
|||
# Creating app from base template
|
||||
|
||||
dist_env.SetDefault(FBT_APPID=appenv.subst("$APPID") or "template")
|
||||
if fbt_appid := dist_env.subst("$FBT_APPID"):
|
||||
if not FlipperApplication.APP_ID_REGEX.match(fbt_appid):
|
||||
raise UserError(
|
||||
f"Invalid app id '{fbt_appid}'. App id must match {FlipperApplication.APP_ID_REGEX.pattern}"
|
||||
)
|
||||
|
||||
app_template_dir = project_template_dir.Dir("app_template")
|
||||
app_template_dist = []
|
||||
for template_file in app_template_dir.glob("*"):
|
||||
|
|
Loading…
Reference in a new issue