Files
sdk/pkg/dev_compiler/tool/dependency_overrides.sh
T
Leaf Petersen bf8c7cd07d Filter warnings from dependency_overrides to make travis green on
bleeding edge analyzer.

Bleeding edge analyzer has some deprecation hints.  We're using --package-warnings in our analyze.sh script and grepping for dev_compiler directory to limit us to dev_compiler errors.  This CL adds
an additional filter to hide warnings from dependency_overrides.

BUG=
R=jmesserly@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1781123004 .
2016-03-14 14:52:56 -07:00

61 lines
1.5 KiB
Bash

#!/bin/bash
function add_dependency_override() {
local name=$1
local path=$2
if ! cat pubspec.yaml | grep "dependency_overrides:" ; then
echo "dependency_overrides:" >> pubspec.yaml
fi
local pubspec=`cat pubspec.yaml | grep -v "$name: .path: "`
echo "$pubspec" > pubspec.yaml
if [[ -n "$path" ]]; then
echo " $name: {path: $path}" >> pubspec.yaml
fi
}
function checkout_dependency_override_from_github() {
local dependency_name=$1
local org_project=$2
local branch=$3
local path=${4:-/}
local url=https://github.com/$org_project
echo "** Checking out $dependency_name override from $url$path#$branch"
: ${TMPDIR:="/tmp"}
local dep_dir=$TMPDIR/dependency_overrides/$dependency_name
[[ -d `dirname $dep_dir` ]] || mkdir `dirname $dep_dir`
if [[ -d $dep_dir ]]; then
# Check there's no local modifications before removing existing directory.
(
cd $dep_dir
if git status -s | grep . ; then
echo "Found local modifications in $dep_dir: aborting"
exit 1
fi
)
rm -fR $dep_dir
fi
if [[ "$path" == "/" ]]; then
# Checkout only the branch, with no history:
git clone --depth 1 --branch $branch $url $dep_dir
else
(
mkdir $dep_dir
cd $dep_dir
# Sparse-checkout only the path + branch, with no history:
git init
git remote add origin $url
git config core.sparsecheckout true
echo $path >> .git/info/sparse-checkout
git pull --depth=1 origin $branch
)
fi
add_dependency_override $dependency_name $dep_dir$path
}