diff options
author | wtgodbe <wigodbe@microsoft.com> | 2016-04-27 14:35:45 -0700 |
---|---|---|
committer | wtgodbe <wigodbe@microsoft.com> | 2016-05-17 14:06:39 -0700 |
commit | 8568bf1d9722657c602a1f1fe0148e28a93ea8ce (patch) | |
tree | d784a4438e3fe7b74106f1d3e82aa88889024fc4 /sync.sh | |
parent | 41a4ad5054cf877db6aa331855b43ad8678a93ad (diff) | |
download | coreclr-8568bf1d9722657c602a1f1fe0148e28a93ea8ce.tar.gz coreclr-8568bf1d9722657c602a1f1fe0148e28a93ea8ce.tar.bz2 coreclr-8568bf1d9722657c602a1f1fe0148e28a93ea8ce.zip |
Add dev workflow scripts for build pipeline
Diffstat (limited to 'sync.sh')
-rwxr-xr-x | sync.sh | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/sync.sh b/sync.sh new file mode 100755 index 0000000000..e1b6401fc1 --- /dev/null +++ b/sync.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +usage() +{ + echo "Usage: sync [-p] [-s]" + echo "Repository syncing script." + echo " -s Fetch source history from all configured remotes" + echo " (git fetch --all -p -v)" + echo " -p Restore all NuGet packages for the repository" + echo + echo "If no option is specified, then \"sync.sh -p -s\" is implied." + exit 1 +} + +working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +sync_log=$working_tree_root/sync.log + +options="/nologo /v:minimal /clp:Summary /flp:v=detailed;Append;LogFile=$sync_log" +unprocessedBuildArgs= + +echo "Running sync.sh $*" > $sync_log + +# Parse arguments +if [ $# == 0 ]; then + sync_packages=true + sync_src=true +fi + +while [[ $# > 0 ]] +do + opt="$1" + case $opt in + -h|--help) + usage + ;; + -p) + sync_packages=true + ;; + -s) + sync_src=true + ;; + *) + unprocessedBuildArgs="$unprocessedBuildArgs $1" + esac + shift +done + +echo "Running init-tools.sh" +$working_tree_root/init-tools.sh + +if [ "$sync_src" == true ]; then + echo "Fetching git database from remote repos..." + git fetch --all -p -v >> $sync_log 2>&1 + if [ $? -ne 0 ]; then + echo -e "\ngit fetch failed. Aborting sync." >> $sync_log + echo "ERROR: An error occurred while fetching remote source code; see $sync_log for more details." + exit 1 + fi +fi + +if [ "$sync_packages" == true ]; then + options="$options /t:RestoreNETCorePlatforms /p:RestoreDuringBuild=true" + echo "Restoring all packages..." + echo -e "\n$working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/build.proj $options $unprocessedBuildArgs" >> $sync_log + $working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/build.proj $options $unprocessedBuildArgs + if [ $? -ne 0 ] + then + echo -e "\nPackage restored failed. Aborting sync." >> $sync_log + echo "ERROR: An error occurred while syncing packages; see $sync_log for more details. There may have been networking problems, so please try again in a few minutes." + exit 1 + fi +fi + +echo "Sync completed successfully." +echo -e "\nSync completed successfully." >> $sync_log +exit 0
\ No newline at end of file |