Welcome to mirror list, hosted at ThFree Co, Russian Federation.

download-tools.sh « formatting « eng - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4534c41de7b17d92c8d00322cf235b63171e9726 (plain)
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