Merge remote-tracking branch 'upstream/release/1.3.0' into merge-release-1.3.0-to-master
This commit is contained in:
Коммит
ba4b413069
|
@ -1,74 +1,49 @@
|
|||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
# Set default behavior to:
|
||||
# automatically normalize line endings on check-in, and
|
||||
# convert to Windows-style line endings on check-out
|
||||
###############################################################################
|
||||
* text=auto encoding=UTF-8
|
||||
|
||||
# csc/vbc are shell scripts and should always have unix line endings
|
||||
# These shell scripts are included in the toolset packages. Normally, the shell
|
||||
# scripts in our repo are only run by cloning onto a Linux/Mac machine, and git
|
||||
# automatically chooses LF as the line ending.
|
||||
#
|
||||
# However, right now the toolset packages must be built on Windows, and so the
|
||||
# files must be hard-coded to be cloned with LF
|
||||
src/Compilers/CSharp/CscCore/csc text eol=lf
|
||||
src/Compilers/VisualBasic/VbcCore/vbc text eol=lf
|
||||
*.sh text eol=lf
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
# Set file behavior to:
|
||||
# treat as text, and
|
||||
# diff as C# source code
|
||||
###############################################################################
|
||||
*.cs diff=csharp text
|
||||
*.vb text
|
||||
*.cs text diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
# Set file behavior to:
|
||||
# treat as text
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
*.cmd text
|
||||
*.config text
|
||||
*.csproj text
|
||||
*.groovy text
|
||||
*.json text
|
||||
*.md text
|
||||
*.nuspec text
|
||||
*.pkgdef text
|
||||
*.proj text
|
||||
*.projitems text
|
||||
*.props text
|
||||
*.ps1 text
|
||||
*.resx text
|
||||
*.ruleset text
|
||||
*.shproj text
|
||||
*.sln text
|
||||
*.targets text
|
||||
*.vb text
|
||||
*.vbproj text
|
||||
*.vcxproj text
|
||||
*.vcxproj.filters text
|
||||
*.vsct text
|
||||
*.vsixmanifest text
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
# Set file behavior to:
|
||||
# treat as binary
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
||||
*.png binary
|
||||
*.snk binary
|
||||
|
|
|
@ -4,107 +4,34 @@
|
|||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
.vs/
|
||||
*.VC.db
|
||||
.vscode/
|
||||
|
||||
# Build results
|
||||
[Aa]rtifacts/
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
artifacts/
|
||||
Debug/
|
||||
Release/
|
||||
bin/
|
||||
obj/
|
||||
.dotnet/
|
||||
.tools/
|
||||
.packages/
|
||||
|
||||
# Per-user project properties
|
||||
launchSettings.json
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.wrn
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.log
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
# =========================
|
||||
# Windows detritus
|
||||
# =========================
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Mac desktop service store files
|
||||
.DS_Store
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
resources:
|
||||
- repo: self
|
||||
clean: true
|
||||
queue:
|
||||
name: VSEng-MicroBuildVS2017
|
||||
demands: Cmd
|
||||
variables:
|
||||
BuildConfiguration: Release
|
||||
TeamName: Roslyn
|
||||
|
||||
steps:
|
||||
- task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@1
|
||||
displayName: Install Signing Plugin
|
||||
inputs:
|
||||
signType: real
|
||||
esrpSigning: true
|
||||
condition: and(succeeded(), eq(variables['PB_SignType'], 'real'))
|
||||
|
||||
- script: eng\common\CIBuild.cmd
|
||||
-configuration $(BuildConfiguration)
|
||||
/p:PB_PublishBlobFeedKey=$(PB_PublishBlobFeedKey)
|
||||
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
|
||||
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
|
||||
displayName: Build
|
||||
|
||||
- task: PublishTestResults@1
|
||||
displayName: Publish Test Results
|
||||
inputs:
|
||||
testRunner: XUnit
|
||||
testResultsFiles: 'artifacts/$(BuildConfiguration)/TestResults/*.xml'
|
||||
mergeTestResults: true
|
||||
testRunTitle: 'Unit Tests'
|
||||
condition: and(succeededOrFailed(), ne(variables['PB_SkipTests'], 'true'))
|
||||
|
||||
- task: NuGetPublisher@0
|
||||
displayName: Publish NuGet Packages to MyGet
|
||||
inputs:
|
||||
searchPattern: 'artifacts\$(BuildConfiguration)\packages\*.nupkg'
|
||||
connectedServiceName: 'SymReader NuGet feed'
|
||||
nuGetVersion: 4.0.0.2283
|
||||
condition: and(succeeded(), not(contains(variables['PB_PublishType'], 'blob')))
|
||||
|
||||
- task: CopyPublishBuildArtifacts@1
|
||||
displayName: Publish Artifacts
|
||||
inputs:
|
||||
CopyRoot: '$(Build.SourcesDirectory)'
|
||||
Contents: |
|
||||
artifacts\$(BuildConfiguration)\bin
|
||||
artifacts\$(BuildConfiguration)\log
|
||||
artifacts\$(BuildConfiguration)\TestResults
|
||||
artifacts\$(BuildConfiguration)\SymStore
|
||||
artifacts\$(BuildConfiguration)\packages
|
||||
ArtifactName: '$(Build.BuildNumber)'
|
||||
ArtifactType: FilePath
|
||||
TargetPath: '$(DropRoot)\$(TeamName)\$(Build.DefinitionName)'
|
||||
condition: and(succeededOrFailed(), not(contains(variables['PB_PublishType'], 'blob')))
|
||||
|
||||
- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1
|
||||
displayName: Cleanup
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: Publish MicroBuild Artifacts
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)\MicroBuild\Output'
|
||||
ArtifactName: '$(Build.BuildNumber)'
|
||||
publishLocation: FilePath
|
||||
TargetPath: '$(DropRoot)\$(TeamName)\$(Build.DefinitionName)'
|
||||
condition: and(succeededOrFailed(), not(contains(variables['PB_PublishType'], 'blob')))
|
|
@ -1,3 +1,3 @@
|
|||
@echo off
|
||||
powershell -ExecutionPolicy ByPass %~dp0build\Build.ps1 -restore -build %*
|
||||
powershell -ExecutionPolicy ByPass -command "& """%~dp0eng\common\Build.ps1""" -restore -build %*"
|
||||
exit /b %ErrorLevel%
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
@echo off
|
||||
powershell -ExecutionPolicy ByPass %~dp0build\Build.ps1 -restore -build -test -sign -pack -ci %*
|
||||
exit /b %ErrorLevel%
|
|
@ -1,15 +0,0 @@
|
|||
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
|
||||
<Project>
|
||||
<Import Project="build\NuGet.props"/>
|
||||
<Import Project="build\Versions.props"/>
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
|
||||
|
||||
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
|
||||
<RepoToolsetDir>$(NuGetPackageRoot)roslyntools.repotoolset\$(RoslynToolsRepoToolsetVersion)\tools\</RepoToolsetDir>
|
||||
|
||||
<RepositoryUrl>https://github.com/dotnet/symreader</RepositoryUrl>
|
||||
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -10,9 +10,10 @@ Pre-release builds are available on MyGet gallery: https://dotnet.myget.org/Gall
|
|||
|
||||
[//]: # (Begin current test results)
|
||||
|
||||
| |Windows Debug|Windows Release|
|
||||
|:--------:|:-----------:|:-------------:|
|
||||
|**master**|[![Build Status](https://ci.dot.net/job/dotnet_symreader/job/master/job/windows_debug/badge/icon)](https://ci.dot.net/job/dotnet_symreader/job/master/job/windows_debug/)|[![Build Status](https://ci.dot.net/job/dotnet_symreader/job/master/job/windows_release/badge/icon)](https://ci.dot.net/job/dotnet_symreader/job/master/job/windows_release/)|
|
||||
| | x64 Debug|x64 Release|
|
||||
|:--:|:--:|:--:|
|
||||
|**Windows**|[![Build Status](https://ci.dot.net/job/dotnet_symreader/job/release_1.3.0/job/Windows_NT_Debug/badge/icon)](https://ci.dot.net/job/dotnet_symreader/job/release_1.3.0/job/Windows_NT_Debug/)|[![Build Status](https://ci.dot.net/job/dotnet_symreader/job/release_1.3.0/job/Windows_NT_Release/badge/icon)](https://ci.dot.net/job/dotnet_symreader/job/release_1.3.0/job/Windows_NT_Release/)|
|
||||
|**Ubuntu 16.04**|[![Build Status](https://ci.dot.net/job/dotnet_symreader/job/release_1.3.0/job/Ubuntu16.04_Debug/badge/icon)](https://ci.dot.net/job/dotnet_symreader/job/release_1.3.0/job/Ubuntu16.04_Debug/)|[![Build Status](https://ci.dot.net/job/dotnet_symreader/job/release_1.3.0/job/Ubuntu16.04_Release/badge/icon)](https://ci.dot.net/job/dotnet_symreader/job/release_1.3.0/job/Ubuntu16.04_Release/)|
|
||||
|
||||
[//]: # (End current test results)
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
@echo off
|
||||
powershell -ExecutionPolicy ByPass %~dp0build\Build.ps1 -restore %*
|
||||
powershell -ExecutionPolicy ByPass -command "& """%~dp0eng\common\Build.ps1""" -restore %*"
|
||||
exit /b %ErrorLevel%
|
||||
|
|
2
Test.cmd
2
Test.cmd
|
@ -1,3 +1,3 @@
|
|||
@echo off
|
||||
powershell -ExecutionPolicy ByPass %~dp0build\Build.ps1 -test %*
|
||||
powershell -ExecutionPolicy ByPass -command "& """%~dp0eng\common\Build.ps1""" -test %*"
|
||||
exit /b %ErrorLevel%
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
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 )"
|
||||
"$scriptroot/eng/common/build.sh" --build --restore $@
|
|
@ -1,10 +0,0 @@
|
|||
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<!-- Respect environment variable for the NuGet Packages Root if set; otherwise, use the current default location -->
|
||||
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == ''">$(NUGET_PACKAGES)</NuGetPackageRoot>
|
||||
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' AND '$(OS)' == 'Windows_NT'">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' AND '$(OS)' != 'Windows_NT'">$([System.Environment]::GetFolderPath(SpecialFolder.Personal))\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageRoot Condition="!HasTrailingSlash('$(NuGetPackageRoot)')">$(NuGetPackageRoot)\</NuGetPackageRoot>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -1,10 +0,0 @@
|
|||
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net462</TargetFramework>
|
||||
<RestoreSources>https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json</RestoreSources>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RoslynTools.RepoToolset" Version="$(RoslynToolsRepoToolsetVersion)" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
|
||||
<!-- This repo version -->
|
||||
<VersionBase>1.4.0</VersionBase>
|
||||
<PreReleaseVersionLabel>beta</PreReleaseVersionLabel>
|
||||
|
||||
<!-- Toolset -->
|
||||
<RoslynToolsRepoToolsetVersion>1.0.0-beta-62503-02</RoslynToolsRepoToolsetVersion>
|
||||
<DotNetCliVersion>2.0.2</DotNetCliVersion>
|
||||
|
||||
<!-- CoreFX -->
|
||||
<SystemCollectionsImmutableVersion>1.3.1</SystemCollectionsImmutableVersion>
|
||||
<SystemReflectionMetadataVersion>1.4.2</SystemReflectionMetadataVersion>
|
||||
|
||||
<!-- Libs -->
|
||||
<MicrosoftDiaSymReaderNativeVersion>1.7.0</MicrosoftDiaSymReaderNativeVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<RestoreSources>
|
||||
$(RestoreSources);
|
||||
https://dotnet.myget.org/F/symreader-native/api/v3/index.json
|
||||
</RestoreSources>
|
||||
</PropertyGroup>
|
||||
</Project>
|
160
build/build.ps1
160
build/build.ps1
|
@ -1,160 +0,0 @@
|
|||
[CmdletBinding(PositionalBinding=$false)]
|
||||
Param(
|
||||
[string] $configuration = "Debug",
|
||||
[string] $solution = "",
|
||||
[string] $verbosity = "minimal",
|
||||
[switch] $restore,
|
||||
[switch] $build,
|
||||
[switch] $rebuild,
|
||||
[switch] $test,
|
||||
[switch] $sign,
|
||||
[switch] $pack,
|
||||
[switch] $ci,
|
||||
[switch] $prepareMachine,
|
||||
[switch] $log,
|
||||
[switch] $help,
|
||||
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
|
||||
)
|
||||
|
||||
set-strictmode -version 2.0
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Print-Usage() {
|
||||
Write-Host "Common settings:"
|
||||
Write-Host " -configuration <value> Build configuration Debug, Release"
|
||||
Write-Host " -verbosity <value> Msbuild verbosity (q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic])"
|
||||
Write-Host " -help Print help and exit"
|
||||
Write-Host ""
|
||||
|
||||
Write-Host "Actions:"
|
||||
Write-Host " -restore Restore dependencies"
|
||||
Write-Host " -build Build solution"
|
||||
Write-Host " -rebuild Rebuild solution"
|
||||
Write-Host " -test Run all unit tests in the solution"
|
||||
Write-Host " -sign Sign build outputs"
|
||||
Write-Host " -pack Package build outputs into NuGet packages and Willow components"
|
||||
Write-Host ""
|
||||
|
||||
Write-Host "Advanced settings:"
|
||||
Write-Host " -solution <value> Path to solution to build"
|
||||
Write-Host " -ci Set when running on CI server"
|
||||
Write-Host " -log Enable logging (by default on CI)"
|
||||
Write-Host " -prepareMachine Prepare machine for CI run"
|
||||
Write-Host ""
|
||||
Write-Host "Command line arguments not listed above are passed thru to msbuild."
|
||||
Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)."
|
||||
}
|
||||
|
||||
if ($help -or (($properties -ne $null) -and ($properties.Contains("/help") -or $properties.Contains("/?")))) {
|
||||
Print-Usage
|
||||
exit 0
|
||||
}
|
||||
|
||||
function Create-Directory([string[]] $path) {
|
||||
if (!(Test-Path $path)) {
|
||||
New-Item -path $path -force -itemType "Directory" | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
function GetVersion([string] $name) {
|
||||
foreach ($propertyGroup in $VersionsXml.Project.PropertyGroup) {
|
||||
if (Get-Member -inputObject $propertyGroup -name $name) {
|
||||
return $propertyGroup.$name
|
||||
}
|
||||
}
|
||||
|
||||
throw "Failed to find $name in Versions.props"
|
||||
}
|
||||
|
||||
function InstallDotNetCli {
|
||||
|
||||
Create-Directory $DotNetRoot
|
||||
$dotnetCliVersion = GetVersion("DotNetCliVersion")
|
||||
|
||||
$installScript = "$DotNetRoot\dotnet-install.ps1"
|
||||
if (!(Test-Path $installScript)) {
|
||||
Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/release/2.0.0/scripts/obtain/dotnet-install.ps1" -OutFile $installScript
|
||||
}
|
||||
|
||||
& $installScript -Version $dotnetCliVersion -InstallDir $DotNetRoot
|
||||
if ($lastExitCode -ne 0) {
|
||||
throw "Failed to install dotnet cli (exit code '$lastExitCode')."
|
||||
}
|
||||
}
|
||||
|
||||
function InstallToolset {
|
||||
if (!(Test-Path $ToolsetBuildProj)) {
|
||||
& $DotNetExe msbuild $ToolsetRestoreProj /t:restore /m /nologo /clp:Summary /warnaserror /v:$verbosity /p:NuGetPackageRoot=$NuGetPackageRoot /p:BaseIntermediateOutputPath=$ToolsetDir /p:ExcludeRestorePackageImports=true
|
||||
}
|
||||
}
|
||||
|
||||
function Build {
|
||||
if ($ci -or $log) {
|
||||
Create-Directory($logDir)
|
||||
$logCmd = "/bl:" + (Join-Path $LogDir "Build.binlog")
|
||||
} else {
|
||||
$logCmd = ""
|
||||
}
|
||||
|
||||
& $DotNetExe msbuild $ToolsetBuildProj /m /nologo /clp:Summary /warnaserror /v:$verbosity $logCmd /p:Configuration=$configuration /p:SolutionPath=$solution /p:Restore=$restore /p:Build=$build /p:Rebuild=$rebuild /p:Test=$test /p:Sign=$sign /p:Pack=$pack /p:CIBuild=$ci /p:NuGetPackageRoot=$NuGetPackageRoot $properties
|
||||
}
|
||||
|
||||
function Stop-Processes() {
|
||||
Write-Host "Killing running build processes..."
|
||||
Get-Process -Name "dotnet" -ErrorAction SilentlyContinue | Stop-Process
|
||||
Get-Process -Name "vbcscompiler" -ErrorAction SilentlyContinue | Stop-Process
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
$RepoRoot = Join-Path $PSScriptRoot "..\"
|
||||
$DotNetRoot = Join-Path $RepoRoot ".dotnet"
|
||||
$DotNetExe = Join-Path $DotNetRoot "dotnet.exe"
|
||||
$BuildProj = Join-Path $PSScriptRoot "build.proj"
|
||||
$ToolsetRestoreProj = Join-Path $PSScriptRoot "Toolset.proj"
|
||||
$ArtifactsDir = Join-Path $RepoRoot "artifacts"
|
||||
$ToolsetDir = Join-Path $ArtifactsDir "toolset"
|
||||
$LogDir = Join-Path (Join-Path $ArtifactsDir $configuration) "log"
|
||||
$TempDir = Join-Path (Join-Path $ArtifactsDir $configuration) "tmp"
|
||||
[xml]$VersionsXml = Get-Content(Join-Path $PSScriptRoot "Versions.props")
|
||||
|
||||
if ($solution -eq "") {
|
||||
$solution = @(gci(Join-Path $RepoRoot "*.sln"))[0]
|
||||
}
|
||||
|
||||
if ($env:NUGET_PACKAGES -ne $null) {
|
||||
$NuGetPackageRoot = $env:NUGET_PACKAGES.TrimEnd("\") + "\"
|
||||
} else {
|
||||
$NuGetPackageRoot = Join-Path $env:UserProfile ".nuget\packages\"
|
||||
}
|
||||
|
||||
$ToolsetVersion = GetVersion("RoslynToolsRepoToolsetVersion")
|
||||
$ToolsetBuildProj = Join-Path $NuGetPackageRoot "roslyntools.repotoolset\$ToolsetVersion\tools\Build.proj"
|
||||
|
||||
if ($ci) {
|
||||
Create-Directory $TempDir
|
||||
$env:TEMP = $TempDir
|
||||
$env:TMP = $TempDir
|
||||
}
|
||||
|
||||
if ($restore) {
|
||||
InstallDotNetCli
|
||||
InstallToolset
|
||||
}
|
||||
|
||||
Build
|
||||
exit $lastExitCode
|
||||
}
|
||||
catch {
|
||||
Write-Host $_
|
||||
Write-Host $_.Exception
|
||||
Write-Host $_.ScriptStackTrace
|
||||
exit 1
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
if ($ci -and $prepareMachine) {
|
||||
Stop-Processes
|
||||
}
|
||||
}
|
||||
|
|
@ -15,10 +15,11 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"certificate": null,
|
||||
"certificate": "NuGet",
|
||||
"strongName": null,
|
||||
"values": [
|
||||
"packages/*.nupkg"
|
||||
"packages/*.nupkg",
|
||||
"packages/*/*.nupkg"
|
||||
]
|
||||
}
|
||||
]
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
|
||||
<!-- This repo version -->
|
||||
<VersionPrefix>1.3.0</VersionPrefix>
|
||||
<PreReleaseVersionLabel>beta</PreReleaseVersionLabel>
|
||||
|
||||
<!-- Opt-in repo features -->
|
||||
<UsingToolSymbolUploader>true</UsingToolSymbolUploader>
|
||||
<UsingToolNetFrameworkReferenceAssemblies>true</UsingToolNetFrameworkReferenceAssemblies>
|
||||
<UsingToolNuGetRepack>true</UsingToolNuGetRepack>
|
||||
|
||||
<!-- Dependencies -->
|
||||
<SystemCollectionsImmutableVersion>1.5.0-preview2-26401-03</SystemCollectionsImmutableVersion>
|
||||
<SystemReflectionMetadataVersion>1.6.0-preview2-26401-03</SystemReflectionMetadataVersion>
|
||||
<SystemValueTupleVersion>4.3.0</SystemValueTupleVersion>
|
||||
|
||||
<MicrosoftDiaSymReaderNativeVersion>1.7.0</MicrosoftDiaSymReaderNativeVersion>
|
||||
<MicrosoftSourceLinkVersion>1.0.0-beta-63001-01</MicrosoftSourceLinkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<RestoreSources>
|
||||
$(RestoreSources);
|
||||
https://dotnet.myget.org/F/symreader-native/api/v3/index.json;
|
||||
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
|
||||
</RestoreSources>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,3 @@
|
|||
@echo off
|
||||
powershell -ExecutionPolicy ByPass -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*"
|
||||
exit /b %ErrorLevel%
|
|
@ -0,0 +1,314 @@
|
|||
[CmdletBinding(PositionalBinding=$false)]
|
||||
Param(
|
||||
[string] $configuration = "Debug",
|
||||
[string] $projects = "",
|
||||
[string] $verbosity = "minimal",
|
||||
[switch] $restore,
|
||||
[switch] $deployDeps,
|
||||
[switch] $build,
|
||||
[switch] $rebuild,
|
||||
[switch] $deploy,
|
||||
[switch] $test,
|
||||
[switch] $integrationTest,
|
||||
[switch] $performanceTest,
|
||||
[switch] $sign,
|
||||
[switch] $pack,
|
||||
[switch] $publish,
|
||||
[switch] $ci,
|
||||
[switch] $prepareMachine,
|
||||
[switch] $help,
|
||||
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
|
||||
)
|
||||
|
||||
set-strictmode -version 2.0
|
||||
$ErrorActionPreference = "Stop"
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
function Print-Usage() {
|
||||
Write-Host "Common settings:"
|
||||
Write-Host " -configuration <value> Build configuration Debug, Release"
|
||||
Write-Host " -verbosity <value> Msbuild verbosity (q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic])"
|
||||
Write-Host " -help Print help and exit"
|
||||
Write-Host ""
|
||||
|
||||
Write-Host "Actions:"
|
||||
Write-Host " -restore Restore dependencies"
|
||||
Write-Host " -build Build solution"
|
||||
Write-Host " -rebuild Rebuild solution"
|
||||
Write-Host " -deploy Deploy built VSIXes"
|
||||
Write-Host " -deployDeps Deploy dependencies (e.g. VSIXes for integration tests)"
|
||||
Write-Host " -test Run all unit tests in the solution"
|
||||
Write-Host " -pack Package build outputs into NuGet packages and Willow components"
|
||||
Write-Host " -integrationTest Run all integration tests in the solution"
|
||||
Write-Host " -performanceTest Run all performance tests in the solution"
|
||||
Write-Host " -sign Sign build outputs"
|
||||
Write-Host " -publish Publish artifacts (e.g. symbols)"
|
||||
Write-Host ""
|
||||
|
||||
Write-Host "Advanced settings:"
|
||||
Write-Host " -projects <value> Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)"
|
||||
Write-Host " -ci Set when running on CI server"
|
||||
Write-Host " -prepareMachine Prepare machine for CI run"
|
||||
Write-Host ""
|
||||
Write-Host "Command line arguments not listed above are passed thru to msbuild."
|
||||
Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)."
|
||||
}
|
||||
|
||||
if ($help -or (($properties -ne $null) -and ($properties.Contains("/help") -or $properties.Contains("/?")))) {
|
||||
Print-Usage
|
||||
exit 0
|
||||
}
|
||||
|
||||
function Create-Directory([string[]] $path) {
|
||||
if (!(Test-Path $path)) {
|
||||
New-Item -path $path -force -itemType "Directory" | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
function InitializeDotNetCli {
|
||||
# Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism
|
||||
$env:DOTNET_MULTILEVEL_LOOKUP=0
|
||||
|
||||
# Disable first run since we do not need all ASP.NET packages restored.
|
||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
|
||||
# Source Build uses DotNetCoreSdkDir variable
|
||||
if ($env:DotNetCoreSdkDir -ne $null) {
|
||||
$env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir
|
||||
}
|
||||
|
||||
# Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version,
|
||||
# otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues.
|
||||
if (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$($GlobalJson.sdk.version)"))) {
|
||||
$dotnetRoot = $env:DOTNET_INSTALL_DIR
|
||||
} else {
|
||||
$dotnetRoot = Join-Path $RepoRoot ".dotnet"
|
||||
$env:DOTNET_INSTALL_DIR = $dotnetRoot
|
||||
|
||||
if ($restore) {
|
||||
InstallDotNetSdk $dotnetRoot $GlobalJson.sdk.version
|
||||
}
|
||||
}
|
||||
|
||||
return $dotnetRoot
|
||||
}
|
||||
|
||||
function GetDotNetInstallScript([string] $dotnetRoot) {
|
||||
$installScript = "$dotnetRoot\dotnet-install.ps1"
|
||||
if (!(Test-Path $installScript)) {
|
||||
Create-Directory $dotnetRoot
|
||||
Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript
|
||||
}
|
||||
|
||||
return $installScript
|
||||
}
|
||||
|
||||
function InstallDotNetSdk([string] $dotnetRoot, [string] $version) {
|
||||
$installScript = GetDotNetInstallScript $dotnetRoot
|
||||
|
||||
& $installScript -Version $version -InstallDir $dotnetRoot
|
||||
if ($lastExitCode -ne 0) {
|
||||
Write-Host "Failed to install dotnet cli (exit code '$lastExitCode')." -ForegroundColor Red
|
||||
exit $lastExitCode
|
||||
}
|
||||
}
|
||||
|
||||
function InitializeVisualStudioBuild {
|
||||
$inVSEnvironment = !($env:VS150COMNTOOLS -eq $null) -and (Test-Path $env:VS150COMNTOOLS)
|
||||
|
||||
if ($inVSEnvironment) {
|
||||
$vsInstallDir = Join-Path $env:VS150COMNTOOLS "..\.."
|
||||
} else {
|
||||
$vsInstallDir = LocateVisualStudio
|
||||
|
||||
$env:VS150COMNTOOLS = Join-Path $vsInstallDir "Common7\Tools\"
|
||||
$env:VSSDK150Install = Join-Path $vsInstallDir "VSSDK\"
|
||||
$env:VSSDKInstall = Join-Path $vsInstallDir "VSSDK\"
|
||||
}
|
||||
|
||||
return $vsInstallDir;
|
||||
}
|
||||
|
||||
function LocateVisualStudio {
|
||||
$vswhereVersion = $GlobalJson.vswhere.version
|
||||
$toolsRoot = Join-Path $RepoRoot ".tools"
|
||||
$vsWhereDir = Join-Path $toolsRoot "vswhere\$vswhereVersion"
|
||||
$vsWhereExe = Join-Path $vsWhereDir "vswhere.exe"
|
||||
|
||||
if (!(Test-Path $vsWhereExe)) {
|
||||
Create-Directory $vsWhereDir
|
||||
Write-Host "Downloading vswhere"
|
||||
Invoke-WebRequest "https://github.com/Microsoft/vswhere/releases/download/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe
|
||||
}
|
||||
|
||||
$vsInstallDir = & $vsWhereExe -latest -prerelease -property installationPath -requires Microsoft.Component.MSBuild -requires Microsoft.VisualStudio.Component.VSSDK -requires Microsoft.Net.Component.4.6.TargetingPack -requires Microsoft.VisualStudio.Component.Roslyn.Compiler -requires Microsoft.VisualStudio.Component.VSSDK
|
||||
|
||||
if ($lastExitCode -ne 0) {
|
||||
Write-Host "Failed to locate Visual Studio (exit code '$lastExitCode')." -ForegroundColor Red
|
||||
exit $lastExitCode
|
||||
}
|
||||
|
||||
return $vsInstallDir
|
||||
}
|
||||
|
||||
function GetBuildCommand() {
|
||||
if ((Get-Member -InputObject $GlobalJson -Name "sdk") -ne $null) {
|
||||
$dotnetRoot = InitializeDotNetCli
|
||||
|
||||
# by default build with dotnet cli:
|
||||
$buildDriver = Join-Path $dotnetRoot "dotnet.exe"
|
||||
$buildArgs = "msbuild"
|
||||
}
|
||||
|
||||
if ((Get-Member -InputObject $GlobalJson -Name "vswhere") -ne $null) {
|
||||
$vsInstallDir = InitializeVisualStudioBuild
|
||||
|
||||
# Presence of vswhere.version indicates the repo needs to build using VS msbuild:
|
||||
$buildDriver = Join-Path $vsInstallDir "MSBuild\15.0\Bin\msbuild.exe"
|
||||
$buildArgs = "/nodeReuse:$(!$ci)"
|
||||
}
|
||||
|
||||
if ($buildDriver -eq $null) {
|
||||
Write-Host "/global.json must either specify 'sdk.version' or 'vswhere.version'." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
if ($ci) {
|
||||
Write-Host "Using $buildDriver"
|
||||
}
|
||||
|
||||
return $buildDriver, $buildArgs
|
||||
}
|
||||
|
||||
function InitializeToolset([string] $buildDriver, [string]$buildArgs) {
|
||||
$toolsetVersion = $GlobalJson.'msbuild-sdks'.'RoslynTools.RepoToolset'
|
||||
$toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt"
|
||||
|
||||
if (Test-Path $toolsetLocationFile) {
|
||||
$path = Get-Content $toolsetLocationFile -TotalCount 1
|
||||
if (Test-Path $path) {
|
||||
$global:ToolsetBuildProj = $path
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $restore) {
|
||||
Write-Host "Toolset version $toolsetVersion has not been restored."
|
||||
exit 1
|
||||
}
|
||||
|
||||
$proj = Join-Path $ToolsetDir "restore.proj"
|
||||
|
||||
'<Project Sdk="RoslynTools.RepoToolset"/>' | Set-Content $proj
|
||||
& $buildDriver $buildArgs $proj /t:__WriteToolsetLocation /m /nologo /clp:None /warnaserror /bl:$ToolsetRestoreLog /v:$verbosity /p:__ToolsetLocationOutputFile=$toolsetLocationFile
|
||||
|
||||
if ($lastExitCode -ne 0) {
|
||||
Write-Host "Failed to restore toolset (exit code '$lastExitCode')." -ForegroundColor Red
|
||||
Write-Host "Build log: $ToolsetRestoreLog" -ForegroundColor DarkGray
|
||||
exit $lastExitCode
|
||||
}
|
||||
|
||||
$path = Get-Content $toolsetLocationFile -TotalCount 1
|
||||
if (!(Test-Path $path)) {
|
||||
throw "Invalid toolset path: $path"
|
||||
}
|
||||
|
||||
$global:ToolsetBuildProj = $path
|
||||
}
|
||||
|
||||
function InitializeCustomToolset {
|
||||
if (-not $restore) {
|
||||
return
|
||||
}
|
||||
|
||||
$script = Join-Path $EngRoot "RestoreToolset.ps1"
|
||||
|
||||
if (Test-Path $script) {
|
||||
. $script
|
||||
}
|
||||
}
|
||||
|
||||
function Build([string] $buildDriver, [string]$buildArgs) {
|
||||
& $buildDriver $buildArgs $ToolsetBuildProj `
|
||||
/m /nologo /clp:Summary /warnaserror `
|
||||
/v:$verbosity `
|
||||
/bl:$BuildLog `
|
||||
/p:Configuration=$configuration `
|
||||
/p:Projects=$projects `
|
||||
/p:RepoRoot=$RepoRoot `
|
||||
/p:Restore=$restore `
|
||||
/p:DeployDeps=$deployDeps `
|
||||
/p:Build=$build `
|
||||
/p:Rebuild=$rebuild `
|
||||
/p:Deploy=$deploy `
|
||||
/p:Test=$test `
|
||||
/p:Pack=$pack `
|
||||
/p:IntegrationTest=$integrationTest `
|
||||
/p:PerformanceTest=$performanceTest `
|
||||
/p:Sign=$sign `
|
||||
/p:Publish=$publish `
|
||||
/p:CIBuild=$ci `
|
||||
$properties
|
||||
|
||||
if ($lastExitCode -ne 0) {
|
||||
Write-Host "Build log: $BuildLog" -ForegroundColor DarkGray
|
||||
exit $lastExitCode
|
||||
}
|
||||
}
|
||||
|
||||
function Stop-Processes() {
|
||||
Write-Host "Killing running build processes..."
|
||||
Get-Process -Name "msbuild" -ErrorAction SilentlyContinue | Stop-Process
|
||||
Get-Process -Name "dotnet" -ErrorAction SilentlyContinue | Stop-Process
|
||||
Get-Process -Name "vbcscompiler" -ErrorAction SilentlyContinue | Stop-Process
|
||||
}
|
||||
|
||||
try {
|
||||
$RepoRoot = Join-Path $PSScriptRoot "..\.."
|
||||
$EngRoot = Join-Path $PSScriptRoot ".."
|
||||
$ArtifactsDir = Join-Path $RepoRoot "artifacts"
|
||||
$ToolsetDir = Join-Path $ArtifactsDir "toolset"
|
||||
$LogDir = Join-Path (Join-Path $ArtifactsDir $configuration) "log"
|
||||
$BuildLog = Join-Path $LogDir "Build.binlog"
|
||||
$ToolsetRestoreLog = Join-Path $LogDir "ToolsetRestore.binlog"
|
||||
$TempDir = Join-Path (Join-Path $ArtifactsDir $configuration) "tmp"
|
||||
$GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json
|
||||
|
||||
if ($projects -eq "") {
|
||||
$projects = Join-Path $RepoRoot "*.sln"
|
||||
}
|
||||
|
||||
if ($env:NUGET_PACKAGES -eq $null) {
|
||||
# Use local cache on CI to ensure deterministic build,
|
||||
# use global cache in dev builds to avoid cost of downloading packages.
|
||||
$env:NUGET_PACKAGES = if ($ci) { Join-Path $RepoRoot ".packages" }
|
||||
else { Join-Path $env:UserProfile ".nuget\packages" }
|
||||
}
|
||||
|
||||
Create-Directory $ToolsetDir
|
||||
Create-Directory $LogDir
|
||||
|
||||
if ($ci) {
|
||||
Create-Directory $TempDir
|
||||
$env:TEMP = $TempDir
|
||||
$env:TMP = $TempDir
|
||||
}
|
||||
|
||||
$driver, $args = GetBuildCommand
|
||||
InitializeToolset $driver $args
|
||||
InitializeCustomToolset
|
||||
Build $driver $args
|
||||
}
|
||||
catch {
|
||||
Write-Host $_
|
||||
Write-Host $_.Exception
|
||||
Write-Host $_.ScriptStackTrace
|
||||
exit 1
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
if ($ci -and $prepareMachine) {
|
||||
Stop-Processes
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,344 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
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 )"
|
||||
|
||||
help=false
|
||||
restore=false
|
||||
build=false
|
||||
rebuild=false
|
||||
test=false
|
||||
pack=false
|
||||
integration_test=false
|
||||
performance_test=false
|
||||
sign=false
|
||||
public=false
|
||||
ci=false
|
||||
|
||||
projects=''
|
||||
configuration='Debug'
|
||||
prepare_machine=false
|
||||
verbosity='minimal'
|
||||
properties=''
|
||||
|
||||
repo_root="$scriptroot/../.."
|
||||
eng_root="$scriptroot/.."
|
||||
artifacts_dir="$repo_root/artifacts"
|
||||
artifacts_configuration_dir="$artifacts_dir/$configuration"
|
||||
toolset_dir="$artifacts_dir/toolset"
|
||||
log_dir="$artifacts_configuration_dir/log"
|
||||
build_log="$log_dir/Build.binlog"
|
||||
toolset_restore_log="$log_dir/ToolsetRestore.binlog"
|
||||
temp_dir="$artifacts_configuration_dir/tmp"
|
||||
|
||||
global_json_file="$repo_root/global.json"
|
||||
build_driver=""
|
||||
toolset_build_proj=""
|
||||
|
||||
while (($# > 0)); do
|
||||
lowerI="$(echo $1 | awk '{print tolower($0)}')"
|
||||
case $lowerI in
|
||||
--build)
|
||||
build=true
|
||||
shift 1
|
||||
;;
|
||||
--ci)
|
||||
ci=true
|
||||
shift 1
|
||||
;;
|
||||
--configuration)
|
||||
configuration=$2
|
||||
shift 2
|
||||
;;
|
||||
--help)
|
||||
echo "Common settings:"
|
||||
echo " --configuration <value> Build configuration Debug, Release"
|
||||
echo " --verbosity <value> Msbuild verbosity (q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic])"
|
||||
echo " --help Print help and exit"
|
||||
echo ""
|
||||
echo "Actions:"
|
||||
echo " --restore Restore dependencies"
|
||||
echo " --build Build solution"
|
||||
echo " --rebuild Rebuild solution"
|
||||
echo " --test Run all unit tests in the solution"
|
||||
echo " --sign Sign build outputs"
|
||||
echo " --pack Package build outputs into NuGet packages and Willow components"
|
||||
echo ""
|
||||
echo "Advanced settings:"
|
||||
echo " --solution <value> Path to solution to build"
|
||||
echo " --ci Set when running on CI server"
|
||||
echo " --prepareMachine Prepare machine for CI run"
|
||||
echo ""
|
||||
echo "Command line arguments not listed above are passed through to MSBuild."
|
||||
exit 0
|
||||
;;
|
||||
--pack)
|
||||
pack=true
|
||||
shift 1
|
||||
;;
|
||||
--preparemachine)
|
||||
prepare_machine=true
|
||||
shift 1
|
||||
;;
|
||||
--rebuild)
|
||||
rebuild=true
|
||||
shift 1
|
||||
;;
|
||||
--restore)
|
||||
restore=true
|
||||
shift 1
|
||||
;;
|
||||
--sign)
|
||||
sign=true
|
||||
shift 1
|
||||
;;
|
||||
--solution)
|
||||
solution=$2
|
||||
shift 2
|
||||
;;
|
||||
--test)
|
||||
test=true
|
||||
shift 1
|
||||
;;
|
||||
--integrationtest)
|
||||
integration_test=true
|
||||
shift 1
|
||||
;;
|
||||
--performancetest)
|
||||
performance_test=true
|
||||
shift 1
|
||||
;;
|
||||
--publish)
|
||||
publish=true
|
||||
shift 1
|
||||
;;
|
||||
--verbosity)
|
||||
verbosity=$2
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
properties="$properties $1"
|
||||
shift 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# ReadJson [filename] [json key]
|
||||
# Result: Sets 'readjsonvalue' to the value of the provided json key
|
||||
# Note: this method may return unexpected results if there are duplicate
|
||||
# keys in the json
|
||||
function ReadJson {
|
||||
local file=$1
|
||||
local key=$2
|
||||
|
||||
local unamestr="$(uname)"
|
||||
local sedextended='-r'
|
||||
if [[ "$unamestr" == 'Darwin' ]]; then
|
||||
sedextended='-E'
|
||||
fi;
|
||||
|
||||
readjsonvalue="$(grep -m 1 "\"$key\"" $file | sed $sedextended 's/^ *//;s/.*: *"//;s/",?//')"
|
||||
if [[ ! "$readjsonvalue" ]]; then
|
||||
echo "Error: Cannot find \"$key\" in $file" >&2;
|
||||
ExitWithExitCode 1
|
||||
fi;
|
||||
}
|
||||
|
||||
function InitializeDotNetCli {
|
||||
# Disable first run since we want to control all package sources
|
||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
|
||||
# Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism
|
||||
export DOTNET_MULTILEVEL_LOOKUP=0
|
||||
|
||||
# Source Build uses DotNetCoreSdkDir variable
|
||||
if [[ -n "$DotNetCoreSdkDir" ]]; then
|
||||
export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir"
|
||||
fi
|
||||
|
||||
ReadJson "$global_json_file" "version"
|
||||
local dotnet_sdk_version="$readjsonvalue"
|
||||
local dotnet_root=""
|
||||
|
||||
# Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version,
|
||||
# otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues.
|
||||
if [[ -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then
|
||||
dotnet_root="$DOTNET_INSTALL_DIR"
|
||||
else
|
||||
dotnet_root="$repo_root/.dotnet"
|
||||
export DOTNET_INSTALL_DIR="$dotnet_root"
|
||||
|
||||
if [[ "$restore" == true ]]; then
|
||||
InstallDotNetSdk $dotnet_root $dotnet_sdk_version
|
||||
fi
|
||||
fi
|
||||
|
||||
build_driver="$dotnet_root/dotnet"
|
||||
}
|
||||
|
||||
function InstallDotNetSdk {
|
||||
local root=$1
|
||||
local version=$2
|
||||
|
||||
local install_script=`GetDotNetInstallScript $root`
|
||||
|
||||
bash "$install_script" --version $version --install-dir $root
|
||||
local lastexitcode=$?
|
||||
|
||||
if [[ $lastexitcode != 0 ]]; then
|
||||
echo "Failed to install dotnet SDK (exit code '$lastexitcode')."
|
||||
ExitWithExitCode $lastexitcode
|
||||
fi
|
||||
}
|
||||
|
||||
function GetDotNetInstallScript {
|
||||
local root=$1
|
||||
local install_script="$root/dotnet-install.sh"
|
||||
|
||||
if [[ ! -a "$install_script" ]]; then
|
||||
mkdir -p "$root"
|
||||
|
||||
# Use curl if available, otherwise use wget
|
||||
if command -v curl > /dev/null; then
|
||||
curl "https://dot.net/v1/dotnet-install.sh" -sSL --retry 10 --create-dirs -o "$install_script"
|
||||
else
|
||||
wget -q -O "$install_script" "https://dot.net/v1/dotnet-install.sh"
|
||||
fi
|
||||
fi
|
||||
|
||||
# return value
|
||||
echo "$install_script"
|
||||
}
|
||||
|
||||
function InitializeToolset {
|
||||
ReadJson $global_json_file "RoslynTools.RepoToolset"
|
||||
local toolset_version=$readjsonvalue
|
||||
local toolset_location_file="$toolset_dir/$toolset_version.txt"
|
||||
|
||||
if [[ -a "$toolset_location_file" ]]; then
|
||||
local path=`cat $toolset_location_file`
|
||||
if [[ -a "$path" ]]; then
|
||||
toolset_build_proj=$path
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$restore" != true ]]; then
|
||||
echo "Toolset version $toolsetVersion has not been restored."
|
||||
ExitWithExitCode 2
|
||||
fi
|
||||
|
||||
local proj="$toolset_dir/restore.proj"
|
||||
|
||||
echo '<Project Sdk="RoslynTools.RepoToolset"/>' > $proj
|
||||
"$build_driver" msbuild $proj /t:__WriteToolsetLocation /m /nologo /clp:None /warnaserror /bl:$toolset_restore_log /v:$verbosity /p:__ToolsetLocationOutputFile=$toolset_location_file
|
||||
local lastexitcode=$?
|
||||
|
||||
if [[ $lastexitcode != 0 ]]; then
|
||||
echo "Failed to restore toolset (exit code '$lastexitcode'). See log: $toolset_restore_log"
|
||||
ExitWithExitCode $lastexitcode
|
||||
fi
|
||||
|
||||
toolset_build_proj=`cat $toolset_location_file`
|
||||
|
||||
if [[ ! -a "$toolset_build_proj" ]]; then
|
||||
echo "Invalid toolset path: $toolset_build_proj"
|
||||
ExitWithExitCode 3
|
||||
fi
|
||||
}
|
||||
|
||||
function InitializeCustomToolset {
|
||||
local script="$eng_root/RestoreToolset.sh"
|
||||
|
||||
if [[ -a "$script" ]]; then
|
||||
. "$script"
|
||||
fi
|
||||
}
|
||||
|
||||
function Build {
|
||||
"$build_driver" msbuild $toolset_build_proj \
|
||||
/m /nologo /clp:Summary /warnaserror \
|
||||
/v:$verbosity \
|
||||
/bl:$build_log \
|
||||
/p:Configuration=$configuration \
|
||||
/p:Projects=$projects \
|
||||
/p:RepoRoot="$repo_root" \
|
||||
/p:Restore=$restore \
|
||||
/p:Build=$build \
|
||||
/p:Rebuild=$rebuild \
|
||||
/p:Deploy=$deploy \
|
||||
/p:Test=$test \
|
||||
/p:Pack=$pack \
|
||||
/p:IntegrationTest=$integration_test \
|
||||
/p:PerformanceTest=$performance_test \
|
||||
/p:Sign=$sign \
|
||||
/p:Publish=$publish \
|
||||
/p:CIBuild=$ci \
|
||||
$properties
|
||||
local lastexitcode=$?
|
||||
|
||||
if [[ $lastexitcode != 0 ]]; then
|
||||
echo "Failed to build $toolset_build_proj"
|
||||
ExitWithExitCode $lastexitcode
|
||||
fi
|
||||
}
|
||||
|
||||
function ExitWithExitCode {
|
||||
if [[ "$ci" == true && "$prepare_machine" == true ]]; then
|
||||
StopProcesses
|
||||
fi
|
||||
exit $1
|
||||
}
|
||||
|
||||
function StopProcesses {
|
||||
echo "Killing running build processes..."
|
||||
pkill -9 "dotnet"
|
||||
pkill -9 "vbcscompiler"
|
||||
}
|
||||
|
||||
function Main {
|
||||
# HOME may not be defined in some scenarios, but it is required by NuGet
|
||||
if [[ -z $HOME ]]; then
|
||||
export HOME="$repo_root/artifacts/.home/"
|
||||
mkdir -p "$HOME"
|
||||
fi
|
||||
|
||||
if [[ -z $projects ]]; then
|
||||
projects="$repo_root/*.sln"
|
||||
fi
|
||||
|
||||
if [[ -z $NUGET_PACKAGES ]]; then
|
||||
if [[ $ci ]]; then
|
||||
export NUGET_PACKAGES="$repo_root/.packages"
|
||||
else
|
||||
export NUGET_PACKAGES="$HOME/.nuget/packages"
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p "$toolset_dir"
|
||||
mkdir -p "$log_dir"
|
||||
|
||||
if [[ $ci ]]; then
|
||||
mkdir -p "$temp_dir"
|
||||
export TEMP="$temp_dir"
|
||||
export TMP="$temp_dir"
|
||||
fi
|
||||
|
||||
InitializeDotNetCli
|
||||
InitializeToolset
|
||||
InitializeCustomToolset
|
||||
|
||||
Build
|
||||
ExitWithExitCode $?
|
||||
}
|
||||
|
||||
Main
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
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 )"
|
||||
|
||||
. "$scriptroot/build.sh" --restore --build --test --pack --publish --ci $@
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "2.1.300-rtm-008866"
|
||||
},
|
||||
"msbuild-sdks": {
|
||||
"RoslynTools.RepoToolset": "1.0.0-beta2-63011-08"
|
||||
}
|
||||
}
|
27
netci.groovy
27
netci.groovy
|
@ -29,28 +29,31 @@ static addXUnitDotNETResults(def job, def configName) {
|
|||
Utilities.addXUnitDotNETResults(job, resultFilePattern, skipIfNoTestFiles)
|
||||
}
|
||||
|
||||
static addBuildSteps(def job, def projectName, def opsysName, def configName, def isPR) {
|
||||
def buildJobName = getJobName(opsysName, configName)
|
||||
static addBuildSteps(def job, def projectName, def os, def configName, def isPR) {
|
||||
def buildJobName = getJobName(os, configName)
|
||||
def buildFullJobName = Utilities.getFullJobName(projectName, buildJobName, isPR)
|
||||
|
||||
job.with {
|
||||
steps {
|
||||
batchFile(""".\\CIBuild.cmd -configuration ${configName} -prepareMachine""")
|
||||
if (os == "Windows_NT") {
|
||||
batchFile(""".\\eng\\common\\CIBuild.cmd -configuration ${configName} -prepareMachine""")
|
||||
} else {
|
||||
shell("./eng/common/cibuild.sh --configuration ${configName} --prepareMachine")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[true, false].each { isPR ->
|
||||
['windows'].each { opsysName ->
|
||||
['debug', 'release'].each { configName ->
|
||||
['Ubuntu16.04', 'Windows_NT'].each { os ->
|
||||
['Debug', 'Release'].each { configName ->
|
||||
def projectName = GithubProject
|
||||
|
||||
def branchName = GithubBranchName
|
||||
|
||||
def filesToArchive = "**/artifacts/${configName}/**"
|
||||
def filesToExclude = "**/artifacts/${configName}/obj/**"
|
||||
|
||||
def jobName = getJobName(opsysName, configName)
|
||||
def jobName = getJobName(os, configName)
|
||||
def fullJobName = Utilities.getFullJobName(projectName, jobName, isPR)
|
||||
def myJob = job(fullJobName)
|
||||
|
||||
|
@ -62,12 +65,16 @@ static addBuildSteps(def job, def projectName, def opsysName, def configName, de
|
|||
Utilities.addGithubPushTrigger(myJob)
|
||||
}
|
||||
|
||||
addArchival(myJob, filesToArchive, filesToExclude)
|
||||
addArchival(myJob, filesToArchive, "")
|
||||
addXUnitDotNETResults(myJob, configName)
|
||||
|
||||
Utilities.setMachineAffinity(myJob, 'Windows_NT', 'latest-dev15-3')
|
||||
if (os == 'Windows_NT') {
|
||||
Utilities.setMachineAffinity(myJob, os, 'latest-dev15-3')
|
||||
} else {
|
||||
Utilities.setMachineAffinity(myJob, os, 'latest-or-auto')
|
||||
}
|
||||
|
||||
addBuildSteps(myJob, projectName, opsysName, configName, isPR)
|
||||
addBuildSteps(myJob, projectName, os, configName, isPR)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<!-- Only specify feed for RepoToolset SDK (see https://github.com/Microsoft/msbuild/issues/2982) -->
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="roslyn-tools" value="https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
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 )"
|
||||
"$scriptroot/eng/common/build.sh" --restore $@
|
|
@ -1,24 +1,13 @@
|
|||
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
|
||||
<Project>
|
||||
<Import Project="..\Directory.Build.props"/>
|
||||
<PropertyGroup>
|
||||
<ImportNetSdkFromRepoToolset>false</ImportNetSdkFromRepoToolset>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- This file is imported by all projects at the beginning of the project files -->
|
||||
<Import Project="$(RepoToolsetDir)Settings.props" />
|
||||
<Import Project="Sdk.props" Sdk="RoslynTools.RepoToolset" />
|
||||
|
||||
<PropertyGroup>
|
||||
<LangVersion>Latest</LangVersion>
|
||||
|
||||
<!--
|
||||
TODO: dotnet cli currently doesn't support building against net20 out of the box.
|
||||
https://github.com/Microsoft/msbuild/issues/1333
|
||||
-->
|
||||
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net20'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
|
||||
|
||||
<!--
|
||||
TODO: Can't use embedded PDBs with LUT:
|
||||
https://github.com/dotnet/testimpact/issues/1877
|
||||
-->
|
||||
<DebugType Condition="'$(BuildingForLiveUnitTesting)' != 'true'">embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
|
||||
<Project>
|
||||
<!-- This file is imported by all projects at the end of the project files -->
|
||||
<Import Project="$(RepoToolsetDir)Imports.targets" />
|
||||
</Project>
|
||||
<Import Project="Sdk.targets" Sdk="RoslynTools.RepoToolset" />
|
||||
</Project>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.DiaSymReader.Native" Version="$(MicrosoftDiaSymReaderNativeVersion)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
|
||||
<Content Include="$(NuGetPackageRoot)\Microsoft.DiaSymReader.Native\$(MicrosoftDiaSymReaderNativeVersion)\runtimes\win\native\Microsoft.DiaSymReader.Native.x86.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>false</Visible>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.DiaSymReader.Tools;
|
||||
using Roslyn.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DiaSymReader.Native.UnitTests
|
||||
|
@ -11,7 +12,7 @@ namespace Microsoft.DiaSymReader.Native.UnitTests
|
|||
{
|
||||
public interface ISymUnmanagedReaderX : ISymUnmanagedReader5 { }
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(WindowsOnly))]
|
||||
public void Create()
|
||||
{
|
||||
// TODO: Ideally we would run each of these tests in a separate process so they don't interfere with each other.
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.DiaSymReader.Native" Version="$(MicrosoftDiaSymReaderNativeVersion)" />
|
||||
<PackageReference Include="System.ValueTuple" Version="$(SystemValueTupleVersion)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<!-- Copy DSRN to a subdirectory of the output directory, so that we can test alternative load path -->
|
||||
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
|
||||
<!-- Copy DSRN to a subdirectory of the output directory, so that we can test alternative load path -->
|
||||
<Content Include="$(NuGetPackageRoot)\Microsoft.DiaSymReader.Native\$(MicrosoftDiaSymReaderNativeVersion)\runtimes\win\native\Microsoft.DiaSymReader.Native.x86.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>false</Visible>
|
||||
|
|
|
@ -7,16 +7,19 @@ using Microsoft.DiaSymReader.Tools;
|
|||
using Roslyn.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DiaSymReader.Native.UnitTests
|
||||
namespace Microsoft.DiaSymReader.UnitTests
|
||||
{
|
||||
public class SymUnmanagedFactoryTests
|
||||
{
|
||||
internal static void SetLoadPath()
|
||||
=> Environment.SetEnvironmentVariable("MICROSOFT_DIASYMREADER_NATIVE_ALT_LOAD_PATH", Path.Combine(Path.GetDirectoryName(typeof(SymUnmanagedFactoryTests).GetTypeInfo().Assembly.Location), "DSRN"));
|
||||
|
||||
static SymUnmanagedFactoryTests()
|
||||
{
|
||||
Environment.SetEnvironmentVariable("MICROSOFT_DIASYMREADER_NATIVE_ALT_LOAD_PATH", Path.Combine(Path.GetDirectoryName(typeof(SymUnmanagedFactoryTests).GetTypeInfo().Assembly.Location), "DSRN"));
|
||||
SetLoadPath();
|
||||
}
|
||||
|
||||
[ConditionalFact(typeof(DesktopOnly))]
|
||||
[ConditionalFact(typeof(DesktopOnly), Skip = "https://github.com/dotnet/symreader/issues/96")]
|
||||
public void Create()
|
||||
{
|
||||
// TODO: Ideally we would run each of these tests in a separate process so they don't interfere with each other.
|
||||
|
@ -51,5 +54,11 @@ namespace Microsoft.DiaSymReader.Native.UnitTests
|
|||
Assert.NotNull(SymUnmanagedWriterFactory.CreateWriter(DummySymWriterMetadataProvider.Instance,
|
||||
SymUnmanagedWriterCreationOptions.UseAlternativeLoadPath | SymUnmanagedWriterCreationOptions.UseComRegistry | SymUnmanagedWriterCreationOptions.Deterministic));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetEnvironmentVariable()
|
||||
{
|
||||
Assert.NotNull(SymUnmanagedFactory.GetEnvironmentVariable("MICROSOFT_DIASYMREADER_NATIVE_ALT_LOAD_PATH"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Roslyn.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DiaSymReader.UnitTests
|
||||
{
|
||||
public class SymUnmanagedWriterTests
|
||||
{
|
||||
static SymUnmanagedWriterTests() => SymUnmanagedFactoryTests.SetLoadPath();
|
||||
|
||||
[ConditionalFact(typeof(WindowsOnly))]
|
||||
public void Deterministic()
|
||||
{
|
||||
var lang = new Guid("00000000-0000-0000-0000-000000000001");
|
||||
var vendor = new Guid("00000000-0000-0000-0000-000000000002");
|
||||
var type = new Guid("00000000-0000-0000-0000-000000000003");
|
||||
var pdbStream = new MemoryStream();
|
||||
|
||||
var metadataProvider = new TestSymWriterMetadataProvider(
|
||||
new Dictionary<int, (string Name, int DeclaringType)>()
|
||||
{
|
||||
{ 0x06000001, ("M", 0x03000001) }
|
||||
},
|
||||
new Dictionary<int, (string Namespace, string Name, TypeAttributes Attributes)>()
|
||||
{
|
||||
{ 0x03000001, ("N", "C", TypeAttributes.Class) }
|
||||
});
|
||||
|
||||
Guid pdbId;
|
||||
uint pdbStamp;
|
||||
int pdbAge;
|
||||
|
||||
using (var writer = SymUnmanagedWriterFactory.CreateWriter(
|
||||
metadataProvider,
|
||||
SymUnmanagedWriterCreationOptions.Deterministic | SymUnmanagedWriterCreationOptions.UseAlternativeLoadPath))
|
||||
{
|
||||
var docIndex = writer.DefineDocument("doc", lang, vendor, type, algorithmId: default, checksum: null, source: null);
|
||||
|
||||
writer.OpenMethod(0x06000001);
|
||||
|
||||
writer.DefineSequencePoints(
|
||||
docIndex,
|
||||
count: 1,
|
||||
offsets: new[] { 0 },
|
||||
startLines: new[] { 1 },
|
||||
startColumns: new[] { 4 },
|
||||
endLines: new[] { 1 },
|
||||
endColumns: new[] { 10 });
|
||||
|
||||
writer.CloseMethod();
|
||||
writer.UpdateSignature(default, 0, 1);
|
||||
writer.GetSignature(out pdbId, out pdbStamp, out pdbAge);
|
||||
writer.WriteTo(pdbStream);
|
||||
}
|
||||
|
||||
Assert.Equal(default, pdbId);
|
||||
Assert.Equal(0U, pdbStamp);
|
||||
Assert.Equal(1, pdbAge);
|
||||
|
||||
var symReader = SymUnmanagedReaderFactory.CreateReader<ISymUnmanagedReader5>(pdbStream, metadataProvider, SymUnmanagedReaderCreationOptions.UseAlternativeLoadPath);
|
||||
var docs = symReader.GetDocuments();
|
||||
AssertEx.Equal(new[] { "doc 00000000-0000-0000-0000-000000000001" }, docs.Select(d => $"{d.GetName()} {d.GetLanguage()}"));
|
||||
|
||||
var method = symReader.GetMethod(0x06000001);
|
||||
AssertEx.Equal(new[] { "IL_0000: (1, 4)-(1, 10)" }, method.GetSequencePoints().Select(s => $"IL_{s.Offset:X4}: ({s.StartLine}, {s.StartColumn})-({s.EndLine}, {s.EndColumn})"));
|
||||
|
||||
Assert.Equal(HResult.S_OK, symReader.MatchesModule(pdbId, pdbStamp, pdbAge, out bool result));
|
||||
Assert.True(result);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Microsoft.DiaSymReader.UnitTests
|
||||
{
|
||||
internal class TestSymWriterMetadataProvider : ISymWriterMetadataProvider, ISymReaderMetadataProvider
|
||||
{
|
||||
private readonly Dictionary<int, (string Name, int DeclaringType)> _methods;
|
||||
private readonly Dictionary<int, (string Namespace, string Name, TypeAttributes Attributes)> _types;
|
||||
|
||||
public TestSymWriterMetadataProvider(
|
||||
Dictionary<int, (string Name, int DeclaringType)> methods,
|
||||
Dictionary<int, (string Namespace, string Name, TypeAttributes Attributes)> types)
|
||||
{
|
||||
_methods = methods;
|
||||
_types = types;
|
||||
}
|
||||
|
||||
public bool TryGetEnclosingType(int nestedTypeToken, out int enclosingTypeToken)
|
||||
{
|
||||
enclosingTypeToken = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetMethodInfo(int methodDefinitionToken, out string methodName, out int declaringTypeToken)
|
||||
{
|
||||
var result = _methods.TryGetValue(methodDefinitionToken, out var entry);
|
||||
methodName = entry.Name;
|
||||
declaringTypeToken = entry.DeclaringType;
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool TryGetTypeDefinitionInfo(int typeDefinitionToken, out string namespaceName, out string typeName, out TypeAttributes attributes)
|
||||
{
|
||||
var result = _types.TryGetValue(typeDefinitionToken, out var entry);
|
||||
namespaceName = entry.Namespace;
|
||||
typeName = entry.Name;
|
||||
attributes = entry.Attributes;
|
||||
return result;
|
||||
}
|
||||
|
||||
public unsafe bool TryGetStandaloneSignature(int standaloneSignatureToken, out byte* signature, out int length)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool TryGetTypeReferenceInfo(int typeReferenceToken, out string namespaceName, out string typeName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -64,7 +64,7 @@ namespace Microsoft.DiaSymReader
|
|||
foreach (var method in typeof(Environment).GetTypeInfo().GetDeclaredMethods("GetEnvironmentVariable"))
|
||||
{
|
||||
var parameters = method.GetParameters();
|
||||
if (parameters.Length == 1 && parameters[0].GetType() == typeof(string))
|
||||
if (parameters.Length == 1 && parameters[0].ParameterType == typeof(string))
|
||||
{
|
||||
return (Func<string, string>)method.CreateDelegate(typeof(Func<string, string>));
|
||||
}
|
||||
|
@ -78,7 +78,8 @@ namespace Microsoft.DiaSymReader
|
|||
});
|
||||
#endif
|
||||
|
||||
private static string GetEnvironmentVariable(string name)
|
||||
// internal for testing
|
||||
internal static string GetEnvironmentVariable(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -117,7 +118,11 @@ namespace Microsoft.DiaSymReader
|
|||
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
|
||||
}
|
||||
|
||||
#if NET20 || NETSTANDARD1_1
|
||||
var creator = (NativeFactory)Marshal.GetDelegateForFunctionPointer(createAddress, typeof(NativeFactory));
|
||||
#else
|
||||
var creator = Marshal.GetDelegateForFunctionPointer<NativeFactory>(createAddress);
|
||||
#endif
|
||||
creator(ref clsid, out instance);
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -7,8 +7,6 @@ using STATSTG = System.Runtime.InteropServices.ComTypes.STATSTG;
|
|||
|
||||
namespace Microsoft.DiaSymReader
|
||||
{
|
||||
// TODO: Copied from Roslyn. Share.
|
||||
|
||||
/// <summary>
|
||||
/// This is a re-definition of COM's IStream interface. The important change is that
|
||||
/// the Read and Write methods take an <see cref="IntPtr"/> instead of a byte[] to avoid the
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace Microsoft.DiaSymReader
|
|||
|
||||
_documentWriters.Add(documentWriter);
|
||||
|
||||
if (algorithmId != default(Guid) && checksum.Length > 0)
|
||||
if (algorithmId != default && checksum.Length > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
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 )"
|
||||
"$scriptroot/eng/common/build.sh" --test $@
|
Загрузка…
Ссылка в новой задаче