Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: tool/dependency_overrides.sh

Issue 1682673002: Add ./tool/override_analyzer_dependency.sh to checkout latest analyzer + set is as override (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: fail on local mods Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « .gitignore ('k') | tool/override_analyzer_dependency.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/dependency_overrides.sh
diff --git a/tool/dependency_overrides.sh b/tool/dependency_overrides.sh
new file mode 100644
index 0000000000000000000000000000000000000000..75845514c686be0e501451bb2f36c778d8ee49fe
--- /dev/null
+++ b/tool/dependency_overrides.sh
@@ -0,0 +1,61 @@
+#!/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 "dependency_name = $dependency_name"
+ echo "url = $url$path"
+ echo "branch = $branch"
+
+ local dep_dir=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
+}
« no previous file with comments | « .gitignore ('k') | tool/override_analyzer_dependency.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698