forked from googleapis/google-cloud-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoolversions.sh
84 lines (69 loc) · 2.95 KB
/
toolversions.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# This is intended to be imported using the "source" function from
# any scripts that use tools.
# TODO: Make all of this work under Linux too, if it's useful
declare -r REPO_ROOT=$(realpath $(dirname ${BASH_SOURCE}))
declare -r TOOL_PACKAGES=$REPO_ROOT/packages
declare -r DOCFX_VERSION=2.32.1
declare -r DOTCOVER_VERSION=2017.1.20170613.162720
declare -r REPORTGENERATOR_VERSION=2.4.5.0
declare -r PROTOC_VERSION=3.5.1
declare -r GRPC_VERSION=1.10.0
# Variables to use to invoke the tools themselves
declare -r DOCFX=$TOOL_PACKAGES/docfx.$DOCFX_VERSION/docfx.exe
declare -r FIND=/usr/bin/find
declare -r DOTCOVER=$TOOL_PACKAGES/JetBrains.dotCover.CommandLineTools.$DOTCOVER_VERSION/tools/dotCover.exe
declare -r REPORTGENERATOR=$TOOL_PACKAGES/ReportGenerator.$REPORTGENERATOR_VERSION/tools/ReportGenerator.exe
declare -r PROTOBUF_TOOLS_ROOT=$TOOL_PACKAGES/Google.Protobuf.Tools.$PROTOC_VERSION
declare -r PROTOC=$PROTOBUF_TOOLS_ROOT/tools/windows_x64/protoc.exe
declare -r GRPC_PLUGIN=packages/Grpc.Tools.$GRPC_VERSION/tools/windows_x64/grpc_csharp_plugin.exe
# Use an appropriate version of nuget... preferring
# first an existing NUGET variable, then NuGet, then
# just falling back to the path.
if [ -z "$NUGET" ]
then
if [ -n "$NuGet" ]
then
declare -r NUGET="$NuGet"
else
declare -r NUGET="nuget"
fi
fi
# Installation functions, all of which should be unconditionally called
# when required. (They handle the case where the tool is already installed.)
install_dotcover() {
$NUGET install -Verbosity quiet -OutputDirectory $TOOL_PACKAGES -Version $DOTCOVER_VERSION JetBrains.dotCover.CommandLineTools
}
install_reportgenerator() {
$NUGET install -Verbosity quiet -OutputDirectory $TOOL_PACKAGES -Version $REPORTGENERATOR_VERSION ReportGenerator
}
install_protoc() {
$NUGET install -Verbosity quiet -OutputDirectory $TOOL_PACKAGES -Version $PROTOC_VERSION Google.Protobuf.Tools
# Temporary fix for a broken proto in the protobuf tools package
sed -i 's/--)/-- )/g' $PROTOBUF_TOOLS_ROOT/tools/google/protobuf/timestamp.proto
}
install_grpc() {
$NUGET install -Verbosity quiet -OutputDirectory $TOOL_PACKAGES -Version $GRPC_VERSION Grpc.Tools
}
install_docfx() {
if [[ ! -f $DOCFX ]]
then
# Not ideal, but only part of the temporary fix later...
if [[ "$VSINSTALLDIR" == "" ]]
then
echo "Unable to detect VS installation directory when installing docfx."
echo "Rerun from git bash launched from a VS 2017 command prompt, just once!"
exit 1
fi
(echo "Fetching docfx v${DOCFX_VERSION}";
mkdir -p $TOOL_PACKAGES;
cd $TOOL_PACKAGES;
mkdir docfx.$DOCFX_VERSION;
cd docfx.$DOCFX_VERSION;
curl -sSL https://github.com/dotnet/docfx/releases/download/v${DOCFX_VERSION}/docfx.zip -o tmp.zip;
unzip -q tmp.zip;
rm tmp.zip;
# Temporary fix for https://github.com/GoogleCloudPlatform/google-cloud-dotnet/issues/1969
cp -f "$VSINSTALLDIR"/MSBuild/15.0/Bin/Microsoft.Build*.dll .
)
fi
}