Merge branch 'master' of https://github.com/dotnet/coreclr
[platform/upstream/coreclr.git] / publish-packages.sh
1 #!/usr/bin/env bash
2
3 usage()
4 {
5     echo "Publishes the NuGet packages to the specified location."
6     echo "For publishing to Azure the following properties are required."
7     echo "   /p:CloudDropAccountName=\"account name\""
8     echo "   /p:CloudDropAccessToken=\"access token\""
9     echo "   /p:__BuildType=\"Configuration\""
10     echo "Configuration can be Release, Checked, or Debug"
11     exit 1
12 }
13
14 working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
15 publish_log=$working_tree_root/publish.log
16
17 while [[ $# > 0 ]]
18 do
19     unprocessedBuildArgs="$unprocessedBuildArgs $1"
20     shift
21 done
22
23 # Use uname to determine what the OS is.
24 OSName=$(uname -s)
25 case $OSName in
26     Linux)
27         __BuildOS=Linux
28         ;;
29
30     Darwin)
31         __BuildOS=OSX
32         ;;
33
34     FreeBSD)
35         __BuildOS=FreeBSD
36         ;;
37
38     OpenBSD)
39         __BuildOS=OpenBSD
40         ;;
41
42     NetBSD)
43         __BuildOS=NetBSD
44         ;;
45
46     SunOS)
47         __BuildOS=SunOS
48         ;;
49
50     *)
51         echo "Unsupported OS $OSName detected, configuring as if for Linux"
52         __BuildOS=Linux
53         ;;
54 esac
55
56 echo $unprocessedBuildArgs
57
58 options="/nologo /v:minimal /flp:v=detailed;Append;LogFile=$publish_log"
59
60 echo "Running publish-packages.sh $*" > $publish_log
61
62 echo "Running init-tools.sh"
63 $working_tree_root/init-tools.sh
64
65 echo "Restoring all packages..."
66 echo -e "\n$working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $unprocessedBuildArgs" /p:__BuildOS=$__BuildOS >> $publish_log
67 $working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $unprocessedBuildArgs /p:__BuildOS=$__BuildOS
68 if [ $? -ne 0 ]
69 then
70     echo -e "\nPackage publishing failed. Aborting." >> $publish_log
71     echo "ERROR: An error occurred while publishing packages; see $publish_log for more details. There may have been networking problems, so please try again in a few minutes."
72     exit 1
73 fi
74
75 echo "Publish completed successfully."
76 echo -e "\nPublish completed successfully." >> $publish_log
77 exit 0