Unverified Commit e4a1913e authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Support local engine and asset sync for macOS (#31515)

parent 15ba3956
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
# TODO(jonahwilliams): refactor this and xcode_backend.sh into one script # TODO(jonahwilliams): refactor this and xcode_backend.sh into one script
# once macOS supports the same configuration as iOS. # once macOS supports the same configuration as iOS.
RunCommand() { RunCommand() {
if [[ -n "$VERBOSE_SCRIPT_LOGGING" ]]; then if [[ -n "$VERBOSE_SCRIPT_LOGGING" ]]; then
echo "♦ $*" echo "♦ $*"
...@@ -40,6 +39,37 @@ if [[ -n "$TRACK_WIDGET_CREATION" ]]; then ...@@ -40,6 +39,37 @@ if [[ -n "$TRACK_WIDGET_CREATION" ]]; then
track_widget_creation_flag="--track-widget-creation" track_widget_creation_flag="--track-widget-creation"
fi fi
# Copy the framework and handle local engine builds.
framework_name = "FlutterMacOS.framework"
derived_dir="${SOURCE_ROOT}/../build/macos/Build/Products/flutter_framework"
framework_path="${FLUTTER_ROOT}/bin/cache/artifacts/engine/darwin-x64"
flutter_framework="${framework_path}/${framework_name}"
if [[ -n "$FLUTTER_ENGINE" ]]; then
flutter_engine_flag="--local-engine-src-path=${FLUTTER_ENGINE}"
fi
if [[ -n "$LOCAL_ENGINE" ]]; then
if [[ $(echo "$LOCAL_ENGINE" | tr "[:upper:]" "[:lower:]") != *"$build_mode"* ]]; then
EchoError "========================================================================"
EchoError "ERROR: Requested build with Flutter local engine at '${LOCAL_ENGINE}'"
EchoError "This engine is not compatible with FLUTTER_BUILD_MODE: '${build_mode}'."
EchoError "You can fix this by updating the LOCAL_ENGINE environment variable, or"
EchoError "by running:"
EchoError " flutter build macos --local-engine=host_${build_mode}"
EchoError "or"
EchoError " flutter build macos --local-engine=host_${build_mode}_unopt"
EchoError "========================================================================"
exit -1
fi
local_engine_flag="--local-engine=${LOCAL_ENGINE}"
flutter_framework="${FLUTTER_ENGINE}/out/${LOCAL_ENGINE}/${framework_name}"
fi
RunCommand mkdir -p -- "$derived_dir"
RunCommand rm -rf -- "${derived_dir}/${framework_name}"
RunCommand cp -Rp -- "${flutter_framework}" "${derived_dir}"
# Set the build mode # Set the build mode
build_mode="$(echo "${FLUTTER_BUILD_MODE:-${CONFIGURATION}}" | tr "[:upper:]" "[:lower:]")" build_mode="$(echo "${FLUTTER_BUILD_MODE:-${CONFIGURATION}}" | tr "[:upper:]" "[:lower:]")"
...@@ -49,4 +79,6 @@ RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics \ ...@@ -49,4 +79,6 @@ RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics \
--target-platform=darwin-x64 \ --target-platform=darwin-x64 \
--target="${target_path}" \ --target="${target_path}" \
--${build_mode} \ --${build_mode} \
${track_widget_creation_flag} ${track_widget_creation_flag} \
${flutter_engine_flag} \
${local_engine_flag}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment