[fuchsia] Small shell scripts for workflow. (flutter/engine#28823)

This commit is contained in:
Alexander Biggs 2021-09-27 20:53:02 -04:00 committed by GitHub
parent 899d41c4f6
commit 12053d00ea
3 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,30 @@
#!/bin/bash
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
### Starts a new branch from Fuchsia's checkout of the Flutter engine.
### This is necessary to avoid skew between the version of the Dart VM used in
### the flutter_runner and the version of the Dart SDK and VM used by the
### Flutter toolchain. See
### https://github.com/flutter/flutter/wiki/Compiling-the-engine#important-dart-version-synchronization-on-fuchsia
### for more details.
###
### Example:
### $ ./branch_from_fuchsia.sh my_new_feature_branch
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
ensure_fuchsia_dir
engine-info "Syncing to Fuchsia's checkout of the Flutter engine."
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/sync_to_fuchsia.sh || exit $?
engine-info "Creating new branch '$1'."
git checkout -b $1
if [ $? -ne 0 ]
then
engine-error "Failed to create new branch '$1'. Restoring previous checkout."
git checkout -
exit $?
fi

View File

@ -29,6 +29,15 @@ function engine-is-stderr-tty {
[[ -t 2 ]]
}
# engine-info prints a line to stderr with a green INFO: prefix.
function engine-info {
if engine-is-stderr-tty; then
echo -e >&2 "\033[1;32mINFO:\033[0m $*"
else
echo -e >&2 "INFO: $*"
fi
}
# engine-error prints a line to stderr with a red ERROR: prefix.
function engine-error {
if engine-is-stderr-tty; then

View File

@ -0,0 +1,21 @@
#!/bin/bash
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
### Checks out the version of Flutter engine in your Fuchsia source tree.
### This is necessary to avoid skew between the version of the Dart VM used in
### the flutter_runner and the version of the Dart SDK and VM used by the
### Flutter toolchain. See
### https://github.com/flutter/flutter/wiki/Compiling-the-engine#important-dart-version-synchronization-on-fuchsia
### for more details.
###
### Example:
### $ ./sync_to_fuchsia.sh
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
ensure_fuchsia_dir
fuchsia_flutter_git_revision="$(cat $FUCHSIA_DIR/integration/jiri.lock | grep -A 1 "\"package\": \"flutter/fuchsia\"" | grep "git_revision" | tr ":" "\n" | sed -n 3p | tr "\"" "\n" | sed -n 1p)"
git checkout $fuchsia_flutter_git_revision