Break up and show more progression during an Xcode build (#14715)

* Created plumbing but has stream problem

* testing with makePipe

* Trying pipe but not really getting anywhere

* works by repeatedly reading line

* Minor cleanup

* works

* Clean up pipe after use.

* Move the last status forward

* Make sure failed script commands bubble up
This commit is contained in:
xster
2018-02-15 15:16:23 -08:00
committed by GitHub
parent 10393a12fa
commit 1e397d3fb7
5 changed files with 116 additions and 14 deletions

View File

@@ -11,6 +11,14 @@ RunCommand() {
return $?
}
# When provided with a pipe by the host Flutter build process, output to the
# pipe goes to stdout of the Flutter build process directly.
StreamOutput() {
if [[ -n "$SCRIPT_OUTPUT_STREAM_FILE" ]]; then
echo "$1" > $SCRIPT_OUTPUT_STREAM_FILE
fi
}
EchoError() {
echo "$@" 1>&2
}
@@ -103,18 +111,20 @@ BuildApp() {
aot_flags="--${build_mode}"
fi
StreamOutput " ├─Building Dart code..."
RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics build aot \
--output-dir="${build_dir}/aot" \
--target-platform=ios \
--target="${target_path}" \
${aot_flags} \
${local_engine_flag} \
${preview_dart_2_flag} \
${preview_dart_2_flag}
if [[ $? -ne 0 ]]; then
EchoError "Failed to build ${project_path}."
exit -1
fi
StreamOutput "done"
RunCommand cp -r -- "${build_dir}/aot/App.framework" "${derived_dir}"
else
@@ -133,6 +143,7 @@ BuildApp() {
precompilation_flag="--precompiled"
fi
StreamOutput " ├─Assembling Flutter resources..."
RunCommand "${FLUTTER_ROOT}/bin/flutter" --suppress-analytics build flx \
--target="${target_path}" \
--output-file="${derived_dir}/app.flx" \
@@ -141,12 +152,14 @@ BuildApp() {
--working-dir="${derived_dir}/flutter_assets" \
${precompilation_flag} \
${local_engine_flag} \
${preview_dart_2_flag} \
${preview_dart_2_flag}
if [[ $? -ne 0 ]]; then
EchoError "Failed to package ${project_path}."
exit -1
fi
StreamOutput "done"
StreamOutput " └─Compiling, linking and signing..."
RunCommand popd > /dev/null