[Buildroot] [PATCH v2 13/13] package/flutter-sdk-bin/Config.in.host: add pub-cache location option

Adam Duskett adam.duskett at amarulasolutions.com
Mon Dec 18 18:54:39 UTC 2023


When running the command "flutter pub get," the plugins are stored in the
pub-cache directory along with their sha256sum hashes. The default location of
the pub-cache directory is current $(HOST_DIR)/share/flutter/sdk/.pub-cache,
which is not an acceptable choice by default because every plugin will be
re-downloaded during every build of a flutter application when building with
the per-package-directory option enabled. Furthermore, keeping the pub-cache
in its current location prevents users from committing the pub-cache directory
to git for faster rebuilds.

To fix the above issue, add a new option to flutter-sdk-bin/Config.in.host,
BR2_PACKAGE_HOST_FLUTTER_SDK_BIN_PUB_CACHE_LOCATION and set the default to the
current default of $(DL_DIR)/br-flutter-pub-cache

Signed-off-by: Adam Duskett <adam.duskett at amarulasolutions.com>
---
v1 -> v2: Set default path to $(DL_DIR)/br-flutter-pub-cache [ Yann ]

 package/flutter-sdk-bin/Config.in.host     | 11 +++++++++++
 package/flutter-sdk-bin/flutter-sdk-bin.mk |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/package/flutter-sdk-bin/Config.in.host b/package/flutter-sdk-bin/Config.in.host
index 181a2ee6e5..a1ac5835d9 100644
--- a/package/flutter-sdk-bin/Config.in.host
+++ b/package/flutter-sdk-bin/Config.in.host
@@ -13,3 +13,14 @@ config BR2_PACKAGE_HOST_FLUTTER_SDK_BIN
 	  free and open source.
 
 	  https://flutter.dev/
+
+if BR2_PACKAGE_HOST_FLUTTER_SDK_BIN_ARCH_SUPPORTS
+
+config BR2_PACKAGE_HOST_FLUTTER_SDK_BIN_PUB_CACHE_LOCATION
+	string "pub-cache location"
+	default "$(DL_DIR)/br-flutter-pub-cache"
+	help
+	  Directory to store cached packages used by Pub with
+	  Dart/Flutter.
+
+endif
diff --git a/package/flutter-sdk-bin/flutter-sdk-bin.mk b/package/flutter-sdk-bin/flutter-sdk-bin.mk
index 0c33d25089..6eea3f2a45 100644
--- a/package/flutter-sdk-bin/flutter-sdk-bin.mk
+++ b/package/flutter-sdk-bin/flutter-sdk-bin.mk
@@ -104,4 +104,4 @@ HOST_FLUTTER_SDK_BIN_DART_BIN = \
 $(eval $(host-generic-package))
 
 # For target packages to locate said pub-cache
-FLUTTER_SDK_BIN_PUB_CACHE = $(HOST_FLUTTER_SDK_BIN_SDK)/.pub-cache
+FLUTTER_SDK_BIN_PUB_CACHE = $(call qstrip,$(BR2_PACKAGE_HOST_FLUTTER_SDK_BIN_PUB_CACHE_LOCATION))
-- 
2.43.0




More information about the buildroot mailing list