diff --git a/.appveyor.yml b/.appveyor.yml
index 31efd819..5057e312 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -7,7 +7,7 @@ branches:
- dev
- /^(.*\/)?ci-.*$/
build_script:
- - ps: .\build.ps1
+ - ps: .\run.ps1 build
clone_depth: 1
environment:
global:
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..2641e32c
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,10 @@
+root = true
+indent_style = space
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.{xml,csproj,props,targets,config}]
+indent_size = 2
+
+[*.cs]
+indent_size = 4
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index b10be142..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-language: csharp
-sudo: false
-dist: trusty
-env:
- global:
- - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
- - DOTNET_CLI_TELEMETRY_OPTOUT: 1
-mono: none
-os:
- - linux
- - osx
-osx_image: xcode8.2
-addons:
- apt:
- packages:
- - libunwind8
-branches:
- only:
- - master
- - release
- - dev
- - /^(.*\/)?ci-.*$/
-before_install:
- - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi
-script:
- - ./build.sh
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 64ff041d..00000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,4 +0,0 @@
-Contributing
-======
-
-Information on contributing to this repo is in the [Contributing Guide](https://github.com/aspnet/Home/blob/dev/CONTRIBUTING.md) in the Home repo.
diff --git a/CommandLineUtils.sln b/CommandLineUtils.sln
new file mode 100644
index 00000000..f44d0205
--- /dev/null
+++ b/CommandLineUtils.sln
@@ -0,0 +1,56 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26124.0
+MinimumVisualStudioVersion = 15.0.26124.0
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{95D4B35E-0A21-4D64-8BAF-27DD6C019FC5}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "McMaster.Extensions.CommandLineUtils", "src\CommandLineUtils\McMaster.Extensions.CommandLineUtils.csproj", "{CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{C4842A1B-019E-40FF-A396-CF5AFDE8FA54}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "McMaster.Extensions.CommandLineUtils.Tests", "test\CommandLineUtils.Tests\McMaster.Extensions.CommandLineUtils.Tests.csproj", "{1258544C-1FDE-4810-9A1B-189A925E9B45}"
+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
+ {CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E}.Debug|x64.ActiveCfg = Debug|x64
+ {CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E}.Debug|x64.Build.0 = Debug|x64
+ {CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E}.Debug|x86.ActiveCfg = Debug|x86
+ {CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E}.Debug|x86.Build.0 = Debug|x86
+ {CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E}.Release|x64.ActiveCfg = Release|x64
+ {CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E}.Release|x64.Build.0 = Release|x64
+ {CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E}.Release|x86.ActiveCfg = Release|x86
+ {CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E}.Release|x86.Build.0 = Release|x86
+ {1258544C-1FDE-4810-9A1B-189A925E9B45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1258544C-1FDE-4810-9A1B-189A925E9B45}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1258544C-1FDE-4810-9A1B-189A925E9B45}.Debug|x64.ActiveCfg = Debug|x64
+ {1258544C-1FDE-4810-9A1B-189A925E9B45}.Debug|x64.Build.0 = Debug|x64
+ {1258544C-1FDE-4810-9A1B-189A925E9B45}.Debug|x86.ActiveCfg = Debug|x86
+ {1258544C-1FDE-4810-9A1B-189A925E9B45}.Debug|x86.Build.0 = Debug|x86
+ {1258544C-1FDE-4810-9A1B-189A925E9B45}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1258544C-1FDE-4810-9A1B-189A925E9B45}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1258544C-1FDE-4810-9A1B-189A925E9B45}.Release|x64.ActiveCfg = Release|x64
+ {1258544C-1FDE-4810-9A1B-189A925E9B45}.Release|x64.Build.0 = Release|x64
+ {1258544C-1FDE-4810-9A1B-189A925E9B45}.Release|x86.ActiveCfg = Release|x86
+ {1258544C-1FDE-4810-9A1B-189A925E9B45}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {CBCFAFF3-A3B1-4C41-B2D1-092BF7307A4E} = {95D4B35E-0A21-4D64-8BAF-27DD6C019FC5}
+ {1258544C-1FDE-4810-9A1B-189A925E9B45} = {C4842A1B-019E-40FF-A396-CF5AFDE8FA54}
+ EndGlobalSection
+EndGlobal
diff --git a/Common.sln b/Common.sln
deleted file mode 100644
index a60f05bf..00000000
--- a/Common.sln
+++ /dev/null
@@ -1,105 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26814.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{FEAA3936-5906-4383-B750-F07FE1B156C5}"
- ProjectSection(SolutionItems) = preProject
- src\Directory.Build.props = src\Directory.Build.props
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{6878D8F1-6DCE-4677-AA1A-4D14BA6D2D60}"
- ProjectSection(SolutionItems) = preProject
- test\Directory.Build.props = test\Directory.Build.props
- EndProjectSection
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Internal.Test", "test\Microsoft.Extensions.Internal.Test\Microsoft.Extensions.Internal.Test.csproj", "{D81EAC23-B515-49FB-B04B-285A9C1C6583}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Primitives", "src\Microsoft.Extensions.Primitives\Microsoft.Extensions.Primitives.csproj", "{711B5F84-1EDC-49A7-9643-766CE93A0466}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Primitives.Tests", "test\Microsoft.Extensions.Primitives.Tests\Microsoft.Extensions.Primitives.Tests.csproj", "{61F72E92-B3AE-4A10-B838-44F80AED40AE}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.ObjectPool", "src\Microsoft.Extensions.ObjectPool\Microsoft.Extensions.ObjectPool.csproj", "{C87DA599-4C1F-4B91-9C77-A10E79CD8701}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.ObjectPool.Test", "test\Microsoft.Extensions.ObjectPool.Test\Microsoft.Extensions.ObjectPool.Test.csproj", "{DA1D70F4-717A-4440-B388-B5BEE670C14D}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.CommandLineUtils.Tests", "test\Microsoft.Extensions.CommandLineUtils.Tests\Microsoft.Extensions.CommandLineUtils.Tests.csproj", "{7E6564C3-04E3-418C-B96A-463FE2906F09}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testassets", "testassets", "{8668B1D5-9C54-49CA-8446-18040B4C7D15}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThrowingLibrary", "testassets\ThrowingLibrary\ThrowingLibrary.csproj", "{E1586801-D345-43C7-BC4B-9D4A83101B6C}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3639F4F0-86E4-4EA1-9A1C-F9FE0337016B}"
- ProjectSection(SolutionItems) = preProject
- .appveyor.yml = .appveyor.yml
- .gitattributes = .gitattributes
- .gitignore = .gitignore
- .travis.yml = .travis.yml
- build.cmd = build.cmd
- build.ps1 = build.ps1
- build.sh = build.sh
- CONTRIBUTING.md = CONTRIBUTING.md
- Directory.Build.props = Directory.Build.props
- Directory.Build.targets = Directory.Build.targets
- LICENSE.txt = LICENSE.txt
- NuGet.config = NuGet.config
- NuGetPackageVerifier.json = NuGetPackageVerifier.json
- README.md = README.md
- version.xml = version.xml
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{D2D23857-741F-4E7B-A8E1-492CC8F38FB0}"
- ProjectSection(SolutionItems) = preProject
- build\repo.props = build\repo.props
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {D81EAC23-B515-49FB-B04B-285A9C1C6583}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D81EAC23-B515-49FB-B04B-285A9C1C6583}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D81EAC23-B515-49FB-B04B-285A9C1C6583}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D81EAC23-B515-49FB-B04B-285A9C1C6583}.Release|Any CPU.Build.0 = Release|Any CPU
- {711B5F84-1EDC-49A7-9643-766CE93A0466}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {711B5F84-1EDC-49A7-9643-766CE93A0466}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {711B5F84-1EDC-49A7-9643-766CE93A0466}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {711B5F84-1EDC-49A7-9643-766CE93A0466}.Release|Any CPU.Build.0 = Release|Any CPU
- {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {61F72E92-B3AE-4A10-B838-44F80AED40AE}.Release|Any CPU.Build.0 = Release|Any CPU
- {C87DA599-4C1F-4B91-9C77-A10E79CD8701}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C87DA599-4C1F-4B91-9C77-A10E79CD8701}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C87DA599-4C1F-4B91-9C77-A10E79CD8701}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C87DA599-4C1F-4B91-9C77-A10E79CD8701}.Release|Any CPU.Build.0 = Release|Any CPU
- {DA1D70F4-717A-4440-B388-B5BEE670C14D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DA1D70F4-717A-4440-B388-B5BEE670C14D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DA1D70F4-717A-4440-B388-B5BEE670C14D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DA1D70F4-717A-4440-B388-B5BEE670C14D}.Release|Any CPU.Build.0 = Release|Any CPU
- {7E6564C3-04E3-418C-B96A-463FE2906F09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7E6564C3-04E3-418C-B96A-463FE2906F09}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7E6564C3-04E3-418C-B96A-463FE2906F09}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7E6564C3-04E3-418C-B96A-463FE2906F09}.Release|Any CPU.Build.0 = Release|Any CPU
- {E1586801-D345-43C7-BC4B-9D4A83101B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E1586801-D345-43C7-BC4B-9D4A83101B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E1586801-D345-43C7-BC4B-9D4A83101B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E1586801-D345-43C7-BC4B-9D4A83101B6C}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {D81EAC23-B515-49FB-B04B-285A9C1C6583} = {6878D8F1-6DCE-4677-AA1A-4D14BA6D2D60}
- {711B5F84-1EDC-49A7-9643-766CE93A0466} = {FEAA3936-5906-4383-B750-F07FE1B156C5}
- {61F72E92-B3AE-4A10-B838-44F80AED40AE} = {6878D8F1-6DCE-4677-AA1A-4D14BA6D2D60}
- {C87DA599-4C1F-4B91-9C77-A10E79CD8701} = {FEAA3936-5906-4383-B750-F07FE1B156C5}
- {DA1D70F4-717A-4440-B388-B5BEE670C14D} = {6878D8F1-6DCE-4677-AA1A-4D14BA6D2D60}
- {7E6564C3-04E3-418C-B96A-463FE2906F09} = {6878D8F1-6DCE-4677-AA1A-4D14BA6D2D60}
- {E1586801-D345-43C7-BC4B-9D4A83101B6C} = {8668B1D5-9C54-49CA-8446-18040B4C7D15}
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {371030CF-B541-4BA9-9F54-3C7563415CF1}
- EndGlobalSection
-EndGlobal
diff --git a/Directory.Build.props b/Directory.Build.props
index fd608eea..6a3953d2 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,15 +1,20 @@
-
- Microsoft .NET Extensions
- https://github.com/aspnet/Common
+ CommandLineUtils
+ https://github.com/natemcmaster/CommandLineUtils
git
- $(MSBuildThisFileDirectory)build\Key.snk
+
+ $(MSBuildThisFileDirectory)build\StrongName.snk
true
true
- $(VersionSuffix)-$(BuildNumber)
+
true
+
+ 2.0.0
+ alpha
+ $(APPVEYOR_BUILD_NUMBER)
+ $(VersionSuffix)-$(BuildNumber)
diff --git a/Directory.Build.targets b/Directory.Build.targets
index 9989b104..8c119d54 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -1,14 +1,2 @@
-
-
-
- <_BootstrapperFile Condition=" $([MSBuild]::IsOSUnixLike()) ">build.sh
- <_BootstrapperFile Condition="! $([MSBuild]::IsOSUnixLike()) ">build.cmd
- <_BootstrapperError>
- Package references have not been pinned. Run './$(_BootstrapperFile) /t:Pin'.
- Also, you can run './$(_BootstrapperFile) /t:Restore' which will pin *and* restore packages. '$(_BootstrapperFile)' can be found in '$(MSBuildThisFileDirectory)'.
-
-
-
-
-
+
diff --git a/NuGet.config b/NuGet.config
index 20060c93..7604d005 100644
--- a/NuGet.config
+++ b/NuGet.config
@@ -2,7 +2,6 @@
-
diff --git a/NuGetPackageVerifier.json b/NuGetPackageVerifier.json
deleted file mode 100644
index 774b3daa..00000000
--- a/NuGetPackageVerifier.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "adx-nonshipping": {
- "rules": [],
- "packages": {
- "Microsoft.Extensions.ClosedGenericMatcher.Sources": {},
- "Microsoft.Extensions.CommandLineUtils.Sources": {},
- "Microsoft.Extensions.CopyOnWriteDictionary.Sources": {},
- "Microsoft.Extensions.HashCodeCombiner.Sources": {},
- "Microsoft.Extensions.ObjectMethodExecutor.Sources": {},
- "Microsoft.Extensions.Process.Sources": {},
- "Microsoft.Extensions.PropertyActivator.Sources": {},
- "Microsoft.Extensions.PropertyHelper.Sources": {},
- "Microsoft.Extensions.RazorViews.Sources": {},
- "Microsoft.Extensions.SecurityHelper.Sources": {},
- "Microsoft.Extensions.StackTrace.Sources": {},
- "Microsoft.Extensions.TypeNameHelper.Sources": {},
- "Microsoft.Extensions.WebEncoders.Sources": {}
- }
- },
- "Default": {
- "rules": [
- "DefaultCompositeRule"
- ]
- }
-}
diff --git a/README.md b/README.md
index eda3cbf0..ab076984 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,7 @@
Common
-===
-AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/snawy2a2vt0vd7dv/branch/dev?svg=true)](https://ci.appveyor.com/project/aspnetci/Common/branch/dev)
+======
-Travis: [![Travis](https://travis-ci.org/aspnet/Common.svg?branch=dev)](https://travis-ci.org/aspnet/Common)
+AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/snawy2a2vt0vd7dv/branch/dev?svg=true)](https://ci.appveyor.com/project/aspnetci/Common/branch/dev)
The Common repository includes projects containing commonly used primitives and utility types.
diff --git a/build.ps1 b/build.ps1
index d5eb4d5c..333a0c35 100644
--- a/build.ps1
+++ b/build.ps1
@@ -1,177 +1,23 @@
-#!/usr/bin/env powershell
-#requires -version 4
-
-<#
-.SYNOPSIS
-Build this repository
-
-.DESCRIPTION
-Downloads korebuild if required. Then builds the repository.
-
-.PARAMETER Path
-The folder to build. Defaults to the folder containing this script.
-
-.PARAMETER Channel
-The channel of KoreBuild to download. Overrides the value from the config file.
-
-.PARAMETER DotNetHome
-The directory where .NET Core tools will be stored.
-
-.PARAMETER ToolsSource
-The base url where build tools can be downloaded. Overrides the value from the config file.
-
-.PARAMETER Update
-Updates KoreBuild to the latest version even if a lock file is present.
-
-.PARAMETER ConfigFile
-The path to the configuration file that stores values. Defaults to version.xml.
-
-.PARAMETER MSBuildArgs
-Arguments to be passed to MSBuild
-
-.NOTES
-This function will create a file $PSScriptRoot/korebuild-lock.txt. This lock file can be committed to source, but does not have to be.
-When the lockfile is not present, KoreBuild will create one using latest available version from $Channel.
-
-The $ConfigFile is expected to be an XML file. It is optional, and the configuration values in it are optional as well.
-
-.EXAMPLE
-Example config file:
-```xml
-
-
-
- dev
- https://aspnetcore.blob.core.windows.net/buildtools
-
-
-```
-#>
-[CmdletBinding(PositionalBinding = $false)]
param(
- [string]$Path = $PSScriptRoot,
- [Alias('c')]
- [string]$Channel,
- [Alias('d')]
- [string]$DotNetHome,
- [Alias('s')]
- [string]$ToolsSource,
- [Alias('u')]
- [switch]$Update,
- [string]$ConfigFile = (Join-Path $PSScriptRoot 'version.xml'),
- [Parameter(ValueFromRemainingArguments = $true)]
- [string[]]$MSBuildArgs
+ [ValidateSet('Debug', 'Release')]
+ $Configuration = 'Debug'
)
-Set-StrictMode -Version 2
+Set-StrictMode -Version 1
$ErrorActionPreference = 'Stop'
-#
-# Functions
-#
-
-function Get-KoreBuild {
-
- $lockFile = Join-Path $Path 'korebuild-lock.txt'
-
- if (!(Test-Path $lockFile) -or $Update) {
- Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $lockFile
- }
-
- $version = Get-Content $lockFile | Where-Object { $_ -like 'version:*' } | Select-Object -first 1
- if (!$version) {
- Write-Error "Failed to parse version from $lockFile. Expected a line that begins with 'version:'"
- }
- $version = $version.TrimStart('version:').Trim()
- $korebuildPath = Join-Paths $DotNetHome ('buildtools', 'korebuild', $version)
-
- if (!(Test-Path $korebuildPath)) {
- Write-Host -ForegroundColor Magenta "Downloading KoreBuild $version"
- New-Item -ItemType Directory -Path $korebuildPath | Out-Null
- $remotePath = "$ToolsSource/korebuild/artifacts/$version/korebuild.$version.zip"
-
- try {
- $tmpfile = Join-Path ([IO.Path]::GetTempPath()) "KoreBuild-$([guid]::NewGuid()).zip"
- Get-RemoteFile $remotePath $tmpfile
- if (Get-Command -Name 'Expand-Archive' -ErrorAction Ignore) {
- # Use built-in commands where possible as they are cross-plat compatible
- Expand-Archive -Path $tmpfile -DestinationPath $korebuildPath
- }
- else {
- # Fallback to old approach for old installations of PowerShell
- Add-Type -AssemblyName System.IO.Compression.FileSystem
- [System.IO.Compression.ZipFile]::ExtractToDirectory($tmpfile, $korebuildPath)
- }
- }
- catch {
- Remove-Item -Recurse -Force $korebuildPath -ErrorAction Ignore
- throw
- }
- finally {
- Remove-Item $tmpfile -ErrorAction Ignore
- }
- }
-
- return $korebuildPath
-}
-
-function Join-Paths([string]$path, [string[]]$childPaths) {
- $childPaths | ForEach-Object { $path = Join-Path $path $_ }
- return $path
-}
-
-function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) {
- if ($RemotePath -notlike 'http*') {
- Copy-Item $RemotePath $LocalPath
- return
+function exec([string]$_cmd) {
+ Write-Host -ForegroundColor DarkGray ">>> $_cmd $args"
+ & $_cmd @args
+ if ($LASTEXITCODE -ne 0) {
+ Write-Error "Command exited with code $LASTEXITCODE"
}
-
- $retries = 10
- while ($retries -gt 0) {
- $retries -= 1
- try {
- Invoke-WebRequest -UseBasicParsing -Uri $RemotePath -OutFile $LocalPath
- return
- }
- catch {
- Write-Verbose "Request failed. $retries retries remaining"
- }
- }
-
- Write-Error "Download failed: '$RemotePath'."
}
-#
-# Main
-#
+$artifacts = "$PSScriptRoot/artifacts/"
-# Load configuration or set defaults
+Remove-Item -Recurse $artifacts -ErrorAction Ignore
-if (Test-Path $ConfigFile) {
- [xml] $config = Get-Content $ConfigFile
- if (!($Channel)) { [string] $Channel = Select-Xml -Xml $config -XPath '/Project/PropertyGroup/KoreBuildChannel' }
- if (!($ToolsSource)) { [string] $ToolsSource = Select-Xml -Xml $config -XPath '/Project/PropertyGroup/KoreBuildToolsSource' }
-}
-
-if (!$DotNetHome) {
- $DotNetHome = if ($env:DOTNET_HOME) { $env:DOTNET_HOME } `
- elseif ($env:USERPROFILE) { Join-Path $env:USERPROFILE '.dotnet'} `
- elseif ($env:HOME) {Join-Path $env:HOME '.dotnet'}`
- else { Join-Path $PSScriptRoot '.dotnet'}
-}
-
-if (!$Channel) { $Channel = 'dev' }
-if (!$ToolsSource) { $ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools' }
-
-# Execute
-
-$korebuildPath = Get-KoreBuild
-Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1')
-
-try {
- Install-Tools $ToolsSource $DotNetHome
- Invoke-RepositoryBuild $Path @MSBuildArgs
-}
-finally {
- Remove-Module 'KoreBuild' -ErrorAction Ignore
-}
+exec dotnet restore /p:BuildNumber=t000
+exec dotnet pack -c $Configuration -o $artifacts
+exec dotnet test -c $Configuration --no-build "$PSScriptRoot/test/CommandLineUtils.Tests/McMaster.Extensions.CommandLineUtils.Tests.csproj"
diff --git a/build.sh b/build.sh
deleted file mode 100755
index 11cdbe55..00000000
--- a/build.sh
+++ /dev/null
@@ -1,199 +0,0 @@
-#!/usr/bin/env bash
-
-set -euo pipefail
-
-#
-# variables
-#
-
-RESET="\033[0m"
-RED="\033[0;31m"
-MAGENTA="\033[0;95m"
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-[ -z "${DOTNET_HOME:-}" ] && DOTNET_HOME="$HOME/.dotnet"
-config_file="$DIR/version.xml"
-verbose=false
-update=false
-repo_path="$DIR"
-channel=''
-tools_source=''
-
-#
-# Functions
-#
-__usage() {
- echo "Usage: $(basename "${BASH_SOURCE[0]}") [options] [[--] ...]"
- echo ""
- echo "Arguments:"
- echo " ... Arguments passed to MSBuild. Variable number of arguments allowed."
- echo ""
- echo "Options:"
- echo " --verbose Show verbose output."
- echo " -c|--channel The channel of KoreBuild to download. Overrides the value from the config file.."
- echo " --config-file TThe path to the configuration file that stores values. Defaults to version.xml."
- echo " -d|--dotnet-home The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet."
- echo " --path The directory to build. Defaults to the directory containing the script."
- echo " -s|--tools-source The base url where build tools can be downloaded. Overrides the value from the config file."
- echo " -u|--update Update to the latest KoreBuild even if the lock file is present."
- echo ""
- echo "Description:"
- echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be."
- echo " When the lockfile is not present, KoreBuild will create one using latest available version from \$channel."
-
- if [[ "${1:-}" != '--no-exit' ]]; then
- exit 2
- fi
-}
-
-get_korebuild() {
- local version
- local lock_file="$repo_path/korebuild-lock.txt"
- if [ ! -f "$lock_file" ] || [ "$update" = true ]; then
- __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file"
- fi
- version="$(grep 'version:*' -m 1 "$lock_file")"
- if [[ "$version" == '' ]]; then
- __error "Failed to parse version from $lock_file. Expected a line that begins with 'version:'"
- return 1
- fi
- version="$(echo "${version#version:}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
- local korebuild_path="$DOTNET_HOME/buildtools/korebuild/$version"
-
- {
- if [ ! -d "$korebuild_path" ]; then
- mkdir -p "$korebuild_path"
- local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip"
- tmpfile="$(mktemp)"
- echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}"
- if __get_remote_file "$remote_path" "$tmpfile"; then
- unzip -q -d "$korebuild_path" "$tmpfile"
- fi
- rm "$tmpfile" || true
- fi
-
- source "$korebuild_path/KoreBuild.sh"
- } || {
- if [ -d "$korebuild_path" ]; then
- echo "Cleaning up after failed installation"
- rm -rf "$korebuild_path" || true
- fi
- return 1
- }
-}
-
-__error() {
- echo -e "${RED}$*${RESET}" 1>&2
-}
-
-__machine_has() {
- hash "$1" > /dev/null 2>&1
- return $?
-}
-
-__get_remote_file() {
- local remote_path=$1
- local local_path=$2
-
- if [[ "$remote_path" != 'http'* ]]; then
- cp "$remote_path" "$local_path"
- return 0
- fi
-
- local failed=false
- if __machine_has wget; then
- wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true
- else
- failed=true
- fi
-
- if [ "$failed" = true ] && __machine_has curl; then
- failed=false
- curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true
- fi
-
- if [ "$failed" = true ]; then
- __error "Download failed: $remote_path" 1>&2
- return 1
- fi
-}
-
-__read_dom () { local IFS=\> ; read -r -d \< ENTITY CONTENT ;}
-
-#
-# main
-#
-
-while [[ $# -gt 0 ]]; do
- case $1 in
- -\?|-h|--help)
- __usage --no-exit
- exit 0
- ;;
- -c|--channel|-Channel)
- shift
- channel="${1:-}"
- [ -z "$channel" ] && __usage
- ;;
- --config-file|-ConfigFile)
- shift
- config_file="${1:-}"
- [ -z "$config_file" ] && __usage
- ;;
- -d|--dotnet-home|-DotNetHome)
- shift
- DOTNET_HOME="${1:-}"
- [ -z "$DOTNET_HOME" ] && __usage
- ;;
- --path|-Path)
- shift
- repo_path="${1:-}"
- [ -z "$repo_path" ] && __usage
- ;;
- -s|--tools-source|-ToolsSource)
- shift
- tools_source="${1:-}"
- [ -z "$tools_source" ] && __usage
- ;;
- -u|--update|-Update)
- update=true
- ;;
- --verbose|-Verbose)
- verbose=true
- ;;
- --)
- shift
- break
- ;;
- *)
- break
- ;;
- esac
- shift
-done
-
-if ! __machine_has unzip; then
- __error 'Missing required command: unzip'
- exit 1
-fi
-
-if ! __machine_has curl && ! __machine_has wget; then
- __error 'Missing required command. Either wget or curl is required.'
- exit 1
-fi
-
-if [ -f "$config_file" ]; then
- comment=false
- while __read_dom; do
- if [ "$comment" = true ]; then [[ $CONTENT == *'-->'* ]] && comment=false ; continue; fi
- if [[ $ENTITY == '!--'* ]]; then comment=true; continue; fi
- if [ -z "$channel" ] && [[ $ENTITY == "KoreBuildChannel" ]]; then channel=$CONTENT; fi
- if [ -z "$tools_source" ] && [[ $ENTITY == "KoreBuildToolsSource" ]]; then tools_source=$CONTENT; fi
- done < "$config_file"
-fi
-
-[ -z "$channel" ] && channel='dev'
-[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools'
-
-get_korebuild
-install_tools "$tools_source" "$DOTNET_HOME"
-invoke_repository_build "$repo_path" "$@"
diff --git a/build/Key.snk b/build/Key.snk
deleted file mode 100644
index e10e4889..00000000
Binary files a/build/Key.snk and /dev/null differ
diff --git a/build/StrongName.snk b/build/StrongName.snk
new file mode 100644
index 00000000..315f8a5f
Binary files /dev/null and b/build/StrongName.snk differ
diff --git a/build/repo.props b/build/repo.props
deleted file mode 100644
index c5d91e8a..00000000
--- a/build/repo.props
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/shared/Microsoft.Extensions.ClosedGenericMatcher.Sources/ClosedGenericMatcher.cs b/shared/Microsoft.Extensions.ClosedGenericMatcher.Sources/ClosedGenericMatcher.cs
deleted file mode 100644
index f234c2ed..00000000
--- a/shared/Microsoft.Extensions.ClosedGenericMatcher.Sources/ClosedGenericMatcher.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright (c) .NET Foundation. 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.Linq;
-using System.Reflection;
-
-namespace Microsoft.Extensions.Internal
-{
- ///
- /// Helper related to generic interface definitions and implementing classes.
- ///
- internal static class ClosedGenericMatcher
- {
- ///
- /// Determine whether is or implements a closed generic
- /// created from .
- ///
- /// The of interest.
- /// The open generic to match. Usually an interface.
- ///
- /// The closed generic created from that
- /// is or implements. null if the two s have no such
- /// relationship.
- ///
- ///
- /// This method will return if is
- /// typeof(KeyValuePair{,}), and is
- /// typeof(KeyValuePair{string, object}).
- ///
- public static Type ExtractGenericInterface(Type queryType, Type interfaceType)
- {
- if (queryType == null)
- {
- throw new ArgumentNullException(nameof(queryType));
- }
-
- if (interfaceType == null)
- {
- throw new ArgumentNullException(nameof(interfaceType));
- }
-
- if (IsGenericInstantiation(queryType, interfaceType))
- {
- // queryType matches (i.e. is a closed generic type created from) the open generic type.
- return queryType;
- }
-
- // Otherwise check all interfaces the type implements for a match.
- // - If multiple different generic instantiations exists, we want the most derived one.
- // - If that doesn't break the tie, then we sort alphabetically so that it's deterministic.
- //
- // We do this by looking at interfaces on the type, and recursing to the base type
- // if we don't find any matches.
- return GetGenericInstantiation(queryType, interfaceType);
- }
-
- private static bool IsGenericInstantiation(Type candidate, Type interfaceType)
- {
- return
- candidate.GetTypeInfo().IsGenericType &&
- candidate.GetGenericTypeDefinition() == interfaceType;
- }
-
- private static Type GetGenericInstantiation(Type queryType, Type interfaceType)
- {
- Type bestMatch = null;
- var interfaces = queryType.GetInterfaces();
- foreach (var @interface in interfaces)
- {
- if (IsGenericInstantiation(@interface, interfaceType))
- {
- if (bestMatch == null)
- {
- bestMatch = @interface;
- }
- else if (StringComparer.Ordinal.Compare(@interface.FullName, bestMatch.FullName) < 0)
- {
- bestMatch = @interface;
- }
- else
- {
- // There are two matches at this level of the class hierarchy, but @interface is after
- // bestMatch in the sort order.
- }
- }
- }
-
- if (bestMatch != null)
- {
- return bestMatch;
- }
-
- // BaseType will be null for object and interfaces, which means we've reached 'bottom'.
- var baseType = queryType?.GetTypeInfo().BaseType;
- if (baseType == null)
- {
- return null;
- }
- else
- {
- return GetGenericInstantiation(baseType, interfaceType);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/shared/Microsoft.Extensions.CopyOnWriteDictionary.Sources/CopyOnWriteDictionary.cs b/shared/Microsoft.Extensions.CopyOnWriteDictionary.Sources/CopyOnWriteDictionary.cs
deleted file mode 100644
index 1408059a..00000000
--- a/shared/Microsoft.Extensions.CopyOnWriteDictionary.Sources/CopyOnWriteDictionary.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright (c) .NET Foundation. 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;
-using System.Collections.Generic;
-
-namespace Microsoft.Extensions.Internal
-{
- internal class CopyOnWriteDictionary : IDictionary
- {
- private readonly IDictionary _sourceDictionary;
- private readonly IEqualityComparer _comparer;
- private IDictionary _innerDictionary;
-
- public CopyOnWriteDictionary(
- IDictionary sourceDictionary,
- IEqualityComparer comparer)
- {
- if (sourceDictionary == null)
- {
- throw new ArgumentNullException(nameof(sourceDictionary));
- }
-
- if (comparer == null)
- {
- throw new ArgumentNullException(nameof(comparer));
- }
-
- _sourceDictionary = sourceDictionary;
- _comparer = comparer;
- }
-
- private IDictionary ReadDictionary
- {
- get
- {
- return _innerDictionary ?? _sourceDictionary;
- }
- }
-
- private IDictionary WriteDictionary
- {
- get
- {
- if (_innerDictionary == null)
- {
- _innerDictionary = new Dictionary(_sourceDictionary,
- _comparer);
- }
-
- return _innerDictionary;
- }
- }
-
- public virtual ICollection Keys
- {
- get
- {
- return ReadDictionary.Keys;
- }
- }
-
- public virtual ICollection Values
- {
- get
- {
- return ReadDictionary.Values;
- }
- }
-
- public virtual int Count
- {
- get
- {
- return ReadDictionary.Count;
- }
- }
-
- public virtual bool IsReadOnly
- {
- get
- {
- return false;
- }
- }
-
- public virtual TValue this[TKey key]
- {
- get
- {
- return ReadDictionary[key];
- }
- set
- {
- WriteDictionary[key] = value;
- }
- }
-
- public virtual bool ContainsKey(TKey key)
- {
- return ReadDictionary.ContainsKey(key);
- }
-
- public virtual void Add(TKey key, TValue value)
- {
- WriteDictionary.Add(key, value);
- }
-
- public virtual bool Remove(TKey key)
- {
- return WriteDictionary.Remove(key);
- }
-
- public virtual bool TryGetValue(TKey key, out TValue value)
- {
- return ReadDictionary.TryGetValue(key, out value);
- }
-
- public virtual void Add(KeyValuePair item)
- {
- WriteDictionary.Add(item);
- }
-
- public virtual void Clear()
- {
- WriteDictionary.Clear();
- }
-
- public virtual bool Contains(KeyValuePair item)
- {
- return ReadDictionary.Contains(item);
- }
-
- public virtual void CopyTo(KeyValuePair[] array, int arrayIndex)
- {
- ReadDictionary.CopyTo(array, arrayIndex);
- }
-
- public bool Remove(KeyValuePair item)
- {
- return WriteDictionary.Remove(item);
- }
-
- public virtual IEnumerator> GetEnumerator()
- {
- return ReadDictionary.GetEnumerator();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-}
\ No newline at end of file
diff --git a/shared/Microsoft.Extensions.CopyOnWriteDictionary.Sources/CopyOnWriteDictionaryHolder.cs b/shared/Microsoft.Extensions.CopyOnWriteDictionary.Sources/CopyOnWriteDictionaryHolder.cs
deleted file mode 100644
index 7cd935e9..00000000
--- a/shared/Microsoft.Extensions.CopyOnWriteDictionary.Sources/CopyOnWriteDictionaryHolder.cs
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright (c) .NET Foundation. 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;
-
-namespace Microsoft.Extensions.Internal
-{
- internal struct CopyOnWriteDictionaryHolder
- {
- private readonly Dictionary _source;
- private Dictionary _copy;
-
- public CopyOnWriteDictionaryHolder(Dictionary source)
- {
- if (source == null)
- {
- throw new ArgumentNullException(nameof(source));
- }
-
- _source = source;
- _copy = null;
- }
-
- public CopyOnWriteDictionaryHolder(CopyOnWriteDictionaryHolder source)
- {
- _source = source._copy ?? source._source;
- _copy = null;
- }
-
- public bool HasBeenCopied => _copy != null;
-
- public Dictionary ReadDictionary
- {
- get
- {
- if (_copy != null)
- {
- return _copy;
- }
- else if (_source != null)
- {
- return _source;
- }
- else
- {
- // Default-Constructor case
- _copy = new Dictionary();
- return _copy;
- }
- }
- }
-
- public Dictionary WriteDictionary
- {
- get
- {
- if (_copy == null && _source == null)
- {
- // Default-Constructor case
- _copy = new Dictionary();
- }
- else if (_copy == null)
- {
- _copy = new Dictionary(_source, _source.Comparer);
- }
-
- return _copy;
- }
- }
-
- public Dictionary.KeyCollection Keys
- {
- get
- {
- return ReadDictionary.Keys;
- }
- }
-
- public Dictionary.ValueCollection Values
- {
- get
- {
- return ReadDictionary.Values;
- }
- }
-
- public int Count
- {
- get
- {
- return ReadDictionary.Count;
- }
- }
-
- public bool IsReadOnly
- {
- get
- {
- return false;
- }
- }
-
- public TValue this[TKey key]
- {
- get
- {
- return ReadDictionary[key];
- }
- set
- {
- WriteDictionary[key] = value;
- }
- }
-
- public bool ContainsKey(TKey key)
- {
- return ReadDictionary.ContainsKey(key);
- }
-
- public void Add(TKey key, TValue value)
- {
- WriteDictionary.Add(key, value);
- }
-
- public bool Remove(TKey key)
- {
- return WriteDictionary.Remove(key);
- }
-
- public bool TryGetValue(TKey key, out TValue value)
- {
- return ReadDictionary.TryGetValue(key, out value);
- }
-
- public void Add(KeyValuePair item)
- {
- ((ICollection>)WriteDictionary).Add(item);
- }
-
- public void Clear()
- {
- WriteDictionary.Clear();
- }
-
- public bool Contains(KeyValuePair item)
- {
- return ((ICollection>)ReadDictionary).Contains(item);
- }
-
- public void CopyTo(KeyValuePair[] array, int arrayIndex)
- {
- ((ICollection>)ReadDictionary).CopyTo(array, arrayIndex);
- }
-
- public bool Remove(KeyValuePair item)
- {
- return ((ICollection>)WriteDictionary).Remove(item);
- }
-
- public Dictionary.Enumerator GetEnumerator()
- {
- return ReadDictionary.GetEnumerator();
- }
- }
-}
diff --git a/shared/Microsoft.Extensions.HashCodeCombiner.Sources/HashCodeCombiner.cs b/shared/Microsoft.Extensions.HashCodeCombiner.Sources/HashCodeCombiner.cs
deleted file mode 100644
index 4df8b46b..00000000
--- a/shared/Microsoft.Extensions.HashCodeCombiner.Sources/HashCodeCombiner.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Collections;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-
-namespace Microsoft.Extensions.Internal
-{
- internal struct HashCodeCombiner
- {
- private long _combinedHash64;
-
- public int CombinedHash
- {
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- get { return _combinedHash64.GetHashCode(); }
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- private HashCodeCombiner(long seed)
- {
- _combinedHash64 = seed;
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void Add(IEnumerable e)
- {
- if (e == null)
- {
- Add(0);
- }
- else
- {
- var count = 0;
- foreach (object o in e)
- {
- Add(o);
- count++;
- }
- Add(count);
- }
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static implicit operator int(HashCodeCombiner self)
- {
- return self.CombinedHash;
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void Add(int i)
- {
- _combinedHash64 = ((_combinedHash64 << 5) + _combinedHash64) ^ i;
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void Add(string s)
- {
- var hashCode = (s != null) ? s.GetHashCode() : 0;
- Add(hashCode);
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void Add(object o)
- {
- var hashCode = (o != null) ? o.GetHashCode() : 0;
- Add(hashCode);
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void Add(TValue value, IEqualityComparer comparer)
- {
- var hashCode = value != null ? comparer.GetHashCode(value) : 0;
- Add(hashCode);
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static HashCodeCombiner Start()
- {
- return new HashCodeCombiner(0x1505L);
- }
- }
-}
diff --git a/shared/Microsoft.Extensions.ObjectMethodExecutor.Sources/AwaitableInfo.cs b/shared/Microsoft.Extensions.ObjectMethodExecutor.Sources/AwaitableInfo.cs
deleted file mode 100644
index 431b83a6..00000000
--- a/shared/Microsoft.Extensions.ObjectMethodExecutor.Sources/AwaitableInfo.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (c) .NET Foundation. 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.Linq;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-namespace Microsoft.Extensions.Internal
-{
- internal struct AwaitableInfo
- {
- public Type AwaiterType { get; }
- public PropertyInfo AwaiterIsCompletedProperty { get; }
- public MethodInfo AwaiterGetResultMethod { get; }
- public MethodInfo AwaiterOnCompletedMethod { get; }
- public MethodInfo AwaiterUnsafeOnCompletedMethod { get; }
- public Type ResultType { get; }
- public MethodInfo GetAwaiterMethod { get; }
-
- public AwaitableInfo(
- Type awaiterType,
- PropertyInfo awaiterIsCompletedProperty,
- MethodInfo awaiterGetResultMethod,
- MethodInfo awaiterOnCompletedMethod,
- MethodInfo awaiterUnsafeOnCompletedMethod,
- Type resultType,
- MethodInfo getAwaiterMethod)
- {
- AwaiterType = awaiterType;
- AwaiterIsCompletedProperty = awaiterIsCompletedProperty;
- AwaiterGetResultMethod = awaiterGetResultMethod;
- AwaiterOnCompletedMethod = awaiterOnCompletedMethod;
- AwaiterUnsafeOnCompletedMethod = awaiterUnsafeOnCompletedMethod;
- ResultType = resultType;
- GetAwaiterMethod = getAwaiterMethod;
- }
-
- public static bool IsTypeAwaitable(Type type, out AwaitableInfo awaitableInfo)
- {
- // Based on Roslyn code: http://source.roslyn.io/#Microsoft.CodeAnalysis.Workspaces/Shared/Extensions/ISymbolExtensions.cs,db4d48ba694b9347
-
- // Awaitable must have method matching "object GetAwaiter()"
- var getAwaiterMethod = type.GetRuntimeMethods().FirstOrDefault(m =>
- m.Name.Equals("GetAwaiter", StringComparison.OrdinalIgnoreCase)
- && m.GetParameters().Length == 0
- && m.ReturnType != null);
- if (getAwaiterMethod == null)
- {
- awaitableInfo = default(AwaitableInfo);
- return false;
- }
-
- var awaiterType = getAwaiterMethod.ReturnType;
-
- // Awaiter must have property matching "bool IsCompleted { get; }"
- var isCompletedProperty = awaiterType.GetRuntimeProperties().FirstOrDefault(p =>
- p.Name.Equals("IsCompleted", StringComparison.OrdinalIgnoreCase)
- && p.PropertyType == typeof(bool)
- && p.GetMethod != null);
- if (isCompletedProperty == null)
- {
- awaitableInfo = default(AwaitableInfo);
- return false;
- }
-
- // Awaiter must implement INotifyCompletion
- var awaiterInterfaces = awaiterType.GetInterfaces();
- var implementsINotifyCompletion = awaiterInterfaces.Any(t => t == typeof(INotifyCompletion));
- if (!implementsINotifyCompletion)
- {
- awaitableInfo = default(AwaitableInfo);
- return false;
- }
-
- // INotifyCompletion supplies a method matching "void OnCompleted(Action action)"
- var iNotifyCompletionMap = awaiterType
- .GetTypeInfo()
- .GetRuntimeInterfaceMap(typeof(INotifyCompletion));
- var onCompletedMethod = iNotifyCompletionMap.InterfaceMethods.Single(m =>
- m.Name.Equals("OnCompleted", StringComparison.OrdinalIgnoreCase)
- && m.ReturnType == typeof(void)
- && m.GetParameters().Length == 1
- && m.GetParameters()[0].ParameterType == typeof(Action));
-
- // Awaiter optionally implements ICriticalNotifyCompletion
- var implementsICriticalNotifyCompletion = awaiterInterfaces.Any(t => t == typeof(ICriticalNotifyCompletion));
- MethodInfo unsafeOnCompletedMethod;
- if (implementsICriticalNotifyCompletion)
- {
- // ICriticalNotifyCompletion supplies a method matching "void UnsafeOnCompleted(Action action)"
- var iCriticalNotifyCompletionMap = awaiterType
- .GetTypeInfo()
- .GetRuntimeInterfaceMap(typeof(ICriticalNotifyCompletion));
- unsafeOnCompletedMethod = iCriticalNotifyCompletionMap.InterfaceMethods.Single(m =>
- m.Name.Equals("UnsafeOnCompleted", StringComparison.OrdinalIgnoreCase)
- && m.ReturnType == typeof(void)
- && m.GetParameters().Length == 1
- && m.GetParameters()[0].ParameterType == typeof(Action));
- }
- else
- {
- unsafeOnCompletedMethod = null;
- }
-
- // Awaiter must have method matching "void GetResult" or "T GetResult()"
- var getResultMethod = awaiterType.GetRuntimeMethods().FirstOrDefault(m =>
- m.Name.Equals("GetResult")
- && m.GetParameters().Length == 0);
- if (getResultMethod == null)
- {
- awaitableInfo = default(AwaitableInfo);
- return false;
- }
-
- awaitableInfo = new AwaitableInfo(
- awaiterType,
- isCompletedProperty,
- getResultMethod,
- onCompletedMethod,
- unsafeOnCompletedMethod,
- getResultMethod.ReturnType,
- getAwaiterMethod);
- return true;
- }
- }
-}
diff --git a/shared/Microsoft.Extensions.ObjectMethodExecutor.Sources/CoercedAwaitableInfo.cs b/shared/Microsoft.Extensions.ObjectMethodExecutor.Sources/CoercedAwaitableInfo.cs
deleted file mode 100644
index 4e48ef09..00000000
--- a/shared/Microsoft.Extensions.ObjectMethodExecutor.Sources/CoercedAwaitableInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) .NET Foundation. 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.Linq.Expressions;
-
-namespace Microsoft.Extensions.Internal
-{
- internal struct CoercedAwaitableInfo
- {
- public AwaitableInfo AwaitableInfo { get; }
- public Expression CoercerExpression { get; }
- public Type CoercerResultType { get; }
- public bool RequiresCoercion => CoercerExpression != null;
-
- public CoercedAwaitableInfo(AwaitableInfo awaitableInfo)
- {
- AwaitableInfo = awaitableInfo;
- CoercerExpression = null;
- CoercerResultType = null;
- }
-
- public CoercedAwaitableInfo(Expression coercerExpression, Type coercerResultType, AwaitableInfo coercedAwaitableInfo)
- {
- CoercerExpression = coercerExpression;
- CoercerResultType = coercerResultType;
- AwaitableInfo = coercedAwaitableInfo;
- }
-
- public static bool IsTypeAwaitable(Type type, out CoercedAwaitableInfo info)
- {
- if (AwaitableInfo.IsTypeAwaitable(type, out var directlyAwaitableInfo))
- {
- info = new CoercedAwaitableInfo(directlyAwaitableInfo);
- return true;
- }
-
- // It's not directly awaitable, but maybe we can coerce it.
- // Currently we support coercing FSharpAsync.
- if (ObjectMethodExecutorFSharpSupport.TryBuildCoercerFromFSharpAsyncToAwaitable(type,
- out var coercerExpression,
- out var coercerResultType))
- {
- if (AwaitableInfo.IsTypeAwaitable(coercerResultType, out var coercedAwaitableInfo))
- {
- info = new CoercedAwaitableInfo(coercerExpression, coercerResultType, coercedAwaitableInfo);
- return true;
- }
- }
-
- info = default(CoercedAwaitableInfo);
- return false;
- }
- }
-}
diff --git a/shared/Microsoft.Extensions.ObjectMethodExecutor.Sources/ObjectMethodExecutor.cs b/shared/Microsoft.Extensions.ObjectMethodExecutor.Sources/ObjectMethodExecutor.cs
deleted file mode 100644
index f8e5b70f..00000000
--- a/shared/Microsoft.Extensions.ObjectMethodExecutor.Sources/ObjectMethodExecutor.cs
+++ /dev/null
@@ -1,340 +0,0 @@
-// Copyright (c) .NET Foundation. 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.Linq.Expressions;
-using System.Reflection;
-
-namespace Microsoft.Extensions.Internal
-{
- internal class ObjectMethodExecutor
- {
- private readonly object[] _parameterDefaultValues;
- private readonly MethodExecutorAsync _executorAsync;
- private readonly MethodExecutor _executor;
-
- private static readonly ConstructorInfo _objectMethodExecutorAwaitableConstructor =
- typeof(ObjectMethodExecutorAwaitable).GetConstructor(new[] {
- typeof(object), // customAwaitable
- typeof(Func