Merge pull request #5773 from Maoni0/grow_card_2
[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 "   /p:__BuildArch=\"Architecture\""
11     echo "Configuration can be Release, Checked, or Debug"
12     echo "Architecture can be x64, x86, arm, or arm64"
13     exit 1
14 }
15
16 working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
17 publish_log=$working_tree_root/publish.log
18
19 # Use uname to determine what the OS is.
20 OSName=$(uname -s)
21 case $OSName in
22     Linux)
23         __BuildOS=Linux
24         ;;
25
26     Darwin)
27         __BuildOS=OSX
28         ;;
29
30     FreeBSD)
31         __BuildOS=FreeBSD
32         ;;
33
34     OpenBSD)
35         __BuildOS=OpenBSD
36         ;;
37
38     NetBSD)
39         __BuildOS=NetBSD
40         ;;
41
42     SunOS)
43         __BuildOS=SunOS
44         ;;
45
46     *)
47         echo "Unsupported OS $OSName detected, configuring as if for Linux"
48         __BuildOS=Linux
49         ;;
50 esac
51
52 options="/nologo /v:minimal /flp:v=detailed;Append;LogFile=$publish_log"
53
54 echo "Running publish-packages.sh $*" > $publish_log
55
56 echo "Running init-tools.sh"
57 $working_tree_root/init-tools.sh
58
59 echo "Publishing packages..."
60 echo -e "\n$working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $*" /p:__BuildOS=$__BuildOS >> $publish_log
61 $working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $* /p:__BuildOS=$__BuildOS
62 if [ $? -ne 0 ]
63 then
64     echo -e "\nPackage publishing failed. Aborting." >> $publish_log
65     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."
66     exit 1
67 fi
68
69 echo "Publish completed successfully."
70 echo -e "\nPublish completed successfully." >> $publish_log
71 exit 0