@@ -34,6 +34,14 @@ while (($# > 0)); do
34
34
force=true
35
35
shift 1
36
36
;;
37
+ --donotabortonfailure)
38
+ donotabortonfailure=true
39
+ shift 1
40
+ ;;
41
+ --donotdisplaywarnings)
42
+ donotdisplaywarnings=true
43
+ shift 1
44
+ ;;
37
45
--downloadretries)
38
46
download_retries=$2
39
47
shift 2
@@ -52,6 +60,8 @@ while (($# > 0)); do
52
60
echo " - (default) %USERPROFILE%/.netcoreeng/native"
53
61
echo " "
54
62
echo " --clean Switch specifying not to install anything, but cleanup native asset folders"
63
+ echo " --donotabortonfailure Switch specifiying whether to abort native tools installation on failure"
64
+ echo " --donotdisplaywarnings Switch specifiying whether to display warnings during native tools installation on failure"
55
65
echo " --force Clean and then install tools"
56
66
echo " --help Print help and exit"
57
67
echo " "
@@ -92,6 +102,7 @@ if [[ -z $install_directory ]]; then
92
102
fi
93
103
94
104
install_bin=" ${native_base_dir} /bin"
105
+ installed_any=false
95
106
96
107
ReadGlobalJsonNativeTools
97
108
103
114
for tool in " ${! native_assets[@]} "
104
115
do
105
116
tool_version=${native_assets[$tool]}
106
- installer_name= " install-$tool .sh"
107
- installer_command=" $native_installer_dir / $installer_name "
117
+ installer_path= " $native_installer_dir / install-$tool .sh"
118
+ installer_command=" $installer_path "
108
119
installer_command+=" --baseuri $base_uri "
109
120
installer_command+=" --installpath $install_bin "
110
121
installer_command+=" --version $tool_version "
@@ -118,11 +129,29 @@ else
118
129
installer_command+=" --clean"
119
130
fi
120
131
121
- $installer_command
122
-
123
- if [[ $? != 0 ]]; then
124
- Write-PipelineTelemetryError -category ' NativeToolsBootstrap' " Execution Failed"
125
- exit 1
132
+ if [[ -a $installer_path ]]; then
133
+ $installer_command
134
+ if [[ $? != 0 ]]; then
135
+ if [[ $donotabortonfailure = true ]]; then
136
+ if [[ $donotdisplaywarnings != true ]]; then
137
+ Write-PipelineTelemetryError -category ' NativeToolsBootstrap' " Execution Failed"
138
+ fi
139
+ else
140
+ Write-PipelineTelemetryError -category ' NativeToolsBootstrap' " Execution Failed"
141
+ exit 1
142
+ fi
143
+ else
144
+ $installed_any = true
145
+ fi
146
+ else
147
+ if [[ $donotabortonfailure == true ]]; then
148
+ if [[ $donotdisplaywarnings != true ]]; then
149
+ Write-PipelineTelemetryError -category ' NativeToolsBootstrap' " Execution Failed: no install script"
150
+ fi
151
+ else
152
+ Write-PipelineTelemetryError -category ' NativeToolsBootstrap' " Execution Failed: no install script"
153
+ exit 1
154
+ fi
126
155
fi
127
156
done
128
157
fi
@@ -135,8 +164,10 @@ if [[ -d $install_bin ]]; then
135
164
echo " Native tools are available from $install_bin "
136
165
echo " ##vso[task.prependpath]$install_bin "
137
166
else
138
- Write-PipelineTelemetryError -category ' NativeToolsBootstrap' " Native tools install directory does not exist, installation failed"
139
- exit 1
167
+ if [[ $installed_any = true ]]; then
168
+ Write-PipelineTelemetryError -category ' NativeToolsBootstrap' " Native tools install directory does not exist, installation failed"
169
+ exit 1
170
+ fi
140
171
fi
141
172
142
173
exit 0
0 commit comments