Set custom flutter_assets by add FLTAssetsPath to AppFrameworkInfo.plist (#29499)
* Get FLTAssetsPath from AppFrameworkInfo.plist
This commit is contained in:
@@ -46,6 +46,19 @@ BuildApp() {
|
||||
target_path="${FLUTTER_TARGET}"
|
||||
fi
|
||||
|
||||
local derived_dir="${SOURCE_ROOT}/Flutter"
|
||||
if [[ -e "${project_path}/.ios" ]]; then
|
||||
derived_dir="${project_path}/.ios/Flutter"
|
||||
fi
|
||||
|
||||
# Default value of assets_path is flutter_assets
|
||||
local assets_path="flutter_assets"
|
||||
# The value of assets_path can set by add FLTAssetsPath to AppFrameworkInfo.plist
|
||||
FLTAssetsPath=$(/usr/libexec/PlistBuddy -c "Print :FLTAssetsPath" "${derived_dir}/AppFrameworkInfo.plist" 2>/dev/null)
|
||||
if [[ -n "$FLTAssetsPath" ]]; then
|
||||
assets_path="${FLTAssetsPath}"
|
||||
fi
|
||||
|
||||
# Use FLUTTER_BUILD_MODE if it's set, otherwise use the Xcode build configuration name
|
||||
# This means that if someone wants to use an Xcode build config other than Debug/Profile/Release,
|
||||
# they _must_ set FLUTTER_BUILD_MODE so we know what type of artifact to build.
|
||||
@@ -87,10 +100,6 @@ BuildApp() {
|
||||
AssertExists "${framework_path}"
|
||||
AssertExists "${project_path}"
|
||||
|
||||
local derived_dir="${SOURCE_ROOT}/Flutter"
|
||||
if [[ -e "${project_path}/.ios" ]]; then
|
||||
derived_dir="${project_path}/.ios/Flutter"
|
||||
fi
|
||||
RunCommand mkdir -p -- "$derived_dir"
|
||||
AssertExists "$derived_dir"
|
||||
|
||||
@@ -248,7 +257,7 @@ BuildApp() {
|
||||
--target="${target_path}" \
|
||||
--${build_mode} \
|
||||
--depfile="${build_dir}/snapshot_blob.bin.d" \
|
||||
--asset-dir="${derived_dir}/App.framework/flutter_assets" \
|
||||
--asset-dir="${derived_dir}/App.framework/${assets_path}" \
|
||||
${precompilation_flag} \
|
||||
${flutter_engine_flag} \
|
||||
${local_engine_flag} \
|
||||
|
||||
Reference in New Issue
Block a user