Skip to content

Commit 34c0c34

Browse files
[main] Update dependencies from dotnet/arcade (#1172)
* Update dependencies from https://github.com/dotnet/arcade build 20210121.2 Microsoft.DotNet.Arcade.Sdk From Version 6.0.0-beta.20573.2 -> To Version 6.0.0-beta.21071.2 * Update dependencies from https://github.com/dotnet/arcade build 20210128.12 Microsoft.DotNet.Arcade.Sdk From Version 6.0.0-beta.20573.2 -> To Version 6.0.0-beta.21078.12 * Update dependencies from https://github.com/dotnet/arcade build 20210205.5 Microsoft.DotNet.Arcade.Sdk From Version 6.0.0-beta.20573.2 -> To Version 6.0.0-beta.21105.5 * Update dependencies from https://github.com/dotnet/arcade build 20210205.12 Microsoft.DotNet.Arcade.Sdk From Version 6.0.0-beta.20573.2 -> To Version 6.0.0-beta.21105.12 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Brett V. Forsgren <[email protected]>
1 parent 9d63761 commit 34c0c34

32 files changed

+456
-173
lines changed

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<ProductDependencies>
44
</ProductDependencies>
55
<ToolsetDependencies>
6-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.20573.2">
6+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.21105.12">
77
<Uri>https://github.com/dotnet/arcade</Uri>
8-
<Sha>35bddd4fbfab8da3518fb920250d7c9e0c3138ff</Sha>
8+
<Sha>938b3e8b4edcd96ca0f0cbbae63c87b3f51f7afe</Sha>
99
</Dependency>
1010
</ToolsetDependencies>
1111
</Dependencies>

eng/Versions.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
<!-- Default version number to global tool. -->
1010
<VersionPrefix>0.1.0</VersionPrefix>
1111
<AutoGenerateAssemblyVersion>true</AutoGenerateAssemblyVersion>
12-
<PreReleaseVersionLabel></PreReleaseVersionLabel>
12+
<PreReleaseVersionLabel>
13+
</PreReleaseVersionLabel>
1314
</PropertyGroup>
1415
<PropertyGroup Condition="'$(UseGlobalToolVersion)' == 'true'">
1516
<AutoGenerateAssemblyVersion>false</AutoGenerateAssemblyVersion>

eng/common/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ runtime_source_feed_key=''
8181

8282
properties=''
8383
while [[ $# > 0 ]]; do
84-
opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
84+
opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")"
8585
case "$opt" in
8686
-help|-h)
8787
usage

eng/common/cross/build-android-rootfs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ __AndroidToolchain=aarch64-linux-android
2727

2828
for i in "$@"
2929
do
30-
lowerI="$(echo $i | awk '{print tolower($0)}')"
30+
lowerI="$(echo $i | tr "[:upper:]" "[:lower:]")"
3131
case $lowerI in
3232
-?|-h|--help)
3333
usage

eng/common/cross/build-rootfs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ while :; do
8282
break
8383
fi
8484

85-
lowerI="$(echo $1 | awk '{print tolower($0)}')"
85+
lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")"
8686
case $lowerI in
8787
-?|-h|--help)
8888
usage

eng/common/darc-init.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ versionEndpoint='https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc
66
verbosity='minimal'
77

88
while [[ $# > 0 ]]; do
9-
opt="$(echo "$1" | awk '{print tolower($0)}')"
9+
opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")"
1010
case "$opt" in
1111
--darcversion)
1212
darcVersion=$2

eng/common/dotnet-install.sh

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ runtime='dotnet'
1919
runtimeSourceFeed=''
2020
runtimeSourceFeedKey=''
2121
while [[ $# > 0 ]]; do
22-
opt="$(echo "$1" | awk '{print tolower($0)}')"
22+
opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")"
2323
case "$opt" in
2424
-version|-v)
2525
shift
@@ -49,13 +49,8 @@ while [[ $# > 0 ]]; do
4949
shift
5050
done
5151

52-
# Use uname to determine what the CPU is.
53-
cpuname=$(uname -p)
54-
# Some Linux platforms report unknown for platform, but the arch for machine.
55-
if [[ "$cpuname" == "unknown" ]]; then
56-
cpuname=$(uname -m)
57-
fi
58-
52+
# Use uname to determine what the CPU is, see https://en.wikipedia.org/wiki/Uname#Examples
53+
cpuname=$(uname -m)
5954
case $cpuname in
6055
aarch64)
6156
buildarch=arm64

eng/common/init-tools-native.sh

Lines changed: 89 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ declare -A native_assets
1616
. $scriptroot/native/common-library.sh
1717

1818
while (($# > 0)); do
19-
lowerI="$(echo $1 | awk '{print tolower($0)}')"
19+
lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")"
2020
case $lowerI in
2121
--baseuri)
2222
base_uri=$2
@@ -76,24 +76,89 @@ while (($# > 0)); do
7676
done
7777

7878
function ReadGlobalJsonNativeTools {
79-
# Get the native-tools section from the global.json.
80-
local native_tools_section=$(cat $global_json_file | awk '/"native-tools"/,/}/')
81-
# Only extract the contents of the object.
82-
local native_tools_list=$(echo $native_tools_section | awk -F"[{}]" '{print $2}')
83-
native_tools_list=${native_tools_list//[\" ]/}
84-
native_tools_list=$( echo "$native_tools_list" | sed 's/\s//g' | sed 's/,/\n/g' )
85-
86-
local old_IFS=$IFS
87-
while read -r line; do
88-
# Lines are of the form: 'tool:version'
89-
IFS=:
90-
while read -r key value; do
91-
native_assets[$key]=$value
92-
done <<< "$line"
93-
done <<< "$native_tools_list"
94-
IFS=$old_IFS
95-
96-
return 0;
79+
# happy path: we have a proper JSON parsing tool `jq(1)` in PATH!
80+
if command -v jq &> /dev/null; then
81+
82+
# jq: read each key/value pair under "native-tools" entry and emit:
83+
# KEY="<entry-key>" VALUE="<entry-value>"
84+
# followed by a null byte.
85+
#
86+
# bash: read line with null byte delimeter and push to array (for later `eval`uation).
87+
88+
while IFS= read -rd '' line; do
89+
native_assets+=("$line")
90+
done < <(jq -r '. |
91+
select(has("native-tools")) |
92+
."native-tools" |
93+
keys[] as $k |
94+
@sh "KEY=\($k) VALUE=\(.[$k])\u0000"' "$global_json_file")
95+
96+
return
97+
fi
98+
99+
# Warning: falling back to manually parsing JSON, which is not recommended.
100+
101+
# Following routine matches the output and escaping logic of jq(1)'s @sh formatter used above.
102+
# It has been tested with several weird strings with escaped characters in entries (key and value)
103+
# and results were compared with the output of jq(1) in binary representation using xxd(1);
104+
# just before the assignment to 'native_assets' array (above and below).
105+
106+
# try to capture the section under "native-tools".
107+
if [[ ! "$(cat "$global_json_file")" =~ \"native-tools\"[[:space:]\:\{]*([^\}]+) ]]; then
108+
return
109+
fi
110+
111+
section="${BASH_REMATCH[1]}"
112+
113+
parseStarted=0
114+
possibleEnd=0
115+
escaping=0
116+
escaped=0
117+
isKey=1
118+
119+
for (( i=0; i<${#section}; i++ )); do
120+
char="${section:$i:1}"
121+
if ! ((parseStarted)) && [[ "$char" =~ [[:space:],:] ]]; then continue; fi
122+
123+
if ! ((escaping)) && [[ "$char" == "\\" ]]; then
124+
escaping=1
125+
elif ((escaping)) && ! ((escaped)); then
126+
escaped=1
127+
fi
128+
129+
if ! ((parseStarted)) && [[ "$char" == "\"" ]]; then
130+
parseStarted=1
131+
possibleEnd=0
132+
elif [[ "$char" == "'" ]]; then
133+
token="$token'\\\''"
134+
possibleEnd=0
135+
elif ((escaping)) || [[ "$char" != "\"" ]]; then
136+
token="$token$char"
137+
possibleEnd=1
138+
fi
139+
140+
if ((possibleEnd)) && ! ((escaping)) && [[ "$char" == "\"" ]]; then
141+
# Use printf to unescape token to match jq(1)'s @sh formatting rules.
142+
# do not use 'token="$(printf "$token")"' syntax, as $() eats the trailing linefeed.
143+
printf -v token "'$token'"
144+
145+
if ((isKey)); then
146+
KEY="$token"
147+
isKey=0
148+
else
149+
line="KEY=$KEY VALUE=$token"
150+
native_assets+=("$line")
151+
isKey=1
152+
fi
153+
154+
# reset for next token
155+
parseStarted=0
156+
token=
157+
elif ((escaping)) && ((escaped)); then
158+
escaping=0
159+
escaped=0
160+
fi
161+
done
97162
}
98163

99164
native_base_dir=$install_directory
@@ -111,14 +176,14 @@ if [[ ${#native_assets[@]} -eq 0 ]]; then
111176
exit 0;
112177
else
113178
native_installer_dir="$scriptroot/native"
114-
for tool in "${!native_assets[@]}"
115-
do
116-
tool_version=${native_assets[$tool]}
117-
installer_path="$native_installer_dir/install-$tool.sh"
179+
for index in "${!native_assets[@]}"; do
180+
eval "${native_assets["$index"]}"
181+
182+
installer_path="$native_installer_dir/install-$KEY.sh"
118183
installer_command="$installer_path"
119184
installer_command+=" --baseuri $base_uri"
120185
installer_command+=" --installpath $install_bin"
121-
installer_command+=" --version $tool_version"
186+
installer_command+=" --version $VALUE"
122187
echo $installer_command
123188

124189
if [[ $force = true ]]; then

eng/common/internal-feed-operations.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ function SetupCredProvider {
6363
}
6464

6565
if (($endpoints | Measure-Object).Count -gt 0) {
66-
# [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Endpoint code example with no real credentials.")]
67-
# Create the JSON object. It should look like '{"endpointCredentials": [{"endpoint":"http://example.index.json", "username":"optional", "password":"accesstoken"}]}'
6866
$endpointCredentials = @{endpointCredentials=$endpoints} | ConvertTo-Json -Compress
6967

7068
# Create the environment variables the AzDo way

eng/common/internal-feed-operations.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ function SetupCredProvider {
6262
endpoints+=']'
6363

6464
if [ ${#endpoints} -gt 2 ]; then
65-
# [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Endpoint code example with no real credentials.")]
66-
# Create the JSON object. It should look like '{"endpointCredentials": [{"endpoint":"http://example.index.json", "username":"optional", "password":"accesstoken"}]}'
6765
local endpointCredentials="{\"endpointCredentials\": "$endpoints"}"
6866

6967
echo "##vso[task.setvariable variable=VSS_NUGET_EXTERNAL_FEED_ENDPOINTS]$endpointCredentials"
@@ -103,7 +101,7 @@ authToken=''
103101
repoName=''
104102

105103
while [[ $# > 0 ]]; do
106-
opt="$(echo "$1" | awk '{print tolower($0)}')"
104+
opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")"
107105
case "$opt" in
108106
--operation)
109107
operation=$2

0 commit comments

Comments
 (0)