script for fetching correct flutter version (flutter/engine#16818)
* script for fetching correct flutter version * change cirrus yml for the script location * change location of the script. Add it to tools * cirrus still does not see the script. repeat path change from the previous step * Looks like script worked correctly. do not change directory. * change directory back to build root after scriot is run * script runs ok. Still not able to find the bin directory. go all the way back * still can't see the bin directory. carry the script content to cirrus.yml to debug better * get the last commit id of the right repository * content of the script worked in cirrus. call the script from tools * cannot find the script under tools * print the current path in the script to see why cirrus cannot see bin directory * move to flutter path before running update packages * tests run now. remove print outs * error if the ENGINE_PATH is not set. exit the script * addressing reviewer comments * engine branch name on cirrus logs doesn't make sense * fix typo * change the directory of branch calculation * remove extra logs * addressing PR comments. Testing CIRRUS_CI env variable * adding CIRRUS_CI check
This commit is contained in:
@@ -11,10 +11,9 @@ web_shard_template: &WEB_SHARD_TEMPLATE
|
||||
./flutter/tools/gn --unoptimized --full-dart-sdk
|
||||
ninja -C out/host_debug_unopt
|
||||
fetch_framework_script: |
|
||||
mkdir -p $FRAMEWORK_PATH
|
||||
cd $FRAMEWORK_PATH
|
||||
git clone https://github.com/flutter/flutter.git
|
||||
cd flutter
|
||||
cd $ENGINE_PATH/src/flutter/tools
|
||||
./clone_flutter.sh
|
||||
cd $FRAMEWORK_PATH/flutter
|
||||
bin/flutter update-packages --local-engine=host_debug_unopt
|
||||
script:
|
||||
- dart --enable-asserts $FRAMEWORK_PATH/flutter/dev/bots/test.dart --local-engine=host_debug_unopt
|
||||
|
||||
64
engine/src/flutter/tools/clone_flutter.sh
Executable file
64
engine/src/flutter/tools/clone_flutter.sh
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [[ "$CIRRUS_CI" = false || -z $CIRRUS_CI ]]
|
||||
then
|
||||
echo "This script is aimed to be run on CI environments. Do not run locally."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z $ENGINE_PATH ]]
|
||||
then
|
||||
echo "Engine path should be set to run the script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Go to the engine git repo to get the date of the latest commit.
|
||||
cd $ENGINE_PATH/src/flutter
|
||||
|
||||
# Special handling of release branches.
|
||||
ENGINE_BRANCH_NAME=`git branch | grep '*' | cut -d ' ' -f2`
|
||||
versionregex="^v[[:digit:]]+\."
|
||||
ON_RELEASE_BRANCH=false
|
||||
echo "Engine on branch $ENGINE_BRANCH_NAME"
|
||||
if [[ $ENGINE_BRANCH_NAME =~ $versionregex ]]
|
||||
then
|
||||
echo "release branch $ENGINE_BRANCH_NAME"
|
||||
ON_RELEASE_BRANCH=true
|
||||
fi
|
||||
|
||||
# Get latest commit's time for the engine repo.
|
||||
# Use date based on local time otherwise timezones might get mixed.
|
||||
LATEST_COMMIT_TIME_ENGINE=`git log -1 --date=local --format="%ad"`
|
||||
echo "Latest commit time on engine found as $LATEST_COMMIT_TIME_ENGINE"
|
||||
|
||||
# Do rest of the task in the root directory
|
||||
cd ~
|
||||
mkdir -p $FRAMEWORK_PATH
|
||||
cd $FRAMEWORK_PATH
|
||||
# Clone the Flutter Framework.
|
||||
git clone https://github.com/flutter/flutter.git
|
||||
cd flutter
|
||||
|
||||
FRAMEWORK_BRANCH_NAME=`git branch | grep '*' | cut -d ' ' -f2`
|
||||
if [[ "$ON_RELEASE_BRANCH" = true && ENGINE_BRANCH_NAME != FRAMEWORK_BRANCH_NAME ]]
|
||||
then
|
||||
echo "For a release framework and engine should be on the same version."
|
||||
echo "Switching branches on Framework to from $FRAMEWORK_BRANCH_NAME to $ENGINE_BRANCH_NAME"
|
||||
# Switch to the same version branch with the engine.
|
||||
# If same version branch does not exits, fail.
|
||||
SWITCH_RESULT=`git checkout $ENGINE_BRANCH_NAME` || true
|
||||
if [[ -z "$SWITCH_RESULT" ]]
|
||||
then
|
||||
echo "$ENGINE_BRANCH_NAME Branch not found on framework. Quit."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Get the time of the youngest commit older than engine commit.
|
||||
# Git log uses commit date not the author date.
|
||||
# Before makes the comparison considering the timezone as well.
|
||||
COMMIT_NO=`git log --before="$LATEST_COMMIT_TIME_ENGINE" -n 1 | grep commit | cut -d ' ' -f2`
|
||||
echo "Using the flutter/flutter commit $COMMIT_NO";
|
||||
git reset --hard $COMMIT_NO
|
||||
Reference in New Issue
Block a user