[FL-3317] fbt: allow strings for fap_version field in app manifests (#2672)
This commit is contained in:
		
							parent
							
								
									c496962f95
								
							
						
					
					
						commit
						8d1f5b04b3
					
				| @ -47,7 +47,7 @@ Only two parameters are mandatory: **_appid_** and **_apptype_**. Others are opt | |||||||
| The following parameters are used only for [FAPs](./AppsOnSDCard.md): | The following parameters are used only for [FAPs](./AppsOnSDCard.md): | ||||||
| 
 | 
 | ||||||
| - **sources**: list of strings, file name masks used for gathering sources within the app folder. The default value of `["*.c*"]` includes C and C++ source files. Applications cannot use the `"lib"` folder for their own source code, as it is reserved for **fap_private_libs**. | - **sources**: list of strings, file name masks used for gathering sources within the app folder. The default value of `["*.c*"]` includes C and C++ source files. Applications cannot use the `"lib"` folder for their own source code, as it is reserved for **fap_private_libs**. | ||||||
| - **fap_version**: tuple, 2 numbers in the form of (x,y): application version to be embedded within .fap file. The default value is (0,1), meaning version "0.1". | - **fap_version**: string, application version. The default value is "0.1". You can also use a tuple of 2 numbers in the form of (x,y) to specify the version. It is also possible to add more dot-separated parts to the version, like patch number, but only major and minor version numbers are stored in the built .fap. | ||||||
| - **fap_icon**: name of a `.png` file, 1-bit color depth, 10x10px, to be embedded within `.fap` file. | - **fap_icon**: name of a `.png` file, 1-bit color depth, 10x10px, to be embedded within `.fap` file. | ||||||
| - **fap_libs**: list of extra libraries to link the application against. Provides access to extra functions that are not exported as a part of main firmware at the expense of increased `.fap` file size and RAM consumption. | - **fap_libs**: list of extra libraries to link the application against. Provides access to extra functions that are not exported as a part of main firmware at the expense of increased `.fap` file size and RAM consumption. | ||||||
| - **fap_category**: string, may be empty. App subcategory, also determines the path of the FAP within the apps folder in the file system. | - **fap_category**: string, may be empty. App subcategory, also determines the path of the FAP within the apps folder in the file system. | ||||||
|  | |||||||
| @ -196,7 +196,10 @@ class FlipperAppStateHelper: | |||||||
|         self.set_debug_mode(False) |         self.set_debug_mode(False) | ||||||
| 
 | 
 | ||||||
|     def set_debug_mode(self, mode: bool) -> None: |     def set_debug_mode(self, mode: bool) -> None: | ||||||
|  |         try: | ||||||
|             gdb.execute(f"set variable furi_hal_debug_gdb_session_active = {int(mode)}") |             gdb.execute(f"set variable furi_hal_debug_gdb_session_active = {int(mode)}") | ||||||
|  |         except gdb.error as e: | ||||||
|  |             print(f"Failed to set debug mode: {e}") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Init additional 'fap-set-debug-elf-root' command and set up hooks | # Init additional 'fap-set-debug-elf-root' command and set up hooks | ||||||
|  | |||||||
| @ -56,7 +56,7 @@ class FlipperApplication: | |||||||
| 
 | 
 | ||||||
|     # .fap-specific |     # .fap-specific | ||||||
|     sources: List[str] = field(default_factory=lambda: ["*.c*"]) |     sources: List[str] = field(default_factory=lambda: ["*.c*"]) | ||||||
|     fap_version: Tuple[int] = field(default_factory=lambda: (0, 1)) |     fap_version: str | Tuple[int] = "0.1" | ||||||
|     fap_icon: Optional[str] = None |     fap_icon: Optional[str] = None | ||||||
|     fap_libs: List[str] = field(default_factory=list) |     fap_libs: List[str] = field(default_factory=list) | ||||||
|     fap_category: str = "" |     fap_category: str = "" | ||||||
| @ -84,6 +84,13 @@ class FlipperApplication: | |||||||
|     def __post_init__(self): |     def __post_init__(self): | ||||||
|         if self.apptype == FlipperAppType.PLUGIN: |         if self.apptype == FlipperAppType.PLUGIN: | ||||||
|             self.stack_size = 0 |             self.stack_size = 0 | ||||||
|  |         if isinstance(self.fap_version, str): | ||||||
|  |             try: | ||||||
|  |                 self.fap_version = tuple(int(v) for v in self.fap_version.split(".")) | ||||||
|  |             except ValueError: | ||||||
|  |                 raise FlipperManifestException( | ||||||
|  |                     f"Invalid version string '{self.fap_version}'. Must be in the form 'major.minor'" | ||||||
|  |                 ) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class AppManager: | class AppManager: | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ App( | |||||||
|     stack_size=2 * 1024, |     stack_size=2 * 1024, | ||||||
|     fap_category="Examples", |     fap_category="Examples", | ||||||
|     # Optional values |     # Optional values | ||||||
|     # fap_version=(0, 1),  # (major, minor) |     # fap_version="0.1", | ||||||
|     fap_icon="@FBT_APPID@.png",  # 10x10 1-bit PNG |     fap_icon="@FBT_APPID@.png",  # 10x10 1-bit PNG | ||||||
|     # fap_description="A simple app", |     # fap_description="A simple app", | ||||||
|     # fap_author="J. Doe", |     # fap_author="J. Doe", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 hedger
						hedger