forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdownload-tools.sh
executable file
·48 lines (34 loc) · 1.28 KB
/
download-tools.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
set -ue
source="${BASH_SOURCE[0]}"
# resolve $source until the file is no longer a symlink
while [[ -h "$source" ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
function DownloadClangTool {
targetPlatform=$(dotnet --info |grep RID:)
targetPlatform=${targetPlatform##*RID:* }
toolUrl=https://clrjit.blob.core.windows.net/clang-tools/${targetPlatform}/$1
toolOutput=$2/$1
if [[ ! -x "$toolOutput" ]]; then
curl --retry 5 -o "${toolOutput}" "$toolUrl"
chmod 751 $toolOutput
fi
if [[ ! -x "$toolOutput" ]]; then
echo "Failed to download $1"
exit 1
fi
}
engFolder="$(cd -P "$( dirname "$scriptroot" )" && pwd )"
downloadPathFolder="$(cd -P "$( dirname "$engFolder" )" && pwd )/artifacts/tools"
mkdir -p "$downloadPathFolder"
. "$scriptroot/../common/tools.sh"
InitializeDotNetCli true
DownloadClangTool "clang-format" "$downloadPathFolder"
DownloadClangTool "clang-tidy" "$downloadPathFolder"
export PATH=$downloadPathFolder:$PATH