Imported Upstream version 5.2.0.175

Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-06-07 13:16:24 +00:00
parent 4bdbaf4a88
commit 966bba02bb
8776 changed files with 346420 additions and 149650 deletions

1
external/linker/corebuild/.cliversion vendored Normal file
View File

@@ -0,0 +1 @@
2.0.0-preview1-005685

View File

@@ -0,0 +1 @@

82
external/linker/corebuild/bootstrap.ps1 vendored Normal file
View File

@@ -0,0 +1,82 @@
param
(
[Parameter(Mandatory=$false)][string]$RepositoryRoot = $PSScriptRoot,
[Parameter(Mandatory=$false)][string]$ToolsLocalPath = (Join-Path $RepositoryRoot "Tools"),
[Parameter(Mandatory=$false)][string]$CliLocalPath = (Join-Path $ToolsLocalPath "dotnetcli"),
[Parameter(Mandatory=$false)][string]$SharedFrameworkSymlinkPath = (Join-Path $ToolsLocalPath "dotnetcli\shared\Microsoft.NETCore.App\version"),
[Parameter(Mandatory=$false)][string]$SharedFrameworkVersion = "<auto>",
[Parameter(Mandatory=$false)][string]$Architecture = "<auto>",
[Parameter(Mandatory=$false)][string]$DotNetInstallBranch = "rel/1.0.0",
[switch]$Force = $false
)
$rootCliVersion = Join-Path $RepositoryRoot ".cliversion"
$bootstrapComplete = Join-Path $ToolsLocalPath "bootstrap.complete"
# if the force switch is specified delete the semaphore file if it exists
if ($Force -and (Test-Path $bootstrapComplete))
{
del $bootstrapComplete
}
# if the semaphore file exists and is identical to the specified version then exit
if ((Test-Path $bootstrapComplete) -and !(Compare-Object (Get-Content $rootCliVersion) (Get-Content $bootstrapComplete)))
{
exit 0
}
$initCliScript = "dotnet-install.ps1"
$dotnetInstallPath = Join-Path $ToolsLocalPath $initCliScript
# blow away the tools directory so we can start from a known state
if (Test-Path $ToolsLocalPath)
{
# if the bootstrap.ps1 script was downloaded to the tools directory don't delete it
rd -recurse -force $ToolsLocalPath -exclude "bootstrap.ps1"
}
else
{
mkdir $ToolsLocalPath | Out-Null
}
# download CLI boot-strapper script
Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/$DotNetInstallBranch/scripts/obtain/dotnet-install.ps1" -OutFile $dotnetInstallPath
# load the version of the CLI
$dotNetCliVersion = Get-Content $rootCliVersion
if (-Not (Test-Path $CliLocalPath))
{
mkdir $CliLocalPath | Out-Null
}
# now execute the script
Write-Host "$dotnetInstallPath -Version $dotNetCliVersion -InstallDir $CliLocalPath -Architecture ""$Architecture"""
Invoke-Expression "$dotnetInstallPath -Version $dotNetCliVersion -InstallDir $CliLocalPath -Architecture ""$Architecture"""
if ($LastExitCode -ne 0)
{
Write-Output "The .NET CLI installation failed with exit code $LastExitCode"
exit $LastExitCode
}
# create a junction to the shared FX version directory. this is
# so we have a stable path to dotnet.exe regardless of version.
$runtimesPath = Join-Path $CliLocalPath "shared\Microsoft.NETCore.App"
if ($SharedFrameworkVersion -eq "<auto>")
{
$SharedFrameworkVersion = Get-ChildItem $runtimesPath -Directory | Sort-Object | Select-Object -First 1 | % { New-Object System.Version($_) }
}
$junctionTarget = Join-Path $runtimesPath $SharedFrameworkVersion
$junctionParent = Split-Path $SharedFrameworkSymlinkPath -Parent
if (-Not (Test-Path $junctionParent))
{
mkdir $junctionParent | Out-Null
}
if (-Not (Test-Path $SharedFrameworkSymlinkPath))
{
cmd.exe /c mklink /j $SharedFrameworkSymlinkPath $junctionTarget | Out-Null
}
# write semaphore file
copy $rootCliVersion $bootstrapComplete
exit 0

223
external/linker/corebuild/bootstrap.sh vendored Executable file
View File

@@ -0,0 +1,223 @@
#!/usr/bin/env bash
# Stop script on NZEC
# set -e
# Stop script if unbound variable found (use ${var:-} if intentional)
set -u
# By default cmd1 | cmd2 returns exit code of cmd2 regardless of cmd1 success
# This is causing it to fail
set -o pipefail
# Use in the the functions: eval $invocation
invocation='say_verbose "Calling: ${FUNCNAME[0]}"'
# standard output may be used as a return value in the functions
# we need a way to write text on the screen in the functions so that
# it won't interfere with the return value.
# Exposing stream 3 as a pipe to standard output of the script itself
exec 3>&1
say_err() {
printf "%b\n" "bootstrap: Error: $1" >&2
}
say() {
# using stream 3 (defined in the beginning) to not interfere with stdout of functions
# which may be used as return value
printf "%b\n" "bootstrap: $1" >&3
}
say_verbose() {
if [ "$verbose" = true ]; then
say "$1"
fi
}
machine_has() {
eval $invocation
hash "$1" > /dev/null 2>&1
return $?
}
check_min_reqs() {
if ! machine_has "curl"; then
say_err "curl is required to download dotnet. Install curl to proceed."
return 1
fi
return 0
}
# args:
# remote_path - $1
# [out_path] - $2 - stdout if not provided
download() {
eval $invocation
local remote_path=$1
local out_path=${2:-}
local failed=false
if [ -z "$out_path" ]; then
curl --retry 10 -sSL --create-dirs $remote_path || failed=true
else
curl --retry 10 -sSL --create-dirs -o $out_path $remote_path || failed=true
fi
if [ "$failed" = true ]; then
say_err "Download failed"
return 1
fi
}
verbose=false
repoRoot=`pwd`
toolsLocalPath="<auto>"
cliLocalPath="<auto>"
symlinkPath="<auto>"
sharedFxVersion="<auto>"
force=
forcedCliLocalPath="<none>"
architecture="<auto>"
dotNetInstallBranch="rel/1.0.0"
while [ $# -ne 0 ]
do
name=$1
case $name in
-r|--repositoryRoot|-[Rr]epositoryRoot)
shift
repoRoot="$1"
;;
-t|--toolsLocalPath|-[Tt]oolsLocalPath)
shift
toolsLocalPath="$1"
;;
-c|--cliInstallPath|--cliLocalPath|-[Cc]liLocalPath)
shift
cliLocalPath="$1"
;;
-u|--useLocalCli|-[Uu]seLocalCli)
shift
forcedCliLocalPath="$1"
;;
-a|--architecture|-[Aa]rchitecture)
shift
architecture="$1"
;;
--dotNetInstallBranch|-[Dd]ot[Nn]et[Ii]nstall[Bb]ranch)
shift
dotNetInstallBranch="$1"
;;
--sharedFrameworkSymlinkPath|--symlink|-[Ss]haredFrameworkSymlinkPath)
shift
symlinkPath="$1"
;;
--sharedFrameworkVersion|-[Ss]haredFrameworkVersion)
sharedFxVersion="$1"
;;
--force|-[Ff]orce)
force=true
;;
-v|--verbose|-[Vv]erbose)
verbose=true
;;
*)
say_err "Unknown argument \`$name\`"
exit 1
;;
esac
shift
done
if [ $toolsLocalPath = "<auto>" ]; then
toolsLocalPath="$repoRoot/Tools"
fi
if [ $cliLocalPath = "<auto>" ]; then
if [ $forcedCliLocalPath = "<none>" ]; then
cliLocalPath="$toolsLocalPath/dotnetcli"
else
cliLocalPath=$forcedCliLocalPath
fi
fi
if [ $symlinkPath = "<auto>" ]; then
symlinkPath="$toolsLocalPath/dotnetcli/shared/Microsoft.NETCore.App/version"
fi
rootCliVersion="$repoRoot/.cliversion"
bootstrapComplete="$toolsLocalPath/bootstrap.complete"
# if the force switch is specified delete the semaphore file if it exists
if [[ $force && -f $bootstrapComplete ]]; then
rm -f $bootstrapComplete
fi
# if the semaphore file exists and is identical to the specified version then exit
if [[ -f $bootstrapComplete && ! `cmp $bootstrapComplete $rootCliVersion` ]]; then
say "$bootstrapComplete appears to show that bootstrapping is complete. Use --force if you want to re-bootstrap."
exit 0
fi
initCliScript="dotnet-install.sh"
dotnetInstallPath="$toolsLocalPath/$initCliScript"
# blow away the tools directory so we can start from a known state
if [ -d $toolsLocalPath ]; then
# if the bootstrap.sh script was downloaded to the tools directory don't delete it
find $toolsLocalPath -type f -not -name bootstrap.sh -exec rm -f {} \;
else
mkdir $toolsLocalPath
fi
if [ $forcedCliLocalPath = "<none>" ]; then
check_min_reqs
# download CLI boot-strapper script
download "https://raw.githubusercontent.com/dotnet/cli/$dotNetInstallBranch/scripts/obtain/dotnet-install.sh" "$dotnetInstallPath"
chmod u+x "$dotnetInstallPath"
# load the version of the CLI
dotNetCliVersion=`cat $rootCliVersion`
if [ ! -e $cliLocalPath ]; then
mkdir -p "$cliLocalPath"
fi
# now execute the script
say_verbose "installing CLI: $dotnetInstallPath --version \"$dotNetCliVersion\" --install-dir $cliLocalPath --architecture \"$architecture\""
$dotnetInstallPath --version "$dotNetCliVersion" --install-dir $cliLocalPath --architecture "$architecture"
if [ $? != 0 ]; then
say_err "The .NET CLI installation failed with exit code $?"
exit $?
fi
fi
runtimesPath="$cliLocalPath/shared/Microsoft.NETCore.App"
if [ $sharedFxVersion = "<auto>" ]; then
# OSX doesn't support --version-sort, https://stackoverflow.com/questions/21394536/how-to-simulate-sort-v-on-mac-osx
sharedFxVersion=`ls $runtimesPath | sed 's/^[0-9]\./0&/; s/\.\([0-9]\)$/.0\1/; s/\.\([0-9]\)\./.0\1./g; s/\.\([0-9]\)\./.0\1./g' | sort -r | sed 's/^0// ; s/\.0/./g' | head -n 1`
fi
# create a junction to the shared FX version directory. this is
# so we have a stable path to dotnet.exe regardless of version.
junctionTarget="$runtimesPath/$sharedFxVersion"
junctionParent="$(dirname "$symlinkPath")"
if [ ! -d $junctionParent ]; then
mkdir -p $junctionParent
fi
if [ ! -e $symlinkPath ]; then
ln -s $junctionTarget $symlinkPath
fi
cp $rootCliVersion $bootstrapComplete
say "Bootstrap finished successfully."

6
external/linker/corebuild/build.cmd vendored Normal file
View File

@@ -0,0 +1,6 @@
@if not defined _echo @echo off
REM build.cmd will bootstrap the cli and ultimately call "dotnet build"
@call %~dp0dotnet.cmd build %~dp0linker.sln %*
@exit /b %ERRORLEVEL%

7
external/linker/corebuild/build.sh vendored Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# build.sh will bootstrap the cli and ultimately call "dotnet build"
working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$working_tree_root/dotnet.sh build $working_tree_root/linker.sln $@
exit $?

15
external/linker/corebuild/dotnet.cmd vendored Normal file
View File

@@ -0,0 +1,15 @@
@if not defined _echo @echo off
setlocal
if not defined VisualStudioVersion (
if defined VS140COMNTOOLS (
call "%VS140COMNTOOLS%\VsDevCmd.bat"
goto :Run
)
echo Error: Visual Studio 2015 required.
exit /b 1
)
:Run
powershell -NoProfile -ExecutionPolicy unrestricted -Command "%~dp0dotnet.ps1 -- %*"
exit /b %ERRORLEVEL%

27
external/linker/corebuild/dotnet.ps1 vendored Normal file
View File

@@ -0,0 +1,27 @@
# set the base tools directory
$toolsLocalPath = Join-Path $PSScriptRoot "Tools"
$bootStrapperPath = Join-Path $toolsLocalPath "bootstrap.ps1"
# if the boot-strapper script doesn't exist copy it to the tools path
if ((Test-Path $bootStrapperPath) -eq 0)
{
if ((Test-Path $toolsLocalPath) -eq 0)
{
mkdir $toolsLocalPath | Out-Null
}
cp (Join-Path $PSScriptRoot "bootstrap.ps1") $bootStrapperPath
}
# now execute it
& $bootStrapperPath $PSScriptRoot $toolsLocalPath | Out-File (Join-Path $PSScriptRoot "bootstrap.log")
if ($LastExitCode -ne 0)
{
Write-Output "Boot-strapping failed with exit code $LastExitCode, see bootstrap.log for more information."
exit $LastExitCode
}
# execute the tool using the dotnet.exe host
$dotNetExe = Join-Path $toolsLocalPath "dotnetcli\dotnet.exe"
& $dotNetExe $args
exit $LastExitCode

25
external/linker/corebuild/dotnet.sh vendored Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
__scriptpath=$(cd "$(dirname "$0")"; pwd -P)
toolsLocalPath=$__scriptpath/Tools
bootStrapperPath=$toolsLocalPath/bootstrap.sh
if [ ! -e $bootStrapperPath ]; then
if [ ! -e $toolsLocalPath ]; then
mkdir $toolsLocalPath
fi
cp $__scriptpath/bootstrap.sh $__scriptpath/Tools
fi
$bootStrapperPath --repositoryRoot $__scriptpath --toolsLocalPath $toolsLocalPath > bootstrap.log
lastExitCode=$?
if [ $lastExitCode -ne 0 ]; then
echo "Boot-strapping failed with exit code $lastExitCode, see bootstrap.log for more information."
exit $lastExitCode
fi
dotNetExe=$toolsLocalPath/dotnetcli/dotnet
echo $dotNetExe $@
$dotNetExe $@
exit $?

62
external/linker/corebuild/linker.sln vendored Normal file
View File

@@ -0,0 +1,62 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Linker", "..\linker\Mono.Linker.csproj", "{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "..\cecil\Mono.Cecil.csproj", "{D68133BD-1E63-496E-9EDE-4FBDBF77B486}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil.Pdb", "..\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj", "{63E6915C-7EA4-4D76-AB28-0D7191EEA626}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.ActiveCfg = netcore_Debug|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.Build.0 = netcore_Debug|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.ActiveCfg = netcore_Debug|x64
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.Build.0 = netcore_Debug|x64
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.ActiveCfg = netcore_Debug|x86
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.Build.0 = netcore_Debug|x86
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.ActiveCfg = netcore_Release|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.Build.0 = netcore_Release|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.ActiveCfg = netcore_Release|x64
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.Build.0 = netcore_Release|x64
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.ActiveCfg = netcore_Release|x86
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.Build.0 = netcore_Release|x86
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.Build.0 = netstandard_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x64.ActiveCfg = netstandard_Debug|x64
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x64.Build.0 = netstandard_Debug|x64
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x86.ActiveCfg = netstandard_Debug|x86
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x86.Build.0 = netstandard_Debug|x86
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.ActiveCfg = netstandard_Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.Build.0 = netstandard_Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x64.ActiveCfg = netstandard_Release|x64
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x64.Build.0 = netstandard_Release|x64
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.ActiveCfg = netstandard_Release|x86
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.Build.0 = netstandard_Release|x86
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Debug|Any CPU.Build.0 = netstandard_Debug|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Debug|x64.ActiveCfg = netstandard_Debug|x64
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Debug|x64.Build.0 = netstandard_Debug|x64
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Debug|x86.ActiveCfg = netstandard_Debug|x86
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Debug|x86.Build.0 = netstandard_Debug|x86
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|Any CPU.ActiveCfg = netstandard_Release|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|Any CPU.Build.0 = netstandard_Release|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|x64.ActiveCfg = netstandard_Release|x64
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|x64.Build.0 = netstandard_Release|x64
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|x86.ActiveCfg = netstandard_Release|x86
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|x86.Build.0 = netstandard_Release|x86
EndGlobalSection
EndGlobal

7
external/linker/corebuild/restore.cmd vendored Normal file
View File

@@ -0,0 +1,7 @@
@if not defined _echo @echo off
REM restore.sh will bootstrap the cli and ultimately call "dotnet
REM restore". Dependencies of the linker will get restored as well.
@call %~dp0dotnet.cmd restore %~dp0linker.sln %*
@exit /b %ERRORLEVEL%

7
external/linker/corebuild/restore.sh vendored Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# restore.sh will bootstrap the cli and ultimately call "dotnet
# restore". Dependencies of the linker will get restored as well.
working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$working_tree_root/dotnet.sh restore $working_tree_root/linker.sln $@