flet-cli 1.0.4__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. {flet_cli-1.0.4 → flet_cli-1.1.0}/PKG-INFO +3 -3
  2. {flet_cli-1.0.4 → flet_cli-1.1.0}/pyproject.toml +3 -3
  3. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/__pyinstaller/__init__.py +1 -1
  4. flet_cli-1.1.0/src/flet_cli/__pyinstaller/config.py +15 -0
  5. flet_cli-1.1.0/src/flet_cli/__pyinstaller/hook-flet_desktop.py +3 -0
  6. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/__pyinstaller/macos_utils.py +18 -16
  7. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/__pyinstaller/utils.py +3 -2
  8. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/__pyinstaller/win_utils.py +33 -14
  9. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/build.py +111 -97
  10. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/build_base.py +2058 -1332
  11. flet_cli-1.1.0/src/flet_cli/commands/create.py +309 -0
  12. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/debug.py +4 -8
  13. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/devices.py +1 -6
  14. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/emulators.py +1 -6
  15. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/flutter_base.py +269 -100
  16. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/pack.py +82 -3
  17. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/run.py +125 -36
  18. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/test.py +18 -16
  19. flet_cli-1.1.0/src/flet_cli/utils/android.py +622 -0
  20. flet_cli-1.1.0/src/flet_cli/utils/examples.py +275 -0
  21. flet_cli-1.1.0/src/flet_cli/utils/extension_settings.py +353 -0
  22. flet_cli-1.1.0/src/flet_cli/utils/log_format.py +473 -0
  23. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/project_dependencies.py +75 -0
  24. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/python_versions.py +1 -1
  25. flet_cli-1.1.0/src/flet_cli/version.py +1 -0
  26. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli.egg-info/PKG-INFO +3 -3
  27. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli.egg-info/SOURCES.txt +13 -0
  28. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli.egg-info/requires.txt +2 -2
  29. flet_cli-1.1.0/tests/test_build_android.py +1627 -0
  30. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_build_icons.py +13 -8
  31. flet_cli-1.1.0/tests/test_build_ios.py +832 -0
  32. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_build_linux.py +22 -17
  33. flet_cli-1.1.0/tests/test_build_macos.py +375 -0
  34. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_build_macos_signing.py +1 -1
  35. flet_cli-1.1.0/tests/test_build_package_cache.py +381 -0
  36. flet_cli-1.1.0/tests/test_build_platform_settings.py +407 -0
  37. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_build_splash.py +6 -6
  38. flet_cli-1.1.0/tests/test_build_svg.py +167 -0
  39. flet_cli-1.1.0/tests/test_build_template.py +467 -0
  40. flet_cli-1.1.0/tests/test_build_version.py +119 -0
  41. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_cli_pass_through_args.py +1 -1
  42. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_create.py +12 -0
  43. flet_cli-1.1.0/tests/test_extension_settings.py +526 -0
  44. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_find_platform_image.py +15 -7
  45. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_flutter.py +2 -0
  46. flet_cli-1.1.0/tests/test_linux_desktop_entry.py +264 -0
  47. flet_cli-1.1.0/tests/test_log_format.py +831 -0
  48. flet_cli-1.1.0/tests/test_pack_extensions.py +127 -0
  49. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_project_dependencies.py +144 -0
  50. flet_cli-1.1.0/tests/test_run_assets_dir.py +375 -0
  51. flet_cli-1.0.4/src/flet_cli/__pyinstaller/config.py +0 -1
  52. flet_cli-1.0.4/src/flet_cli/commands/create.py +0 -177
  53. flet_cli-1.0.4/src/flet_cli/utils/android.py +0 -53
  54. flet_cli-1.0.4/src/flet_cli/version.py +0 -1
  55. flet_cli-1.0.4/tests/test_build_ios.py +0 -254
  56. flet_cli-1.0.4/tests/test_build_platform_settings.py +0 -77
  57. flet_cli-1.0.4/tests/test_build_template.py +0 -142
  58. flet_cli-1.0.4/tests/test_run_assets_dir.py +0 -81
  59. {flet_cli-1.0.4 → flet_cli-1.1.0}/README.md +0 -0
  60. {flet_cli-1.0.4 → flet_cli-1.1.0}/setup.cfg +0 -0
  61. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/__pyinstaller/hook-flet.py +0 -0
  62. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/__pyinstaller/rthooks/pyi_rth_localhost_fletd.py +0 -0
  63. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/__pyinstaller/rthooks.dat +0 -0
  64. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/cli.py +0 -0
  65. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/base.py +0 -0
  66. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/clean.py +0 -0
  67. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/doctor.py +0 -0
  68. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/mcp.py +0 -0
  69. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/options.py +0 -0
  70. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/publish.py +0 -0
  71. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/serve.py +0 -0
  72. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/commands/test_host.py +0 -0
  73. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/android_sdk.py +0 -0
  74. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/app_excludes.py +0 -0
  75. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/cli.py +0 -0
  76. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/distros.py +0 -0
  77. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/flutter.py +0 -0
  78. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/hash_stamp.py +0 -0
  79. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/ios_sign.py +0 -0
  80. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/jdk.py +0 -0
  81. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/linux_deps.py +0 -0
  82. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/macos_sign.py +0 -0
  83. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/merge.py +0 -0
  84. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/plist.py +0 -0
  85. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/processes.py +0 -0
  86. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/pyodide.py +0 -0
  87. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/pyproject_toml.py +0 -0
  88. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli/utils/template_cache.py +0 -0
  89. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli.egg-info/dependency_links.txt +0 -0
  90. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli.egg-info/entry_points.txt +0 -0
  91. {flet_cli-1.0.4 → flet_cli-1.1.0}/src/flet_cli.egg-info/top_level.txt +0 -0
  92. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_app_excludes.py +0 -0
  93. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_build_app_path.py +0 -0
  94. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_build_copy_output.py +0 -0
  95. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_build_list_options.py +0 -0
  96. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_build_windows_arm64.py +0 -0
  97. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_clean.py +0 -0
  98. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_cli_positionals.py +0 -0
  99. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_macos_sign.py +0 -0
  100. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_plist.py +0 -0
  101. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_python_versions.py +0 -0
  102. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_run_desktop_dependency.py +0 -0
  103. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_run_script_args.py +0 -0
  104. {flet_cli-1.0.4 → flet_cli-1.1.0}/tests/test_run_watcher_unavailable.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-cli
3
- Version: 1.0.4
3
+ Version: 1.1.0
4
4
  Summary: Flet CLI
5
5
  Author-email: "Appveyor Systems Inc." <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -9,8 +9,8 @@ Project-URL: Repository, https://github.com/flet-dev/flet
9
9
  Project-URL: Documentation, https://flet.dev/docs
10
10
  Requires-Python: >=3.10
11
11
  Description-Content-Type: text/markdown
12
- Requires-Dist: flet==1.0.4
13
- Requires-Dist: flet-platform-assets==1.0.4
12
+ Requires-Dist: flet==1.1.0
13
+ Requires-Dist: flet-platform-assets==1.1.0
14
14
  Requires-Dist: watchdog>=4.0.0
15
15
  Requires-Dist: packaging>=25.0
16
16
  Requires-Dist: qrcode>=7.4.2
@@ -1,14 +1,14 @@
1
1
  [project]
2
2
  name = "flet-cli"
3
- version = "1.0.4"
3
+ version = "1.1.0"
4
4
  description = "Flet CLI"
5
5
  authors = [{ name = "Appveyor Systems Inc.", email = "hello@flet.dev" }]
6
6
  license = "Apache-2.0"
7
7
  readme = "README.md"
8
8
  requires-python = ">=3.10"
9
9
  dependencies = [
10
- "flet==1.0.4",
11
- "flet-platform-assets==1.0.4",
10
+ "flet==1.1.0",
11
+ "flet-platform-assets==1.1.0",
12
12
  "watchdog >=4.0.0",
13
13
  "packaging >=25.0",
14
14
  "qrcode >=7.4.2",
@@ -1,7 +1,7 @@
1
1
  import os
2
2
 
3
3
 
4
- def get_hook_dirs():
4
+ def get_hook_dirs() -> list[str]:
5
5
  """
6
6
  Return directories containing PyInstaller hook modules for `flet-cli`.
7
7
  """
@@ -0,0 +1,15 @@
1
+ temp_bin_dir = None
2
+
3
+ verbose = 0
4
+ """
5
+ Number of `-v` flags `flet pack` runs with.
6
+ """
7
+
8
+
9
+ def log_progress(*args) -> None:
10
+ """
11
+ Print a progress message of `flet pack`, shown with `-v` only.
12
+ """
13
+
14
+ if verbose > 0:
15
+ print(*args)
@@ -0,0 +1,3 @@
1
+ from flet.utils import is_windows
2
+
3
+ excludedimports = [] if is_windows() else ["flet_desktop.win_taskbar"]
@@ -5,14 +5,16 @@ import shutil
5
5
  import subprocess
6
6
  import tarfile
7
7
  from pathlib import Path
8
+ from typing import Any, Optional
8
9
 
9
10
  from PyInstaller.building.icon import normalize_icon_type
10
11
 
12
+ import flet_cli.__pyinstaller.config as hook_config
11
13
  from flet.utils import safe_tar_extractall
12
14
  from flet_cli.__pyinstaller.utils import normalize_tar_entry
13
15
 
14
16
 
15
- def unpack_app_bundle(tar_path):
17
+ def unpack_app_bundle(tar_path: str) -> str:
16
18
  """
17
19
  Extract a macOS app bundle archive and remove the source tarball.
18
20
 
@@ -32,7 +34,7 @@ def unpack_app_bundle(tar_path):
32
34
  return os.path.join(bin_dir, "Flet.app")
33
35
 
34
36
 
35
- def update_flet_view_icon(app_path, icon_path):
37
+ def update_flet_view_icon(app_path: str, icon_path: str) -> None:
36
38
  """
37
39
  Replace app icon in a macOS app bundle and update Info.plist metadata.
38
40
 
@@ -41,7 +43,7 @@ def update_flet_view_icon(app_path, icon_path):
41
43
  icon_path: Path to source icon file.
42
44
  """
43
45
 
44
- print("Updating Flet View icon", app_path, icon_path)
46
+ hook_config.log_progress("Updating Flet View icon", app_path, icon_path)
45
47
 
46
48
  icon_file = "AppIcon.icns"
47
49
 
@@ -51,7 +53,7 @@ def update_flet_view_icon(app_path, icon_path):
51
53
  )
52
54
 
53
55
  # patch icon
54
- print("Copying icons from", normalized_icon_path)
56
+ hook_config.log_progress("Copying icons from", normalized_icon_path)
55
57
  shutil.copy(
56
58
  normalized_icon_path,
57
59
  os.path.join(app_path, "Contents", "Resources", icon_file),
@@ -65,12 +67,12 @@ def update_flet_view_icon(app_path, icon_path):
65
67
 
66
68
 
67
69
  def update_flet_view_version_info(
68
- app_path,
69
- bundle_id,
70
- product_name,
71
- product_version,
72
- copyright,
73
- ):
70
+ app_path: str,
71
+ bundle_id: Optional[str],
72
+ product_name: Optional[str],
73
+ product_version: Optional[str],
74
+ copyright: Optional[str],
75
+ ) -> str:
74
76
  """
75
77
  Update selected Info.plist metadata fields in a macOS app bundle.
76
78
 
@@ -85,7 +87,7 @@ def update_flet_view_version_info(
85
87
  Final app bundle path (may change when app bundle is renamed).
86
88
  """
87
89
 
88
- print("Updating Flet View plist", app_path)
90
+ hook_config.log_progress("Updating Flet View plist", app_path)
89
91
 
90
92
  pl = __load_info_plist(app_path)
91
93
 
@@ -109,7 +111,7 @@ def update_flet_view_version_info(
109
111
  return app_path
110
112
 
111
113
 
112
- def assemble_app_bundle(app_path, tar_path):
114
+ def assemble_app_bundle(app_path: str, tar_path: str) -> None:
113
115
  """
114
116
  Code-sign a macOS app bundle, package it as tar.gz, and remove unpacked bundle.
115
117
 
@@ -122,7 +124,7 @@ def assemble_app_bundle(app_path, tar_path):
122
124
  """
123
125
 
124
126
  # sign app bundle
125
- print(f"Signing file {app_path}")
127
+ hook_config.log_progress(f"Signing file {app_path}")
126
128
  cmd_args = [
127
129
  "codesign",
128
130
  "-s",
@@ -162,7 +164,7 @@ def assemble_app_bundle(app_path, tar_path):
162
164
  shutil.rmtree(app_path, ignore_errors=True)
163
165
 
164
166
 
165
- def __load_info_plist(app_path):
167
+ def __load_info_plist(app_path: str) -> dict[str, Any]:
166
168
  """
167
169
  Load Info.plist content from a macOS app bundle.
168
170
  """
@@ -171,7 +173,7 @@ def __load_info_plist(app_path):
171
173
  return plistlib.load(fp)
172
174
 
173
175
 
174
- def __save_info_plist(app_path, pl):
176
+ def __save_info_plist(app_path: str, pl: dict[str, Any]) -> None:
175
177
  """
176
178
  Save Info.plist content to a macOS app bundle.
177
179
 
@@ -184,7 +186,7 @@ def __save_info_plist(app_path, pl):
184
186
  plistlib.dump(pl, fp)
185
187
 
186
188
 
187
- def __get_plist_path(app_path):
189
+ def __get_plist_path(app_path: str) -> str:
188
190
  """
189
191
  Return path to `Info.plist` inside a macOS app bundle.
190
192
  """
@@ -3,12 +3,13 @@ import tarfile
3
3
  import tempfile
4
4
  import uuid
5
5
  from pathlib import Path
6
+ from typing import Optional
6
7
 
7
8
  from flet.utils import copy_tree
8
9
  from flet_desktop import ensure_client_cached
9
10
 
10
11
 
11
- def get_flet_bin_path():
12
+ def get_flet_bin_path() -> Optional[str]:
12
13
  """
13
14
  Return path to Flet desktop binaries, if available.
14
15
 
@@ -52,7 +53,7 @@ def normalize_tar_entry(tarinfo: tarfile.TarInfo) -> tarfile.TarInfo:
52
53
  return tarinfo
53
54
 
54
55
 
55
- def copy_flet_bin():
56
+ def copy_flet_bin() -> Optional[str]:
56
57
  """
57
58
  Copy packaged Flet desktop binaries into a temporary directory.
58
59
 
@@ -1,26 +1,34 @@
1
1
  import os
2
+ import shutil
2
3
  import tempfile
3
4
  import uuid
4
5
  from pathlib import Path
6
+ from typing import Optional
5
7
 
6
8
  import pefile
7
9
  from packaging import version
8
- from PyInstaller.building.icon import normalize_icon_type
9
10
  from PyInstaller.compat import win32api
10
11
  from PyInstaller.utils.win32 import versioninfo
11
12
  from PyInstaller.utils.win32.icon import IconFile, normalize_icon_type
12
13
 
14
+ import flet_cli.__pyinstaller.config as hook_config
13
15
 
14
- def update_flet_view_icon(exe_path, icon_path):
16
+
17
+ def update_flet_view_icon(exe_path: str, icon_path: str) -> None:
15
18
  """
16
19
  Replace icon resources in a Windows executable.
17
20
 
21
+ When the icon is an `.ico` file, or an image converted to one, it is also
22
+ written to `data/app_icon.ico` next to the executable: Windows shows the icon
23
+ of an app without package identity on its notifications from an image file,
24
+ not from the executable's resources.
25
+
18
26
  Args:
19
27
  exe_path: Path to target executable file.
20
28
  icon_path: Path to source icon file or executable resource.
21
29
  """
22
30
 
23
- print("Updating Flet View icon", exe_path, icon_path)
31
+ hook_config.log_progress("Updating Flet View icon", exe_path, icon_path)
24
32
 
25
33
  RT_ICON = 3
26
34
  RT_GROUP_ICON = 14
@@ -29,7 +37,7 @@ def update_flet_view_icon(exe_path, icon_path):
29
37
  icon_path, ("exe", "ico"), "ico", os.getcwd()
30
38
  )
31
39
  icon = IconFile(normalized_icon_path)
32
- print("Copying icons from", normalized_icon_path)
40
+ hook_config.log_progress("Copying icons from", normalized_icon_path)
33
41
 
34
42
  hdst = win32api.BeginUpdateResource(exe_path, 0)
35
43
 
@@ -40,23 +48,34 @@ def update_flet_view_icon(exe_path, icon_path):
40
48
  data = icon.grp_icon_dir()
41
49
  data = data + icon.grp_icondir_entries(iconid)
42
50
  win32api.UpdateResource(hdst, RT_GROUP_ICON, i, data, 1033)
43
- print("Writing RT_GROUP_ICON %d resource with %d bytes", i, len(data))
51
+ hook_config.log_progress(
52
+ f"Writing RT_GROUP_ICON {i} resource with {len(data)} bytes"
53
+ )
44
54
  for data in icon.images:
45
55
  win32api.UpdateResource(hdst, RT_ICON, iconid, data, 1033)
46
- print("Writing RT_ICON %d resource with %d bytes", iconid, len(data))
56
+ hook_config.log_progress(
57
+ f"Writing RT_ICON {iconid} resource with {len(data)} bytes"
58
+ )
47
59
  iconid = iconid + 1
48
60
 
49
61
  win32api.EndUpdateResource(hdst, 0)
50
62
 
63
+ # Copy the icon only when normalize_icon_type() produced an .ico file.
64
+ if Path(normalized_icon_path).suffix.lower() == ".ico":
65
+ icon_file = Path(exe_path).parent / "data" / "app_icon.ico"
66
+ icon_file.parent.mkdir(parents=True, exist_ok=True)
67
+ shutil.copyfile(normalized_icon_path, icon_file)
68
+ hook_config.log_progress("Writing", icon_file)
69
+
51
70
 
52
71
  def update_flet_view_version_info(
53
- exe_path,
54
- product_name,
55
- file_description,
56
- product_version,
57
- file_version,
58
- company_name,
59
- copyright,
72
+ exe_path: str,
73
+ product_name: Optional[str],
74
+ file_description: Optional[str],
75
+ product_version: Optional[str],
76
+ file_version: Optional[str],
77
+ company_name: Optional[str],
78
+ copyright: Optional[str],
60
79
  ) -> str:
61
80
  """
62
81
  Update VERSIONINFO resources in a Windows executable.
@@ -74,7 +93,7 @@ def update_flet_view_version_info(
74
93
  Path to a temporary text file containing serialized version info.
75
94
  """
76
95
 
77
- print("Updating Flet View version info", exe_path)
96
+ hook_config.log_progress("Updating Flet View version info", exe_path)
78
97
 
79
98
  # load versioninfo from exe
80
99
  if versioninfo.read_version_info_from_executable:
@@ -6,9 +6,6 @@ import tempfile
6
6
  from pathlib import Path
7
7
  from typing import Callable, Optional
8
8
 
9
- from rich.console import Group
10
- from rich.live import Live
11
-
12
9
  from flet_cli.commands.build_base import BaseBuildCommand, console
13
10
  from flet_cli.commands.flutter_base import verbose1_style
14
11
  from flet_cli.utils.android import flutter_target_platforms
@@ -94,11 +91,9 @@ class Command(BaseBuildCommand):
94
91
 
95
92
  super().handle(options)
96
93
  assert self.target_platform
97
- self.status = console.status(
98
- f"[bold blue]Initializing {self.target_platform} build...",
99
- spinner="bouncingBall",
100
- )
101
- with Live(Group(self.status, self.progress), console=console) as self.live:
94
+ with self.live_status(
95
+ f"[bold blue]Initializing {self.target_platform} build..."
96
+ ):
102
97
  self.initialize_command()
103
98
  self.validate_target_platform()
104
99
  self.validate_entry_point()
@@ -114,11 +109,27 @@ class Command(BaseBuildCommand):
114
109
  self.update_flutter_dependencies()
115
110
  self.customize_icons()
116
111
  self.customize_splash_images()
112
+ self.copy_android_resources()
117
113
  self.run_flutter()
118
114
  self.copy_build_output()
119
115
  if self.target_platform == "macos":
120
116
  self.sign_macos_app()
121
117
 
118
+ unsigned_ipa = self.target_platform == "ipa" and not self.built_ipa()
119
+ if self.no_rich_output:
120
+ # Non-interactive: the exit code is the result, no banner; only
121
+ # the missing .ipa is worth a warning.
122
+ if unsigned_ipa:
123
+ self.warn(
124
+ "No .ipa was produced: Xcode exports one only for a "
125
+ "signed app. Configure a provisioning profile and a "
126
+ "signing certificate to get an uploadable bundle: "
127
+ "https://flet.dev/docs/publish/ios",
128
+ title="iOS signing",
129
+ )
130
+ self.cleanup(0)
131
+ return
132
+
122
133
  self.cleanup(
123
134
  0,
124
135
  message=(
@@ -139,7 +150,7 @@ class Command(BaseBuildCommand):
139
150
  "[cyan]provisioning profile[/cyan] and a "
140
151
  "[cyan]signing certificate[/cyan] to get an uploadable "
141
152
  "bundle: https://flet.dev/docs/publish/ios"
142
- if self.target_platform == "ipa" and not self.built_ipa()
153
+ if unsigned_ipa
143
154
  else ""
144
155
  )
145
156
  ),
@@ -168,14 +179,14 @@ class Command(BaseBuildCommand):
168
179
 
169
180
  if (
170
181
  self.target_platform in ("apk", "aab")
171
- and self.template_data["options"]["target_arch"]
182
+ and self.template_data["_options"]["target_arch"]
172
183
  ):
173
184
  args.extend(
174
185
  [
175
186
  "--target-platform",
176
187
  ",".join(
177
188
  flutter_target_platforms(
178
- self.template_data["options"]["target_arch"]
189
+ self.template_data["_options"]["target_arch"]
179
190
  )
180
191
  ),
181
192
  ]
@@ -219,33 +230,32 @@ class Command(BaseBuildCommand):
219
230
  assert self.platforms
220
231
  assert self.target_platform
221
232
 
222
- self.update_status(
233
+ with self.step(
223
234
  f"[bold blue]Building [cyan]"
224
235
  f"{self.platforms[self.target_platform]['status_text']}[/cyan]..."
225
- )
226
-
227
- # Clear the build output directories of artifacts from previous runs. Flutter
228
- # only ever adds files to them, and copy_build_output harvests them wholesale —
229
- # so without this, a previous build with different options (e.g. --arch,
230
- # --split-per-abi, or a renamed product) would leak its artifacts into the
231
- # user's output directory.
232
- assert self.flutter_dir
233
- flutter_dir = self.flutter_dir.resolve()
234
- for output in self.platforms[self.target_platform]["outputs"]:
235
- output_dir = Path(
236
- os.path.dirname(self.resolve_output_path(output))
237
- ).resolve()
238
- # only delete directories that are strictly inside the generated Flutter
239
- # project (and never the project directory itself).
240
- if output_dir != flutter_dir and output_dir.is_relative_to(flutter_dir):
241
- shutil.rmtree(output_dir, ignore_errors=True)
242
-
243
- self._run_flutter_command()
236
+ ):
237
+ # Clear the build output directories of artifacts from previous runs.
238
+ # Flutter only ever adds files to them, and copy_build_output harvests
239
+ # them wholesale — so without this, a previous build with different
240
+ # options (e.g. --arch, --split-per-abi, or a renamed product) would
241
+ # leak its artifacts into the user's output directory.
242
+ assert self.flutter_dir
243
+ flutter_dir = self.flutter_dir.resolve()
244
+ for output in self.platforms[self.target_platform]["outputs"]:
245
+ output_dir = Path(
246
+ os.path.dirname(self.resolve_output_path(output))
247
+ ).resolve()
248
+ # only delete directories that are strictly inside the generated Flutter
249
+ # project (and never the project directory itself).
250
+ if output_dir != flutter_dir and output_dir.is_relative_to(flutter_dir):
251
+ shutil.rmtree(output_dir, ignore_errors=True)
252
+
253
+ self._run_flutter_command()
244
254
 
245
- console.log(
246
- f"Built [cyan]{self.describe_build_output()}"
247
- f"[/cyan] {self.emojis['checkmark']}",
248
- )
255
+ console.log(
256
+ f"Built [cyan]{self.describe_build_output()}"
257
+ f"[/cyan] {self.emojis['checkmark']}",
258
+ )
249
259
 
250
260
  def built_ipa(self) -> bool:
251
261
  """
@@ -566,7 +576,7 @@ class Command(BaseBuildCommand):
566
576
  # The authoritative check reads the built app's Info.plist; this
567
577
  # one catches the common case — the key not configured at all —
568
578
  # before the build.
569
- if not self.template_data["options"]["info_plist"].get(
579
+ if not self.template_data["_options"]["info_plist"].get(
570
580
  "LSApplicationCategoryType"
571
581
  ):
572
582
  self.cleanup(
@@ -646,58 +656,60 @@ class Command(BaseBuildCommand):
646
656
  if self.verbose > 0:
647
657
  console.log(message, style=verbose1_style)
648
658
 
649
- self.update_status(f"[bold blue]Signing [cyan]{app_path.name}[/cyan]...")
650
- try:
651
- # Each lane scopes resolution to the certificate type Apple's
652
- # services accept for it — which also lets an unset identity
653
- # auto-discover the only candidate. The plain lane stays
654
- # unscoped: Apple Development or corporate certificates are
655
- # legitimate there.
656
- if distribution == "app-store":
657
- resolved = resolve_identity(identity, types=APP_STORE_CERTIFICATE_TYPES)
658
- elif distribution == "developer-id":
659
- resolved = resolve_identity(
660
- identity, types=DEVELOPER_ID_CERTIFICATE_TYPES
661
- )
662
- else:
663
- resolved = resolve_identity(identity)
664
- if not identity:
665
- console.log(f"Signing identity: {resolved.name}")
666
- if distribution == "developer-id" and resolved.is_adhoc:
667
- self.cleanup(
668
- 1,
669
- "Developer ID distribution requires a Developer ID "
670
- 'identity; ad-hoc ("-") signed apps cannot be notarized.',
671
- )
672
-
673
- if distribution == "app-store":
674
- self._sign_macos_app_store(app_path, resolved, entitlements, log)
675
- return
659
+ with self.step(f"[bold blue]Signing [cyan]{app_path.name}[/cyan]..."):
660
+ try:
661
+ # Each lane scopes resolution to the certificate type Apple's
662
+ # services accept for it — which also lets an unset identity
663
+ # auto-discover the only candidate. The plain lane stays
664
+ # unscoped: Apple Development or corporate certificates are
665
+ # legitimate there.
666
+ if distribution == "app-store":
667
+ resolved = resolve_identity(
668
+ identity, types=APP_STORE_CERTIFICATE_TYPES
669
+ )
670
+ elif distribution == "developer-id":
671
+ resolved = resolve_identity(
672
+ identity, types=DEVELOPER_ID_CERTIFICATE_TYPES
673
+ )
674
+ else:
675
+ resolved = resolve_identity(identity)
676
+ if not identity:
677
+ console.log(f"Signing identity: {resolved.name}")
678
+ if distribution == "developer-id" and resolved.is_adhoc:
679
+ self.cleanup(
680
+ 1,
681
+ "Developer ID distribution requires a Developer ID "
682
+ 'identity; ad-hoc ("-") signed apps cannot be notarized.',
683
+ )
676
684
 
677
- signed_count = sign_app(
678
- app_path,
679
- resolved,
680
- entitlements=entitlements,
681
- log=log,
682
- )
683
- console.log(
684
- f"Signed [cyan]{app_path.name}[/cyan] ({signed_count} binaries, "
685
- f"identity: {resolved.description}) {self.emojis['checkmark']}"
686
- )
685
+ if distribution == "app-store":
686
+ self._sign_macos_app_store(app_path, resolved, entitlements, log)
687
+ return
687
688
 
688
- if distribution == "developer-id":
689
- credentials = self._macos_notary_credentials()
690
- self.update_status(
691
- f"[bold blue]Notarizing [cyan]{app_path.name}[/cyan] "
692
- "(this can take a few minutes)...",
689
+ signed_count = sign_app(
690
+ app_path,
691
+ resolved,
692
+ entitlements=entitlements,
693
+ log=log,
693
694
  )
694
- notarize_and_staple(app_path, credentials, log=log)
695
695
  console.log(
696
- f"Notarized and stapled [cyan]{app_path.name}[/cyan] "
697
- f"{self.emojis['checkmark']}"
696
+ f"Signed [cyan]{app_path.name}[/cyan] ({signed_count} binaries, "
697
+ f"identity: {resolved.description}) {self.emojis['checkmark']}"
698
698
  )
699
- except MacOSSigningError as e:
700
- self.cleanup(1, str(e))
699
+
700
+ if distribution == "developer-id":
701
+ credentials = self._macos_notary_credentials()
702
+ with self.step(
703
+ f"[bold blue]Notarizing [cyan]{app_path.name}[/cyan] "
704
+ "(this can take a few minutes)...",
705
+ ):
706
+ notarize_and_staple(app_path, credentials, log=log)
707
+ console.log(
708
+ f"Notarized and stapled [cyan]{app_path.name}[/cyan] "
709
+ f"{self.emojis['checkmark']}"
710
+ )
711
+ except MacOSSigningError as e:
712
+ self.cleanup(1, str(e))
701
713
 
702
714
  def _sign_macos_app_store(
703
715
  self,
@@ -797,12 +809,14 @@ class Command(BaseBuildCommand):
797
809
  "or `[tool.flet.macos.info]` in pyproject.toml.",
798
810
  )
799
811
  if "ITSAppUsesNonExemptEncryption" not in info:
800
- console.log(
801
- "[yellow]Warning: ITSAppUsesNonExemptEncryption is not set in "
812
+ self.warn(
813
+ "ITSAppUsesNonExemptEncryption is not set in "
802
814
  "Info.plist — App Store Connect will ask the export-compliance "
803
815
  "question manually for every build. Set it with --info-plist "
804
816
  "ITSAppUsesNonExemptEncryption=False if your app only uses "
805
- "standard encryption.[/yellow]"
817
+ "standard encryption.",
818
+ title="App Store",
819
+ style="yellow",
806
820
  )
807
821
 
808
822
  profile_app_id = profile_application_identifier(profile_path)
@@ -845,17 +859,17 @@ class Command(BaseBuildCommand):
845
859
  f"{self.emojis['checkmark']}"
846
860
  )
847
861
 
848
- self.update_status(f"[bold blue]Packaging [cyan]{app_path.stem}.pkg[/cyan]...")
849
- pkg = build_pkg(
850
- app_path,
851
- installer,
852
- self.out_dir / f"{app_path.stem}.pkg",
853
- log=log,
854
- )
855
- console.log(
856
- f"Packaged [cyan]{pkg.name}[/cyan] for App Store Connect "
857
- f"(installer identity: {installer.name}) {self.emojis['checkmark']}"
858
- )
862
+ with self.step(f"[bold blue]Packaging [cyan]{app_path.stem}.pkg[/cyan]..."):
863
+ pkg = build_pkg(
864
+ app_path,
865
+ installer,
866
+ self.out_dir / f"{app_path.stem}.pkg",
867
+ log=log,
868
+ )
869
+ console.log(
870
+ f"Packaged [cyan]{pkg.name}[/cyan] for App Store Connect "
871
+ f"(installer identity: {installer.name}) {self.emojis['checkmark']}"
872
+ )
859
873
 
860
874
  def _macos_notary_credentials(self) -> NotaryCredentials:
861
875
  """