diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index 46b66cb1b67def..51d9b2432e848f 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -3,16 +3,22 @@
"isRoot": true,
"tools": {
"coverlet.console": {
- "version": "1.7.0",
+ "version": "1.7.1",
"commands": [
"coverlet"
]
},
"dotnet-reportgenerator-globaltool": {
- "version": "4.5.2",
+ "version": "4.5.8",
"commands": [
"reportgenerator"
]
+ },
+ "microsoft.dotnet.xharness.cli": {
+ "version": "1.0.0-prerelease.20271.3",
+ "commands": [
+ "xharness"
+ ]
}
}
}
diff --git a/.editorconfig b/.editorconfig
index 6c6dcb40761745..28e3eaba64e83b 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -155,6 +155,7 @@ csharp_space_between_square_brackets = false
# Analyzers
dotnet_code_quality.ca1802.api_surface = private, internal
+dotnet_code_quality.CA2208.api_surface = public
# C++ Files
[*.{cpp,h,in}]
@@ -165,6 +166,9 @@ indent_brace_style = Allman
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2
+[*.{csproj,vbproj,proj,nativeproj,locproj}]
+charset = utf-8
+
# Xml build files
[*.builds]
indent_size = 2
diff --git a/.github/ISSUE_TEMPLATE/01_bug_report.md b/.github/ISSUE_TEMPLATE/01_bug_report.md
new file mode 100644
index 00000000000000..ddca1a08888f50
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/01_bug_report.md
@@ -0,0 +1,41 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+
+
+### Description
+
+
+
+### Configuration
+
+
+
+### Regression?
+
+
+
+### Other information
+
+
diff --git a/.github/ISSUE_TEMPLATE/02_api_proposal.md b/.github/ISSUE_TEMPLATE/02_api_proposal.md
new file mode 100644
index 00000000000000..4ba85d6256ab52
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/02_api_proposal.md
@@ -0,0 +1,52 @@
+---
+name: API proposal
+about: Propose a change to the public API surface
+title: ''
+labels: api-suggestion
+assignees: ''
+
+---
+
+## Background and Motivation
+
+
+
+## Proposed API
+
+
+
+## Usage Examples
+
+
+
+## Alternative Designs
+
+
+
+## Risks
+
+
diff --git a/.github/ISSUE_TEMPLATE/03_performance_issue.md b/.github/ISSUE_TEMPLATE/03_performance_issue.md
new file mode 100644
index 00000000000000..6da186f0453df1
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/03_performance_issue.md
@@ -0,0 +1,50 @@
+---
+name: Performance issue
+about: Report a performance problem or regression
+title: ''
+labels: 'tenet-performance'
+assignees: ''
+
+---
+
+
+
+### Description
+
+
+
+### Configuration
+
+
+
+### Regression?
+
+
+
+### Data
+
+
+
+### Analysis
+
+
diff --git a/.github/ISSUE_TEMPLATE/04_blank_issue.md b/.github/ISSUE_TEMPLATE/04_blank_issue.md
new file mode 100644
index 00000000000000..d1429bfd4c1d90
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/04_blank_issue.md
@@ -0,0 +1,8 @@
+---
+name: Blank issue
+about: Something that doesn't fit the other categories
+title: ''
+labels: ''
+assignees: ''
+
+---
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 00000000000000..54d8c5740bad6c
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,20 @@
+blank_issues_enabled: true
+contact_links:
+ - name: Issue with ASP.NET Core
+ url: https://github.com/dotnet/aspnetcore/issues/new/choose
+ about: Please open issues relating to ASP.NET Core in dotnet/aspnetcore.
+ - name: Issue with .NET SDK
+ url: https://github.com/dotnet/sdk/issues/new/choose
+ about: Please open issues relating to the .NET SDK in dotnet/sdk.
+ - name: Issue with Entity Framework
+ url: https://github.com/dotnet/efcore/issues/new/choose
+ about: Please open issues relating to Entity Framework in dotnet/efcore.
+ - name: Issue with Roslyn compiler
+ url: https://github.com/dotnet/roslyn/issues/new/choose
+ about: Please open issues relating to the Roslyn .NET compiler in dotnet/roslyn.
+ - name: Issue with Windows Forms
+ url: https://github.com/dotnet/winforms/issues/new/choose
+ about: Please open issues relating to Windows Forms in dotnet/winforms.
+ - name: Issue with WPF
+ url: https://github.com/dotnet/wpf/issues/new/choose
+ about: Please open issues relating to WPF in dotnet/wpf.
diff --git a/.gitignore b/.gitignore
index a9a3cae8e94553..88165cf3073fd2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -348,3 +348,6 @@ linker
# ln -s $(pwd)/src/libraries/Common/src src/coreclr/src/System.Private.CoreLib/common
src/coreclr/src/System.Private.CoreLib/shared
src/coreclr/src/System.Private.CoreLib/common
+
+# The debug directory should not be ignored
+!src/coreclr/src/debug
diff --git a/Build.proj b/Build.proj
index 0ecff09e8552be..dc4a15ab5f413d 100644
--- a/Build.proj
+++ b/Build.proj
@@ -5,10 +5,7 @@
Reference the projects for traversal build. Ordering matters here.
-->
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(RepoTasksDir)
- $(ArtifactsObjDir)runtime.tasks\Debug\build-semaphore.txt
-
-
-
-
-
+
+ $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'installer.tasks'))
$([MSBuild]::NormalizePath('$(InstallerTasksOutputPath)', 'Debug', 'netstandard2.0', 'installer.tasks.dll'))$([MSBuild]::NormalizePath('$(InstallerTasksOutputPath)', 'Debug', 'net46', 'installer.tasks.dll'))
- $(ArtifactsObjDir)HostMachineInfo.props$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'docs'))$([MSBuild]::NormalizeDirectory('$(DocsDir)', 'manpages'))$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'System.Private.CoreLib', 'src'))
+
+ $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', 'Debug', '$(NetCoreAppCurrent)'))
+ $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidAppBuilder', 'Debug', '$(NetCoreAppCurrent)'))
+ $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmAppBuilder', 'Debug', '$(NetCoreAppCurrent)', 'publish'))
+ $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', 'Debug', '$(NetCoreAppCurrent)'))
+
+ $([MSBuild]::NormalizePath('$(AppleAppBuilderDir)', 'AppleAppBuilder.dll'))
+ $([MSBuild]::NormalizePath('$(AndroidAppBuilderDir)', 'AndroidAppBuilder.dll'))
+ $([MSBuild]::NormalizePath('$(WasmAppBuilderDir)', 'WasmAppBuilder.dll'))
+ $([MSBuild]::NormalizePath('$(MonoAOTCompilerDir)', 'MonoAOTCompiler.dll'))
+
+
true
-
-
- false
diff --git a/Directory.Build.targets b/Directory.Build.targets
index aa09db11f42053..2d72cd0f912847 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -20,10 +20,6 @@
$(MajorVersion).$(MinorVersion)
-
- $([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(MSBuildProjectName).AssemblyInfo$(DefaultLanguageSourceExtension)'))
-
-
@@ -31,11 +27,4 @@
latest
-
-
-
-
diff --git a/README.md b/README.md
index ee0ac7fcf5ff4e..72e763d3bcceaa 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@ For other issues, please use the following repos:
## Useful Links
* [.NET Core source index](https://source.dot.net) / [.NET Framework source index](https://referencesource.microsoft.com)
-* [API Reference docs](https://docs.microsoft.com/dotnet/api/?view=netcore-3.0)
+* [API Reference docs](https://docs.microsoft.com/dotnet/api/?view=netcore-3.1)
* [.NET API Catalog](http://apisof.net) (incl. APIs from daily builds and API usage info)
* [API docs writing guidelines](https://github.com/dotnet/dotnet-api-docs/wiki) - useful when writing /// comments
@@ -55,7 +55,7 @@ For other issues, please use the following repos:
There are many .NET related projects on GitHub.
- [.NET home repo](https://github.com/Microsoft/dotnet) - links to 100s of .NET projects, from Microsoft and the community.
-- [ASP.NET Core home](https://docs.microsoft.com/aspnet/core/?view=aspnetcore-3.0) - the best place to start learning about ASP.NET Core.
+- [ASP.NET Core home](https://docs.microsoft.com/aspnet/core/?view=aspnetcore-3.1) - the best place to start learning about ASP.NET Core.
This project has adopted the code of conduct defined by the [Contributor Covenant](http://contributor-covenant.org/) to clarify expected behavior in our community. For more information, see the [.NET Foundation Code of Conduct](http://www.dotnetfoundation.org/code-of-conduct).
diff --git a/THIRD-PARTY-NOTICES.TXT b/THIRD-PARTY-NOTICES.TXT
index 33b2268a7f2faa..707bd024f8f867 100644
--- a/THIRD-PARTY-NOTICES.TXT
+++ b/THIRD-PARTY-NOTICES.TXT
@@ -820,3 +820,43 @@ Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
+
+License notice for DirectX Math Library
+---------------------------------------
+
+https://github.com/microsoft/DirectXMath/blob/master/LICENSE
+
+ The MIT License (MIT)
+
+Copyright (c) 2011-2020 Microsoft Corp
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this
+software and associated documentation files (the "Software"), to deal in the Software
+without restriction, including without limitation the rights to use, copy, modify,
+merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be included in all copies
+or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+License notice for ldap4net
+---------------------------
+
+The MIT License (MIT)
+
+Copyright (c) 2018 Alexander Chermyanin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/build.cmd b/build.cmd
index 615bef6c65b576..76f4d8418947e8 100644
--- a/build.cmd
+++ b/build.cmd
@@ -4,5 +4,5 @@ setlocal
set _args=%*
if "%~1"=="-?" set _args=-help
-powershell -ExecutionPolicy ByPass -NoProfile -Command "%~dp0eng\build.ps1" %_args%
+powershell -ExecutionPolicy ByPass -NoProfile -Command "& '%~dp0eng\build.ps1'" %_args%
exit /b %ERRORLEVEL%
diff --git a/docs/area-owners.md b/docs/area-owners.md
index 4193e6f88632b8..ed99186090f578 100644
--- a/docs/area-owners.md
+++ b/docs/area-owners.md
@@ -4,8 +4,8 @@ Below table shows the combined area owners on this repository:
|-------------|------------------|------------------|
| area-AssemblyLoader-coreclr | @jeffschwMSFT @vitek-karas | |
| area-CodeGen-coreclr | @BruceForstall @dotnet/jit-contrib | |
-| area-CrossGen/NGEN-coreclr | @fadimounir | |
-| area-crossgen2-coreclr | @nattress @MichalStrehovsky @trylek @fadimounir | |
+| area-CrossGen/NGEN-coreclr | @nattress | |
+| area-crossgen2-coreclr | @nattress @trylek @dotnet/crossgen-contrib | |
| area-DependencyModel | @eerhardt | Microsoft.Extensions.DependencyModel |
| area-Diagnostics-coreclr | @tommcdon | |
| area-ExceptionHandling-coreclr | @janvorli | |
@@ -30,14 +30,15 @@ Below table shows the combined area owners on this repository:
| area-TieredCompilation-coreclr | @kouvel | |
| area-Tizen | @alpencolt @gbalykov | |
| area-Tracing-coreclr | @sywhang @josalem | |
-| area-TypeSystem-coreclr | @davidwrighton @MichalStrehovsky @fadimounir | |
+| area-TypeSystem-coreclr | @davidwrighton @MichalStrehovsky @janvorli @mangod9 | |
| area-UWP | @nattress | UWP-specific issues including Microsoft.NETCore.UniversalWindowsPlatform and Microsoft.Net.UWPCoreRuntimeSdk |
-| area-VM-coreclr | @jeffschwMSFT | |
+| area-VM-coreclr | @mangod9 | |
| area-AssemblyLoader-mono | @CoffeeFlux | |
| area-Codegen-meta-mono | @vargaz | |
| area-Codegen-JIT-mono | @SamMonoRT | |
| area-Codegen-AOT-mono | @SamMonoRT | |
| area-Codegen-Interpreter-mono | @BrzVlad | |
+| area-CodeGen-LLVM-mono | @imhameed | |
| area-CoreLib-mono | @steveisok | |
| area-GC-mono | @BrzVlad | |
| area-Build-mono | @akoeplinger | |
@@ -47,8 +48,19 @@ Below table shows the combined area owners on this repository:
| area-Threading-mono | @lambdageek | |
| area-Tracing-mono | @lambdageek | |
| area-Performance-mono | @SamMonoRT | |
+| ** Extensions namespaces ** | | |
+| area-Extensions-Caching | @maryamariyan | |
+| area-Extensions-Configuration | @maryamariyan | |
+| area-Extensions-DependencyInjection | @maryamariyan | |
+| area-Extensions-FileSystem | @maryamariyan | |
+| area-Extensions-Hosting | @maryamariyan | |
+| area-Extensions-HttpClientFactory | @maryamariyan | |
+| area-Extensions-Logging | @maryamariyan | |
+| area-Extensions-Options | @maryamariyan | |
+| area-Extensions-Primitives | @maryamariyan | |
+| area-Microsoft.Extensions | @maryamariyan | |
| **System namespaces** | | |
-| area-System.Buffers | @tannergooding | |
+| area-System.Buffers | @tannergooding @GrabYourPitchforks @pgovind | |
| area-System.CodeDom | @buyaa-n @krwq | |
| area-System.Collections | @eiriktsarpalis @layomia | Excluded:
|
| area-System.DirectoryServices | @tquerec @josephisenhour | |
-| area-System.Drawing | @safern | |
+| area-System.Drawing | @safern @tannergooding | |
| area-System.Dynamic.Runtime | @cston @333fred | Archived component - limited churn/contributions (see [#33170](https://github.com/dotnet/corefx/issues/33170)) |
| area-System.Globalization | @safern @tarekgh @krwq | |
| area-System.IO | @carlossanlop @jozkee | |
diff --git a/docs/coding-guidelines/adding-api-guidelines.md b/docs/coding-guidelines/adding-api-guidelines.md
index 1910130c9e7f8a..b9eba22012015f 100644
--- a/docs/coding-guidelines/adding-api-guidelines.md
+++ b/docs/coding-guidelines/adding-api-guidelines.md
@@ -24,8 +24,8 @@ the implementation without compat concerns in future releases.
### Determine target framework
-`netcoreapp5.0` is the target framework version currently under development and the new apis
-should be added to `netcoreapp5.0`. [More Information on TargetFrameworks](https://docs.microsoft.com/en-us/dotnet/standard/frameworks)
+`net5.0` is the target framework version currently under development and the new apis
+should be added to `net5.0`. [More Information on TargetFrameworks](https://docs.microsoft.com/en-us/dotnet/standard/frameworks)
## Making the changes in repo
diff --git a/docs/coding-guidelines/api-guidelines/nullability.md b/docs/coding-guidelines/api-guidelines/nullability.md
index 4f2e1cb31de02e..997c2b38ac79fa 100644
--- a/docs/coding-guidelines/api-guidelines/nullability.md
+++ b/docs/coding-guidelines/api-guidelines/nullability.md
@@ -94,6 +94,10 @@ The C# compiler respects a set of attributes that impact its flow analysis. We
- **DO** annotate `ref` arguments that guarantee the argument will be non-`null` upon exit (e.g. lazy initialization helpers) with `[NotNull]`.
- **DO** annotate properties where a getter will never return `null` but a setter allows `null` as being non-nullable but also `[AllowNull]`.
- **DO** annotate properties where a getter may return `null` but a setter throws for `null` as being nullable but also `[DisallowNull]`.
+- **DO** add `[NotNullWhen(true)]` to nullable arguments of `Try` methods that will definitively be non-`null` if the method returns `true`. For example, if `Int32.TryParse(string? s)` returns `true`, `s` is known to not be `null`, and so the method should be `public static bool TryParse([NotNullWhen(true)] string? s, out int result)`.
+- **DO** add `[NotNullIfNotNull(string)]` if nullable ref argument will be non-`null` upon exit, when an other argument passed evaluated to non-`null`, pass that argument name as string. Example: `public void Exchange([NotNullIfNotNull("value")] ref object? location, object? value);`.
+- **DO** add `[return: NotNullIfNotNull(string)]` if a method would not return `null` in case an argument passed evaluated to non-`null`, pass that argument name as string. Example: `[return: NotNullIfNotNull("name")] public string? FormatName(string? name);`
+- **DO** add `[MemberNotNull(params string[])]` for a helper method which initializes member field(s), pass the field name. Example: `[MemberNotNull("_buffer")] private void InitializeBuffer()`
## Code Review Guidance
diff --git a/docs/coding-guidelines/interop-guidelines.md b/docs/coding-guidelines/interop-guidelines.md
index ce0731e20cae11..e6e3a1d32060dc 100644
--- a/docs/coding-guidelines/interop-guidelines.md
+++ b/docs/coding-guidelines/interop-guidelines.md
@@ -178,7 +178,7 @@ Guidelines for shim C++ API:
- If an export point has a 1:1 correspondence to the platform API, then name it after the platform API in PascalCase (e.g. stat -> Stat, fstat -> FStat).
- If an export is not 1:1, then spell things out as we typically would in dotnet/runtime code (i.e. don't use abbreviations unless they come from the underlying API.
- At first, it seemed that we'd want to use 1:1 names throughout, but it turns out there are many cases where being strictly 1:1 isn't practical.
- - In order to reduce the chance of collisions when linking with CoreRT, all exports should have a prefix that corresponds to the Libraries' name, e.g. "SystemNative_" or "CryptoNative_" to make the method name more unique. See https://github.com/dotnet/corefx/issues/4818.
+ - In order to reduce the chance of collisions when linking with CoreRT, all exports should have a prefix that corresponds to the Libraries' name, e.g. "SystemNative_" or "CryptoNative_" to make the method name more unique. See https://github.com/dotnet/runtime/issues/15854.
- Stick to data types which are guaranteed not to vary in size across flavors.
- Use int32_t, int64_t, etc. from stdint.h and not int, long, etc.
- Use char* for ASCII or UTF-8 strings and uint8_t* for byte buffers.
diff --git a/docs/coding-guidelines/project-guidelines.md b/docs/coding-guidelines/project-guidelines.md
index 55728730a3c518..f0050a58588096 100644
--- a/docs/coding-guidelines/project-guidelines.md
+++ b/docs/coding-guidelines/project-guidelines.md
@@ -28,7 +28,7 @@ Below is a list of all the various options we pivot the project builds on:
## Individual build properties
The following are the properties associated with each build pivot
-- `$(BuildTargetFramework) -> netstandard2.1 | netcoreapp5.0 | net472`
+- `$(BuildTargetFramework) -> netstandard2.1 | net5.0 | net472`
- `$(TargetOS) -> Windows | Linux | OSX | FreeBSD | [defaults to running OS when empty]`
- `$(Configuration) -> Release | [defaults to Debug when empty]`
- `$(TargetArchitecture) - x86 | x64 | arm | arm64 | [defaults to x64 when empty]`
@@ -82,7 +82,7 @@ When we have a project that has a `netstandard2.0` target framework that means t
A full or individual project build is centered around BuildTargetFramework, TargetOS, Configuration and TargetArchitecture.
1. `$(BuildTargetFramework), $(TargetOS), $(Configuration), $(TargetArchitecture)` can individually be passed in to change the default values.
-2. If nothing is passed to the build then we will default value of these properties from the environment. Example: `netcoreapp5.0-[TargetOS Running On]-Debug-x64`.
+2. If nothing is passed to the build then we will default value of these properties from the environment. Example: `net5.0-[TargetOS Running On]-Debug-x64`.
3. While Building an individual project from the VS, we build the project for all latest netcoreapp target frameworks.
We also have `RuntimeOS` which can be passed to customize the specific OS and version needed for native package builds as well as package restoration. If not passed it will default based on the OS you are running on.
@@ -97,6 +97,46 @@ When building an individual project the `BuildTargetFramework` and `TargetOS` wi
- .NET Framework latest -> `$(NetFrameworkCurrent)-Windows_NT`
# Library project guidelines
+
+## TargetFramework conditions
+`TargetFramework` conditions should be avoided in the first PropertyGroup as that causes DesignTimeBuild issues: https://github.com/dotnet/project-system/issues/6143
+
+1. Use an equality check if the TargetFramework isn't overloaded with the OS portion.
+Example:
+```
+
+ netstandard2.0;netstandard2.1
+
+...
+```
+2. Use a StartsWith when you want to test for multiple .NETStandard or .NETFramework versions.
+Example:
+```
+
+ netstandard2.0;netstandard2.1
+
+...
+```
+4. Use negations if that makes the conditions easier.
+Example:
+```
+
+ netstandard2.0;net461;net472;net5.0
+
+...
+```
+
+## Directory layout
+
Library projects should use the following directory layout.
```
@@ -121,7 +161,7 @@ The output for the ref project build will be a flat targeting pack folder in the
## src
In the src directory for a library there should be only **one** `.csproj` file that contains any information necessary to build the library in various target frameworks. All supported target frameworks should be listed in the `TargetFrameworks` property.
-All libraries should use `` for all their project references. That will cause them to be resolved against a targeting pack (i.e. `bin\ref\netcoreapp5.0` or `\bin\ref\netstanard2.0`) based on the project target framework. There should not be any direct project references to other libraries. The only exception to that rule right now is for partial facades which directly reference System.Private.CoreLib and thus need to directly reference other partial facades to avoid type conflicts.
+All libraries should use `` for all their project references. That will cause them to be resolved against a targeting pack (i.e. `bin\ref\net5.0` or `\bin\ref\netstanard2.0`) based on the project target framework. There should not be any direct project references to other libraries. The only exception to that rule right now is for partial facades which directly reference System.Private.CoreLib and thus need to directly reference other partial facades to avoid type conflicts.
//**CONSIDER**: just using Reference and use a reference to System.Private.CoreLib as a trigger to turn the other References into a ProjectReference automatically. That will allow us to have consistency where all projects just use Reference.
### src output
diff --git a/docs/coding-guidelines/updating-ref-source.md b/docs/coding-guidelines/updating-ref-source.md
index d702db01f695fa..6ca0e56cc2629e 100644
--- a/docs/coding-guidelines/updating-ref-source.md
+++ b/docs/coding-guidelines/updating-ref-source.md
@@ -2,16 +2,16 @@ This document provides the steps you need to take to update the reference assemb
## For most assemblies within libraries
-1. Implement the API in the source assembly and [build it](../workflow/building/libraries/README.md#building-individual-libraries).
-2. Run the following command (from the src directory) `msbuild /t:GenerateReferenceSource` to update the reference assembly**.
+1. Implement the API in the source assembly and [build it](../workflow/building/libraries/README.md#building-individual-libraries). Note that when adding new public types, this might fail with a `TypeMustExist` error. The deadlock can be worked around by disabling the `RunApiCompat` property: `dotnet build /p:RunApiCompat=false`.
+2. Run the following command (from the src directory) `msbuild /t:GenerateReferenceAssemblySource` to update the reference assembly**.
3. Navigate to the ref directory and build the reference assembly.
4. Add, build, and run tests.
-** **Note:** If you already added the new API to the reference source, re-generating it (after building the source assembly) will update it to be fully qualified and placed in the correct order. This can be done by running the `GenerateReferenceSource` command from the ref directory.
+** **Note:** If you already added the new API to the reference source, re-generating it (after building the source assembly) will update it to be fully qualified and placed in the correct order. This can be done by running the `GenerateReferenceAssemblySource` command from the ref directory.
## For System.Runtime
These steps can also be applied to some unique assemblies which depend on changes in System.Private.Corelib. (partial facades like System.Memory, for example).
-1) Run `dotnet build -c Release /t:GenerateReferenceSource` from the System.Runtime/ref directory.
+1) Run `dotnet build -c Release /t:GenerateReferenceAssemblySource` from the System.Runtime/ref directory.
2) Filter out all unrelated changes and extract the changes you care about (ignore certain attributes being removed). Generally, this step is not required for other reference assemblies.
diff --git a/docs/design/coreclr/botr/README.md b/docs/design/coreclr/botr/README.md
index fde9992daeb9cc..4c6e6cb5b3bf6a 100644
--- a/docs/design/coreclr/botr/README.md
+++ b/docs/design/coreclr/botr/README.md
@@ -19,7 +19,7 @@ Below is a table of contents.
- [Method Descriptor](method-descriptor.md)
- [Virtual Stub Dispatch](virtual-stub-dispatch.md)
- [Stack Walking](stackwalking.md)
-- [Mscorlib and Calling Into the Runtime](mscorlib.md)
+- [`System.Private.CoreLib` and calling into the runtime](corelib.md)
- [Data Access Component (DAC) Notes](dac-notes.md)
- [Profiling](profiling.md)
- [Implementing Profilability](profilability.md)
diff --git a/docs/design/coreclr/botr/corelib.md b/docs/design/coreclr/botr/corelib.md
new file mode 100644
index 00000000000000..9b6f5dbb7f4c22
--- /dev/null
+++ b/docs/design/coreclr/botr/corelib.md
@@ -0,0 +1,352 @@
+`System.Private.CoreLib` and calling into the runtime
+===
+
+# Introduction
+
+`System.Private.CoreLib.dll` is the assembly for defining the core parts of the type system, and a good portion of the Base Class Library in .NET Framework. It was originally named `mscorlib` in .NET Core, though many places in the code and documentation still refer to it as `mscorlib`. This document will endeavour to stick to using `System.Private.CoreLib` or CoreLib. Base data types live in this assembly, and it has a tight coupling with the CLR. Here you will learn exactly how and why CoreLib is special and the basics about calling into the CLR from managed code via QCall and FCall methods. It also discusses calling from within the CLR into managed code.
+
+## Dependencies
+
+Since CoreLib defines base data types like `Object`, `Int32`, and `String`, CoreLib cannot depend on other managed assemblies. However, there is a strong dependency between CoreLib and the CLR. Many of the types in CoreLib need to be accessed from native code, so the layout of many managed types is defined both in managed code and in native code inside the CLR. Additionally, some fields may be defined only in Debug, Checked, or Release builds, so typically CoreLib must be compiled separately for each type of build.
+
+`System.Private.CoreLib.dll` builds separately for 64 bit and 32 bit, and some public constants it exposes differ by bitness. By using these constants, such as `IntPtr.Size`, most libraries above CoreLib should not need to build separately for 32 bit vs. 64 bit.
+
+## What makes `System.Private.CoreLib` special?
+
+CoreLib has several unique properties, many of which are due to its tight coupling to the CLR.
+
+- CoreLib defines the core types necessary to implement the CLR's Virtual Object System, such as the base data types (`Object`, `Int32`, `String`, etc).
+- The CLR must load CoreLib on startup to load certain system types.
+- Can only have one CoreLib loaded in the process at a time, due to layout issues. Loading multiple CoreLibs would require formalizing a contract of behavior, FCall methods, and datatype layout between CLR and CoreLib, and keeping that contract relatively stable across versions.
+- CoreLib's types are used heavily for native interop and managed exceptions should map correctly to native error codes/formats.
+- The CLR's multiple JIT compilers may special case a small group of certain methods in CoreLib for performance reasons, both in terms of optimizing away the method (such as `Math.Cos(double)`), or calling a method in peculiar ways (such as `Array.Length`, or some implementation details on `StringBuilder` for getting the current thread).
+- CoreLib will need to call into native code, via P/Invoke where appropriate, primarily into the underlying operating system or occasionally a platform adaptation layer.
+- CoreLib will require calling into the CLR to expose some CLR-specific functionality, such as triggering a garbage collection, to load classes, or to interact with the type system in a non-trivial way. This requires a bridge between managed code and native, "manually managed" code within the CLR.
+- The CLR will need to call into managed code to call managed methods, and to get at certain functionality that is only implemented in managed code.
+
+# Interface between managed and CLR code
+
+To reiterate, the needs of managed code in CoreLib include:
+
+- The ability to access fields of some managed data structures in both managed code and "manually managed" code within the CLR.
+- Managed code must be able to call into the CLR.
+- The CLR must be able to call managed code.
+
+To implement these, we need a way for the CLR to specify and optionally verify the layout of a managed object in native code, a managed mechanism for calling into native code, and a native mechanism for calling into managed code.
+
+The managed mechanism for calling into native code must also support the special managed calling convention used by `String`'s constructors, where the constructor allocates the memory used by the object (instead of the typical convention where the constructor is called after the GC allocates memory).
+
+The CLR provides a [`mscorlib` binder](https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/binder.cpp) internally, providing a mapping between unmanaged types and fields to managed types and fields. The binder will look up and load classes and allows the calling of managed methods. It also performs simple verification to ensure the correctness of any layout information specified in both managed and native code. The binder ensures that the managed class attempting to load exists in mscorlib, has been loaded, and the field offsets are correct. It also needs the ability to differentiate between method overloads with different signatures.
+
+# Calling from managed to native code
+
+Two techniques exist for calling into the CLR from managed code. FCall allows you to call directly into the CLR code, and provides a lot of flexibility in terms of manipulating objects, though it is easy to cause GC holes by not tracking object references correctly. QCall also allows you to call into the CLR via the P/Invoke, but is much harder to accidentally mis-use. FCalls are identified in managed code as extern methods with the [`MethodImplOptions.InternalCall`](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.methodimploptions) bit set. QCalls are marked `static extern` methods similar to regular P/Invokes, but are directed toward a library called `"QCall"`.
+
+There is a small variant of FCall called HCall (for Helper call) for implementing JIT helpers. The HCall is intended for doing things like accessing multi-dimensional array elements, range checks, etc. The only difference between HCall and FCall is that HCall methods won't show up in an exception stack trace.
+
+### Choosing between FCall, QCall, P/Invoke, and writing in managed code
+
+First, remember that you should be writing as much as possible in managed code. You avoid a raft of potential GC hole issues, you get a better debugging experience, and the code is often simpler.
+
+Reasons to write FCalls in the past generally fell into three camps: missing language features, better performance, or implementing unique interactions with the runtime. C# now has almost every useful language feature that you could get from C++, including unsafe code and stack-allocated buffers, and this eliminates the first two reasons for FCalls. We have ported some parts of the CLR that were heavily reliant on FCalls to managed code in the past (such as Reflection, some Encoding, and String operations) and we intend to continue this momentum.
+
+If the only reason you're defining a FCall method is to call a native method, you should be using P/Invoke to call the method directly. [P/Invoke](https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.dllimportattribute) is the public native method interface and should be doing everything you need in a correct manner.
+
+If you still need to implement a feature inside the runtime, consider if there is a way to reduce the frequency of transitioning to native code. Can you write the common case in managed and only call into native for some rare corner cases? You're usually best off keeping as much as possible in managed code.
+
+QCalls are the preferred mechanism going forward. You should only use FCalls when you are "forced" to. This happens when there is common "short path" through the code that is important to optimize. This short path should not be more than a few hundred instructions, cannot allocate GC memory, take locks or throw exceptions (`GC_NOTRIGGER`, `NOTHROWS`). In all other circumstances (and especially when you enter a FCall and then simply erect HelperMethodFrame), you should be using QCall.
+
+FCalls were specifically designed for short paths of code that must be optimized. They allowed explicit control over when erecting a frame was done. However, it is error prone and not worth the complexity for many APIs. QCalls are essentially P/Invokes into the CLR. In the event the performance of an FCall is required consider creating a QCall and marking it with [`SuppressGCTransitionAttribute`](https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.suppressgctransitionattribute).
+
+As a result, QCalls give you some advantageous marshaling for `SafeHandle`s automatically – your native method just takes a `HANDLE` type, and can be used without worrying whether someone will free the handle while in that method body. The resulting FCall method would need to use a `SafeHandleHolder` and may need to protect the `SafeHandle`, etc. Leveraging the P/Invoke marshaler can avoid this additional plumbing code.
+
+## QCall functional behavior
+
+QCalls are very much like a normal P/Invoke from CoreLib to CLR. Unlike FCalls, QCalls will marshal all arguments as unmanaged types like a normal P/Invoke. QCall also switch to preemptive GC mode like a normal P/Invoke. These two features should make QCalls easier to write reliably compared to FCalls. QCalls are not prone to GC holes and GC starvation bugs that are common with FCalls.
+
+QCalls perform better than FCalls that erect a `HelperMethodFrame`. The overhead is about 1.4x less compared to FCall w/ `HelperMethodFrame` overhead on x86 and x64.
+
+The preferred types for QCall arguments are primitive types that are efficiently handled by the P/Invoke marshaler (`INT32`, `LPCWSTR`, `BOOL`). Notice that `BOOL` is the correct boolean flavor for QCall arguments. On the other hand, `CLR_BOOL` is the correct boolean flavor for FCall arguments.
+
+The pointers to common unmanaged EE structures should be wrapped into handle types. This is to make the managed implementation type safe and avoid falling into unsafe C# everywhere. See AssemblyHandle in [vm\qcall.h][qcall] for an example.
+
+[qcall]: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/qcall.h
+
+Passing object references in and out of QCalls is done by wrapping a pointer to a local variable in a handle. It is intentionally cumbersome and should be avoided if reasonably possible. See the `StringHandleOnStack` in the example below. Returning objects, especially strings, from QCalls is the only common pattern where passing the raw objects is widely acceptable. (For reasoning on why this set of restrictions helps make QCalls less prone to GC holes, read the ["GC Holes, FCall, and QCall"](#gcholes) section below.)
+
+### QCall example - managed
+
+Do not replicate the comments into your actual QCall implementation. This is for illustrative purposes.
+
+```CSharp
+class Foo
+{
+ // All QCalls should have the following DllImport attribute
+ [DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
+
+ // QCalls should always be static extern.
+ private static extern bool BarInternal(int flags, string inString, StringHandleOnStack retString);
+
+ // Many QCalls have a thin managed wrapper around them to perform
+ // as much work prior to the transition as possible. An example would be
+ // argument validation which is easier in managed than native code.
+ public string Bar(int flags)
+ {
+ if (flags != 0)
+ throw new ArgumentException("Invalid flags");
+
+ string retString = null;
+ // The strings are returned from QCalls by taking address
+ // of a local variable using StringHandleOnStack
+ if (!BarInternal(flags, this.Id, new StringHandleOnStack(ref retString)))
+ FatalError();
+
+ return retString;
+ }
+}
+```
+
+### QCall example - unmanaged
+
+Do not replicate the comments into your actual QCall implementation.
+
+The QCall entrypoint has to be registered in tables in [vm\ecalllist.h][ecalllist] using `QCFuncEntry` macro. See ["Registering your QCall or FCall Method"](#register) below.
+
+[ecalllist]: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/ecalllist.h
+
+```C++
+class FooNative
+{
+public:
+ // All QCalls should be static and tagged with QCALLTYPE
+ static
+ BOOL QCALLTYPE BarInternal(int flags, LPCWSTR wszString, QCall::StringHandleOnStack retString);
+};
+
+BOOL QCALLTYPE FooNative::BarInternal(int flags, LPCWSTR wszString, QCall::StringHandleOnStack retString)
+{
+ // All QCalls should have QCALL_CONTRACT.
+ // It is alias for THROWS; GC_TRIGGERS; MODE_PREEMPTIVE.
+ QCALL_CONTRACT;
+
+ // Optionally, use QCALL_CHECK instead and the expanded form of the contract
+ // if you want to specify preconditions:
+ // CONTRACTL {
+ // QCALL_CHECK;
+ // PRECONDITION(wszString != NULL);
+ // } CONTRACTL_END;
+
+ // The only line between QCALL_CONTRACT and BEGIN_QCALL
+ // should be the return value declaration if there is one.
+ BOOL retVal = FALSE;
+
+ // The body has to be enclosed in BEGIN_QCALL/END_QCALL macro.
+ // It is necessary for exception handling.
+ BEGIN_QCALL;
+
+ // Argument validation would ideally be in managed, but in some cases
+ // needs to be done in native. If argument validation is done in
+ // managed asserting in native is warranted.
+ _ASSERTE(flags != 0);
+
+ // No need to worry about GC moving strings passed into QCall.
+ // Marshalling pins them for us.
+ printf("%S\n", wszString);
+
+ // This is the most efficient way to return strings back
+ // to managed code. No need to use StringBuilder.
+ retString.Set(L"Hello");
+
+ // You can not return from inside of BEGIN_QCALL/END_QCALL.
+ // The return value has to be passed out in helper variable.
+ retVal = TRUE;
+
+ END_QCALL;
+
+ return retVal;
+}
+```
+
+## FCall functional behavior
+
+FCalls allow more flexibility in terms of passing object references around, but with higher code complexity and more opportunities to make mistakes. Additionally, FCall methods must either erect a helper method frame along their common code paths, or for any FCall of non-trivial length, explicitly poll for whether a garbage collection must occur. Failing to do so will lead to starvation issues if managed code repeatedly calls the FCall method in a tight loop, because FCalls execute while the thread only allows the GC to run in a cooperative manner.
+
+FCalls require a lot of boilerplate code, too much to describe here. Refer to [fcall.h][fcall] for details.
+
+[fcall]: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/fcall.h
+
+### GC holes, FCall, and QCall
+
+A more complete discussion on GC holes can be found in the [CLR Code Guide](../../../coding-guidelines/clr-code-guide.md). Look for ["Is your code GC-safe?"](../../../coding-guidelines/clr-code-guide.md#2.1). This tailored discussion motivates some of the reasons why FCall and QCall have some of their strange conventions.
+
+Object references passed as parameters to FCall methods are not GC-protected, meaning that if a GC occurs, those references will point to the old location in memory of an object, not the new location. For this reason, FCalls usually follow the discipline of accepting something like `StringObject*` as their parameter type, then explicitly converting that to a `STRINGREF` before doing operations that may trigger a GC. If you expect to use an object reference later, you must GC protect object references before triggering a GC.
+
+All GC heap allocations within an FCall method must happen within a helper method frame. If you allocate memory on the GC heap, the GC may collect dead objects and move objects around in unpredictable ways, with some low probability. For this reason, you must manually report any object references in your method to the GC, so that if a garbage collection occurs, your object reference will be updated to refer to the new location in memory. Any pointers into managed objects (like arrays or Strings) within your code will not be updated automatically, and must be re-fetched after any operation that may allocate memory and before your first usage. Reporting a reference can be done via the `GCPROTECT_*` macros or as parameters when erecting a helper method frame.
+
+Failing to properly report an `OBJECTREF` or to update an interior pointer is commonly referred to as a "GC hole", because the `OBJECTREF` class will do some validation that it points to a valid object every time you dereference it in Debug and Checked builds. When an `OBJECTREF` pointing to an invalid object is dereferenced, an assert will trigger saying something like "Detected an invalid object reference. Possible GC hole?". This assert is unfortunately easy to hit when writing "manually managed" code.
+
+Note that QCall's programming model is restrictive to sidestep GC holes by forcing you to pass in the address of an object reference on the stack. This guarantees that the object reference is GC protected by the JIT's reporting logic, and that the actual object reference will not move because it is not allocated in the GC heap. QCall is our recommended approach, precisely because it makes GC holes harder to write.
+
+### FCall epilog walker for x86
+
+The managed stack walker needs to be able to find its way from FCalls. It is relative easy on newer platforms that define conventions for stack unwinding as part of the ABI. The stack unwinding conventions are not defined by an ABI for x86. The runtime works around this by implementing an epilog walker. The epilog walker computes the FCall return address and callee save registers by simulating the FCall execution. This imposes limits on what constructs are allowed in the FCall implementation.
+
+Complex constructs like stack allocated objects with destructors or exception handling in the FCall implementation may confuse the epilog walker. This can lead to GC holes or crashes during stack walking. There is no comprehensive list of what constructs should be avoided to prevent this class of bugs. An FCall implementation that is fine one day may break with the next C++ compiler update. We depend on stress runs and code coverage to find bugs in this area.
+
+Setting a breakpoint inside an FCall implementation may confuse the epilog walker. It leads to an "Invalid breakpoint in a helpermethod frame epilog" assert inside [vm\i386\gmsx86.cpp](https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/i386/gmsx86.cpp).
+
+### FCall example – managed
+
+Here's a real-world example from the `String` class:
+
+```CSharp
+public partial sealed class String
+{
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private extern string? IsInterned();
+
+ public static string? IsInterned(string str)
+ {
+ if (str == null)
+ {
+ throw new ArgumentNullException(nameof(str));
+ }
+
+ return str.IsInterned();
+ }
+}
+```
+
+### FCall example – unmanaged
+
+The FCall entrypoint has to be registered in tables in [vm\ecalllist.h][ecalllist] using `FCFuncEntry` macro. See ["Registering your QCall or FCall Method"](#register).
+
+This method is an instance method in managed code, with the "this" parameter passed as the first argument. We use `StringObject*` as the argument type, then copy it into a `STRINGREF` so we get some error checking when we use it.
+
+```C++
+FCIMPL1(Object*, AppDomainNative::IsStringInterned, StringObject* pStringUNSAFE)
+{
+ FCALL_CONTRACT;
+
+ STRINGREF refString = ObjectToSTRINGREF(pStringUNSAFE);
+ STRINGREF* prefRetVal = NULL;
+
+ HELPER_METHOD_FRAME_BEGIN_RET_1(refString);
+
+ if (refString == NULL)
+ COMPlusThrow(kArgumentNullException, W("ArgumentNull_String"));
+
+ prefRetVal = GetAppDomain()->IsStringInterned(&refString);
+
+ HELPER_METHOD_FRAME_END();
+
+ if (prefRetVal == NULL)
+ return NULL;
+
+ return OBJECTREFToObject(*prefRetVal);
+}
+FCIMPLEND
+```
+
+## Registering your QCall or FCall method
+
+The CLR must know the name of your QCall and FCall methods, both in terms of the managed class and method names, as well as which native methods to call. That is done in [ecalllist.h][ecalllist], with two arrays. The first array maps namespace and class names to an array of function elements. That array of function elements then maps individual method names and signatures to function pointers.
+
+Say we defined an FCall method for `String.IsInterned()`, in the example above. First, we need to ensure that we have an array of function elements for the String class.
+
+``` C++
+// Note these have to remain sorted by name:namespace pair
+ ...
+ FCClassElement("String", "System", gStringFuncs)
+ ...
+```
+
+Second, we must then ensure that `gStringFuncs` contains a proper entry for `IsInterned`. Note that if a method name has multiple overloads then we can specify a signature:
+
+```C++
+FCFuncStart(gStringFuncs)
+ ...
+ FCFuncElement("IsInterned", AppDomainNative::IsStringInterned)
+ ...
+FCFuncEnd()
+```
+
+There is a parallel `QCFuncElement` macro.
+
+## Naming convention
+
+FCalls and QCalls should not be publicly exposed. Instead wrap the actual FCall or QCall and provide a API approved name.
+
+The internal FCall or QCall should use the "Internal" suffix to disambiguate the name of the FCall or QCall from public entry point (e.g. the public entry point does error checking and then calls shared worker function with exactly same signature). This is no different from how you would deal with this situation in pure managed code in BCL.
+
+# Types with a managed/unmanaged duality
+
+Certain managed types must have a representation available in both managed and native code. You could ask whether the canonical definition of a type is in managed code or native code within the CLR, but the answer doesn't matter – the key thing is they must both be identical. This will allow the CLR's native code to access fields within a managed object in a fast and efficient manner. There is a more complex way of using essentially the CLR's equivalent of Reflection over `MethodTable`s and `FieldDesc`s to retrieve field values, but this doesn't perform as well as desired and isn't very usable. For commonly used types, it makes sense to declare a data structure in native code and keep the two in sync.
+
+The CLR provides a binder for this purpose. After you define your managed and native classes, you should provide some clues to the binder to help ensure that the field offsets remain the same to quickly spot when someone accidentally adds a field to only one definition of a type.
+
+In [mscorlib.h][mscorlib.h], use macros ending in "_U" to describe a type, the name of fields in managed code, and the name of fields in a corresponding native data structure. Additionally, you can specify a list of methods, and reference them by name when you attempt to call them later.
+
+[mscorlib.h]: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/mscorlib.h
+
+``` C++
+DEFINE_CLASS_U(SAFE_HANDLE, Interop, SafeHandle, SafeHandle)
+DEFINE_FIELD(SAFE_HANDLE, HANDLE, handle)
+DEFINE_FIELD_U(SAFE_HANDLE, STATE, _state, SafeHandle, m_state)
+DEFINE_FIELD_U(SAFE_HANDLE, OWNS_HANDLE, _ownsHandle, SafeHandle, m_ownsHandle)
+DEFINE_FIELD_U(SAFE_HANDLE, INITIALIZED, _fullyInitialized, SafeHandle, m_fullyInitialized)
+DEFINE_METHOD(SAFE_HANDLE, GET_IS_INVALID, get_IsInvalid, IM_RetBool)
+DEFINE_METHOD(SAFE_HANDLE, RELEASE_HANDLE, ReleaseHandle, IM_RetBool)
+DEFINE_METHOD(SAFE_HANDLE, DISPOSE, Dispose, IM_RetVoid)
+DEFINE_METHOD(SAFE_HANDLE, DISPOSE_BOOL, Dispose, IM_Bool_RetVoid)
+```
+
+Then, you can use the `REF` template to create a type name like `SAFEHANDLEREF`. All the error checking from `OBJECTREF` is built into the `REF` template, and you can freely dereference this `SAFEHANDLEREF` and use fields off of it in native code. You still must GC protect these references.
+
+# Calling into managed code from unmanaged code
+
+Clearly there are places where the CLR must call into managed code from native. For this purpose, we have added a `MethodDescCallSite` class to handle a lot of plumbing for you. Conceptually, all you need to do is find the `MethodDesc*` for the method you want to call, find a managed object for the "this" pointer (if you're calling an instance method), pass in an array of arguments, and deal with the return value. Internally, you'll need to potentially toggle your thread's state to allow the GC to run in preemptive mode, etc.
+
+Here's a simplified example. Note how this instance uses the binder described in the previous section to call `SafeHandle`'s virtual `ReleaseHandle` method.
+
+```C++
+void SafeHandle::RunReleaseMethod(SafeHandle* psh)
+{
+ CONTRACTL {
+ THROWS;
+ GC_TRIGGERS;
+ MODE_COOPERATIVE;
+ } CONTRACTL_END;
+
+ SAFEHANDLEREF sh(psh);
+
+ GCPROTECT_BEGIN(sh);
+
+ MethodDescCallSite releaseHandle(s_pReleaseHandleMethod, METHOD__SAFE_HANDLE__RELEASE_HANDLE, (OBJECTREF*)&sh, TypeHandle(), TRUE);
+
+ ARG_SLOT releaseArgs[] = { ObjToArgSlot(sh) };
+ if (!(BOOL)releaseHandle.Call_RetBool(releaseArgs)) {
+ MDA_TRIGGER_ASSISTANT(ReleaseHandleFailed, ReportViolation)(sh->GetTypeHandle(), sh->m_handle);
+ }
+
+ GCPROTECT_END();
+}
+```
+
+# Interactions with other subsystems
+
+## Debugger
+
+One limitation of FCalls today is that you cannot easily debug both managed code and FCalls easily in Visual Studio's Interop (or mixed mode) debugging. Setting a breakpoint today in an FCall and debugging with Interop debugging just doesn't work. This most likely won't be fixed.
+
+# Physical architecture
+
+When the CLR starts up, CoreLib is loaded by a method called `SystemDomain::LoadBaseSystemClasses()`. Here, the base data types and other similar classes (like `Exception`) are loaded, and appropriate global pointers are set up to refer to CoreLib's types.
+
+For FCalls, look in [fcall.h][fcall] for infrastructure, and [ecalllist.h][ecalllist] to properly inform the runtime about your FCall method.
+
+For QCalls, look in [qcall.h][qcall] for associated infrastructure, and [ecalllist.h][ecalllist] to properly inform the runtime about your QCall method.
+
+More general infrastructure and some native type definitions can be found in [object.h][object.h]. The binder uses `mscorlib.h` to associate managed and native classes.
+
+[object.h]: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/object.h
diff --git a/docs/design/coreclr/botr/dac-notes.md b/docs/design/coreclr/botr/dac-notes.md
index 1a267484760e9e..43b1714b1d8c90 100644
--- a/docs/design/coreclr/botr/dac-notes.md
+++ b/docs/design/coreclr/botr/dac-notes.md
@@ -11,13 +11,13 @@ Historically, the CLR debugger has operated in process. A debugger extension, SO
Notice that the DAC reads _the memory of the target process_. It's important to realize that the debugger and the debuggee are separate processes with separate address spaces. Thus it is important to make a clear distinction between target memory and host memory. Using a target address in code running in the host process would have completely unpredictable and generally incorrect results. When using the DAC to retrieve memory from the target, it is important to be very careful to use addresses from the correct address space. Furthermore, sometimes the target addresses are sometimes strictly used as data. In this case, it would be just as incorrect to use a host address. For example, to display information about a managed function, we might want to list its starting address and size. Here, it is important to provide the target address. When writing code in the VM that the DAC will run, one needs to correctly choose when to use host and target addresses.
-The DAC infrastructure (the macros and templates that control how host or target memory is accessed) supplies certain conventions that distinguish which pointers are host addresses and which are target addresses. When a function is _DACized_ (i.e., use the DAC infrastructure to make the function work out of process), host pointers of type _T _are declared to be of type _T _\*. Target pointers are of type PTR\ __T_. Remember though, that the concept of host versus target is only meaningful for the DAC. In a non-DAC build, we have only a single address space. The host and the target are the same: the CLR. If we declare a local variable of either type _T \* _or of type PTR\_T in a VM function, it will be a "host pointer" When we are executing code in clr.dll (coreclr.dll), there is absolutely no difference between a local variable of type _T \* _and a local variable of type PTR\__ T._ If we execute the function compiled into mscordacwks.dll (msdaccore.dll) from the same source, the variable declared to be of type _T \*_ will be a true host pointer, with the debugger as the host. If you think about it, this is obvious. Nevertheless it can become confusing when we start passing these pointers to other VM functions. When we are DACizing a function (i.e., changing _T \*_ to PTR\__T_, as appropriate), we sometimes need to trace a pointer back to its point of origin to determine whether it should be a host or target type.
+The DAC infrastructure (the macros and templates that control how host or target memory is accessed) supplies certain conventions that distinguish which pointers are host addresses and which are target addresses. When a function is _DACized_ (i.e., use the DAC infrastructure to make the function work out of process), host pointers of type `T` are declared to be of type `T *`. Target pointers are of type `PTR_T`. Remember though, that the concept of host versus target is only meaningful for the DAC. In a non-DAC build, we have only a single address space. The host and the target are the same: the CLR. If we declare a local variable of either type `T *` _or of type `PTR_T` in a VM function, it will be a "host pointer". When we are executing code in clr.dll (coreclr.dll), there is absolutely no difference between a local variable of type `T *` and a local variable of type `PTR_T`. If we execute the function compiled into mscordacwks.dll (msdaccore.dll) from the same source, the variable declared to be of type `T *` will be a true host pointer, with the debugger as the host. If you think about it, this is obvious. Nevertheless it can become confusing when we start passing these pointers to other VM functions. When we are DACizing a function (i.e., changing `T *` to `PTR_T`, as appropriate), we sometimes need to trace a pointer back to its point of origin to determine whether it should be a host or target type.
-When one has no understanding of the DAC, it's easy to find the use of the DAC infrastructure annoying. The TADDRs and PTR\_this and dac\_casts, etc. seem to clutter the code and make it harder to understand. With just a little work, though, you'll find that these are not really difficult to learn. Keeping host and target addresses explicitly different is really a form of strong typing. The more diligent we are, the easier it becomes to ensure our code is correct.
+When one has no understanding of the DAC, it's easy to find the use of the DAC infrastructure annoying. The `TADDR`s and `PTR_this` and `dac_casts`, etc. seem to clutter the code and make it harder to understand. With just a little work, though, you'll find that these are not really difficult to learn. Keeping host and target addresses explicitly different is really a form of strong typing. The more diligent we are, the easier it becomes to ensure our code is correct.
Because the DAC potentially operates on a dump, the part of the VM sources we build in clr.dll (msdaccore.dll) must be non-invasive. Specifically, we usually don't want to do anything that would cause writing to the target's address space, nor can we execute any code that might cause an immediate garbage collection. (If we can defer the GC, it may be possible to allocate.) Note that the _host_ state is always mutated (temporaries, stack or local heap values); it is only mutating the _target_ space that is problematic. To enforce this, we do two things: code factoring and conditional compilation. In an ideal world, we would factor the VM code so that we would strictly isolate invasive actions in functions that are separate from non-invasive functions.
-Unfortunately, we have a large code base, most of which we wrote without ever thinking about the DAC at all. We have a significant number of functions with "find or create" semantics and many other functions that have some parts that just do inspection and other parts that write to the target. Sometimes we control this with a flag passed into the function. This is common in loader code, for example. To avoid having to complete the immense job of refactoring all the VM code before we can use the DAC, we have a second method to prevent executing invasive code from out of process. We have a defined pre-processor constant, DACCESS\_COMPILE that we use to control what parts of the code we compile into the DAC. We would like to use the DACCESS\_COMPILE constant as little as we can, so when we DACize a new code path, we prefer to refactor whenever possible. Thus, a function that has "find or create" semantics should become two functions: one that tries to find the information and a wrapper that calls this and creates if the find fails. That way, the DAC code path can call the find function directly and avoid the creation.
+Unfortunately, we have a large code base, most of which we wrote without ever thinking about the DAC at all. We have a significant number of functions with "find or create" semantics and many other functions that have some parts that just do inspection and other parts that write to the target. Sometimes we control this with a flag passed into the function. This is common in loader code, for example. To avoid having to complete the immense job of refactoring all the VM code before we can use the DAC, we have a second method to prevent executing invasive code from out of process. We have a defined pre-processor constant, `DACCESS_COMPILE` that we use to control what parts of the code we compile into the DAC. We would like to use the `DACCESS_COMPILE` constant as little as we can, so when we DACize a new code path, we prefer to refactor whenever possible. Thus, a function that has "find or create" semantics should become two functions: one that tries to find the information and a wrapper that calls this and creates if the find fails. That way, the DAC code path can call the find function directly and avoid the creation.
How does the DAC work?
======================
@@ -27,9 +27,9 @@ As discussed, the DAC works by marshaling the data it needs and running code in
Marshaling Principles
---------------------
-The DAC maintains a cache of data that it reads. This avoids the overhead of reading the same values repeatedly. Of course, if the target is live, the values will potentially change. We can only assume the cached values are valid as long as the debuggee remains stopped. Once we allow the target to continue execution, we must flush the DAC cache. The DAC will retrieve the values again when the debugger stops the target for further inspection. The entries in the DAC cache are of type DAC\_INSTANCE. This contains (among other data) the target address, the size of the data and space for the marshaled data itself. When the DAC marshals data, it returns the address of the marshaled data part of this entry as the host address.
+The DAC maintains a cache of data that it reads. This avoids the overhead of reading the same values repeatedly. Of course, if the target is live, the values will potentially change. We can only assume the cached values are valid as long as the debuggee remains stopped. Once we allow the target to continue execution, we must flush the DAC cache. The DAC will retrieve the values again when the debugger stops the target for further inspection. The entries in the DAC cache are of type `DAC_INSTANCE`. This contains (among other data) the target address, the size of the data and space for the marshaled data itself. When the DAC marshals data, it returns the address of the marshaled data part of this entry as the host address.
-When the DAC reads a value from the target, it marshals the value as a chunk of bytes of a given size (determined by its type). By keeping the target address as a field in the cache entries, it maintains a mapping between the target address and the host address (the address in the cache). Between any stop and continue of a debugger session, the DAC will marshal each value requested only once, as long as subsequent accesses use the same type. (If we reference the target address by two different types, the size may be different, so the DAC will create a new cache entry for the new type). If the value is already in the cache, the DAC will be able to look it up by its target address. That means we can correctly compare two host pointers for (in)equality as long as we have accessed both pointers using the same type. This identity of pointers does not hold across type conversions however. Furthermore, we have no guarantee that values marshaled separately will maintain the same spatial relationship in the cache that they do in the target, so it is incorrect to compare two host pointers for less-than or greater-than relationships. Object layout must be identical in host and target, so we can access fields in an object in the cache using the same offsets we use in the target. Remember that any pointer fields in a marshaled object will be target addresses (generally declared as data members of a PTR type). If we need the values at those addresses, the DAC must marshal them to the host before dereferencing them.
+When the DAC reads a value from the target, it marshals the value as a chunk of bytes of a given size (determined by its type). By keeping the target address as a field in the cache entries, it maintains a mapping between the target address and the host address (the address in the cache). Between any stop and continue of a debugger session, the DAC will marshal each value requested only once, as long as subsequent accesses use the same type. (If we reference the target address by two different types, the size may be different, so the DAC will create a new cache entry for the new type). If the value is already in the cache, the DAC will be able to look it up by its target address. That means we can correctly compare two host pointers for (in)equality as long as we have accessed both pointers using the same type. This identity of pointers does not hold across type conversions however. Furthermore, we have no guarantee that values marshaled separately will maintain the same spatial relationship in the cache that they do in the target, so it is incorrect to compare two host pointers for less-than or greater-than relationships. Object layout must be identical in host and target, so we can access fields in an object in the cache using the same offsets we use in the target. Remember that any pointer fields in a marshaled object will be target addresses (generally declared as data members of a `PTR` type). If we need the values at those addresses, the DAC must marshal them to the host before dereferencing them.
Because we build this dll from the same sources that we use to build mscorwks.dll (coreclr.dll), the mscordacwks.dll (msdaccore.dll) build that the debugger uses must match the mscorwks build exactly. You can see that this is obviously true if you consider that between builds we might add or remove a field from a type we use. The size for the object in mscorwks would then be different from the size in mscordacwks and the DAC could not marshal the object correctly. This has a ramification that's obvious when you think about it, but easy to overlook. We cannot have fields in objects that exist only in DAC builds or only in non-DAC builds. Thus, a declaration such as the following would lead to incorrect behavior.
@@ -60,20 +60,20 @@ An example may be helpful in understanding how marshaling works. The common debu

-The debugger in this figure could be Visual Studio, MDbg, WinDbg, etc. The debugger interfaces with the CLR debugger interface (DBI) APIs to get the information it needs. Information that must come from the target goes through the DAC. The debugger implements the data target, which is responsible for implementing a ReadVirtual function to read memory in the target. The dotted line in the diagram represents the process boundary.
+The debugger in this figure could be Visual Studio, MDbg, WinDbg, etc. The debugger interfaces with the CLR debugger interface (DBI) APIs to get the information it needs. Information that must come from the target goes through the DAC. The debugger implements the data target, which is responsible for implementing a `ReadVirtual` function to read memory in the target. The dotted line in the diagram represents the process boundary.
-Suppose the debugger needs to display the starting address of an ngen'ed method in the managed application that it has gotten from the managed stack. We will assume that the debugger has already gotten an instance of ICorDebugFunction back from the DBI. It will begin by calling the DBI API ICorDebugFunction::GetNativeCode. This calls into the DAC through the DAC/DBI interface function GetNativeCodeInfo, passing in the domain file and metadata token for the function. The following code fragment is a simplification of the actual function, but it illustrates marshaling without introducing extraneous details.
+Suppose the debugger needs to display the starting address of an ngen'ed method in the managed application that it has gotten from the managed stack. We will assume that the debugger has already gotten an instance of `ICorDebugFunction` back from the DBI. It will begin by calling the DBI API `ICorDebugFunction::GetNativeCode`. This calls into the DAC through the DAC/DBI interface function `GetNativeCodeInfo`, passing in the domain file and metadata token for the function. The following code fragment is a simplification of the actual function, but it illustrates marshaling without introducing extraneous details.
void DacDbiInterfaceImpl::GetNativeCodeInfo(TADDR taddrDomainFile,
- mdToken functionToken,
- NativeCodeFunctionData \* pCodeInfo)
+ mdToken functionToken,
+ NativeCodeFunctionData * pCodeInfo)
{
...
- DomainFile \* pDomainFile = dac\_cast(taddrDomainFile);
- Module \* pModule = pDomainFile->GetCurrentModule();
+ DomainFile * pDomainFile = dac_cast(taddrDomainFile);
+ Module * pModule = pDomainFile->GetCurrentModule();
- MethodDesc\* pMethodDesc = pModule->LookupMethodDef (functionToken);
+ MethodDesc* pMethodDesc = pModule->LookupMethodDef (functionToken);
pCodeInfo->pNativeCodeMethodDescToken = pMethodDesc;
// if we are loading a module and trying to bind a previously set breakpoint, we may not have
@@ -85,9 +85,9 @@ Suppose the debugger needs to display the starting address of an ngen'ed method
}
}
-The first step is to get the module in which the managed function resides. The taddrDomainFile parameter we pass in represents a target address, but we will need to be able to dereference it here. This means we need the DAC to marshal the value. The dac\_cast operator will construct a new instance of PTR\_DomainFile with a target address equal to the value of domainFileTaddr. When we assign this to pDomainFile, we have an implicit conversion to the host pointer type. This conversion operator is a member of the PTR type and this is where the marshaling occurs. The DAC first searches its cache for the target address. If it doesn't find it, it reads the data from the target for the marshaled DomainFile instance and copies it to the cache. Finally, it returns the host address of the marshaled value.
+The first step is to get the module in which the managed function resides. The `taddrDomainFile` parameter we pass in represents a target address, but we will need to be able to dereference it here. This means we need the DAC to marshal the value. The `dac_cast` operator will construct a new instance of `PTR_DomainFile` with a target address equal to the value of `domainFileTaddr`. When we assign this to `pDomainFile`, we have an implicit conversion to the host pointer type. This conversion operator is a member of the `PTR` type and this is where the marshaling occurs. The DAC first searches its cache for the target address. If it doesn't find it, it reads the data from the target for the marshaled `DomainFile` instance and copies it to the cache. Finally, it returns the host address of the marshaled value.
-Now we can call GetCurrentModule on this host instance of the DomainFile. This function is a simple accessor that returns DomainFile::m\_pModule. Notice that it returns a Module \*, which will be a host address. The value of m\_pModule is a target address (the DAC will have copied the DomainFile instance as raw bytes). The type for the field is PTR\_Module, however, so when the function returns it, the DAC will automatically marshal it as part of the conversion to Module \*. That means the return value is a host address. Now we have the correct module and a method token, so we have all the information we need to get the MethodDesc.
+Now we can call `GetCurrentModule` on this host instance of the `DomainFile`. This function is a simple accessor that returns `DomainFile::m_pModule`. Notice that it returns a `Module *`, which will be a host address. The value of `m_pModule` is a target address (the DAC will have copied the `DomainFile` instance as raw bytes). The type for the field is `PTR_Module`, however, so when the function returns it, the DAC will automatically marshal it as part of the conversion to `Module *`. That means the return value is a host address. Now we have the correct module and a method token, so we have all the information we need to get the `MethodDesc`.
Module * DomainFile::GetCurrentModule()
{
@@ -96,20 +96,19 @@ Now we can call GetCurrentModule on this host instance of the DomainFile. This f
return m_pModule;
}
-In this simplified version of the code, we are assuming that the method token is a method definition. The next step, then, is to call the LookupMethodDef function on the Module instance.
+In this simplified version of the code, we are assuming that the method token is a method definition. The next step, then, is to call the `LookupMethodDef` function on the `Module` instance.
- inline MethodDesc \*Module::LookupMethodDef(mdMethodDef token)
+ inline MethodDesc *Module::LookupMethodDef(mdMethodDef token)
{
- WRAPPER\_CONTRACT;
- SUPPORTS\_DAC;
+ WRAPPER_CONTRACT;
+ SUPPORTS_DAC;
...
- return dac\_cast(GetFromRidMap(&m\_MethodDefToDescMap,
- RidFromToken(token)));
+ return dac_cast(GetFromRidMap(&m_MethodDefToDescMap, RidFromToken(token)));
}
-This uses the RidMap to lookup the MethodDesc. If you look at the definition for this function, you will see that it returns a TADDR:
+This uses the `RidMap` to lookup the `MethodDesc`. If you look at the definition for this function, you will see that it returns a `TADDR`:
- TADDR GetFromRidMap(LookupMap \*pMap, DWORD rid)
+ TADDR GetFromRidMap(LookupMap *pMap, DWORD rid)
{
...
@@ -118,52 +117,53 @@ This uses the RidMap to lookup the MethodDesc. If you look at the definition for
return result;
}
-This represents a target address, but it's not really a pointer; it's simply a number (although it represents an address). The problem is that LookupMethodDef needs to return the address of a MethodDesc that we can dereference. To accomplish this, the function uses a dac\_cast to PTR\_MethodDesc to convert the TADDR to a PTR\_MethodDesc. You can think of this as the target address space form of a cast from void \* to MethodDesc \*. In fact, this code would be slightly cleander if GetFromRidMap returned a PTR\_VOID (with pointer semantics) instead of a TADDR (with integer semantics). Again, the type conversion implicit in the return statement ensures that the DAC marshals the object (if necessary) and returns the host address of the MethodDesc in the DAC cache.
+This represents a target address, but it's not really a pointer; it's simply a number (although it represents an address). The problem is that `LookupMethodDef` needs to return the address of a `MethodDesc` that we can dereference. To accomplish this, the function uses a `dac_cast` to `PTR_MethodDesc` to convert the `TADDR` to a `PTR_MethodDesc`. You can think of this as the target address space form of a cast from `void *` to `MethodDesc *`. In fact, this code would be slightly cleander if `GetFromRidMap` returned a `PTR_VOID` (with pointer semantics) instead of a `TADDR` (with integer semantics). Again, the type conversion implicit in the return statement ensures that the DAC marshals the object (if necessary) and returns the host address of the `MethodDesc` in the DAC cache.
-The assignment statement in GetFromRidMap indexes an array to get a particular value. The pMap parameter is the address of a structure field from the MethodDesc. As such, the DAC will have copied the entire field into the cache when it marshaled the MethodDesc instance. Thus, pMap, which is the address of this struct, is a host pointer. Dereferencing it does not involve the DAC at all. The pTable field, however, is a PTR\_TADDR. What this tells us is that pTable is an array of target addresses, but its type indicates that it is a marshaled type. This means that pTable will be a target address as well. We dereference it with the overloaded indexing operator for the PTR type. This will get the target address of the array and compute the target address of the element we want. The last step of indexing marshals the array element back to a host instance in the DAC cache and returns its value. We assign the the element (a TADDR) to the local variable result and return it.
+The assignment statement in `GetFromRidMap` indexes an array to get a particular value. The `pMap` parameter is the address of a structure field from the `MethodDesc`. As such, the DAC will have copied the entire field into the cache when it marshaled the `MethodDesc` instance. Thus, `pMap`, which is the address of this struct, is a host pointer. Dereferencing it does not involve the DAC at all. The `pTable` field, however, is a `PTR_TADDR`. What this tells us is that `pTable` is an array of target addresses, but its type indicates that it is a marshaled type. This means that `pTable` will be a target address as well. We dereference it with the overloaded indexing operator for the `PTR` type. This will get the target address of the array and compute the target address of the element we want. The last step of indexing marshals the array element back to a host instance in the DAC cache and returns its value. We assign the the element (a `TADDR`) to the local variable result and return it.
-Finally, to get the code address, the DAC/DBI interface function will call MethodDesc::GetNativeCode. This function returns a value of type PCODE. This type is a target address, but one that we cannot dereference (it is just an alias of TADDR) and one that we use specifically to specify a code address. We store this value on the ICorDebugFunction instance and return it to the debugger.
+Finally, to get the code address, the DAC/DBI interface function will call `MethodDesc::GetNativeCode`. This function returns a value of type `PCODE`. This type is a target address, but one that we cannot dereference (it is just an alias of `TADDR`) and one that we use specifically to specify a code address. We store this value on the `ICorDebugFunction` instance and return it to the debugger.
### PTR Types
-Because the DAC marshals values from the target address space to the host address space, understanding how the DAC handles target pointers is fundamental. We collectively refer to the fundamental types used for marshaling these as "PTR types." You will see that [daccess.h][daccess.h] defines two classes: \_\_TPtrBase, which has several derived types, and \_\_GlobalPtr. We don't use these types directly; we use them only indirectly through a number of macros. Each of these contains a single data member to give us the target address of the value. For \_\_TPtrBase, this is a full address. For \_\_GlobalPtr, it is a relative address, referenced from a DAC global base location. The "T" in \_\_TPtrBase stands for "target". As you can guess, we use types derived from \_\_TPtrBase for pointers that are data members or locals and we use \_\_GlobalPtr for globals and statics.
+Because the DAC marshals values from the target address space to the host address space, understanding how the DAC handles target pointers is fundamental. We collectively refer to the fundamental types used for marshaling these as "PTR types." You will see that [daccess.h][daccess.h] defines two classes: `__TPtrBase`, which has several derived types, and `__GlobalPtr`. We don't use these types directly; we use them only indirectly through a number of macros. Each of these contains a single data member to give us the target address of the value. For `__TPtrBase`, this is a full address. For `__GlobalPtr`, it is a relative address, referenced from a DAC global base location. The "T" in `__TPtrBase` stands for "target". As you can guess, we use types derived from `__TPtrBase` for pointers that are data members or locals and we use `__GlobalPtr` for globals and statics.
-In practice, we use these types only through macros. The introductory comment in [daccess.h][daccess.h] has examples of the use of all of these. What is interesting about these macros is that they will expand to declare instantiated types from these marshaling templates in DAC builds, but are no-ops in non-DAC builds. For example, the following definition declares PTR\_MethodTable as a type to represent method table pointers (note that the convention is to name these types with a prefix of PTR\_):
+In practice, we use these types only through macros. The introductory comment in [daccess.h][daccess.h] has examples of the use of all of these. What is interesting about these macros is that they will expand to declare instantiated types from these marshaling templates in DAC builds, but are no-ops in non-DAC builds. For example, the following definition declares `PTR_MethodTable` as a type to represent method table pointers (note that the convention is to name these types with a prefix of `PTR_`):
- typedef DPTR(class MethodTable) PTR\_MethodTable;
+ typedef DPTR(class MethodTable) PTR_MethodTable;
-In a DAC build, the DPTR macro will expand to declare a \_\_DPtr type named PTR\_MethodTable. In a non-DAC build, the macro simply declares PTR\_MethodTable to be MethodTable \*. This implies that the DAC functionality does not result in any behavior change or performance degradation in non-DAC builds.
+In a DAC build, the `DPTR` macro will expand to declare a `__DPtr` type named `PTR_MethodTable`. In a non-DAC build, the macro simply declares `PTR_MethodTable` to be `MethodTable *`. This implies that the DAC functionality does not result in any behavior change or performance degradation in non-DAC builds.
-Even better, in a DAC build, the DAC will automatically marshal variables, data members, or return values declared to be of type PTR\_MethodTable, as we saw in the example in the last section. The marshaling is completely transparent. The \_\_DPtr type has overloaded operator functions to redefine pointer dereferencing and array indexing, and a conversion operator to cast to the host pointer type. These operations determine whether the requested value is already in the cache, from whence the operators will return them immediately, or whether it is necessary to read from the target and load the value into the cache before returning it. If you are interested in understanding the details, the function responsible for these cache operations is DacInstantiateTypeByAddressHelper.
+Even better, in a DAC build, the DAC will automatically marshal variables, data members, or return values declared to be of type `PTR_MethodTable`, as we saw in the example in the last section. The marshaling is completely transparent. The `__DPtr` type has overloaded operator functions to redefine pointer dereferencing and array indexing, and a conversion operator to cast to the host pointer type. These operations determine whether the requested value is already in the cache, from whence the operators will return them immediately, or whether it is necessary to read from the target and load the value into the cache before returning it. If you are interested in understanding the details, the function responsible for these cache operations is `DacInstantiateTypeByAddressHelper`.
-PTR types defined with DPTR are the most common in the runtime, but we also have PTR types for global and static pointers, restricted-use arrays, pointers to variable-sized objects, and pointers to classes with virtual functions that we may need to call from mscordacwks.dll (msdaccore.dll). Most of these are rare and you can refer to [daccess.h][daccess.h] to learn more about them if you need them.
+`PTR` types defined with `DPTR` are the most common in the runtime, but we also have `PTR` types for global and static pointers, restricted-use arrays, pointers to variable-sized objects, and pointers to classes with virtual functions that we may need to call from mscordacwks.dll (msdaccore.dll). Most of these are rare and you can refer to [daccess.h][daccess.h] to learn more about them if you need them.
-The GPTR and VPTR macros are common enough to warrant special mention here. Both the way we use these and their external behavior is quite similar to DPTRs. Again, marshaling is automatic and transparent. The VPTR macro declares a marshaled pointer type for a class with virtual functions. This special macro is necessary because the virtual function table is essentially an implicit extra field. The DAC has to marshal this separately, since the function addresses are all target addresses that the DAC must convert to host addresses. Treating these classes in this way means that the DAC automatically instantiates the correct implementation class, making casts between base and derived types unnecessary. When you declare a VPTR type, you must also list it in vptr\_list.h. \_\_GlobalPtr types provide base functionality to marshal both global variables and static data members through the GPTR, GVAL, SPTR and SVAL macros. The implementation of global variables is almost identical to that of static fields (both use the \_\_GlobalPtr class) and require the addition of an entry in [dacvars.h][dacvars.h]. The comments in daccess.h and dacvars.h provide more details about declaring these types.
+The `GPTR` and `VPTR` macros are common enough to warrant special mention here. Both the way we use these and their external behavior is quite similar to `DPTR`s. Again, marshaling is automatic and transparent. The `VPTR` macro declares a marshaled pointer type for a class with virtual functions. This special macro is necessary because the virtual function table is essentially an implicit extra field. The DAC has to marshal this separately, since the function addresses are all target addresses that the DAC must convert to host addresses. Treating these classes in this way means that the DAC automatically instantiates the correct implementation class, making casts between base and derived types unnecessary. When you declare a `VPTR` type, you must also list it in [vptr_list.h][vptr_list.h]. `__GlobalPtr` types provide base functionality to marshal both global variables and static data members through the `GPTR`, `GVAL`, `SPTR` and `SVAL` macros. The implementation of global variables is almost identical to that of static fields (both use the `__GlobalPtr` class) and require the addition of an entry in [dacvars.h][dacvars.h]. The comments in [daccess.h][daccess.h] and [dacvars.h][dacvars.h] provide more details about declaring these types.
[dacvars.h]: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/inc/dacvars.h
+[vptr_list.h]: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/inc/vptr_list.h
-Global and static values and pointers are interesting because they form the entry points to the target address space (all other uses of the DAC require you to have a target address already). Many of the globals in the runtime are already DACized. It occasionally becomes necessary to make a previously unDACized (or a newly introduced) global available to the DAC. By using the appropriate macros and [dacvars.h][dacvars.h] entry, you enable a post-build step (DacTableGen.exe run by the build in ndp\clr\src\dacupdatedll) to save the address of the global (from clr.pdb) into a table that is embedded into mscordacwks.dll. The DAC uses this table at run-time to determine where to look in the target address space when the code accesses a global.
+Global and static values and pointers are interesting because they form the entry points to the target address space (all other uses of the DAC require you to have a target address already). Many of the globals in the runtime are already DACized. It occasionally becomes necessary to make a previously un-DACized (or a newly introduced) global available to the DAC. By using the appropriate macros and [dacvars.h][dacvars.h] entry, you enable a post-build step (DacTableGen.exe run by the build in ndp\clr\src\dacupdatedll) to save the address of the global (from clr.pdb) into a table that is embedded into mscordacwks.dll. The DAC uses this table at run-time to determine where to look in the target address space when the code accesses a global.
### VAL Types
-In addition to pointer types, the DAC must also marshal static and global values (as opposed to values referenced by static or global pointers). For this we have a collection of macros ?VAL\_\*. We use GVAL\_\* for global values, and SVAL\_\* for static values. The comment in the [daccess.h][daccess.h] file has a table showing how to use the various forms of these and includes instructions for declaring global and static values (and global and static pointers) that we will use in DACized code.
+In addition to pointer types, the DAC must also marshal static and global values (as opposed to values referenced by static or global pointers). For this we have a collection of macros `?VAL_*`. We use `GVAL_*` for global values, and `SVAL_*` for static values. The comment in the [daccess.h][daccess.h] file has a table showing how to use the various forms of these and includes instructions for declaring global and static values (and global and static pointers) that we will use in DACized code.
### Pure Addresses
-The TADDR and PCODE types we introduced in the example of DAC operation are pure target addresses. These are actually integer types, rather than pointers. This prevents code in the host from incorrectly dereferencing them. The DAC does not treat them as pointers either. Specifically, because we have no type or size information no dereferencing or marshalling can occur. We use these primarily in two situations: when we are treating a target address as pure data and when we need to do pointer arithmetic with target addresses (although we can also do pointer arithmetic with PTR types). Of course, because TADDRs have no type information for the target locations they specify, when we perform address arithmetic, we need to factor in the size explicitly.
+The `TADDR` and `PCODE` types we introduced in the example of DAC operation are pure target addresses. These are actually integer types, rather than pointers. This prevents code in the host from incorrectly dereferencing them. The DAC does not treat them as pointers either. Specifically, because we have no type or size information no dereferencing or marshalling can occur. We use these primarily in two situations: when we are treating a target address as pure data and when we need to do pointer arithmetic with target addresses (although we can also do pointer arithmetic with `PTR` types). Of course, because `TADDR`s have no type information for the target locations they specify, when we perform address arithmetic, we need to factor in the size explicitly.
-We also have one special class of PTRs that don't involve marshaling: PTR\_VOID and PTR\_CVOID. These are the target equivalents of void \* and const void \*, respectively. Because TADDRs are simply numbers, they don't have pointer semantics, which means that if we DACize code by converting void \* to TADDR (as was often the case in the past), we often need extra casts and other changes, even in code that does not compile for the DAC. Using PTR\_VOID makes it easier and cleaner to DACize code that uses void \* by preserving the semantics expected for void \*. If we DACize a function that uses PTR\_VOID or PTR\_CVOID, we can't directly marshal data from these addresses, since we have no idea how much data we would need to read. This means we can't dereference them (or even do pointer arithmetic), but this is identical to the semantics of void \*. As is the case for void \*, we generally cast them to a more specific PTR type when we need to use them. We also have a PTR\_BYTE type, which is a standard marshaled target pointer (that supports pointer arithmetic, etc.). In general, when we DACize code, void \* becomes PTR\_VOID and BYTE \* becomes PTR\_BYTE, just as you would expect. [daccess.h][daccess.h] has explanatory comments that provide more details about the use and semantics of the PTR\_VOID type.
+We also have one special class of `PTR`s that don't involve marshaling: `PTR_VOID` and `PTR_CVOID`. These are the target equivalents of `void *` and `const void *`, respectively. Because `TADDR`s are simply numbers, they don't have pointer semantics, which means that if we DACize code by converting `void *` to `TADDR` (as was often the case in the past), we often need extra casts and other changes, even in code that does not compile for the DAC. Using `PTR_VOID` makes it easier and cleaner to DACize code that uses `void *` by preserving the semantics expected for `void *`. If we DACize a function that uses `PTR_VOID` or `PTR_CVOID`, we can't directly marshal data from these addresses, since we have no idea how much data we would need to read. This means we can't dereference them (or even do pointer arithmetic), but this is identical to the semantics of `void *`. As is the case for `void *`, we generally cast them to a more specific `PTR` type when we need to use them. We also have a `PTR_BYTE` type, which is a standard marshaled target pointer (that supports pointer arithmetic, etc.). In general, when we DACize code, `void *` becomes `PTR_VOID` and `BYTE *` becomes `PTR_BYTE`, just as you would expect. [daccess.h][daccess.h] has explanatory comments that provide more details about the use and semantics of the `PTR_VOID` type.
-Occasionally, legacy code stores a target address in a host pointer type such as void \*. This is always a bug and makes it extremely difficult to reason about the code. It will also break when we support cross-platform, where the pointer types are different sizes). In DAC builds, the void \* type is a host pointer which should never contain a target address. Using PTR\_VOID instead allows us to indicate that a void pointer type is a target address. We are trying to eliminate all such uses, but some are quite pervasive in the code and will take a while to eliminate entirely.
+Occasionally, legacy code stores a target address in a host pointer type such as `void *`. This is always a bug and makes it extremely difficult to reason about the code. It will also break when we support cross-platform, where the pointer types are different sizes. In DAC builds, the `void *` type is a host pointer which should never contain a target address. Using `PTR_VOID` instead allows us to indicate that a void pointer type is a target address. We are trying to eliminate all such uses, but some are quite pervasive in the code and will take a while to eliminate entirely.
### Conversions
-In earlier CLR versions, we used C-style type casting, macros, and constructors to cast between types. For example, in MethodIterator::Next, we have the following:
+In earlier CLR versions, we used C-style type casting, macros, and constructors to cast between types. For example, in `MethodIterator::Next`, we have the following:
if (methodCold)
{
PTR_CORCOMPILE_METHOD_COLD_HEADER methodColdHeader
- = PTR_CORCOMPILE_METHOD_COLD_HEADER((TADDR)methodCold);
+ = PTR_CORCOMPILE_METHOD_COLD_HEADER((TADDR)methodCold);
if (((TADDR)methodCode) == PTR_TO_TADDR(methodColdHeader->hotHeader))
{
@@ -171,31 +171,31 @@ In earlier CLR versions, we used C-style type casting, macros, and constructors
m_pCMH = PTR_CORCOMPILE_METHOD_COLD_HEADER((TADDR)methodCold);
...
-Both methodCold and methodCode are declared as BYTE \*, but in fact hold target addresses. In line 4, methodCold is casted to a TADDR and used as the argument to the constructor for PTR\_CORCOMPILE\_METHOD\_COLD\_HEADER. At this point, methodColdHeader is explicitly a target address. In line 6, there is another C-style cast for methodCode. The hotHeader field of methodColdHeader is of type PTR\_CORCOMPILE\_METHOD\_HEADER. The macro PTR\_TO\_TADDR extracts the raw target address from this PTR type and assigns it to methodCode. Finally, in line 9, another instance of type PTR\_CORCOMPILE\_METHOD\_COLD\_HEADER is constructed. Again, methodCold is casted to TADDR to pass to this constructor.
+Both methodCold and methodCode are declared as `BYTE *`, but in fact hold target addresses. In line 4, methodCold is casted to a `TADDR` and used as the argument to the constructor for `PTR_CORCOMPILE_METHOD_COLD_HEADER`. At this point, `methodColdHeader` is explicitly a target address. In line 6, there is another C-style cast for `methodCode`. The hotHeader field of `methodColdHeader` is of type `PTR_CORCOMPILE_METHOD_HEADER`. The macro `PTR_TO_TADDR` extracts the raw target address from this `PTR` type and assigns it to `methodCode`. Finally, in line 9, another instance of type `PTR_CORCOMPILE_METHOD_COLD_HEADER` is constructed. Again, `methodCold` is casted to `TADDR` to pass to this constructor.
-If this code seems overly complex and confusing to you, that's good. In fact it is. Worse, it provides no protection for the separation of host and target addresses. From the declarations of methodCold and methodCode, there is no particular reason to interpret them as target addresses at all. If these pointers were dereferenced in DAC builds as if they really were host pointers, the process would probably AV. This snippet demonstrates that any arbitrary pointer type (as opposed to a PTR type) can be casted to a TADDR. Given that these two variables always hold target addresses, they should be of type PTR\_BYTE, rather than BYTE \*.
+If this code seems overly complex and confusing to you, that's good. In fact it is. Worse, it provides no protection for the separation of host and target addresses. From the declarations of `methodCold` and `methodCode`, there is no particular reason to interpret them as target addresses at all. If these pointers were dereferenced in DAC builds as if they really were host pointers, the process would probably AV. This snippet demonstrates that any arbitrary pointer type (as opposed to a `PTR` type) can be casted to a `TADDR`. Given that these two variables always hold target addresses, they should be of type `PTR_BYTE`, rather than `BYTE *`.
-There is also a disciplined means to cast between different PTR types: dac\_cast. The dac\_cast operator is the DAC-aware vesion of the C++ static\_cast operator (which the CLR coding conventions stipulate instead of C-style casts when casting pointer types). The dac\_cast operator will do any of the following things:
+There is also a disciplined means to cast between different `PTR` types: `dac_cast`. The `dac_cast` operator is the DAC-aware vesion of the C++ `static_cast` operator (which the CLR coding conventions stipulate instead of C-style casts when casting pointer types). The `dac_cast` operator will do any of the following things:
-1. Create a PTR type from a TADDR
-2. Convert one PTR type to another
-3. Create a PTR from a host instance previously marshaled to the DAC cache
-4. Extract the TADDR from a PTR type
-5. Get a TADDR from a host instance previously marshaled to the DAC cache
+1. Create a `PTR` type from a `TADDR`
+2. Convert one `PTR` type to another
+3. Create a `PTR` from a host instance previously marshaled to the DAC cache
+4. Extract the `TADDR` from a `PTR` type
+5. Get a `TADDR` from a host instance previously marshaled to the DAC cache
-Now, assuming both methodCold and methodCode are declared to be of type PTR\_BYTE, the code above can be rewritten as follows.
+Now, assuming both methodCold and methodCode are declared to be of type `PTR_BYTE`, the code above can be rewritten as follows.
if (methodCold)
{
PTR_CORCOMPILE_METHOD_COLD_HEADER methodColdHeader
- = dac_cast(methodCold);
+ = dac_cast(methodCold);
if (methodCode == methodColdHeader->hotHeader)
{
// Matched the cold code
m_pCMH = methodColdHeader;
-You might argue that this code still seems complex and confusing, but at least we have significantly reduced the number of casts and constructors. We have also used constructs that maintain the separation between host and target pointers, so we have made the code safer. In particular, dac\_cast will often generate compiler or run-time errors if we try to do the wrong thing. In general, dac\_cast should be used for conversions.
+You might argue that this code still seems complex and confusing, but at least we have significantly reduced the number of casts and constructors. We have also used constructs that maintain the separation between host and target pointers, so we have made the code safer. In particular, `dac_cast` will often generate compiler or run-time errors if we try to do the wrong thing. In general, `dac_cast` should be used for conversions.
DACizing
========
@@ -203,11 +203,11 @@ DACizing
When do you need to DACize?
---------------------------
-Whenever you add a new feature, you will need to consider its debuggability needs and DACize the code to support your feature. You must also ensure that any other changes, such as bug fixes or code clean-up, conform to the DAC rules when necessary. Otherwise, the changes will break the debugger or SOS. If you are simply modifying existing code (as opposed to implementing a new feature), you will generally be able to determine that you need to worry about the DAC when a function you modify includes a SUPPORTS\_DAC contract. This contract has a few variants such as SUPPORTS\_DAC\_WRAPPER and LEAF\_DAC\_CONTRACT. You can find comments explaining the differences in [contract.h][contract.h]. If you see a number of DAC-specific types in the function, you should assume the code will run in DAC builds.
+Whenever you add a new feature, you will need to consider its debuggability needs and DACize the code to support your feature. You must also ensure that any other changes, such as bug fixes or code clean-up, conform to the DAC rules when necessary. Otherwise, the changes will break the debugger or SOS. If you are simply modifying existing code (as opposed to implementing a new feature), you will generally be able to determine that you need to worry about the DAC when a function you modify includes a `SUPPORTS_DAC` contract. This contract has a few variants such as `SUPPORTS_DAC_WRAPPER` and `LEAF_DAC_CONTRACT`. You can find comments explaining the differences in [contract.h][contract.h]. If you see a number of DAC-specific types in the function, you should assume the code will run in DAC builds.
[contract.h]: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/inc/contract.h
-DACizing ensures that code in the engine will work correctly with the DAC. It is important to use the DAC correctly to marshal values from the target to the host. Target addresses used incorrectly from the host (or vice versa) may reference unmapped addresses. If addresses are mapped, the values will be completely unrelated to the values expected. As a result, DACizing mostly involves ensuring that we use PTR types for all values that the DAC needs to marshal. Another major task is to ensure that we do not allow invasive code to execute in DAC builds. In practice, this means that we must sometimes refactor code or add DACCESS\_COMPILE preprocessor directives. We also want to be sure that we add the appropriate SUPPORTS\_DAC contract. The use of this contract signals to developers that the function works with the DAC. This is important for two reasons:
+DACizing ensures that code in the engine will work correctly with the DAC. It is important to use the DAC correctly to marshal values from the target to the host. Target addresses used incorrectly from the host (or vice versa) may reference unmapped addresses. If addresses are mapped, the values will be completely unrelated to the values expected. As a result, DACizing mostly involves ensuring that we use `PTR` types for all values that the DAC needs to marshal. Another major task is to ensure that we do not allow invasive code to execute in DAC builds. In practice, this means that we must sometimes refactor code or add `DACCESS_COMPILE` preprocessor directives. We also want to be sure that we add the appropriate `SUPPORTS_DAC` contract. The use of this contract signals to developers that the function works with the DAC. This is important for two reasons:
-1. If we later call it from some other SUPPORTS\_DAC function, we know that it is DAC-safe and we don't need to worry about DACizing it.
+1. If we later call it from some other `SUPPORTS_DAC` function, we know that it is DAC-safe and we don't need to worry about DACizing it.
2. If we make modifications to the function, we need to make sure that they are DAC-safe. If we add a call to another function from this one, we also need to ensure that it is DAC-safe or that we only make the call in non-DAC builds.
diff --git a/docs/design/coreclr/botr/method-descriptor.md b/docs/design/coreclr/botr/method-descriptor.md
index ea5123bdc4b9a8..7d3f24ccf40f1d 100644
--- a/docs/design/coreclr/botr/method-descriptor.md
+++ b/docs/design/coreclr/botr/method-descriptor.md
@@ -42,7 +42,7 @@ Used for less common IL methods that have generic instantiation or that do not h
**FCall**
-Internal methods implemented in unmanaged code. These are [methods marked with MethodImplAttribute(MethodImplOptions.InternalCall) attribute](mscorlib.md), delegate constructors and tlbimp constructors.
+Internal methods implemented in unmanaged code. These are [methods marked with MethodImplAttribute(MethodImplOptions.InternalCall) attribute](corelib.md), delegate constructors and tlbimp constructors.
**NDirect**
diff --git a/docs/design/coreclr/botr/mscorlib.md b/docs/design/coreclr/botr/mscorlib.md
deleted file mode 100644
index c2d995567f4917..00000000000000
--- a/docs/design/coreclr/botr/mscorlib.md
+++ /dev/null
@@ -1,355 +0,0 @@
-Mscorlib and Calling Into the Runtime
-===
-
-Author: Brian Grunkemeyer ([@briangru](https://github.com/briangru)) - 2006
-
-# Introduction
-
-Mscorlib is the assembly for defining the core parts of the type system, and a good portion of the Base Class Library in .NET Framework. It has been renamed to System.Private.CoreLib in .NET Core, though many places in the code and documentation still refer to it as mscorlib. Base data types live in this assembly, and it has a tight coupling with the CLR. Here you will learn exactly how & why mscorlib.dll is special, and the basics about calling into the CLR from managed code via QCall and FCall methods. It also discusses calling from within the CLR into managed code.
-
-## Dependencies
-
-Since mscorlib defines base data types like Object, Int32, and String, mscorlib cannot depend on other managed assemblies. However, there is a strong dependency between mscorlib and the CLR. Many of the types in mscorlib need to be accessed from native code, so the layout of many managed types is defined both in managed code and in native code inside the CLR. Additionally, some fields may be defined only in debug or checked builds, so typically mscorlib must be compiled separately for checked vs. retail builds.
-
-For 64 bit platforms, some constants are also defined at compile time. So a 64 bit mscorlib.dll is slightly different from a 32 bit mscorlib.dll. Due to these constants, such as IntPtr.Size, most libraries above mscorlib should not need to build separately for 32 bit vs. 64 bit.
-
-## What Makes Mscorlib Special?
-
-Mscorlib has several unique properties, many of which are due to its tight coupling to the CLR.
-
-- Mscorlib defines the core types necessary to implement the CLR's Virtual Object System, such as the base data types (Object, Int32, String, etc).
-- The CLR must load mscorlib on startup to load certain system types.
-- Can only have one mscorlib loaded in the process at a time, due to layout issues. Loading multiple mscorlibs would require formalizing a contract of behavior, FCall methods, and datatype layout between CLR & mscorlib, and keeping that contract relatively stable across versions.
-- Mscorlib's types will be used heavily for native interop, and managed exceptions should map correctly to native error codes/formats.
-- The CLR's multiple JIT compilers may special case a small group of certain methods in mscorlib for performance reasons, both in terms of optimizing away the method (such as Math.Cos(double)), or calling a method in peculiar ways (such as Array.Length, or some implementation details on StringBuilder for getting the current thread).
-- Mscorlib will need to call into native code, via P/Invoke where appropriate, primarily into the underlying operating system or occasionally a platform adaptation layer.
-- Mscorlib will require calling into the CLR to expose some CLR-specific functionality, such as triggering a garbage collection, to load classes, or to interact with the type system in a non-trivial way. This requires a bridge between managed code and native, "manually managed" code within the CLR.
-- The CLR will need to call into managed code to call managed methods, and to get at certain functionality that is only implemented in managed code.
-
-# Interface between managed & CLR code
-
-To reiterate, the needs of managed code in mscorlib include:
-
-- The ability to access fields of some managed data structures in both managed code and "manually managed" code within the CLR
-- Managed code must be able to call into the CLR
-- The CLR must be able to call managed code.
-
-To implement these, we need a way for the CLR to specify and optionally verify the layout of a managed object in native code, a managed mechanism for calling into native code, and a native mechanism for calling into managed code.
-
-The managed mechanism for calling into native code must also support the special managed calling convention used by String's constructors, where the constructor allocates the memory used by the object (instead of the typical convention where the constructor is called after the GC allocates memory).
-
-The CLR provides a [mscorlib binder](https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/binder.cpp) internally, providing a mapping between unmanaged types and fields to managed types & fields. The binder will look up & load classes, allow you to call managed methods. It also does some simple verification to ensure the correctness of any layout information specified in both managed & native code. The binder ensures that the managed class you're attempting to use exists in mscorlib, has been loaded, and the field offsets are correct. It also needs the ability to differentiate between method overloads with different signatures.
-
-# Calling from managed to native code
-
-We have two techniques for calling into the CLR from managed code. FCall allows you to call directly into the CLR code, and provides a lot of flexibility in terms of manipulating objects, though it is easy to cause GC holes by not tracking object references correctly. QCall allows you to call into the CLR via the P/Invoke, and is much harder to accidentally mis-use than FCall. FCalls are identified in managed code as extern methods with the MethodImplOptions.InternalCall bit set. QCalls are _static_ extern methods that look like regular P/Invokes, but to a library called "QCall".
-
-There is a small variant of FCall called HCall (for Helper call) for implementing JIT helpers, for doing things like accessing multi-dimensional array elements, range checks, etc. The only difference between HCall and FCall is that HCall methods won't show up in an exception stack trace.
-
-### Choosing between FCall, QCall, P/Invoke, and writing in managed code
-
-First, remember that you should be writing as much as possible in managed code. You avoid a raft of potential GC hole issues, you get a good debugging experience, and the code is often simpler. It also is preparation for ongoing refactoring of mscorlib into smaller layered fully [managed libraries](https://github.com/dotnet/runtime/src/libraries).
-
-Reasons to write FCalls in the past generally fell into three camps: missing language features, better performance, or implementing unique interactions with the runtime. C# now has almost every useful language feature that you could get from C++, including unsafe code & stack-allocated buffers, and this eliminates the first two reasons for FCalls. We have ported some parts of the CLR that were heavily reliant on FCalls to managed code in the past (such as Reflection and some Encoding & String operations), and we want to continue this momentum. We may port our number formatting & String comparison code to managed in the future.
-
-If the only reason you're defining a FCall method is to call a native Win32 method, you should be using P/Invoke to call Win32 directly. P/Invoke is the public native method interface, and should be doing everything you need in a correct manner.
-
-If you still need to implement a feature inside the runtime, now consider if there is a way to reduce the frequency of transitioning to native code. Can you write the common case in managed, and only call into native for some rare corner cases? You're usually best off keeping as much as possible in managed code.
-
-QCalls are the preferred mechanism going forward. You should only use FCalls when you are "forced" to. This happens when there is common "short path" through the code that is important to optimize. This short path should not be more than a few hundred instructions, cannot allocate GC memory, take locks or throw exceptions (GC_NOTRIGGER, NOTHROWS). In all other circumstances (and especially when you enter a FCall and then simply erect HelperMethodFrame), you should be using QCall.
-
-FCalls were specifically designed for short paths of code that must be optimized. They allowed you to take explicit control over when erecting a frame was done. However it is error prone and is not worth it for many APIs. QCalls are essentially P/Invokes into CLR.
-
-As a result, QCalls give you some advantageous marshaling for SafeHandles automatically – your native method just takes a HANDLE type, and can use it without worrying whether someone will free the handle while you are in that method body. The resulting FCall method would need to use a SafeHandleHolder, and may need to protect the SafeHandle, etc. Leveraging the P/Invoke marshaler can avoid this additional plumbing code.
-
-## QCall Functional Behavior
-
-QCalls are very much like a normal P/Invoke from mscorlib.dll to CLR. Unlike FCalls, QCalls will marshal all arguments as unmanaged types like a normal P/Invoke. QCall also switch to preemptive GC mode like a normal P/Invoke. These two features should make QCalls easier to write reliably compared to FCalls. QCalls are not prone to GC holes and GC starvation bugs that are common with FCalls.
-
-QCalls perform better than FCalls that erect a HelperMethodFrame. The overhead is about 1.4x less compared to FCall w/ HelperMethodFrame overhead on x86 and x64.
-
-The preferred types for QCall arguments are primitive types that are efficiently handled by the P/Invoke marshaler (INT32, LPCWSTR, BOOL). Notice that BOOL is the correct boolean flavor for QCall arguments. On the other hand, CLR_BOOL is the correct boolean flavor for FCall arguments.
-
-The pointers to common unmanaged EE structures should be wrapped into handle types. This is to make the managed implementation type safe and avoid falling into unsafe C# everywhere. See AssemblyHandle in [vm\qcall.h][qcall] for an example.
-
-[qcall]: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/qcall.h
-
-There is a way to pass a raw object references in and out of QCalls. It is done by wrapping a pointer to a local variable in a handle. It is intentionally cumbersome and should be avoided if reasonably possible. See the StringHandleOnStack in the example below. Returning objects, especially strings, from QCalls is the only common pattern where passing the raw objects is widely acceptable. (For reasoning on why this set of restrictions helps make QCalls less prone to GC holes, read the "GC Holes, FCall, and QCall" section below.)
-
-### QCall Example - Managed Part
-
-Do not replicate the comments into your actual QCall implementation. This is for illustrative purposes.
-
- class Foo
- {
- // All QCalls should have the following DllImport attribute
- [DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
- // QCalls should always be static extern.
- private static extern bool Bar(int flags, string inString, StringHandleOnStack retString);
-
- // Many QCalls have a thin managed wrapper around them to expose them to
- // the world in more meaningful way.
- public string Bar(int flags)
- {
- string retString = null;
-
- // The strings are returned from QCalls by taking address
- // of a local variable using StringHandleOnStack
- if (!Bar(flags, this.Id, new StringHandleOnStack(ref retString)))
- FatalError();
-
- return retString;
- }
- }
-
-### QCall Example - Unmanaged Part
-
-Do not replicate the comments into your actual QCall implementation.
-
-The QCall entrypoint has to be registered in tables in [vm\ecalllist.h][ecalllist] using QCFuncEntry macro. See "Registering your QCall or FCall Method" below.
-
-[ecalllist]: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/ecalllist.h
-
- class FooNative
- {
- public:
- // All QCalls should be static and should be tagged with QCALLTYPE
- static
- BOOL QCALLTYPE Bar(int flags, LPCWSTR wszString, QCall::StringHandleOnStack retString);
- };
-
- BOOL QCALLTYPE FooNative::Bar(int flags, LPCWSTR wszString, QCall::StringHandleOnStack retString)
- {
- // All QCalls should have QCALL_CONTRACT.
- // It is alias for THROWS; GC_TRIGGERS; MODE_PREEMPTIVE.
- QCALL_CONTRACT;
-
- // Optionally, use QCALL_CHECK instead and the expanded form of the contract
- // if you want to specify preconditions:
- // CONTRACTL {
- // QCALL_CHECK;
- // PRECONDITION(wszString != NULL);
- // } CONTRACTL_END;
-
- // The only line between QCALL_CONTRACT and BEGIN_QCALL
- // should be the return value declaration if there is one.
- BOOL retVal = FALSE;
-
- // The body has to be enclosed in BEGIN_QCALL/END_QCALL macro. It is necessary
- // to make the exception handling work.
- BEGIN_QCALL;
-
- // Validate arguments if necessary and throw exceptions.
- // There is no convention currently on whether the argument validation should be
- // done in managed or unmanaged code.
- if (flags != 0)
- COMPlusThrow(kArgumentException, L"InvalidFlags");
-
- // No need to worry about GC moving strings passed into QCall.
- // Marshalling pins them for us.
- printf("%S", wszString);
-
- // This is most the efficient way to return strings back
- // to managed code. No need to use StringBuilder.
- retString.Set(L"Hello");
-
- // You can not return from inside of BEGIN_QCALL/END_QCALL.
- // The return value has to be passed out in helper variable.
- retVal = TRUE;
-
- END_QCALL;
-
- return retVal;
- }
-
-## FCall Functional Behavior
-
-FCalls allow more flexibility in terms of passing object references around, with a higher code complexity and more opportunities to hang yourself. Additionally, FCall methods must either erect a helper method frame along their common code paths, or for any FCall of non-trivial length, explicitly poll for whether a garbage collection must occur. Failing to do so will lead to starvation issues if managed code repeatedly calls the FCall method in a tight loop, because FCalls execute while the thread only allows the GC to run in a cooperative manner.
-
-FCalls require a lot of glue, too much to describe here. Look at [fcall.h][fcall] for details.
-
-[fcall]: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/fcall.h
-
-### GC Holes, FCall, and QCall
-
-A much more complete discussion on GC holes can be found in the [CLR Code Guide](../../../coding-guidelines/clr-code-guide.md). Look for ["Is your code GC-safe?"](../../../coding-guidelines/clr-code-guide.md#2.1). This tailored discussion motivates some of the reasons why FCall and QCall have some of their strange conventions.
-
-Object references passed as parameters to FCall methods are not GC-protected, meaning that if a GC occurs, those references will point to the old location in memory of an object, not the new location. For this reason, FCalls usually follow the discipline of accepting something like "StringObject*" as their parameter type, then explicitly converting that to a STRINGREF before doing operations that may trigger a GC. You must GC protect object references before triggering a GC, if you expect to be able to use that object reference later.
-
-All GC heap allocations within an FCall method must happen within a helper method frame. If you allocate memory on the GC's heap, the GC may collect dead objects & move objects around in unpredictable ways, with some low probability. For this reason, you must manually report any object references in your method to the GC, so that if a garbage collection occurs, your object reference will be updated to refer to the new location in memory. Any pointers into managed objects (like arrays or Strings) within your code will not be updated automatically, and must be re-fetched after any operation that may allocate memory and before your first usage. Reporting a reference can be done via the GCPROTECT macros, or as parameters when you erect a helper method frame.
-
-Failing to properly report an OBJECTREF or to update an interior pointer is commonly referred to as a "GC hole", because the OBJECTREF class will do some validation that it points to a valid object every time you dereference it in checked builds. When an OBJECTREF pointing to an invalid object is dereferenced, you'll get an assert saying something like "Detected an invalid object reference. Possible GC hole?". This assert is unfortunately easy to hit when writing "manually managed" code.
-
-Note that QCall's programming model is restrictive to sidestep GC holes most of the time, by forcing you to pass in the address of an object reference on the stack. This guarantees that the object reference is GC protected by the JIT's reporting logic, and that the actual object reference will not move because it is not allocated in the GC heap. QCall is our recommended approach, precisely because it makes GC holes harder to write.
-
-### FCall Epilogue Walker for x86
-
-The managed stack walker needs to be able to find its way from FCalls. It is relative easy on newer platforms that define conventions for stack unwinding as part of the ABI. The stack unwinding conventions are not defined by ABI for x86. The runtime works around it by implementing a epilog walker. The epilog walker computes the FCall return address and callee save registers by simulating the FCall execution. This imposes limits on what constructs are allowed in the FCall implementation.
-
-Complex constructs like stack allocated objects with destructors or exception handling in the FCall implementation may confuse the epilog walker. It leads to GC holes or crashes during stack walking. There is no exact list of what constructs should be avoided to prevent this class of bugs. An FCall implementation that is fine one day may break with the next C++ compiler update. We depend on stress runs & code coverage to find bugs in this area.
-
-Setting a breakpoint inside an FCall implementation may confuse the epilog walker. It leads to an "Invalid breakpoint in a helpermethod frame epilog" assert inside [vm\i386\gmsx86.cpp](https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/i386/gmsx86.cpp).
-
-### FCall Example – Managed Part
-
-Here's a real-world example from the String class:
-
- public partial sealed class String
- {
- // Replaces all instances of oldChar with newChar.
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern String Replace (char oldChar, char newChar);
- }
-
-### FCall Example – Native Part
-
-The FCall entrypoint has to be registered in tables in [vm\ecalllist.h][ecalllist] using FCFuncEntry macro. See "Registering your QCall or FCall Method".
-
-Notice how oldBuffer and newBuffer (interior pointers into String instances) are re-fetched after allocating memory. Also, this method is an instance method in managed code, with the "this" parameter passed as the first argument. We use StringObject* as the argument type, then copy it into a STRINGREF so we get some error checking when we use it.
-
- FCIMPL3(LPVOID, COMString::Replace, StringObject* thisRefUNSAFE, CLR_CHAR oldChar, CLR_CHAR newChar)
- {
- FCALL_CONTRACT;
-
- int length = 0;
- int firstFoundIndex = -1;
- WCHAR *oldBuffer = NULL;
- WCHAR *newBuffer;
-
- STRINGREF newString = NULL;
- STRINGREF thisRef = (STRINGREF)thisRefUNSAFE;
-
- if (thisRef==NULL) {
- FCThrowRes(kNullReferenceException, L"NullReference_This");
- }
-
- [... Removed some uninteresting code here for illustrative purposes...]
-
- HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_2(Frame::FRAME_ATTR_RETURNOBJ, newString, thisRef);
-
- //Get the length and allocate a new String
- //We will definitely do an allocation here.
- newString = NewString(length);
-
- //After allocation, thisRef may have moved
- oldBuffer = thisRef->GetBuffer();
-
- //Get the buffers in both of the Strings.
- newBuffer = newString->GetBuffer();
-
- //Copy the characters, doing the replacement as we go.
- for (int i=0; i template to create a type name like SAFEHANDLEREF. All the error checking from OBJECTREF is built into the REF macro, and you can freely dereference this SAFEHANDLEREF & use fields off of it in native code. You still must GC protect these references.
-
-# Calling Into Managed Code From Native
-
-Clearly there are places where the CLR must call into managed code from native. For this purpose, we have added a MethodDescCallSite class to handle a lot of plumbing for you. Conceptually, all you need to do is find the MethodDesc\* for the method you want to call, find a managed object for the "this" pointer (if you're calling an instance method), pass in an array of arguments, and deal with the return value. Internally, you'll need to potentially toggle your thread's state to allow the GC to run in preemptive mode, etc.
-
-Here's a simplified example. Note how this instance uses the binder described in the previous section to call SafeHandle's virtual ReleaseHandle method.
-
- void SafeHandle::RunReleaseMethod(SafeHandle* psh)
- {
- CONTRACTL {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- } CONTRACTL_END;
-
- SAFEHANDLEREF sh(psh);
-
- GCPROTECT_BEGIN(sh);
-
- MethodDescCallSite releaseHandle(s_pReleaseHandleMethod, METHOD__SAFE_HANDLE__RELEASE_HANDLE, (OBJECTREF*)&sh, TypeHandle(), TRUE);
-
- ARG_SLOT releaseArgs[] = { ObjToArgSlot(sh) };
- if (!(BOOL)releaseHandle.Call_RetBool(releaseArgs)) {
- MDA_TRIGGER_ASSISTANT(ReleaseHandleFailed, ReportViolation)(sh->GetTypeHandle(), sh->m_handle);
- }
-
- GCPROTECT_END();
- }
-
-# Interactions with Other Subsystems
-
-## Debugger
-
-One limitation of FCalls today is that you cannot easily debug both managed code and FCalls easily in Visual Studio's Interop (or mixed mode) debugging. Setting a breakpoint today in an FCall and debugging with Interop debugging just doesn't work. This most likely won't be fixed.
-
-# Physical Architecture
-
-When the CLR starts up, mscorlib is loaded by a method called LoadBaseSystemClasses. Here, the base data types & other similar classes (like Exception) are loaded, and appropriate global pointers are set up to refer to mscorlib's types.
-
-For FCalls, look in [fcall.h][fcall] for infrastructure, and [ecalllist.h][ecalllist] to properly inform the runtime about your FCall method.
-
-For QCalls, look in [qcall.h][qcall] for associated infrastructure, and [ecalllist.h][ecalllist] to properly inform the runtime about your QCall method.
-
-More general infrastructure and some native type definitions can be found in [object.h][object.h]. The binder uses mscorlib.h to associate managed & native classes.
-
-[object.h]: https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/object.h
diff --git a/docs/design/coreclr/botr/readytorun-format.md b/docs/design/coreclr/botr/readytorun-format.md
index 51fcd1cab56b4c..8db3423dbadfe9 100644
--- a/docs/design/coreclr/botr/readytorun-format.md
+++ b/docs/design/coreclr/botr/readytorun-format.md
@@ -28,8 +28,9 @@ in the COFF header represent a full copy of the input IL and MSIL metadata it wa
**Composite R2R files** currently conform to Windows PE executable file format as the
native envelope. Moving forward we plan to gradually add support for platform-native
-executable formats (ELF on Linux, MachO on OSX) as the native envelopes. As a natural corollary
-there is no global CLI / COR header in the file. The ReadyToRun header structure is pointed to
+executable formats (ELF on Linux, MachO on OSX) as the native envelopes. There is a
+global CLI / COR header in the file, but it only exists to facilitate pdb generation, and does
+not participate in any usages by the CoreCLR runtime. The ReadyToRun header structure is pointed to
by the well-known export symbol `RTR_HEADER` and has the `READYTORUN_FLAG_COMPOSITE` flag set.
Input MSIL metadata and IL streams can be either embedded in the composite R2R file or left
diff --git a/docs/design/coreclr/botr/shared-generics.md b/docs/design/coreclr/botr/shared-generics.md
index 690513621da103..6b23563ebf223d 100644
--- a/docs/design/coreclr/botr/shared-generics.md
+++ b/docs/design/coreclr/botr/shared-generics.md
@@ -12,31 +12,31 @@ Shared generics is a runtime+JIT feature aimed at reducing the amount of code th
Consider the following C# code sample:
``` c#
-string Func()
+string Method()
{
return typeof(List).ToString();
}
```
-Without shared generics, the code for instantiations like `Func
- 5.0
- .NETCoreApp,Version=v$(NETCoreAppCurrentVersion)
- netcoreapp$(NETCoreAppCurrentVersion)
+
+ 5.0
+ .NETCoreApp
+ $(NetCoreAppCurrentIdentifier),Version=v$(NetCoreAppCurrentVersion)
+ net$(NetCoreAppCurrentVersion)
+
+ $(NetCoreAppCurrent)
+ Microsoft.NETCore.App
+ .NET $(NetCoreAppCurrentVersion)
+
net472
@@ -37,9 +46,13 @@
+ $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)
+ win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant)
+
OSXFreeBSDNetBSD
+ SunOSLinuxWindows_NT$(TargetOS)
@@ -47,6 +60,10 @@
$(TargetOS)
+
+ true
+
+
true
diff --git a/eng/DiaSymReaderNative.targets b/eng/DiaSymReaderNative.targets
new file mode 100644
index 00000000000000..5836a781dfa8f6
--- /dev/null
+++ b/eng/DiaSymReaderNative.targets
@@ -0,0 +1,35 @@
+
+
+
+
+
+ AnyCPU
+
+
+
+
+
+ PreserveNewest
+ false
+ false
+
+
+ PreserveNewest
+ false
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/eng/SignCheckExclusionsFile.txt b/eng/SignCheckExclusionsFile.txt
index 2db3b79a9339ec..dc77ca3e4603ca 100644
--- a/eng/SignCheckExclusionsFile.txt
+++ b/eng/SignCheckExclusionsFile.txt
@@ -7,6 +7,9 @@
;; and SCD apps. If they are signed, the file that the SDK produces has an invalid signature and
;; can't be signed again. More info at https://github.com/dotnet/core-setup/pull/7549.
*apphost.exe;;Template, https://github.com/dotnet/core-setup/pull/7549
+*singlefilehost.exe;;Template, https://github.com/dotnet/core-setup/pull/7549
*comhost.dll;;Template, https://github.com/dotnet/core-setup/pull/7549
*apphosttemplateapphostexe.exe;;Template, https://github.com/dotnet/core-setup/pull/7549
*comhosttemplatecomhostdll.dll;;Template, https://github.com/dotnet/core-setup/pull/7549
+*staticapphosttemplateapphostexe.exe;;Template, https://github.com/dotnet/core-setup/pull/7549
+*dotnet.js;;Workaround, https://github.com/dotnet/core-eng/issues/9933
diff --git a/eng/Signing.props b/eng/Signing.props
index 05f2a8bcb39570..463c3602bb7f94 100644
--- a/eng/Signing.props
+++ b/eng/Signing.props
@@ -24,7 +24,7 @@
-
+
@@ -71,7 +71,6 @@
-
diff --git a/eng/SubsetValidation.targets b/eng/SubsetValidation.targets
index 53ea39ccd4959c..3b0acd5c5e1564 100644
--- a/eng/SubsetValidation.targets
+++ b/eng/SubsetValidation.targets
@@ -6,7 +6,7 @@
on a whole subset, and the dependency on the subset is disregarded automatically when Subset
doesn't contain it.
- %(InstallerProject.SignPhase): Indicates this project must be built before a certain signing
+ %(ProjectToBuild.SignPhase): Indicates this project must be built before a certain signing
phase. Projects can depend on 'signing/stages/Sign.proj' to wait until all projects
that are part of a stage are complete. This allows the build to perform complex container
signing that isn't (can't be?) supported by Arcade's single pass, such as MSIs and bundles:
diff --git a/eng/Subsets.props b/eng/Subsets.props
index d33944f97ddbdb..f7c472357e68c5 100644
--- a/eng/Subsets.props
+++ b/eng/Subsets.props
@@ -13,7 +13,7 @@
./build.sh corehost installer.managed
- This builds the CoreHost and also the Managed installer portion (e.g. Microsoft.DotNet.PlatformAbstractions)
+ This builds the CoreHost and also the Managed installer portion (e.g. Microsoft.NET.HostModel)
projects. A space ' ' or '+' are the delimiters between multiple subsets to build.
./build.sh -test installer.tests
@@ -38,12 +38,23 @@
clr+mono+libs+installer
- mono+libs+installer
- mono+libs
+ mono+libs+installer
+
- clr.runtime+linuxdac+clr.corelib+clr.nativecorelib+clr.tools+clr.buildtools+clr.packages
+ <_subset Condition="'$(Subset)' != ''">+$(Subset.ToLowerInvariant())+
+ <_subset Condition="'$(Subset)' == ''">+$(DefaultSubsets)+
+
+
+
+ Mono
+ Mono
+ CoreCLR
+
+
+
+ clr.runtime+linuxdac+clr.corelib+clr.nativecorelib+clr.tools+clr.packagesmono.llvm+$(DefaultMonoSubsets)mono.runtime+mono.corelib
@@ -51,12 +62,10 @@
libs.depprojs+libs.native+libs.ref+libs.src+libs.pretest+libs.packagescorehost+installer.managed+installer.depprojs+installer.pkgprojs+bundles+installers+installer.tests
- installer.depprojs+installer.pkgprojs
+ installer.pkgprojs
- <_subset Condition="'$(Subset)' != ''">+$(Subset.ToLowerInvariant())+
- <_subset Condition="'$(Subset)' == ''">+$(DefaultSubsets)+
<_subset>$(_subset.Replace('+clr+', '+$(DefaultCoreClrSubsets)+'))
<_subset>$(_subset.Replace('+mono+', '+$(DefaultMonoSubsets)+'))
<_subset>$(_subset.Replace('+libs+', '+$(DefaultLibrariesSubsets)+'))
@@ -66,12 +75,6 @@
<_subset>+$(_subset.Trim('+'))+
-
- Mono
- Mono
- CoreCLR
-
-
@@ -81,7 +84,6 @@
-
@@ -102,7 +104,7 @@
-
+
@@ -113,82 +115,58 @@
-
+ falsefalsefalsefalse
- Configuration=$(CoreCLRConfiguration)
-
-
- false
- false
- false
- false
- Configuration=$(MonoConfiguration)
-
-
- false
- false
- false
- false
- Configuration=$(LibrariesConfiguration)
-
-
- false
- true
- false
-
+
-
-
-
-
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
+
+
-
+
-
-
+
+
-
+
-
+
@@ -199,65 +177,65 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
-
+
@@ -267,11 +245,20 @@
-
+
-
+
+
+
+
+
+
+ Configuration=$(CoreCLRConfiguration)
+ Configuration=$(MonoConfiguration)
+ Configuration=$(LibrariesConfiguration)
+
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 7b7ecd8507195a..0e5212ef380e4f 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -6,61 +6,61 @@
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575d
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575d
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575d
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575d
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575d
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575d
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575d
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575d
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575d
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575d
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575d
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575d
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575d
-
+ https://github.com/dotnet/arcade
- bce0a98620c1c5a110b2bba9912f3d5929069c6b
+ 898e51ed5fdcc4871087ac5754ca9056e58e575dhttps://dev.azure.com/dnceng/internal/_git/dotnet-optimization
@@ -82,65 +82,65 @@
https://dev.azure.com/dnceng/internal/_git/dotnet-optimizationd0bb63d2ec7060714e63ee4082fac48f2e57f3e2
-
+ https://github.com/microsoft/vstest
- 732a3a37e8d3e1a2522546fca644c7d69be457cf
+ 8ee627ea54aba31b941e5d45a1a1614b50f7befb
-
+ https://github.com/dotnet/runtime-assets
- 3e5b67e9033c00da5e1ce539c0186cbf171b6ce4
+ 71b9284907ebc69e5f80b491a51084c75e0ef7d3
-
+ https://github.com/dotnet/runtime-assets
- 3e5b67e9033c00da5e1ce539c0186cbf171b6ce4
+ 71b9284907ebc69e5f80b491a51084c75e0ef7d3
-
+ https://github.com/dotnet/runtime-assets
- 3e5b67e9033c00da5e1ce539c0186cbf171b6ce4
+ 71b9284907ebc69e5f80b491a51084c75e0ef7d3
-
+ https://github.com/dotnet/runtime-assets
- 3e5b67e9033c00da5e1ce539c0186cbf171b6ce4
+ 71b9284907ebc69e5f80b491a51084c75e0ef7d3
-
+ https://github.com/dotnet/runtime-assets
- 3e5b67e9033c00da5e1ce539c0186cbf171b6ce4
+ 71b9284907ebc69e5f80b491a51084c75e0ef7d3
-
+ https://github.com/dotnet/runtime-assets
- 3e5b67e9033c00da5e1ce539c0186cbf171b6ce4
+ 71b9284907ebc69e5f80b491a51084c75e0ef7d3
-
+ https://github.com/dotnet/runtime-assets
- 3e5b67e9033c00da5e1ce539c0186cbf171b6ce4
+ 71b9284907ebc69e5f80b491a51084c75e0ef7d3
-
+ https://github.com/dotnet/runtime-assets
- 3e5b67e9033c00da5e1ce539c0186cbf171b6ce4
+ 71b9284907ebc69e5f80b491a51084c75e0ef7d3
-
+ https://github.com/dotnet/llvm-project
- f29b04491741ba1e4c7aa4f0fa039512aad2028f
+ d179d1b519fb0b3e4a4b3f15ee55920e310c582f
-
+ https://github.com/dotnet/llvm-project
- f29b04491741ba1e4c7aa4f0fa039512aad2028f
+ d179d1b519fb0b3e4a4b3f15ee55920e310c582f
-
+ https://github.com/dotnet/llvm-project
- f29b04491741ba1e4c7aa4f0fa039512aad2028f
+ d179d1b519fb0b3e4a4b3f15ee55920e310c582f
-
+ https://github.com/dotnet/llvm-project
- f29b04491741ba1e4c7aa4f0fa039512aad2028f
+ d179d1b519fb0b3e4a4b3f15ee55920e310c582f
-
+ https://github.com/dotnet/llvm-project
- f29b04491741ba1e4c7aa4f0fa039512aad2028f
+ d179d1b519fb0b3e4a4b3f15ee55920e310c582f
-
+ https://github.com/dotnet/llvm-project
- f29b04491741ba1e4c7aa4f0fa039512aad2028f
+ d179d1b519fb0b3e4a4b3f15ee55920e310c582fhttps://github.com/dotnet/runtime
@@ -166,9 +166,17 @@
https://github.com/dotnet/runtime0375524a91a47ca4db3ee1be548f74bab7e26e76
-
+
+ https://github.com/dotnet/runtime
+ 0375524a91a47ca4db3ee1be548f74bab7e26e76
+
+ https://github.com/mono/linker
- 8caef57d1f3bc7a188e5dd26d43a2d34151223f9
+ 3481158940a2b7f1114950cc7ba5bd56e0bfc761
+
+
+ https://github.com/dotnet/xharness
+ 8f6cc04f53cb6759758ffc97c9c8ca3ab4802f7f
diff --git a/eng/Versions.props b/eng/Versions.props
index 948bdc32af6337..586f105dc54668 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -7,7 +7,7 @@
00preview
- 4
+ 6$(MajorVersion).$(MinorVersion).0.0
@@ -18,15 +18,9 @@
truetruefalse
-
- 3.6.0-2.20166.2dotnet$(ContainerName)
-
- $(MajorVersion).$(MinorVersion)
- $(MajorVersion).$(MinorVersion)
- netcoreapp$(NETCoreAppFrameworkVersion)
- 5.0.0-beta.20201.2
- 5.0.0-beta.20201.2
- 5.0.0-beta.20201.2
- 5.0.0-beta.20201.2
- 5.0.0-beta.20201.2
- 5.0.0-beta.20201.2
- 5.0.0-beta.20201.2
- 2.5.1-beta.20201.2
- 5.0.0-beta.20201.2
- 5.0.0-beta.20201.2
- 5.0.0-beta.20201.2
+ 5.0.0-beta.20261.9
+ 5.0.0-beta.20261.9
+ 5.0.0-beta.20261.9
+ 5.0.0-beta.20261.9
+ 5.0.0-beta.20261.9
+ 5.0.0-beta.20261.9
+ 2.5.1-beta.20264.3
+ 5.0.0-beta.20261.9
+ 5.0.0-beta.20261.9
+ 5.0.0-beta.20261.95.0.0-preview.4.20202.185.0.0-preview.4.20202.185.0.0-preview.4.20202.18
- 2.1.0
- 3.0.0
+ 3.1.05.0.0-preview.4.20202.185.0.0-preview.4.20202.18
- 1.0.120601
+ 5.0.0-preview.4.20202.185.0.0-alpha.1.19563.3
- 5.0.0-beta.20206.1
- 5.0.0-beta.20206.1
- 5.0.0-beta.20206.1
- 5.0.0-beta.20206.1
- 5.0.0-beta.20206.1
- 5.0.0-beta.20206.1
- 5.0.0-beta.20206.1
- 5.0.0-beta.20206.1
+ 5.0.0-beta.20258.1
+ 5.0.0-beta.20258.1
+ 5.0.0-beta.20258.1
+ 5.0.0-beta.20258.1
+ 5.0.0-beta.20258.1
+ 5.0.0-beta.20258.1
+ 5.0.0-beta.20258.1
+ 5.0.0-beta.20258.12.2.0-prerelease.19564.1
@@ -100,6 +92,7 @@
1.0.51.7.0
+ 2.0.0-beta1.20253.14.8.0
- 16.7.0-preview-20200408-06
+ 16.7.0-preview-20200521-01
+ 1.0.0-prerelease.20277.12.4.1
+ 1.2.12.0.512.0.34.12.03.1.0-preview-20200129.1
- 5.0.0-preview.3.20210.1
+ 5.0.0-preview.3.20276.2
- 6.0.1-alpha.1.20206.1
- 6.0.1-alpha.1.20206.1
- 6.0.1-alpha.1.20206.1
- 6.0.1-alpha.1.20206.1
- 6.0.1-alpha.1.20206.1
- 6.0.1-alpha.1.20206.1
+ 9.0.1-alpha.1.20268.2
+ 9.0.1-alpha.1.20268.2
+ 9.0.1-alpha.1.20268.2
+ 9.0.1-alpha.1.20268.2
+ 9.0.1-alpha.1.20268.2
+ 9.0.1-alpha.1.20268.2
diff --git a/eng/build.ps1 b/eng/build.ps1
index 1298a9ba6a2742..f8f1164bcafc8d 100644
--- a/eng/build.ps1
+++ b/eng/build.ps1
@@ -2,15 +2,16 @@
Param(
[switch][Alias('h')]$help,
[switch][Alias('t')]$test,
- [string[]][Alias('c')]$configuration = @("Debug"),
+ [ValidateSet("Debug","Release","Checked")][string[]][Alias('c')]$configuration = @("Debug"),
[string][Alias('f')]$framework,
[string]$vs,
- [string]$os,
+ [string][Alias('v')]$verbosity = "minimal",
+ [ValidateSet("Windows_NT","Linux","OSX","Browser")][string]$os,
[switch]$allconfigurations,
[switch]$coverage,
[string]$testscope,
[switch]$testnobuild,
- [string[]][Alias('a')]$arch = @([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()),
+ [ValidateSet("x86","x64","arm","arm64","wasm")][string[]][Alias('a')]$arch = @([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()),
[Parameter(Position=0)][string][Alias('s')]$subset,
[ValidateSet("Debug","Release","Checked")][string][Alias('rc')]$runtimeConfiguration,
[ValidateSet("Debug","Release")][string][Alias('lc')]$librariesConfiguration,
@@ -20,9 +21,9 @@ Param(
function Get-Help() {
Write-Host "Common settings:"
Write-Host " -subset Build a subset, print available subsets with -subset help (short: -s)"
- Write-Host " -vs Open the solution with VS for Test Explorer support. Path or solution name (ie -vs Microsoft.CSharp)"
- Write-Host " -os Build operating system: Windows_NT or Unix"
- Write-Host " -arch Build platform: x86, x64, arm or arm64 (short: -a). Pass a comma-separated list to build for multiple architectures."
+ Write-Host " -vs Open the solution with VS using the locally acquired SDK. Path or solution name (ie -vs Microsoft.CSharp)"
+ Write-Host " -os Build operating system: Windows_NT, Linux, OSX, or Browser"
+ Write-Host " -arch Build platform: x86, x64, arm, arm64, or wasm (short: -a). Pass a comma-separated list to build for multiple architectures."
Write-Host " -configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c). Pass a comma-separated list to build for multiple configurations"
Write-Host " -runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked (short: -rc)"
Write-Host " -librariesConfiguration Libraries build configuration: Debug or Release (short: -lc)"
@@ -43,7 +44,7 @@ function Get-Help() {
Write-Host ""
Write-Host "Libraries settings:"
- Write-Host " -framework Build framework: netcoreapp5.0 or net472 (short: -f)"
+ Write-Host " -framework Build framework: net5.0 or net472 (short: -f)"
Write-Host " -coverage Collect code coverage when testing"
Write-Host " -testscope Scope tests, allowed values: innerloop, outerloop, all"
Write-Host " -testnobuild Skip building tests when invoking -test"
@@ -59,37 +60,32 @@ if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $
exit 0
}
-# VS Test Explorer support for libraries
if ($vs) {
. $PSScriptRoot\common\tools.ps1
- # Microsoft.DotNet.CoreSetup.sln is special - hosting tests are currently meant to run on the
- # bootstrapped .NET Core, not on the live-built runtime.
- if (([System.IO.Path]::GetFileName($vs) -ieq "Microsoft.DotNet.CoreSetup.sln") -or ($vs -ieq "Microsoft.DotNet.CoreSetup")) {
+ if (-Not (Test-Path $vs)) {
+ $solution = $vs
+ # Search for the solution in libraries
+ $vs = Split-Path $PSScriptRoot -Parent | Join-Path -ChildPath "src\libraries" | Join-Path -ChildPath $vs | Join-Path -ChildPath "$vs.sln"
if (-Not (Test-Path $vs)) {
- if (-Not ( $vs.endswith(".sln"))) {
- $vs = "$vs.sln"
+ $vs = $solution
+ # Search for the solution in installer
+ if (-Not ($vs.endswith(".sln"))) {
+ $vs = "$vs.sln"
+ }
+ $vs = Split-Path $PSScriptRoot -Parent | Join-Path -ChildPath "src\installer" | Join-Path -ChildPath $vs
+ if (-Not (Test-Path $vs)) {
+ Write-Error "Passed in solution cannot be resolved."
+ exit 1
}
- $vs = Join-Path "$PSScriptRoot\..\src\installer" $vs
}
-
- # This tells .NET Core to use the bootstrapped runtime to run the tests
- $env:DOTNET_ROOT=InitializeDotNetCli -install:$false
}
- else {
- if (-Not (Test-Path $vs)) {
- $vs = Join-Path "$PSScriptRoot\..\src\libraries" $vs | Join-Path -ChildPath "$vs.sln"
- }
-
- $archTestHost = if ($arch) { $arch } else { "x64" }
- # This tells .NET Core to use the same dotnet.exe that build scripts use
- $env:DOTNET_ROOT="$PSScriptRoot\..\artifacts\bin\testhost\netcoreapp5.0-Windows_NT-$configuration-$archTestHost";
- $env:DEVPATH="$PSScriptRoot\..\artifacts\bin\testhost\net472-Windows_NT-$configuration-$archTestHost";
- }
+ # This tells .NET Core to use the bootstrapped runtime
+ $env:DOTNET_ROOT=InitializeDotNetCli -install:$false
# This tells MSBuild to load the SDK from the directory of the bootstrapped SDK
- $env:DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=InitializeDotNetCli -install:$false
+ $env:DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=$env:DOTNET_ROOT
# This tells .NET Core not to go looking for .NET Core in other places
$env:DOTNET_MULTILEVEL_LOOKUP=0;
@@ -130,6 +126,7 @@ foreach ($argument in $PSBoundParameters.Keys)
"os" { $arguments += " /p:TargetOS=$($PSBoundParameters[$argument])" }
"allconfigurations" { $arguments += " /p:BuildAllConfigurations=true" }
"properties" { $arguments += " " + $properties }
+ "verbosity" { $arguments += " -$argument " + $($PSBoundParameters[$argument]) }
# configuration and arch can be specified multiple times, so they should be no-ops here
"configuration" {}
"arch" {}
@@ -159,4 +156,4 @@ if ($failedBuilds.Count -ne 0) {
exit 1
}
-exit 0
\ No newline at end of file
+exit 0
diff --git a/eng/build.sh b/eng/build.sh
index 5b55cabd4ba2af..02c5d278e259d6 100755
--- a/eng/build.sh
+++ b/eng/build.sh
@@ -18,8 +18,8 @@ usage()
{
echo "Common settings:"
echo " --subset Build a subset, print available subsets with -subset help (short: -s)"
- echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS or Android"
- echo " --arch Build platform: x86, x64, arm, armel or arm64"
+ echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, NetBSD or SunOS"
+ echo " --arch Build platform: x86, x64, arm, armel, arm64 or wasm"
echo " --configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c)"
echo " --runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked (short: -rc)"
echo " --librariesConfiguration Libraries build configuration: Debug or Release (short: -lc)"
@@ -42,7 +42,7 @@ usage()
echo ""
echo "Libraries settings:"
- echo " --framework Build framework: netcoreapp5.0 or net472 (short: -f)"
+ echo " --framework Build framework: net5.0 or net472 (short: -f)"
echo " --coverage Collect code coverage when testing"
echo " --testscope Test scope, allowed values: innerloop, outerloop, all"
echo " --testnobuild Skip building tests when invoking -test"
@@ -107,71 +107,190 @@ while [[ $# > 0 ]]; do
usage
exit 0
;;
+
-subset|-s)
- arguments="$arguments /p:Subset=$2"
- shift 2
+ if [ -z ${2+x} ]; then
+ arguments="$arguments /p:Subset=help"
+ shift 1
+ else
+ arguments="$arguments /p:Subset=$2"
+ shift 2
+ fi
;;
+
-arch)
- arch=$2
+ if [ -z ${2+x} ]; then
+ echo "No architecture supplied. See help (--help) for supported architectures." 1>&2
+ exit 1
+ fi
+ passedArch="$(echo "$2" | awk '{print tolower($0)}')"
+ case "$passedArch" in
+ x64|x86|arm|armel|arm64|wasm)
+ arch=$passedArch
+ ;;
+ *)
+ echo "Unsupported target architecture '$2'."
+ echo "The allowed values are x86, x64, arm, armel, arm64, and wasm."
+ exit 1
+ ;;
+ esac
shift 2
;;
+
-configuration|-c)
- val="$(tr '[:lower:]' '[:upper:]' <<< ${2:0:1})${2:1}"
+ if [ -z ${2+x} ]; then
+ echo "No configuration supplied. See help (--help) for supported configurations." 1>&2
+ exit 1
+ fi
+ passedConfig="$(echo "$2" | awk '{print tolower($0)}')"
+ case "$passedConfig" in
+ debug|release|checked)
+ val="$(tr '[:lower:]' '[:upper:]' <<< ${passedConfig:0:1})${passedConfig:1}"
+ ;;
+ *)
+ echo "Unsupported target configuration '$2'."
+ echo "The allowed values are Debug, Release, and Checked."
+ exit 1
+ ;;
+ esac
arguments="$arguments -configuration $val"
shift 2
;;
+
-framework|-f)
+ if [ -z ${2+x} ]; then
+ echo "No framework supplied. See help (--help) for supported frameworks." 1>&2
+ exit 1
+ fi
val="$(echo "$2" | awk '{print tolower($0)}')"
arguments="$arguments /p:BuildTargetFramework=$val"
shift 2
;;
+
-os)
- os=$2
- arguments="$arguments /p:TargetOS=$2"
+ if [ -z ${2+x} ]; then
+ echo "No target operating system supplied. See help (--help) for supported target operating systems." 1>&2
+ exit 1
+ fi
+ passedOS="$(echo "$2" | awk '{print tolower($0)}')"
+ case "$passedOS" in
+ windows_nt)
+ os="Windows_NT" ;;
+ linux)
+ os="Linux" ;;
+ freebsd)
+ os="FreeBSD" ;;
+ osx)
+ os="OSX" ;;
+ tvos)
+ os="tvOS" ;;
+ ios)
+ os="iOS" ;;
+ android)
+ os="Android" ;;
+ browser)
+ os="Browser" ;;
+ sunos)
+ os="SunOS" ;;
+ *)
+ echo "Unsupported target OS '$2'."
+ echo "The allowed values are Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, and SunOS."
+ exit 1
+ ;;
+ esac
+ arguments="$arguments /p:TargetOS=$os"
shift 2
;;
+
-allconfigurations)
arguments="$arguments /p:BuildAllConfigurations=true"
shift 1
;;
+
-testscope)
+ if [ -z ${2+x} ]; then
+ echo "No test scope supplied. See help (--help) for supported test scope values." 1>&2
+ exit 1
+ fi
arguments="$arguments /p:TestScope=$2"
shift 2
;;
+
-testnobuild)
- arguments="$arguments /p:TestNoBuild=$2"
- shift 2
+ arguments="$arguments /p:TestNoBuild=true"
+ shift 1
;;
+
-coverage)
arguments="$arguments /p:Coverage=true"
shift 1
;;
+
-runtimeconfiguration|-rc)
- val="$(tr '[:lower:]' '[:upper:]' <<< ${2:0:1})${2:1}"
+ if [ -z ${2+x} ]; then
+ echo "No runtime configuration supplied. See help (--help) for supported runtime configurations." 1>&2
+ exit 1
+ fi
+ passedRuntimeConf="$(echo "$2" | awk '{print tolower($0)}')"
+ case "$passedRuntimeConf" in
+ debug|release|checked)
+ val="$(tr '[:lower:]' '[:upper:]' <<< ${passedRuntimeConf:0:1})${passedRuntimeConf:1}"
+ ;;
+ *)
+ echo "Unsupported runtime configuration '$2'."
+ echo "The allowed values are Debug, Release, and Checked."
+ exit 1
+ ;;
+ esac
arguments="$arguments /p:RuntimeConfiguration=$val"
shift 2
;;
+
-librariesconfiguration|-lc)
- arguments="$arguments /p:LibrariesConfiguration=$2"
+ if [ -z ${2+x} ]; then
+ echo "No libraries configuration supplied. See help (--help) for supported libraries configurations." 1>&2
+ exit 1
+ fi
+ passedLibConf="$(echo "$2" | awk '{print tolower($0)}')"
+ case "$passedLibConf" in
+ debug|release)
+ val="$(tr '[:lower:]' '[:upper:]' <<< ${passedLibConf:0:1})${passedLibConf:1}"
+ ;;
+ *)
+ echo "Unsupported libraries configuration '$2'."
+ echo "The allowed values are Debug and Release."
+ exit 1
+ ;;
+ esac
+ arguments="$arguments /p:LibrariesConfiguration=$val"
shift 2
;;
+
-cross)
crossBuild=1
arguments="$arguments /p:CrossBuild=True"
shift 1
;;
+
-clang*)
arguments="$arguments /p:Compiler=$opt"
shift 1
;;
+
-cmakeargs)
+ if [ -z ${2+x} ]; then
+ echo "No cmake args supplied." 1>&2
+ exit 1
+ fi
cmakeargs="${cmakeargs} ${opt} $2"
shift 2
;;
+
-gcc*)
arguments="$arguments /p:Compiler=$opt"
shift 1
;;
+
*)
extraargs="$extraargs $1"
shift 1
diff --git a/eng/codeOptimization.targets b/eng/codeOptimization.targets
index 3687c865c90046..6ed7e997487bd6 100644
--- a/eng/codeOptimization.targets
+++ b/eng/codeOptimization.targets
@@ -9,7 +9,7 @@
IBCMerge optimizations on Mac for now to unblock the offical build.
See issue https://github.com/dotnet/runtime/issues/33303
-->
- false
+ false 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 " -excludeCIBinarylog Don't output binary log (short: -nobl)"
Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build"
Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')"
Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)."
@@ -134,7 +136,9 @@ try {
}
if ($ci) {
- $binaryLog = $true
+ if (-not $excludeCIBinarylog) {
+ $binaryLog = $true
+ }
$nodeReuse = $false
}
diff --git a/eng/common/build.sh b/eng/common/build.sh
index 36f9aa0462ee17..6d7c5a1f69c200 100755
--- a/eng/common/build.sh
+++ b/eng/common/build.sh
@@ -32,6 +32,7 @@ usage()
echo "Advanced settings:"
echo " --projects Project or solution file(s) to build"
echo " --ci Set when running on CI server"
+ echo " --excludeCIBinarylog Don't output binary log (short: -nobl)"
echo " --prepareMachine Prepare machine for CI run, clean up processes after build"
echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')"
echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')"
@@ -68,6 +69,7 @@ clean=false
warn_as_error=true
node_reuse=true
binary_log=false
+exclude_ci_binary_log=false
pipelines_log=false
projects=''
@@ -98,6 +100,9 @@ while [[ $# > 0 ]]; do
-binarylog|-bl)
binary_log=true
;;
+ -excludeCIBinarylog|-nobl)
+ exclude_ci_binary_log=true
+ ;;
-pipelineslog|-pl)
pipelines_log=true
;;
@@ -156,8 +161,10 @@ done
if [[ "$ci" == true ]]; then
pipelines_log=true
- binary_log=true
node_reuse=false
+ if [[ "$exclude_ci_binary_log" == false ]]; then
+ binary_log=true
+ fi
fi
. "$scriptroot/tools.sh"
diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh
index 2cdd82d30df62e..d780fefb541432 100755
--- a/eng/common/cross/build-rootfs.sh
+++ b/eng/common/cross/build-rootfs.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
+set -e
+
usage()
{
echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [--skipunmount] --rootfsdir ]"
@@ -15,6 +17,8 @@ __CodeName=xenial
__CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
__InitialDir=$PWD
__BuildArch=arm
+__AlpineArch=armv7
+__QEMUArch=arm
__UbuntuArch=armhf
__UbuntuRepo="http://ports.ubuntu.com/"
__LLDB_Package="liblldb-3.9-dev"
@@ -26,9 +30,10 @@ __UbuntuPackages="build-essential"
__AlpinePackages="alpine-base"
__AlpinePackages+=" build-base"
__AlpinePackages+=" linux-headers"
-__AlpinePackagesEdgeTesting=" lldb-dev"
-__AlpinePackagesEdgeMain=" llvm9-libs"
+__AlpinePackagesEdgeCommunity=" lldb-dev"
+__AlpinePackagesEdgeMain=" llvm10-libs"
__AlpinePackagesEdgeMain+=" python3"
+__AlpinePackagesEdgeMain+=" libedit"
# symlinks fixer
__UbuntuPackages+=" symlinks"
@@ -55,12 +60,11 @@ __AlpinePackages+=" openssl-dev"
__AlpinePackages+=" zlib-dev"
__FreeBSDBase="12.1-RELEASE"
-__FreeBSDPkg="1.10.5"
+__FreeBSDPkg="1.12.0"
__FreeBSDPackages="libunwind"
__FreeBSDPackages+=" icu"
__FreeBSDPackages+=" libinotify"
__FreeBSDPackages+=" lttng-ust"
-__FreeBSDPackages+=" llvm-90"
__FreeBSDPackages+=" krb5"
__UnprocessedBuildArgs=
@@ -78,7 +82,7 @@ while :; do
arm)
__BuildArch=arm
__UbuntuArch=armhf
- __AlpineArch=armhf
+ __AlpineArch=armv7
__QEMUArch=arm
;;
arm64)
@@ -205,7 +209,7 @@ fi
if [ -d "$__RootfsDir" ]; then
if [ $__SkipUnmount == 0 ]; then
- umount $__RootfsDir/*
+ umount $__RootfsDir/* || true
fi
rm -rf $__RootfsDir
fi
@@ -231,9 +235,9 @@ if [[ "$__CodeName" == "alpine" ]]; then
add $__AlpinePackagesEdgeMain
$__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \
- -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \
+ -X http://dl-cdn.alpinelinux.org/alpine/edge/community \
-U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \
- add $__AlpinePackagesEdgeTesting
+ add $__AlpinePackagesEdgeCommunity
rm -r $__ApkToolsDir
elif [[ "$__CodeName" == "freebsd" ]]; then
@@ -246,11 +250,13 @@ elif [[ "$__CodeName" == "freebsd" ]]; then
# get and build package manager
wget -O - https://github.com/freebsd/pkg/archive/${__FreeBSDPkg}.tar.gz | tar -C $__RootfsDir/tmp -zxf -
cd $__RootfsDir/tmp/pkg-${__FreeBSDPkg}
- ./autogen.sh && ./configure --prefix=$__RootfsDir/host && make install
+ # needed for install to succeed
+ mkdir -p $__RootfsDir/host/etc
+ ./autogen.sh && ./configure --prefix=$__RootfsDir/host && make && make install
rm -rf $__RootfsDir/tmp/pkg-${__FreeBSDPkg}
# install packages we need.
- $__RootfsDir/host/sbin/pkg -r $__RootfsDir -C $__RootfsDir/usr/local/etc/pkg.conf update
- $__RootfsDir/host/sbin/pkg -r $__RootfsDir -C $__RootfsDir/usr/local/etc/pkg.conf install --yes $__FreeBSDPackages
+ INSTALL_AS_USER=$(whoami) $__RootfsDir/host/sbin/pkg -r $__RootfsDir -C $__RootfsDir/usr/local/etc/pkg.conf update
+ INSTALL_AS_USER=$(whoami) $__RootfsDir/host/sbin/pkg -r $__RootfsDir -C $__RootfsDir/usr/local/etc/pkg.conf install --yes $__FreeBSDPackages
elif [[ -n $__CodeName ]]; then
qemu-debootstrap --arch $__UbuntuArch $__CodeName $__RootfsDir $__UbuntuRepo
cp $__CrossDir/$__BuildArch/sources.list.$__CodeName $__RootfsDir/etc/apt/sources.list
@@ -260,7 +266,7 @@ elif [[ -n $__CodeName ]]; then
chroot $__RootfsDir symlinks -cr /usr
if [ $__SkipUnmount == 0 ]; then
- umount $__RootfsDir/*
+ umount $__RootfsDir/* || true
fi
if [[ "$__BuildArch" == "arm" && "$__CodeName" == "trusty" ]]; then
diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj
index 1a39a7ef3f67b1..f46d5efe2e32af 100644
--- a/eng/common/internal/Tools.csproj
+++ b/eng/common/internal/Tools.csproj
@@ -4,6 +4,7 @@
net472false
+ false
diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1
index 41416862d9132f..d7d1a6510949af 100644
--- a/eng/common/native/CommonLibrary.psm1
+++ b/eng/common/native/CommonLibrary.psm1
@@ -145,9 +145,12 @@ function Get-File {
New-Item -path $DownloadDirectory -force -itemType "Directory" | Out-Null
}
+ $TempPath = "$Path.tmp"
if (Test-Path -IsValid -Path $Uri) {
- Write-Verbose "'$Uri' is a file path, copying file to '$Path'"
- Copy-Item -Path $Uri -Destination $Path
+ Write-Verbose "'$Uri' is a file path, copying temporarily to '$TempPath'"
+ Copy-Item -Path $Uri -Destination $TempPath
+ Write-Verbose "Moving temporary file to '$Path'"
+ Move-Item -Path $TempPath -Destination $Path
return $?
}
else {
@@ -157,8 +160,10 @@ function Get-File {
while($Attempt -Lt $DownloadRetries)
{
try {
- Invoke-WebRequest -UseBasicParsing -Uri $Uri -OutFile $Path
- Write-Verbose "Downloaded to '$Path'"
+ Invoke-WebRequest -UseBasicParsing -Uri $Uri -OutFile $TempPath
+ Write-Verbose "Downloaded to temporary location '$TempPath'"
+ Move-Item -Path $TempPath -Destination $Path
+ Write-Verbose "Moved temporary file to '$Path'"
return $True
}
catch {
@@ -359,16 +364,21 @@ function Expand-Zip {
return $False
}
}
- if (-Not (Test-Path $OutputDirectory)) {
- New-Item -path $OutputDirectory -Force -itemType "Directory" | Out-Null
+
+ $TempOutputDirectory = Join-Path "$(Split-Path -Parent $OutputDirectory)" "$(Split-Path -Leaf $OutputDirectory).tmp"
+ if (Test-Path $TempOutputDirectory) {
+ Remove-Item $TempOutputDirectory -Force -Recurse
}
+ New-Item -Path $TempOutputDirectory -Force -ItemType "Directory" | Out-Null
Add-Type -assembly "system.io.compression.filesystem"
- [io.compression.zipfile]::ExtractToDirectory("$ZipPath", "$OutputDirectory")
+ [io.compression.zipfile]::ExtractToDirectory("$ZipPath", "$TempOutputDirectory")
if ($? -Eq $False) {
Write-Error "Unable to extract '$ZipPath'"
return $False
}
+
+ Move-Item -Path $TempOutputDirectory -Destination $OutputDirectory
}
catch {
Write-Host $_
diff --git a/eng/common/native/find-native-compiler.sh b/eng/common/native/find-native-compiler.sh
new file mode 100644
index 00000000000000..aed19d07d506ff
--- /dev/null
+++ b/eng/common/native/find-native-compiler.sh
@@ -0,0 +1,121 @@
+#!/usr/bin/env bash
+#
+# This file locates the native compiler with the given name and version and sets the environment variables to locate it.
+#
+
+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 )"
+
+if [ $# -lt 0 ]
+then
+ echo "Usage..."
+ echo "find-native-compiler.sh "
+ echo "Specify the name of compiler (clang or gcc)."
+ echo "Specify the major version of compiler."
+ echo "Specify the minor version of compiler."
+ exit 1
+fi
+
+. $scriptroot/../pipeline-logging-functions.sh
+
+compiler="$1"
+cxxCompiler="$compiler++"
+majorVersion="$2"
+minorVersion="$3"
+
+if [ "$compiler" = "gcc" ]; then cxxCompiler="g++"; fi
+
+check_version_exists() {
+ desired_version=-1
+
+ # Set up the environment to be used for building with the desired compiler.
+ if command -v "$compiler-$1.$2" > /dev/null; then
+ desired_version="-$1.$2"
+ elif command -v "$compiler$1$2" > /dev/null; then
+ desired_version="$1$2"
+ elif command -v "$compiler-$1$2" > /dev/null; then
+ desired_version="-$1$2"
+ fi
+
+ echo "$desired_version"
+}
+
+if [ -z "$CLR_CC" ]; then
+
+ # Set default versions
+ if [ -z "$majorVersion" ]; then
+ # note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero.
+ if [ "$compiler" = "clang" ]; then versions=( 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
+ elif [ "$compiler" = "gcc" ]; then versions=( 9 8 7 6 5 4.9 ); fi
+
+ for version in "${versions[@]}"; do
+ parts=(${version//./ })
+ desired_version="$(check_version_exists "${parts[0]}" "${parts[1]}")"
+ if [ "$desired_version" != "-1" ]; then majorVersion="${parts[0]}"; break; fi
+ done
+
+ if [ -z "$majorVersion" ]; then
+ if command -v "$compiler" > /dev/null; then
+ if [ "$(uname)" != "Darwin" ]; then
+ Write-PipelineTelemetryError -category "Build" -type "warning" "Specific version of $compiler not found, falling back to use the one in PATH."
+ fi
+ export CC="$(command -v "$compiler")"
+ export CXX="$(command -v "$cxxCompiler")"
+ else
+ Write-PipelineTelemetryError -category "Build" "No usable version of $compiler found."
+ exit 1
+ fi
+ else
+ if [ "$compiler" = "clang" ] && [ "$majorVersion" -lt 5 ]; then
+ if [ "$build_arch" = "arm" ] || [ "$build_arch" = "armel" ]; then
+ if command -v "$compiler" > /dev/null; then
+ Write-PipelineTelemetryError -category "Build" -type "warning" "Found clang version $majorVersion which is not supported on arm/armel architectures, falling back to use clang from PATH."
+ export CC="$(command -v "$compiler")"
+ export CXX="$(command -v "$cxxCompiler")"
+ else
+ Write-PipelineTelemetryError -category "Build" "Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH."
+ exit 1
+ fi
+ fi
+ fi
+ fi
+ else
+ desired_version="$(check_version_exists "$majorVersion" "$minorVersion")"
+ if [ "$desired_version" = "-1" ]; then
+ Write-PipelineTelemetryError -category "Build" "Could not find specific version of $compiler: $majorVersion $minorVersion."
+ exit 1
+ fi
+ fi
+
+ if [ -z "$CC" ]; then
+ export CC="$(command -v "$compiler$desired_version")"
+ export CXX="$(command -v "$cxxCompiler$desired_version")"
+ if [ -z "$CXX" ]; then export CXX="$(command -v "$cxxCompiler")"; fi
+ fi
+else
+ if [ ! -f "$CLR_CC" ]; then
+ Write-PipelineTelemetryError -category "Build" "CLR_CC is set but path '$CLR_CC' does not exist"
+ exit 1
+ fi
+ export CC="$CLR_CC"
+ export CXX="$CLR_CXX"
+fi
+
+if [ -z "$CC" ]; then
+ Write-PipelineTelemetryError -category "Build" "Unable to find $compiler."
+ exit 1
+fi
+
+export CCC_CC="$CC"
+export CCC_CXX="$CXX"
+export SCAN_BUILD_COMMAND="$(command -v "scan-build$desired_version")"
diff --git a/eng/common/performance/perfhelixpublish.proj b/eng/common/performance/perfhelixpublish.proj
index cf5941e1b64554..1db5e8a84d758b 100644
--- a/eng/common/performance/perfhelixpublish.proj
+++ b/eng/common/performance/perfhelixpublish.proj
@@ -6,6 +6,7 @@
py -3%HELIX_CORRELATION_PAYLOAD%\Core_Root\CoreRun.exe%HELIX_CORRELATION_PAYLOAD%\Baseline_Core_Root\CoreRun.exe
+
$(HelixPreCommands);call %HELIX_CORRELATION_PAYLOAD%\performance\tools\machine-setup.cmd;set PYTHONPATH=%HELIX_WORKITEM_PAYLOAD%\scripts%3B%HELIX_WORKITEM_PAYLOAD%%HELIX_CORRELATION_PAYLOAD%\artifacts\BenchmarkDotNet.Artifacts%HELIX_CORRELATION_PAYLOAD%\artifacts\BenchmarkDotNet.Artifacts_Baseline
@@ -40,6 +41,13 @@
$HELIX_WORKITEM_ROOT/testResults.xml
+
+ --corerun %HELIX_CORRELATION_PAYLOAD%\dotnet-mono\shared\Microsoft.NETCore.App\5.0.0\corerun.exe
+
+
+ --corerun $(BaseDirectory)/dotnet-mono/shared/Microsoft.NETCore.App/5.0.0/corerun
+
+
--corerun $(CoreRun)
diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1
index 1763a1a97b0e79..31a99e49015f49 100644
--- a/eng/common/performance/performance-setup.ps1
+++ b/eng/common/performance/performance-setup.ps1
@@ -3,7 +3,7 @@ Param(
[string] $CoreRootDirectory,
[string] $BaselineCoreRootDirectory,
[string] $Architecture="x64",
- [string] $Framework="netcoreapp5.0",
+ [string] $Framework="net5.0",
[string] $CompilationMode="Tiered",
[string] $Repository=$env:BUILD_REPOSITORY_NAME,
[string] $Branch=$env:BUILD_SOURCEBRANCH,
@@ -12,8 +12,12 @@ Param(
[string] $RunCategories="Libraries Runtime",
[string] $Csproj="src\benchmarks\micro\MicroBenchmarks.csproj",
[string] $Kind="micro",
+ [switch] $LLVM,
+ [switch] $MonoInterpreter,
+ [switch] $MonoAOT,
[switch] $Internal,
[switch] $Compare,
+ [string] $MonoDotnet="",
[string] $Configurations="CompilationMode=$CompilationMode RunKind=$Kind"
)
@@ -31,7 +35,8 @@ $HelixSourcePrefix = "pr"
$Queue = "Windows.10.Amd64.ClientRS4.DevEx.15.8.Open"
-if ($Framework.StartsWith("netcoreapp")) {
+# TODO: Implement a better logic to determine if Framework is .NET Core or >= .NET 5.
+if ($Framework.StartsWith("netcoreapp") -or ($Framework -eq "net5.0")) {
$Queue = "Windows.10.Amd64.ClientRS5.Open"
}
@@ -49,6 +54,21 @@ if ($Internal) {
$HelixSourcePrefix = "official"
}
+if($MonoDotnet -ne "")
+{
+ $Configurations += " LLVM=$LLVM MonoInterpreter=$MonoInterpreter MonoAOT=$MonoAOT"
+ if($ExtraBenchmarkDotNetArguments -eq "")
+ {
+ #FIX ME: We need to block these tests as they don't run on mono for now
+ $ExtraBenchmarkDotNetArguments = "--exclusion-filter *Perf_Image* *Perf_NamedPipeStream*"
+ }
+ else
+ {
+ #FIX ME: We need to block these tests as they don't run on mono for now
+ $ExtraBenchmarkDotNetArguments += " --exclusion-filter *Perf_Image* *Perf_NamedPipeStream*"
+ }
+}
+
# FIX ME: This is a workaround until we get this from the actual pipeline
$CommonSetupArguments="--channel master --queue $Queue --build-number $BuildNumber --build-configs $Configurations --architecture $Architecture"
$SetupArguments = "--repository https://github.com/$Repository --branch $Branch --get-perf-hash --commit-sha $CommitSha $CommonSetupArguments"
@@ -69,6 +89,13 @@ else {
git clone --branch master --depth 1 --quiet https://github.com/dotnet/performance $PerformanceDirectory
}
+if($MonoDotnet -ne "")
+{
+ $UsingMono = "true"
+ $MonoDotnetPath = (Join-Path $PayloadDirectory "dotnet-mono")
+ Move-Item -Path $MonoDotnet -Destination $MonoDotnetPath
+}
+
if ($UseCoreRun) {
$NewCoreRoot = (Join-Path $PayloadDirectory "Core_Root")
Move-Item -Path $CoreRootDirectory -Destination $NewCoreRoot
@@ -104,6 +131,7 @@ Write-PipelineSetVariable -Name 'UseCoreRun' -Value "$UseCoreRun" -IsMultiJobVar
Write-PipelineSetVariable -Name 'UseBaselineCoreRun' -Value "$UseBaselineCoreRun" -IsMultiJobVariable $false
Write-PipelineSetVariable -Name 'RunFromPerfRepo' -Value "$RunFromPerformanceRepo" -IsMultiJobVariable $false
Write-PipelineSetVariable -Name 'Compare' -Value "$Compare" -IsMultiJobVariable $false
+Write-PipelineSetVariable -Name 'MonoDotnet' -Value "$UsingMono" -IsMultiJobVariable $false
# Helix Arguments
Write-PipelineSetVariable -Name 'Creator' -Value "$Creator" -IsMultiJobVariable $false
diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh
index b9eecf94bd01b8..9409e4d85e92e3 100755
--- a/eng/common/performance/performance-setup.sh
+++ b/eng/common/performance/performance-setup.sh
@@ -4,7 +4,7 @@ source_directory=$BUILD_SOURCESDIRECTORY
core_root_directory=
baseline_core_root_directory=
architecture=x64
-framework=netcoreapp5.0
+framework=net5.0
compilation_mode=tiered
repository=$BUILD_REPOSITORY_NAME
branch=$BUILD_SOURCEBRANCH
@@ -12,13 +12,18 @@ commit_sha=$BUILD_SOURCEVERSION
build_number=$BUILD_BUILDNUMBER
internal=false
compare=false
+mono_dotnet=
kind="micro"
+llvm=false
+monointerpreter=false
+monoaot=false
run_categories="Libraries Runtime"
csproj="src\benchmarks\micro\MicroBenchmarks.csproj"
configurations="CompliationMode=$compilation_mode RunKind=$kind"
run_from_perf_repo=false
use_core_run=true
use_baseline_core_run=true
+using_mono=false
while (($# > 0)); do
lowerI="$(echo $1 | awk '{print tolower($0)}')"
@@ -65,6 +70,7 @@ while (($# > 0)); do
;;
--kind)
kind=$2
+ configurations="CompliationMode=$compilation_mode RunKind=$kind"
shift 2
;;
--runcategories)
@@ -79,6 +85,22 @@ while (($# > 0)); do
internal=true
shift 1
;;
+ --llvm)
+ llvm=true
+ shift 1
+ ;;
+ --monointerpreter)
+ monointerpreter=true
+ shift 1
+ ;;
+ --monoaot)
+ monoaot=true
+ shift 1
+ ;;
+ --monodotnet)
+ mono_dotnet=$2
+ shift 2
+ ;;
--compare)
compare=true
shift 1
@@ -107,6 +129,7 @@ while (($# > 0)); do
echo " --kind Related to csproj. The kind of benchmarks that should be run. Defaults to micro"
echo " --runcategories Related to csproj. Categories of benchmarks to run. Defaults to \"coreclr corefx\""
echo " --internal If the benchmarks are running as an official job."
+ echo " --monodotnet Pass the path to the mono dotnet for mono performance testing."
echo ""
exit 0
;;
@@ -164,6 +187,10 @@ if [[ "$internal" == true ]]; then
fi
fi
+if [[ "$mono_dotnet" != "" ]]; then
+ configurations="$configurations LLVM=$llvm MonoInterpreter=$monointerpreter MonoAOT=$monoaot"
+fi
+
common_setup_arguments="--channel master --queue $queue --build-number $build_number --build-configs $configurations --architecture $architecture"
setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments"
@@ -186,6 +213,12 @@ else
mv $docs_directory $workitem_directory
fi
+if [[ "$mono_dotnet" != "" ]]; then
+ using_mono=true
+ mono_dotnet_path=$payload_directory/dotnet-mono
+ mv $mono_dotnet $mono_dotnet_path
+fi
+
if [[ "$use_core_run" = true ]]; then
new_core_root=$payload_directory/Core_Root
mv $core_root_directory $new_core_root
@@ -221,3 +254,4 @@ Write-PipelineSetVariable -name "HelixSourcePrefix" -value "$helix_source_prefix
Write-PipelineSetVariable -name "Kind" -value "$kind" -is_multi_job_variable false
Write-PipelineSetVariable -name "_BuildConfig" -value "$architecture.$kind.$framework" -is_multi_job_variable false
Write-PipelineSetVariable -name "Compare" -value "$compare" -is_multi_job_variable false
+Write-PipelineSetVariable -name "MonoDotnet" -value "$using_mono" -is_multi_job_variable false
diff --git a/eng/common/post-build/check-channel-consistency.ps1 b/eng/common/post-build/check-channel-consistency.ps1
index 7e6618d64ad9f3..38abc5392dc75c 100644
--- a/eng/common/post-build/check-channel-consistency.ps1
+++ b/eng/common/post-build/check-channel-consistency.ps1
@@ -6,13 +6,18 @@ param(
try {
. $PSScriptRoot\post-build-utils.ps1
+ if ($PromoteToChannels -eq "") {
+ Write-PipelineTaskError -Type 'warning' -Message "This build won't publish assets as it's not configured to any Maestro channel. If that wasn't intended use Darc to configure a default channel using add-default-channel for this branch or to promote it to a channel using add-build-to-channel. See https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#assigning-an-individual-build-to-a-channel for more info."
+ ExitWithExitCode 0
+ }
+
# Check that every channel that Maestro told to promote the build to
# is available in YAML
$PromoteToChannelsIds = $PromoteToChannels -split "\D" | Where-Object { $_ }
foreach ($id in $PromoteToChannelsIds) {
if (($id -ne 0) -and ($id -notin $AvailableChannelIds)) {
- Write-PipelineTaskError -Type 'warning' -Message "Channel $id is not present in the post-build YAML configuration!"
+ Write-PipelineTaskError -Message "Channel $id is not present in the post-build YAML configuration! This is an error scenario. Please contact @dnceng."
}
}
diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1
index f7cfe986ddd3e4..8e9527113ca083 100644
--- a/eng/common/post-build/symbols-validation.ps1
+++ b/eng/common/post-build/symbols-validation.ps1
@@ -1,7 +1,9 @@
param(
[Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where NuGet packages to be checked are stored
[Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation
- [Parameter(Mandatory=$true)][string] $DotnetSymbolVersion # Version of dotnet symbol to use
+ [Parameter(Mandatory=$true)][string] $DotnetSymbolVersion, # Version of dotnet symbol to use
+ [Parameter(Mandatory=$false)][switch] $ContinueOnError, # If we should keep checking symbols after an error
+ [Parameter(Mandatory=$false)][switch] $Clean # Clean extracted symbols directory after checking symbols
)
function FirstMatchingSymbolDescriptionOrDefault {
@@ -80,7 +82,14 @@ function CountMissingSymbols {
$ExtractPath = Join-Path -Path $ExtractPath -ChildPath $PackageGuid
$SymbolsPath = Join-Path -Path $ExtractPath -ChildPath 'Symbols'
- [System.IO.Compression.ZipFile]::ExtractToDirectory($PackagePath, $ExtractPath)
+ try {
+ [System.IO.Compression.ZipFile]::ExtractToDirectory($PackagePath, $ExtractPath)
+ }
+ catch {
+ Write-Host "Something went wrong extracting $PackagePath"
+ Write-Host $_
+ return -1
+ }
Get-ChildItem -Recurse $ExtractPath |
Where-Object {$RelevantExtensions -contains $_.Extension} |
@@ -115,6 +124,10 @@ function CountMissingSymbols {
}
}
+ if ($Clean) {
+ Remove-Item $ExtractPath -Recurse -Force
+ }
+
Pop-Location
return $MissingSymbols
@@ -125,6 +138,8 @@ function CheckSymbolsAvailable {
Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue
}
+ $TotalFailures = 0
+
Get-ChildItem "$InputPath\*.nupkg" |
ForEach-Object {
$FileName = $_.Name
@@ -148,11 +163,22 @@ function CheckSymbolsAvailable {
if ($Status -ne 0) {
Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Missing symbols for $Status modules in the package $FileName"
- ExitWithExitCode $exitCode
+
+ if ($ContinueOnError) {
+ $TotalFailures++
+ }
+ else {
+ ExitWithExitCode 1
+ }
}
Write-Host
}
+
+ if ($TotalFailures -ne 0) {
+ Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Symbols missing for $TotalFailures packages"
+ ExitWithExitCode 1
+ }
}
function InstallDotnetSymbol {
diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1
index 3872af59b97288..f997be4331d224 100644
--- a/eng/common/sdk-task.ps1
+++ b/eng/common/sdk-task.ps1
@@ -57,6 +57,19 @@ try {
ExitWithExitCode 1
}
+ if( $msbuildEngine -eq "vs") {
+ # Ensure desktop MSBuild is available for sdk tasks.
+ if( -not ($GlobalJson.tools.PSObject.Properties.Name -contains "vs" )) {
+ $GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty
+ }
+ if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) {
+ $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "16.5.0-alpha" -MemberType NoteProperty
+ }
+
+ $xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true
+ $global:_MSBuildExe = "$($xcopyMSBuildToolsFolder)\MSBuild\Current\Bin\MSBuild.exe"
+ }
+
$taskProject = GetSdkTaskProject $task
if (!(Test-Path $taskProject)) {
Write-PipelineTelemetryError -Category 'Build' -Message "Unknown task: $task" -ForegroundColor Red
diff --git a/eng/common/sdl/extract-artifact-packages.ps1 b/eng/common/sdl/extract-artifact-packages.ps1
index 9e5f3cb43c7e4e..7f28d9c59ec69c 100644
--- a/eng/common/sdl/extract-artifact-packages.ps1
+++ b/eng/common/sdl/extract-artifact-packages.ps1
@@ -63,7 +63,7 @@ try {
}
}
catch {
- Write-Host $_.ScriptStackTrace
+ Write-Host $_
Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_
ExitWithExitCode 1
}
@@ -74,7 +74,7 @@ try {
Measure-Command { ExtractArtifacts }
}
catch {
- Write-Host $_.ScriptStackTrace
+ Write-Host $_
Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_
ExitWithExitCode 1
}
diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1
index 1a91bbbc5a9a9c..a68bf0b88ea681 100644
--- a/eng/common/sdl/init-sdl.ps1
+++ b/eng/common/sdl/init-sdl.ps1
@@ -24,7 +24,7 @@ $ProgressPreference = 'SilentlyContinue'
# Construct basic auth from AzDO access token; construct URI to the repository's gdn folder stored in that repository; construct location of zip file
$encodedPat = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$AzureDevOpsAccessToken"))
$escapedRepository = [Uri]::EscapeDataString("/$Repository/$BranchName/.gdn")
-$uri = "https://dev.azure.com/dnceng/internal/_apis/git/repositories/sdl-tool-cfg/Items?path=$escapedRepository&versionDescriptor[versionOptions]=0&`$format=zip&api-version=5.0-preview.1"
+$uri = "https://dev.azure.com/dnceng/internal/_apis/git/repositories/sdl-tool-cfg/Items?path=$escapedRepository&versionDescriptor[versionOptions]=0&`$format=zip&api-version=5.0"
$zipFile = "$WorkingDirectory/gdn.zip"
Add-Type -AssemblyName System.IO.Compression.FileSystem
diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config
index 256ffbfb93a306..968b39bef5f193 100644
--- a/eng/common/sdl/packages.config
+++ b/eng/common/sdl/packages.config
@@ -1,4 +1,4 @@
-
+
diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml
index 640f2b04e240f9..c64c4f5686cbfa 100644
--- a/eng/common/templates/job/execute-sdl.yml
+++ b/eng/common/templates/job/execute-sdl.yml
@@ -6,6 +6,7 @@ parameters:
# 'continueOnError', the parameter value is not correctly picked up.
# This can also be remedied by the caller (post-build.yml) if it does not use a nested parameter
sdlContinueOnError: false # optional: determines whether to continue the build if the step errors;
+ downloadArtifacts: true # optional: determines if the artifacts should be dowloaded
dependsOn: '' # Optional: dependencies of the job
artifactNames: '' # Optional: patterns supplied to DownloadBuildArtifacts
# Usage:
@@ -31,8 +32,20 @@ jobs:
steps:
- checkout: self
clean: true
- - ${{ if ne(parameters.artifactNames, '') }}:
- - ${{ each artifactName in parameters.artifactNames }}:
+ - ${{ if ne(parameters.downloadArtifacts, 'false')}}:
+ - ${{ if ne(parameters.artifactNames, '') }}:
+ - ${{ each artifactName in parameters.artifactNames }}:
+ - task: DownloadBuildArtifacts@0
+ displayName: Download Build Artifacts
+ inputs:
+ buildType: specific
+ buildVersionToDownload: specific
+ project: $(AzDOProjectName)
+ pipeline: $(AzDOPipelineId)
+ buildId: $(AzDOBuildId)
+ artifactName: ${{ artifactName }}
+ downloadPath: $(Build.ArtifactStagingDirectory)\artifacts
+ - ${{ if eq(parameters.artifactNames, '') }}:
- task: DownloadBuildArtifacts@0
displayName: Download Build Artifacts
inputs:
@@ -41,20 +54,9 @@ jobs:
project: $(AzDOProjectName)
pipeline: $(AzDOPipelineId)
buildId: $(AzDOBuildId)
- artifactName: ${{ artifactName }}
+ downloadType: specific files
+ itemPattern: "**"
downloadPath: $(Build.ArtifactStagingDirectory)\artifacts
- - ${{ if eq(parameters.artifactNames, '') }}:
- - task: DownloadBuildArtifacts@0
- displayName: Download Build Artifacts
- inputs:
- buildType: specific
- buildVersionToDownload: specific
- project: $(AzDOProjectName)
- pipeline: $(AzDOPipelineId)
- buildId: $(AzDOBuildId)
- downloadType: specific files
- itemPattern: "**"
- downloadPath: $(Build.ArtifactStagingDirectory)\artifacts
- powershell: eng/common/sdl/extract-artifact-packages.ps1
-InputPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts
-ExtractPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts
@@ -81,7 +83,7 @@ jobs:
continueOnError: ${{ parameters.sdlContinueOnError }}
- ${{ if eq(parameters.overrideParameters, '') }}:
- powershell: eng/common/sdl/execute-all-sdl-tools.ps1
- -GuardianPackageName Microsoft.Guardian.Cli.0.7.2
+ -GuardianPackageName Microsoft.Guardian.Cli.win10-x64.0.20.1
-NugetPackageDirectory $(Build.SourcesDirectory)\.packages
-AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw)
${{ parameters.additionalParameters }}
diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml
index 536c15c4641c18..fc39647f4b1d0f 100644
--- a/eng/common/templates/job/job.yml
+++ b/eng/common/templates/job/job.yml
@@ -24,6 +24,7 @@ parameters:
enablePublishBuildAssets: false
enablePublishTestResults: false
enablePublishUsingPipelines: false
+ useBuildManifest: false
mergeTestResults: false
testRunTitle: $(AgentOsName)-$(BuildConfiguration)-xunit
name: ''
@@ -218,3 +219,12 @@ jobs:
ArtifactName: AssetManifests
continueOnError: ${{ parameters.continueOnError }}
condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true'))
+
+ - ${{ if eq(parameters.useBuildManifest, true) }}:
+ - task: PublishBuildArtifacts@1
+ displayName: Publish Build Manifest
+ inputs:
+ PathToPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/manifest.props'
+ PublishLocation: Container
+ ArtifactName: BuildManifests
+ continueOnError: ${{ parameters.continueOnError }}
diff --git a/eng/common/templates/post-build/channels/generic-internal-channel.yml b/eng/common/templates/post-build/channels/generic-internal-channel.yml
index dde27800c3f268..258ba4b7706d96 100644
--- a/eng/common/templates/post-build/channels/generic-internal-channel.yml
+++ b/eng/common/templates/post-build/channels/generic-internal-channel.yml
@@ -23,7 +23,7 @@ stages:
- job: publish_symbols
displayName: Symbol Publishing
dependsOn: setupMaestroVars
- condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }}))
+ condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'], format('[{0}]', ${{ parameters.channelId }} ))
variables:
- group: DotNet-Symbol-Server-Pats
- name: AzDOProjectName
@@ -96,7 +96,7 @@ stages:
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
- name: AzDOBuildId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
- condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }}))
+ condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'], format('[{0}]', ${{ parameters.channelId }} ))
pool:
vmImage: 'windows-2019'
steps:
diff --git a/eng/common/templates/post-build/channels/generic-public-channel.yml b/eng/common/templates/post-build/channels/generic-public-channel.yml
index 08853ec45e0c1f..bf98d990e88ef7 100644
--- a/eng/common/templates/post-build/channels/generic-public-channel.yml
+++ b/eng/common/templates/post-build/channels/generic-public-channel.yml
@@ -25,7 +25,7 @@ stages:
- job: publish_symbols
displayName: Symbol Publishing
dependsOn: setupMaestroVars
- condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }}))
+ condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'], format('[{0}]', ${{ parameters.channelId }} ))
variables:
- group: DotNet-Symbol-Server-Pats
- name: AzDOProjectName
@@ -99,7 +99,7 @@ stages:
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
- name: ArtifactsCategory
value: ${{ coalesce(variables._DotNetArtifactsCategory, '.NETCore') }}
- condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }}))
+ condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'], format('[{0}]', ${{ parameters.channelId }} ))
pool:
vmImage: 'windows-2019'
steps:
diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml
index 867f37cd875885..c99fd7503767cd 100644
--- a/eng/common/templates/post-build/common-variables.yml
+++ b/eng/common/templates/post-build/common-variables.yml
@@ -63,7 +63,7 @@ variables:
- name: MaestroApiAccessToken
value: $(MaestroAccessToken)
- name: MaestroApiVersion
- value: "2019-01-16"
+ value: "2020-02-20"
- name: SourceLinkCLIVersion
value: 3.0.0
diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml
index fbab4cb5dce058..b51bc5375ecf0d 100644
--- a/eng/common/templates/post-build/post-build.yml
+++ b/eng/common/templates/post-build/post-build.yml
@@ -9,12 +9,14 @@ parameters:
continueOnError: false
params: ''
artifactNames: ''
+ downloadArtifacts: true
# These parameters let the user customize the call to sdk-task.ps1 for publishing
# symbols & general artifacts as well as for signing validation
symbolPublishingAdditionalParameters: ''
artifactsPublishingAdditionalParameters: ''
signingValidationAdditionalParameters: ''
+ useBuildManifest: false
# Which stages should finish execution before post-build stages start
validateDependsOn:
@@ -35,10 +37,13 @@ parameters:
NETCoreExperimentalChannelId: 562
NetEngServicesIntChannelId: 678
NetEngServicesProdChannelId: 679
- Net5Preview2ChannelId: 738
Net5Preview3ChannelId: 739
+ Net5Preview4ChannelId: 856
+ Net5Preview5ChannelId: 857
NetCoreSDK313xxChannelId: 759
NetCoreSDK313xxInternalChannelId: 760
+ NetCoreSDK314xxChannelId: 921
+ NetCoreSDK314xxInternalChannelId: 922
stages:
- stage: Validate
@@ -53,10 +58,8 @@ stages:
displayName: Post-build Checks
dependsOn: setupMaestroVars
variables:
- - name: InitialChannels
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'] ]
- - name: PromoteToMaestroChannelId
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'] ]
+ - name: TargetChannels
+ value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'] ]
pool:
vmImage: 'windows-2019'
steps:
@@ -64,8 +67,8 @@ stages:
displayName: Maestro Channels Consistency
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1
- arguments: -PromoteToChannels "$(InitialChannels)[$(PromoteToMaestroChannelId)]"
- -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview2ChannelId}},${{parameters.Net5Preview3ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}}
+ arguments: -PromoteToChannels "$(TargetChannels)"
+ -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview3ChannelId}},${{parameters.Net5Preview4ChannelId}},${{parameters.Net5Preview5ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}}
- job:
displayName: NuGet Validation
@@ -113,6 +116,16 @@ stages:
pool:
vmImage: 'windows-2019'
steps:
+ - ${{ if eq(parameters.useBuildManifest, true) }}:
+ - task: DownloadBuildArtifacts@0
+ displayName: Download build manifest
+ inputs:
+ buildType: specific
+ buildVersionToDownload: specific
+ project: $(AzDOProjectName)
+ pipeline: $(AzDOPipelineId)
+ buildId: $(AzDOBuildId)
+ artifactName: BuildManifests
- task: DownloadBuildArtifacts@0
displayName: Download Package Artifacts
inputs:
@@ -135,11 +148,13 @@ stages:
filePath: eng\common\enable-cross-org-publishing.ps1
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
+ # Signing validation will optionally work with the buildmanifest file which is downloaded from
+ # Azure DevOps above.
- task: PowerShell@2
displayName: Validate
inputs:
filePath: eng\common\sdk-task.ps1
- arguments: -task SigningValidation -restore -msbuildEngine dotnet
+ arguments: -task SigningValidation -restore -msbuildEngine vs
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts'
/p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt'
${{ parameters.signingValidationAdditionalParameters }}
@@ -192,6 +207,7 @@ stages:
additionalParameters: ${{ parameters.SDLValidationParameters.params }}
continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }}
artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }}
+ downloadArtifacts: ${{ parameters.SDLValidationParameters.downloadArtifacts }}
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
parameters:
@@ -213,10 +229,10 @@ stages:
dependsOn: ${{ parameters.publishDependsOn }}
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'Net5_Preview2_Publish'
- channelName: '.NET 5 Preview 2'
- akaMSChannelName: 'net5/preview2'
- channelId: ${{ parameters.Net5Preview2ChannelId }}
+ stageName: 'Net5_Preview3_Publish'
+ channelName: '.NET 5 Preview 3'
+ akaMSChannelName: 'net5/preview3'
+ channelId: ${{ parameters.Net5Preview3ChannelId }}
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json'
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json'
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json'
@@ -227,10 +243,24 @@ stages:
dependsOn: ${{ parameters.publishDependsOn }}
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'Net5_Preview3_Publish'
- channelName: '.NET 5 Preview 3'
- akaMSChannelName: 'net5/preview3'
- channelId: ${{ parameters.Net5Preview3ChannelId }}
+ stageName: 'Net5_Preview4_Publish'
+ channelName: '.NET 5 Preview 4'
+ akaMSChannelName: 'net5/preview4'
+ channelId: ${{ parameters.Net5Preview4ChannelId }}
+ transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json'
+ shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json'
+ symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json'
+
+- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
+ parameters:
+ artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
+ dependsOn: ${{ parameters.publishDependsOn }}
+ publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
+ symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
+ stageName: 'Net5_Preview5_Publish'
+ channelName: '.NET 5 Preview 5'
+ akaMSChannelName: 'net5/preview5'
+ channelId: ${{ parameters.Net5Preview5ChannelId }}
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json'
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json'
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json'
@@ -355,6 +385,32 @@ stages:
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json'
+- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
+ parameters:
+ artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
+ dependsOn: ${{ parameters.publishDependsOn }}
+ publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
+ symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
+ stageName: 'NETCore_SDK_314xx_Publishing'
+ channelName: '.NET Core SDK 3.1.4xx'
+ channelId: ${{ parameters.NetCoreSDK314xxChannelId }}
+ transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json'
+ shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json'
+ symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json'
+
+- template: \eng\common\templates\post-build\channels\generic-internal-channel.yml
+ parameters:
+ artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
+ dependsOn: ${{ parameters.publishDependsOn }}
+ publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
+ symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
+ stageName: 'NETCore_SDK_314xx_Internal_Publishing'
+ channelName: '.NET Core SDK 3.1.4xx Internal'
+ channelId: ${{ parameters.NetCoreSDK314xxInternalChannelId }}
+ transportFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v3/index.json'
+ shippingFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v3/index.json'
+ symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-symbols/nuget/v3/index.json'
+
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
parameters:
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml
index 05e611edb68a2b..b3d29d4498e36a 100644
--- a/eng/common/templates/post-build/setup-maestro-vars.yml
+++ b/eng/common/templates/post-build/setup-maestro-vars.yml
@@ -5,7 +5,9 @@ jobs:
- template: common-variables.yml
- name: BuildId
value: $[ coalesce(variables.BARBuildId, 0) ]
- - name: PromoteToChannelId
+ - name: PromoteToMaestroChannels
+ value: $[ coalesce(variables.PromoteToChannelIds, 0) ]
+ - name: PromoteToMaestroChannel
value: $[ coalesce(variables.PromoteToMaestroChannelId, 0) ]
pool:
vmImage: 'windows-2019'
@@ -14,7 +16,7 @@ jobs:
- task: DownloadBuildArtifacts@0
displayName: Download Release Configs
- condition: eq(variables.PromoteToChannelId, 0)
+ condition: and(eq(variables.PromoteToMaestroChannels, 0), eq(variables.PromoteToMaestroChannel, 0))
inputs:
buildType: current
artifactName: ReleaseConfigs
@@ -26,20 +28,16 @@ jobs:
targetType: inline
script: |
try {
- if ($Env:PromoteToChannelId -eq 0) {
+ if ($Env:PromoteToMaestroChannels -eq 0 -and $Env:PromoteToMaestroChannel -eq 0) {
$Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt
$BarId = $Content | Select -Index 0
-
- $Channels = ""
- $Content | Select -Index 1 | ForEach-Object { $Channels += "$_ ," }
-
+ $Channels = $Content | Select -Index 1
$IsStableBuild = $Content | Select -Index 2
$AzureDevOpsProject = $Env:System_TeamProject
$AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId
$AzureDevOpsBuildId = $Env:Build_BuildId
- $PromoteToMaestroChannelId = 0
}
else {
$buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}"
@@ -51,25 +49,23 @@ jobs:
$buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" }
$BarId = $Env:BARBuildId
- $Channels = 'None'
-
- #TODO: Fix this once this issue is done: https://github.com/dotnet/arcade/issues/3834
- $IsStableBuild = 'False'
+ $Channels = $Env:PromoteToMaestroChannels -split ","
+ $Channels = $Channels -join "]["
+ $Channels = "[$Channels][$Env:PromoteToMaestroChannel]"
+ $IsStableBuild = $buildInfo.stable
$AzureDevOpsProject = $buildInfo.azureDevOpsProject
$AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId
$AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId
- $PromoteToMaestroChannelId = $Env:PromoteToMaestroChannelId
}
Write-Host "##vso[task.setvariable variable=BARBuildId;isOutput=true]$BarId"
- Write-Host "##vso[task.setvariable variable=InitialChannels;isOutput=true]$Channels"
+ Write-Host "##vso[task.setvariable variable=TargetChannels;isOutput=true]$Channels"
Write-Host "##vso[task.setvariable variable=IsStableBuild;isOutput=true]$IsStableBuild"
Write-Host "##vso[task.setvariable variable=AzDOProjectName;isOutput=true]$AzureDevOpsProject"
Write-Host "##vso[task.setvariable variable=AzDOPipelineId;isOutput=true]$AzureDevOpsBuildDefinitionId"
Write-Host "##vso[task.setvariable variable=AzDOBuildId;isOutput=true]$AzureDevOpsBuildId"
- Write-Host "##vso[task.setvariable variable=PromoteToMaestroChannelId;isOutput=true]$PromoteToMaestroChannelId"
}
catch {
Write-Host $_
diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml
index 30becf01ea55a8..5eceb48725dcf5 100644
--- a/eng/common/templates/steps/send-to-helix.yml
+++ b/eng/common/templates/steps/send-to-helix.yml
@@ -10,7 +10,7 @@ parameters:
HelixPostCommands: '' # optional -- commands to run after Helix work item execution
WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects
WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects
- WorkItemTimeout: '' # optional -- a timeout in seconds for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects
+ WorkItemTimeout: '' # optional -- a timeout in TimeSpan.Parse-ready value (e.g. 00:02:00) for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects
CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload
XUnitProjects: '' # optional -- semicolon delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true
XUnitWorkItemTimeout: '' # optional -- the workitem timeout in seconds for all workitems created from the xUnit projects specified by XUnitProjects
@@ -18,8 +18,8 @@ parameters:
XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner
XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects
IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion
- DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json
- DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json
+ DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json
+ DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json
EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control
WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget."
IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set
diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1
index 60c1cd89758721..d8dfc5e00498ce 100644
--- a/eng/common/tools.ps1
+++ b/eng/common/tools.ps1
@@ -7,9 +7,11 @@
# Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names.
[string]$configuration = if (Test-Path variable:configuration) { $configuration } else { 'Debug' }
+# Set to true to opt out of outputting binary log while running in CI
+[bool]$excludeCIBinarylog = if (Test-Path variable:excludeCIBinarylog) { $excludeCIBinarylog } else { $false }
+
# Set to true to output binary log from msbuild. Note that emitting binary log slows down the build.
-# Binary log must be enabled on CI.
-[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci }
+[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci -and !$excludeCIBinarylog }
# Set to true to use the pipelines logger which will enable Azure logging output.
# https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md
@@ -55,10 +57,8 @@ set-strictmode -version 2.0
$ErrorActionPreference = 'Stop'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
-function Create-Directory([string[]] $path) {
- if (!(Test-Path $path)) {
- New-Item -path $path -force -itemType 'Directory' | Out-Null
- }
+function Create-Directory ([string[]] $path) {
+ New-Item -Path $path -Force -ItemType 'Directory' | Out-Null
}
function Unzip([string]$zipfile, [string]$outpath) {
@@ -488,10 +488,11 @@ function GetNuGetPackageCachePath() {
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.
+ # For directory normalization, see also: https://github.com/NuGet/Home/issues/7968
if ($useGlobalNuGetCache) {
- $env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages'
+ $env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\'
} else {
- $env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages'
+ $env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages\'
}
}
@@ -546,7 +547,7 @@ function InitializeToolset() {
MSBuild-Core $proj $bl /t:__WriteToolsetLocation /clp:ErrorsOnly`;NoSummary /p:__ToolsetLocationOutputFile=$toolsetLocationFile
- $path = Get-Content $toolsetLocationFile -TotalCount 1
+ $path = Get-Content $toolsetLocationFile -Encoding UTF8 -TotalCount 1
if (!(Test-Path $path)) {
throw "Invalid toolset path: $path"
}
@@ -604,8 +605,8 @@ function MSBuild() {
#
function MSBuild-Core() {
if ($ci) {
- if (!$binaryLog) {
- Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build.'
+ if (!$binaryLog -and !$excludeCIBinarylog) {
+ Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build, or explicitly opted-out from with the -excludeCIBinarylog switch.'
ExitWithExitCode 1
}
@@ -632,6 +633,8 @@ function MSBuild-Core() {
}
}
+ $env:ARCADE_BUILD_TOOL_COMMAND = "$($buildTool.Path) $cmdArgs"
+
$exitCode = Exec-Process $buildTool.Path $cmdArgs
if ($exitCode -ne 0) {
diff --git a/eng/common/tools.sh b/eng/common/tools.sh
index caae1dbdb273c5..e94fce22ec37ba 100755
--- a/eng/common/tools.sh
+++ b/eng/common/tools.sh
@@ -18,9 +18,17 @@ fi
# Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names.
configuration=${configuration:-'Debug'}
+# Set to true to opt out of outputting binary log while running in CI
+exclude_ci_binary_log=${exclude_ci_binary_log:-false}
+
+if [[ "$ci" == true && "$exclude_ci_binary_log" == false ]]; then
+ binary_log_default=true
+else
+ binary_log_default=false
+fi
+
# Set to true to output binary log from msbuild. Note that emitting binary log slows down the build.
-# Binary log must be enabled on CI.
-binary_log=${binary_log:-$ci}
+binary_log=${binary_log:-$binary_log_default}
# Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes).
prepare_machine=${prepare_machine:-false}
@@ -201,7 +209,14 @@ function InstallDotNet {
local runtimeSourceFeedKey=''
if [[ -n "${7:-}" ]]; then
- decodedFeedKey=`echo $7 | base64 --decode`
+ # The 'base64' binary on alpine uses '-d' and doesn't support '--decode'
+ # '-d'. To work around this, do a simple detection and switch the parameter
+ # accordingly.
+ decodeArg="--decode"
+ if base64 --help 2>&1 | grep -q "BusyBox"; then
+ decodeArg="-d"
+ fi
+ decodedFeedKey=`echo $7 | base64 $decodeArg`
runtimeSourceFeedKey="--feed-credential $decodedFeedKey"
fi
@@ -397,8 +412,8 @@ function MSBuild {
function MSBuild-Core {
if [[ "$ci" == true ]]; then
- if [[ "$binary_log" != true ]]; then
- Write-PipelineTelemetryError -category 'Build' "Binary log must be enabled in CI build."
+ if [[ "$binary_log" != true && "$exclude_ci_binary_log" != true ]]; then
+ Write-PipelineTelemetryError -category 'Build' "Binary log must be enabled in CI build, or explicitly opted-out from with the -noBinaryLog switch."
ExitWithExitCode 1
fi
@@ -415,11 +430,17 @@ function MSBuild-Core {
warnaserror_switch="/warnaserror"
fi
- "$_InitializeBuildTool" "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" || {
- local exit_code=$?
- Write-PipelineTelemetryError -category 'Build' "Build failed (exit code '$exit_code')."
- ExitWithExitCode $exit_code
+ function RunBuildTool {
+ export ARCADE_BUILD_TOOL_COMMAND="$_InitializeBuildTool $@"
+
+ "$_InitializeBuildTool" "$@" || {
+ local exit_code=$?
+ Write-PipelineTaskError "Build failed (exit code '$exit_code')."
+ ExitWithExitCode $exit_code
+ }
}
+
+ RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@"
}
ResolvePath "${BASH_SOURCE[0]}"
diff --git a/eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile b/eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile
index f352d29cac70c0..422e8e19601558 100644
--- a/eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile
+++ b/eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile
@@ -14,7 +14,7 @@ RUN ./src/coreclr/build.sh -release -skiptests -clang9 && \
FROM $SDK_BASE_IMAGE as target
ARG TESTHOST_LOCATION=/repo/artifacts/bin/testhost
-ARG TFM=netcoreapp5.0
+ARG TFM=net5.0
ARG OS=Linux
ARG ARCH=x64
ARG CONFIGURATION=Release
diff --git a/eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile b/eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile
index 59aa7f034f71f0..81c13817d11d91 100644
--- a/eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile
+++ b/eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile
@@ -4,7 +4,7 @@ ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/core/sdk:3.0.100-nanoserver-1809
FROM $SDK_BASE_IMAGE as target
ARG TESTHOST_LOCATION=".\\artifacts\\bin\\testhost"
-ARG TFM=netcoreapp5.0
+ARG TFM=net5.0
ARG OS=Windows_NT
ARG ARCH=x64
ARG CONFIGURATION=Release
diff --git a/eng/docker/libraries-sdk.linux.Dockerfile b/eng/docker/libraries-sdk.linux.Dockerfile
index bbfaef49a39d12..8a4abed0b09509 100644
--- a/eng/docker/libraries-sdk.linux.Dockerfile
+++ b/eng/docker/libraries-sdk.linux.Dockerfile
@@ -13,7 +13,7 @@ RUN ./build.sh -ci -subset clr+libs -runtimeconfiguration release -c $CONFIGURAT
FROM $SDK_BASE_IMAGE as target
ARG TESTHOST_LOCATION=/repo/artifacts/bin/testhost
-ARG TFM=netcoreapp5.0
+ARG TFM=net5.0
ARG OS=Linux
ARG ARCH=x64
ARG CONFIGURATION=Release
diff --git a/eng/docker/libraries-sdk.windows.Dockerfile b/eng/docker/libraries-sdk.windows.Dockerfile
index 5954ae39a0c003..b6393424aad23a 100644
--- a/eng/docker/libraries-sdk.windows.Dockerfile
+++ b/eng/docker/libraries-sdk.windows.Dockerfile
@@ -4,7 +4,7 @@ ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/core/sdk:3.0.100-nanoserver-1809
FROM $SDK_BASE_IMAGE as target
ARG TESTHOST_LOCATION=".\\artifacts\\bin\\testhost"
-ARG TFM=netcoreapp5.0
+ARG TFM=net5.0
ARG OS=Windows_NT
ARG ARCH=x64
ARG CONFIGURATION=Release
diff --git a/eng/empty.csproj b/eng/empty.csproj
index 0bd280da02f353..6edde5507fcdaa 100644
--- a/eng/empty.csproj
+++ b/eng/empty.csproj
@@ -12,4 +12,6 @@
netcoreapp2.0
+
+
diff --git a/eng/illink.targets b/eng/illink.targets
index cecc5c2a5a3699..6ac5e9ac2a1ee0 100644
--- a/eng/illink.targets
+++ b/eng/illink.targets
@@ -8,8 +8,8 @@
-
- $([MSBuild]::NormalizeDirectory('$(PkgILLink_Tasks)', 'tools'))
+ $([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NET_ILLink_Tasks)', 'tools'))$(ILLinkTasksDir)netcoreapp3.0/ILLink.Tasks.dll$(ILLinkTasksDir)$(NetFrameworkCurrent)/ILLink.Tasks.dll$(IntermediateOutputPath)$(TargetName)$(TargetExt)
@@ -29,6 +29,8 @@
$(IntermediateOutputPath)$(MSBuildProjectDirectory)/ILLinkTrim.xml
+
+ $(MSBuildProjectDirectory)/ILLinkTrim_LibraryBuild.xmltrue
@@ -40,6 +42,10 @@
+
+
+
+
@@ -87,7 +93,9 @@
$(ILLinkArgs) -v true
- $(ILLinkArgs) --strip-resources false
+ $(ILLinkArgs) --strip-descriptors false
+
+ $(ILLinkArgs) -x "$(ILLinkTrimXmlLibraryBuild)"$(ILLinkArgs) --skip-unresolved true
diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh
old mode 100644
new mode 100755
index 9670ae590314cd..00be5a6287289f
--- a/eng/install-native-dependencies.sh
+++ b/eng/install-native-dependencies.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/usr/bin/env bash
if [ "$1" = "Linux" ]; then
sudo apt update
@@ -9,37 +9,9 @@ if [ "$1" = "Linux" ]; then
if [ "$?" != "0" ]; then
exit 1;
fi
-elif [ "$1" = "OSX" ]; then
- brew update
- brew upgrade
- if [ "$?" != "0" ]; then
- exit 1;
- fi
- brew install icu4c openssl autoconf automake libtool pkg-config python3
- if [ "$?" != "0" ]; then
- exit 1;
- fi
- brew link --force icu4c
- if [ "$?" != "0" ]; then
- exit 1;
- fi
-elif [ "$1" = "tvOS" ]; then
- brew update
- brew upgrade
- if [ "$?" != "0" ]; then
- exit 1;
- fi
- brew install openssl autoconf automake libtool pkg-config python3
- if [ "$?" != "0" ]; then
- exit 1;
- fi
-elif [ "$1" = "iOS" ]; then
- brew update
- brew upgrade
- if [ "$?" != "0" ]; then
- exit 1;
- fi
- brew install openssl autoconf automake libtool pkg-config python3
+elif [ "$1" = "OSX" ] || [ "$1" = "tvOS" ] || [ "$1" = "iOS" ]; then
+ engdir=$(dirname "${BASH_SOURCE[0]}")
+ brew bundle --no-lock --file "${engdir}/Brewfile"
if [ "$?" != "0" ]; then
exit 1;
fi
diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets
index e01739925eb8ea..42cae8568797aa 100644
--- a/eng/liveBuilds.targets
+++ b/eng/liveBuilds.targets
@@ -76,11 +76,12 @@
x64x86x64
+ x64
-
-
+
+ $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)'))
@@ -133,18 +134,18 @@
true
-
-
-
+
-
-
+
+
-
-
-
+
+
+
+
+
-
-
+
+
diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh
index a1a975ce177348..c231a01d429570 100755
--- a/eng/native/build-commons.sh
+++ b/eng/native/build-commons.sh
@@ -53,10 +53,23 @@ check_prereqs()
function version { echo "$@" | awk -F. '{ printf("%d%02d%02d\n", $1,$2,$3); }'; }
- local cmake_version="$(cmake --version | awk '/^cmake version [0-9]+\.[0-9]+\.[0-9]+$/ {print $3}')"
+ local cmake_version="$(cmake --version | awk '/^cmake.* version [0-9]+\.[0-9]+\.[0-9]+$/ {print $3}')"
if [[ "$(version "$cmake_version")" -lt "$(version 3.14.2)" ]]; then
- echo "Please install CMake 3.14.2 or newer from http://www.cmake.org/download/ or https://apt.kitware.com and ensure it is on your path."; exit 1;
+ echo "Please install CMake 3.14.2 or newer from https://cmake.org/download/ or https://apt.kitware.com and ensure it is on your path."; exit 1;
+ fi
+
+ if [[ "$__HostOS" == "OSX" ]]; then
+ # Check presence of pkg-config on the path
+ command -v pkg-config 2>/dev/null || { echo >&2 "Please install pkg-config before running this script, see https://github.com/dotnet/runtime/blob/master/docs/workflow/requirements/macos-requirements.md"; exit 1; }
+
+ if ! pkg-config openssl ; then
+ # We export the proper PKG_CONFIG_PATH where openssl was installed by Homebrew
+ # It's important to _export_ it since build-commons.sh is sourced by other scripts such as build-native.sh
+ export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
+ # We try again with the PKG_CONFIG_PATH in place, if pkg-config still can't find OpenSSL, exit with an error, cmake won't find OpenSSL either
+ pkg-config openssl || { echo >&2 "Please install openssl before running this script, see https://github.com/dotnet/runtime/blob/master/docs/workflow/requirements/macos-requirements.md"; exit 1; }
+ fi
fi
if [[ "$__UseNinja" == 1 ]]; then
@@ -82,6 +95,7 @@ build_native()
buildTool="make"
fi
+ runtimeVersionHeaderFile="$intermediatesDir/../runtime_version.h"
if [[ "$__SkipConfigure" == 0 ]]; then
# if msbuild is not supported, then set __SkipGenerateVersion to 1
if [[ "$__IsMSBuildOnNETCoreSupported" == 0 ]]; then __SkipGenerateVersion=1; fi
@@ -95,7 +109,8 @@ build_native()
if [[ "$__SkipGenerateVersion" == 0 ]]; then
"$__RepoRootDir/eng/common/msbuild.sh" /clp:nosummary "$__ArcadeScriptArgs" "$__RepoRootDir"/eng/empty.csproj \
/p:NativeVersionFile="$__versionSourceFile" \
- /t:GenerateNativeVersionFile /restore \
+ /p:RuntimeVersionFile="$runtimeVersionHeaderFile" \
+ /t:GenerateRuntimeVersionFile /restore \
$__CommonMSBuildArgs $__binlogArg $__UnprocessedBuildArgs
local exit_code="$?"
if [[ "$exit_code" != 0 ]]; then
@@ -103,12 +118,24 @@ build_native()
exit "$exit_code"
fi
else
- # Generate the dummy version.c, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
+ # Generate the dummy version.c and runtime_version.h, but only if they didn't exist to make sure we don't trigger unnecessary rebuild
__versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
if [[ -e "$__versionSourceFile" ]]; then
read existingVersionSourceLine < "$__versionSourceFile"
fi
if [[ "$__versionSourceLine" != "$existingVersionSourceLine" ]]; then
+ cat << EOF > $runtimeVersionHeaderFile
+#define RuntimeAssemblyMajorVersion 0
+#define RuntimeAssemblyMinorVersion 0
+#define RuntimeFileMajorVersion 0
+#define RuntimeFileMinorVersion 0
+#define RuntimeFileBuildVersion 0
+#define RuntimeFileRevisionVersion 0
+#define RuntimeProductMajorVersion 0
+#define RuntimeProductMinorVersion 0
+#define RuntimeProductPatchVersion 0
+#define RuntimeProductVersion
+EOF
echo "$__versionSourceLine" > "$__versionSourceFile"
fi
fi
@@ -382,7 +409,7 @@ done
# Get the number of processors available to the scheduler
# Other techniques such as `nproc` only get the number of
# processors available to a single process.
-platform=$(uname)
+platform="$(uname)"
if [[ "$platform" == "FreeBSD" ]]; then
__NumProc=$(sysctl hw.ncpu | awk '{ print $2+1 }')
elif [[ "$platform" == "NetBSD" || "$platform" == "SunOS" ]]; then
diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake
index 2937916ced91b2..a6e6ba45808d2c 100644
--- a/eng/native/configurecompiler.cmake
+++ b/eng/native/configurecompiler.cmake
@@ -183,10 +183,10 @@ elseif(CLR_CMAKE_HOST_FREEBSD)
add_compile_options($<$:-Wa,--noexecstack>)
add_link_options(LINKER:--build-id=sha1)
elseif(CLR_CMAKE_HOST_SUNOS)
- set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} /opt/local/include)
- set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /opt/local/lib)
+ add_compile_options($<$:-Wa,--noexecstack>)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector")
+ add_definitions(-D__EXTENSIONS__)
endif()
#------------------------------------
@@ -227,15 +227,13 @@ if (CLR_CMAKE_HOST_UNIX)
if(CLR_CMAKE_HOST_OSX)
message("Detected OSX x86_64")
- endif(CLR_CMAKE_HOST_OSX)
-
- if(CLR_CMAKE_HOST_FREEBSD)
+ elseif(CLR_CMAKE_HOST_FREEBSD)
message("Detected FreeBSD amd64")
- endif(CLR_CMAKE_HOST_FREEBSD)
-
- if(CLR_CMAKE_HOST_NETBSD)
+ elseif(CLR_CMAKE_HOST_NETBSD)
message("Detected NetBSD amd64")
- endif(CLR_CMAKE_HOST_NETBSD)
+ elseif(CLR_CMAKE_HOST_SUNOS)
+ message("Detected SunOS amd64")
+ endif(CLR_CMAKE_HOST_OSX)
endif(CLR_CMAKE_HOST_UNIX)
if (CLR_CMAKE_HOST_WIN32)
@@ -367,17 +365,15 @@ if(CLR_CMAKE_TARGET_UNIX)
add_definitions(-DDISABLE_CONTRACTS)
if(CLR_CMAKE_TARGET_OSX)
add_definitions(-DTARGET_OSX)
- endif(CLR_CMAKE_TARGET_OSX)
- if(CLR_CMAKE_TARGET_FREEBSD)
+ elseif(CLR_CMAKE_TARGET_FREEBSD)
add_definitions(-DTARGET_FREEBSD)
- endif(CLR_CMAKE_TARGET_FREEBSD)
- if(CLR_CMAKE_TARGET_LINUX)
+ elseif(CLR_CMAKE_TARGET_LINUX)
add_definitions(-DTARGET_LINUX)
- endif(CLR_CMAKE_TARGET_LINUX)
- if(CLR_CMAKE_TARGET_NETBSD)
+ elseif(CLR_CMAKE_TARGET_NETBSD)
add_definitions(-DTARGET_NETBSD)
- endif(CLR_CMAKE_TARGET_NETBSD)
- if(CLR_CMAKE_TARGET_ANDROID)
+ elseif(CLR_CMAKE_TARGET_SUNOS)
+ add_definitions(-DTARGET_SUNOS)
+ elseif(CLR_CMAKE_TARGET_ANDROID)
add_definitions(-DTARGET_ANDROID)
endif()
else(CLR_CMAKE_TARGET_UNIX)
diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake
index 1c5254d84965a8..04fdfaed45a99d 100644
--- a/eng/native/configureplatform.cmake
+++ b/eng/native/configureplatform.cmake
@@ -88,6 +88,8 @@ if(CLR_CMAKE_HOST_OS STREQUAL iOS)
set(CLR_CMAKE_HOST_IOS 1)
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
+ elseif(CMAKE_OSX_ARCHITECTURES MATCHES "i386")
+ set(CLR_CMAKE_HOST_UNIX_X86 1)
elseif(CMAKE_OSX_ARCHITECTURES MATCHES "armv7")
set(CLR_CMAKE_HOST_UNIX_ARM 1)
elseif(CMAKE_OSX_ARCHITECTURES MATCHES "arm64")
@@ -168,6 +170,7 @@ endif(CLR_CMAKE_HOST_OS STREQUAL Windows)
if(CLR_CMAKE_HOST_OS STREQUAL Emscripten)
#set(CLR_CMAKE_HOST_UNIX 1) # TODO: this should be reenabled but it activates a bunch of additional compiler flags in configurecompiler.cmake
set(CLR_CMAKE_HOST_UNIX_WASM 1)
+ set(CLR_CMAKE_HOST_BROWSER 1)
endif(CLR_CMAKE_HOST_OS STREQUAL Emscripten)
#--------------------------------------------
@@ -315,7 +318,7 @@ endif(CLR_CMAKE_TARGET_OS STREQUAL SunOS)
if(CLR_CMAKE_TARGET_OS STREQUAL Emscripten)
set(CLR_CMAKE_TARGET_UNIX 1)
set(CLR_CMAKE_TARGET_LINUX 1)
- set(CLR_CMAKE_TARGET_EMSCRIPTEN 1)
+ set(CLR_CMAKE_TARGET_BROWSER 1)
endif(CLR_CMAKE_TARGET_OS STREQUAL Emscripten)
if(CLR_CMAKE_TARGET_UNIX)
@@ -357,7 +360,7 @@ else()
endif()
endif()
-if(NOT CLR_CMAKE_TARGET_EMSCRIPTEN)
+if(NOT CLR_CMAKE_TARGET_BROWSER)
# Skip check_pie_supported call on Android as ld from llvm toolchain with NDK API level 21
# complains about missing linker flag `-no-pie` (while level 28's ld does support this flag,
# but since we know that PIE is supported, we can safely skip this redundant check).
diff --git a/eng/native/configuretools.cmake b/eng/native/configuretools.cmake
index b63ab0f1a66d5a..4fb94531d76987 100644
--- a/eng/native/configuretools.cmake
+++ b/eng/native/configuretools.cmake
@@ -6,7 +6,7 @@ if (CMAKE_C_COMPILER MATCHES "-?[0-9]+(\.[0-9]+)?$")
set(CLR_CMAKE_COMPILER_FILE_NAME_VERSION "${CMAKE_MATCH_0}")
endif()
-if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_ARCH_WASM)
+if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(APPLE)
set(TOOLSET_PREFIX "")
diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake
index 9a5014917ec61c..49b0064499eb42 100644
--- a/eng/native/functions.cmake
+++ b/eng/native/functions.cmake
@@ -175,8 +175,8 @@ function(generate_exports_file)
add_custom_command(
OUTPUT ${outputFilename}
- COMMAND ${AWK} -f ${CMAKE_SOURCE_DIR}/${AWK_SCRIPT} ${INPUT_LIST} >${outputFilename}
- DEPENDS ${INPUT_LIST} ${CMAKE_SOURCE_DIR}/${AWK_SCRIPT}
+ COMMAND ${AWK} -f ${CLR_ENG_NATIVE_DIR}/${AWK_SCRIPT} ${INPUT_LIST} >${outputFilename}
+ DEPENDS ${INPUT_LIST} ${CLR_ENG_NATIVE_DIR}/${AWK_SCRIPT}
COMMENT "Generating exports file ${outputFilename}"
)
set_source_files_properties(${outputFilename}
@@ -196,8 +196,8 @@ function(generate_exports_file_prefix inputFilename outputFilename prefix)
add_custom_command(
OUTPUT ${outputFilename}
- COMMAND ${AWK} -f ${CMAKE_SOURCE_DIR}/${AWK_SCRIPT} ${AWK_VARS} ${inputFilename} >${outputFilename}
- DEPENDS ${inputFilename} ${CMAKE_SOURCE_DIR}/${AWK_SCRIPT}
+ COMMAND ${AWK} -f ${CLR_ENG_NATIVE_DIR}/${AWK_SCRIPT} ${AWK_VARS} ${inputFilename} >${outputFilename}
+ DEPENDS ${inputFilename} ${CLR_ENG_NATIVE_DIR}/${AWK_SCRIPT}
COMMENT "Generating exports file ${outputFilename}"
)
set_source_files_properties(${outputFilename}
@@ -268,13 +268,20 @@ function(strip_symbols targetName outputFilename)
message(FATAL_ERROR "strip not found")
endif()
+ string(TOLOWER "${CMAKE_BUILD_TYPE}" LOWERCASE_CMAKE_BUILD_TYPE)
+ if (LOWERCASE_CMAKE_BUILD_TYPE STREQUAL release)
+ set(strip_command ${STRIP} -S ${strip_source_file})
+ else ()
+ set(strip_command)
+ endif ()
+
add_custom_command(
TARGET ${targetName}
POST_BUILD
VERBATIM
COMMAND ${DSYMUTIL} --flat --minimize ${strip_source_file}
- COMMAND ${STRIP} -S ${strip_source_file}
- COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file}
+ COMMAND ${strip_command}
+ COMMENT "Stripping symbols from ${strip_source_file} into file ${strip_destination_file}"
)
else (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
set(strip_destination_file ${strip_source_file}.dbg)
@@ -286,7 +293,7 @@ function(strip_symbols targetName outputFilename)
COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file}
COMMAND ${CMAKE_OBJCOPY} --strip-debug ${strip_source_file}
COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file}
- COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file}
+ COMMENT "Stripping symbols from ${strip_source_file} into file ${strip_destination_file}"
)
endif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
@@ -338,7 +345,7 @@ function(install_clr)
if (NOT DEFINED CLR_CROSS_COMPONENTS_LIST OR NOT ${INDEX} EQUAL -1)
strip_symbols(${targetName} symbol_file)
- foreach(destination in ${destinations})
+ foreach(destination ${destinations})
# We don't need to install the export libraries for our DLLs
# since they won't be directly linked against.
install(PROGRAMS $ DESTINATION ${destination})
@@ -415,3 +422,28 @@ endfunction()
function(add_executable_clr)
_add_executable(${ARGV})
endfunction()
+
+function(generate_module_index Target ModuleIndexFile)
+ if(CLR_CMAKE_HOST_WIN32)
+ set(scriptExt ".cmd")
+ else()
+ set(scriptExt ".sh")
+ endif()
+
+ add_custom_command(
+ OUTPUT ${ModuleIndexFile}
+ COMMAND ${CLR_ENG_NATIVE_DIR}/genmoduleindex${scriptExt} $ ${ModuleIndexFile}
+ DEPENDS ${Target}
+ COMMENT "Generating ${Target} module index file -> ${ModuleIndexFile}"
+ )
+
+ set_source_files_properties(
+ ${ModuleIndexFile}
+ PROPERTIES GENERATED TRUE
+ )
+
+ add_custom_target(
+ ${Target}_module_index_header
+ DEPENDS ${ModuleIndexFile}
+ )
+endfunction(generate_module_index)
diff --git a/src/coreclr/generateexportedsymbols.awk b/eng/native/generateexportedsymbols.awk
similarity index 100%
rename from src/coreclr/generateexportedsymbols.awk
rename to eng/native/generateexportedsymbols.awk
diff --git a/src/coreclr/generateversionscript.awk b/eng/native/generateversionscript.awk
similarity index 100%
rename from src/coreclr/generateversionscript.awk
rename to eng/native/generateversionscript.awk
diff --git a/eng/native/genmoduleindex.cmd b/eng/native/genmoduleindex.cmd
new file mode 100644
index 00000000000000..a6be851461a695
--- /dev/null
+++ b/eng/native/genmoduleindex.cmd
@@ -0,0 +1,25 @@
+@echo off
+REM Generate module index header
+
+if [%1]==[] goto :Usage
+if [%2]==[] goto :Usage
+
+setlocal
+for /f "tokens=1" %%i in ('dumpbin /HEADERS %1 ^| findstr /c:"size of image"') do set imagesize=%%i
+REM Pad the extracted size to 8 hex digits
+set imagesize=00000000%imagesize%
+set imagesize=%imagesize:~-8%
+
+for /f "tokens=1" %%i in ('dumpbin /HEADERS %1 ^| findstr /c:"time date"') do set timestamp=%%i
+REM Pad the extracted time stamp to 8 hex digits
+set timestamp=00000000%timestamp%
+set timestamp=%timestamp:~-8%
+
+echo 0x08, 0x%timestamp:~6,2%, 0x%timestamp:~4,2%, 0x%timestamp:~2,2%, 0x%timestamp:~0,2%, 0x%imagesize:~6,2%, 0x%imagesize:~4,2%, 0x%imagesize:~2,2%, 0x%imagesize:~0,2%, > %2
+
+endlocal
+exit /b 0
+
+:Usage
+echo Usage: genmoduleindex.cmd ModuleBinaryFile IndexHeaderFile
+exit /b 1
diff --git a/eng/native/genmoduleindex.sh b/eng/native/genmoduleindex.sh
new file mode 100755
index 00000000000000..77ead1cc8bd86b
--- /dev/null
+++ b/eng/native/genmoduleindex.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+#
+# Generate module index header
+#
+set -euo pipefail
+
+if [[ "$#" -lt 2 ]]; then
+ echo "Usage: genmoduleindex.sh ModuleBinaryFile IndexHeaderFile"
+ exit 1
+fi
+
+OSName=$(uname -s)
+
+case "$OSName" in
+Darwin)
+ # Extract the build id and prefix it with its length in bytes
+ dwarfdump -u $1 |
+ awk '/UUID:/ { gsub(/\-/,"", $2); printf("%02x", length($2)/2); print $2}' |
+ # Convert each byte of the id to 0x prefixed constant followed by comma
+ sed -E s/\(\.\.\)/0x\\1,\ /g > $2
+ ;;
+*)
+ # Extract the build id and prefix it with its length in bytes
+ readelf -n $1 |
+ awk '/Build ID:/ { printf("%02x", length($3)/2); print $3 }' |
+ # Convert each byte of the id to 0x prefixed constant followed by comma
+ sed -E s/\(\.\.\)/0x\\1,\ /g > $2
+ ;;
+esac
diff --git a/eng/native/init-distro-rid.sh b/eng/native/init-distro-rid.sh
index 3c875a3e28b96f..22efd8e8b5423f 100644
--- a/eng/native/init-distro-rid.sh
+++ b/eng/native/init-distro-rid.sh
@@ -137,7 +137,7 @@ initDistroRidGlobal()
initNonPortableDistroRid "${targetOs}" "${buildArch}" "${isPortable}" "${rootfsDir}"
if [ "$buildArch" = "wasm" ]; then
- __DistroRid=WebAssembly-wasm
+ __DistroRid=browser-wasm
export __DistroRid
fi
@@ -165,6 +165,8 @@ initDistroRidGlobal()
distroRid="ios-$buildArch"
elif [ "$targetOs" = "Android" ]; then
distroRid="android-$buildArch"
+ elif [ "$targetOs" = "Browser" ]; then
+ distroRid="browser-$buildArch"
elif [ "$targetOs" = "FreeBSD" ]; then
distroRid="freebsd-$buildArch"
elif [ "$targetOs" = "SunOS" ]; then
diff --git a/eng/notSupported.SourceBuild.targets b/eng/notSupported.SourceBuild.targets
index afbbdd32de4047..743c4a3ace00bc 100644
--- a/eng/notSupported.SourceBuild.targets
+++ b/eng/notSupported.SourceBuild.targets
@@ -3,7 +3,11 @@
BeforeTargets="BeforeCompile"
Condition="'$(DotNetBuildFromSource)' == 'true' and
('$(GeneratePlatformNotSupportedAssembly)' == 'true' or '$(GeneratePlatformNotSupportedAssemblyMessage)' != '')">
-
+
+
+ $(IntermediateOutputPath)
+
+
diff --git a/eng/outerBuild.targets b/eng/outerBuild.targets
index dd546d6bd6f6bc..2c529a56aa2f91 100644
--- a/eng/outerBuild.targets
+++ b/eng/outerBuild.targets
@@ -1,7 +1,7 @@
-
+
diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml
index b5140477a7f35d..29071209e79dc1 100644
--- a/eng/pipelines/common/global-build-job.yml
+++ b/eng/pipelines/common/global-build-job.yml
@@ -25,22 +25,27 @@ jobs:
variables: ${{ parameters.variables }}
steps:
- - ${{ if eq(parameters.osGroup, 'OSX') }}:
- - script: |
- $(setScriptToEchoAndFailOnNonZero)
- brew install pkgconfig icu4c openssl autoconf automake libtool pkg-config python3
- brew link --force icu4c
- ln -s /usr/local/opt/openssl/lib/pkgconfig/libcrypto.pc /usr/local/lib/pkgconfig/
- ln -s /usr/local/opt/openssl/lib/pkgconfig/libssl.pc /usr/local/lib/pkgconfig/
- ln -s /usr/local/opt/openssl/lib/pkgconfig/openssl.pc /usr/local/lib/pkgconfig/
+ - template: /eng/pipelines/common/clone-checkout-bundle-step.yml
+
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
+ - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
displayName: Install Build Dependencies
- - template: /eng/pipelines/common/clone-checkout-bundle-step.yml
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage before Build
# Build
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci -arch ${{ parameters.archType }} ${{ parameters.buildArgs }}
displayName: Build product
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage after Build
+
- task: PublishBuildArtifacts@1
displayName: Publish Logs
inputs:
diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml
index fe0765b81050e3..2979349d8beca7 100644
--- a/eng/pipelines/common/platform-matrix.yml
+++ b/eng/pipelines/common/platform-matrix.yml
@@ -38,7 +38,7 @@ jobs:
archType: arm
platform: Linux_arm
container:
- image: ubuntu-16.04-cross-09ec757-20200320131433
+ image: ubuntu-16.04-cross-20200413125008-09ec757
registry: mcr
jobParameters:
runtimeFlavor: ${{ parameters.runtimeFlavor }}
@@ -62,7 +62,7 @@ jobs:
archType: arm64
platform: Linux_arm64
container:
- image: ubuntu-16.04-cross-arm64-cfdd435-20200121150126
+ image: ubuntu-16.04-cross-arm64-20200413125008-cfdd435
registry: mcr
jobParameters:
runtimeFlavor: ${{ parameters.runtimeFlavor }}
@@ -119,7 +119,7 @@ jobs:
archType: arm64
platform: Linux_musl_arm64
container:
- image: ubuntu-16.04-cross-arm64-alpine-406629a-20200127195039
+ image: ubuntu-16.04-cross-arm64-alpine-20200413125008-406629a
registry: mcr
jobParameters:
runtimeFlavor: ${{ parameters.runtimeFlavor }}
@@ -160,14 +160,14 @@ jobs:
# WebAssembly
-- ${{ if containsValue(parameters.platforms, 'WebAssembly_wasm') }}:
+- ${{ if containsValue(parameters.platforms, 'Browser_wasm') }}:
- template: xplat-setup.yml
parameters:
jobTemplate: ${{ parameters.jobTemplate }}
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
- osGroup: WebAssembly
+ osGroup: Browser
archType: wasm
- platform: WebAssembly_wasm
+ platform: Browser_wasm
container:
image: ubuntu-18.04-webassembly-20200409132031-f70ea41
registry: mcr
@@ -180,23 +180,25 @@ jobs:
${{ insert }}: ${{ parameters.jobParameters }}
# FreeBSD
-
-# FreeBSD machines are currently offline. Re-enable in the official build when
-# the machines are healthy.
-
-# - template: xplat-setup.yml
-# parameters:
-# jobTemplate: ${{ parameters.jobTemplate }}
-# osGroup: FreeBSD
-# archType: x64
-# jobParameters:
-# runtimeFlavor: ${{ parameters.runtimeFlavor }}
-# buildConfig: ${{ parameters.buildConfig }}
-# # There are no FreeBSD helix queues, so we don't run tests at the moment.
-# helixQueues:
-# asString: ''
-# asArray: []
-# ${{ insert }}: ${{ parameters.jobParameters }}
+- ${{ if containsValue(parameters.platforms, 'FreeBSD_x64') }}:
+ - template: xplat-setup.yml
+ parameters:
+ jobTemplate: ${{ parameters.jobTemplate }}
+ helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
+ osGroup: FreeBSD
+ archType: x64
+ platform: FreeBSD_x64
+ container:
+ image: ubuntu-18.04-cross-freebsd-11-20200407092345-a84b0d2
+ registry: mcr
+ jobParameters:
+ runtimeFlavor: ${{ parameters.runtimeFlavor }}
+ buildConfig: ${{ parameters.buildConfig }}
+ helixQueueGroup: ${{ parameters.helixQueueGroup }}
+ crossrootfsDir: '/crossrootfs/x64'
+ ${{ if eq(parameters.passPlatforms, true) }}:
+ platforms: ${{ parameters.platforms }}
+ ${{ insert }}: ${{ parameters.jobParameters }}
# Android x64
@@ -209,7 +211,7 @@ jobs:
archType: x64
platform: Android_x64
container:
- image: ubuntu-18.04-android-20200401093035-1517ea2
+ image: ubuntu-18.04-android-20200422191843-e2c3f83
registry: mcr
jobParameters:
runtimeFlavor: mono
@@ -231,7 +233,7 @@ jobs:
archType: x86
platform: Android_x86
container:
- image: ubuntu-18.04-android-20200401093035-1517ea2
+ image: ubuntu-18.04-android-20200422191843-e2c3f83
registry: mcr
jobParameters:
runtimeFlavor: mono
@@ -253,7 +255,7 @@ jobs:
archType: arm
platform: Android_arm
container:
- image: ubuntu-18.04-android-20200401093035-1517ea2
+ image: ubuntu-18.04-android-20200422191843-e2c3f83
registry: mcr
jobParameters:
runtimeFlavor: mono
@@ -275,7 +277,7 @@ jobs:
archType: arm64
platform: Android_arm64
container:
- image: ubuntu-18.04-android-20200401093035-1517ea2
+ image: ubuntu-18.04-android-20200422191843-e2c3f83
registry: mcr
jobParameters:
runtimeFlavor: mono
@@ -346,6 +348,26 @@ jobs:
managedTestBuildOsGroup: OSX
${{ insert }}: ${{ parameters.jobParameters }}
+# iOS x86
+
+- ${{ if containsValue(parameters.platforms, 'iOS_x86') }}:
+ - template: xplat-setup.yml
+ parameters:
+ jobTemplate: ${{ parameters.jobTemplate }}
+ helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
+ osGroup: iOS
+ archType: x86
+ platform: iOS_x86
+ jobParameters:
+ runtimeFlavor: mono
+ stagedBuild: ${{ parameters.stagedBuild }}
+ buildConfig: ${{ parameters.buildConfig }}
+ ${{ if eq(parameters.passPlatforms, true) }}:
+ platforms: ${{ parameters.platforms }}
+ helixQueueGroup: ${{ parameters.helixQueueGroup }}
+ managedTestBuildOsGroup: OSX
+ ${{ insert }}: ${{ parameters.jobParameters }}
+
# iOS arm
- ${{ if containsValue(parameters.platforms, 'iOS_arm') }}:
diff --git a/eng/pipelines/common/templates/runtimes/build-test-job.yml b/eng/pipelines/common/templates/runtimes/build-test-job.yml
new file mode 100644
index 00000000000000..6c46cfadeb0c4b
--- /dev/null
+++ b/eng/pipelines/common/templates/runtimes/build-test-job.yml
@@ -0,0 +1,162 @@
+parameters:
+ buildConfig: ''
+ archType: ''
+ osGroup: ''
+ osSubgroup: ''
+ container: ''
+ testGroup: ''
+ liveRuntimeBuildConfig: ''
+
+ # When set to a non-empty value (Debug / Release), it determines libraries
+ # build configuration to use for the tests. Setting this property implies
+ # a dependency of this job on the appropriate libraries build and is used
+ # to construct the name of the Azure artifact representing libraries build
+ # to use for building the tests.
+ liveLibrariesBuildConfig: ''
+
+ displayNameArgs: ''
+ condition: true
+ stagedBuild: false
+ variables: {}
+ pool: ''
+ runtimeFlavor: 'coreclr'
+ runtimeFlavorDisplayName: 'CoreCLR'
+ runtimeVariant: ''
+
+### Build managed test components (native components are getting built as part
+### of the the product build job).
+
+### TODO: As of today, build of managed test components requires the product build
+### as a prerequisite due to dependency on System.Private.Corelib. After switching
+### over to its reference assembly we should be able to remove this dependency and
+### run managed test builds in parallel with the product build job.
+
+
+jobs:
+- template: /eng/pipelines/${{ parameters.runtimeFlavor }}/templates/xplat-pipeline-job.yml
+ parameters:
+ buildConfig: ${{ parameters.buildConfig }}
+ archType: ${{ parameters.archType }}
+ osGroup: ${{ parameters.osGroup }}
+ osSubgroup: ${{ parameters.osSubgroup }}
+ managedTestBuildOsGroup: ${{ parameters.osGroup }}
+ managedTestBuildOsSubgroup: ${{ parameters.osSubgroup }}
+ container: ${{ parameters.container }}
+ runtimeVariant: ${{ parameters.runtimeVariant }}
+ testGroup: ${{ parameters.testGroup }}
+ stagedBuild: ${{ parameters.stagedBuild }}
+ liveLibrariesBuildConfig: ${{ parameters.liveLibrariesBuildConfig }}
+ variables: ${{ parameters.variables }}
+ pool: ${{ parameters.pool }}
+
+ # Test jobs should continue on error for internal builds
+ ${{ if eq(variables['System.TeamProject'], 'internal') }}:
+ continueOnError: true
+
+ ${{ if eq(parameters.testGroup, 'innerloop') }}:
+ name: '${{ parameters.runtimeFlavor }}_common_test_build_p0_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }}'
+ displayName: '${{ parameters.runtimeFlavorDisplayName }} Common Pri0 Test Build ${{ parameters.osGroup }}${{ parameters.osSubgroup }} ${{ parameters.archType }} ${{ parameters.buildConfig }}'
+
+ ${{ if ne(parameters.testGroup, 'innerloop') }}:
+ name: '${{ parameters.runtimeFlavor }}_common_test_build_p1_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }}'
+ displayName: '${{ parameters.runtimeFlavorDisplayName }} Common Pri1 Test Build ${{ parameters.osGroup }}${{ parameters.osSubgroup }} ${{ parameters.archType }} ${{ parameters.buildConfig }}'
+
+ # Since the condition is being altered, merge the default with the additional conditions.
+ # See https://docs.microsoft.com/azure/devops/pipelines/process/conditions
+ condition: and(succeeded(), ${{ parameters.condition }})
+
+ # TODO: Build of managed test components currently depends on the corresponding build job
+ # because it needs System.Private.Corelib; we should be able to remove this dependency
+ # by switching over to using reference assembly.
+ ${{ if ne(parameters.stagedBuild, true) }}:
+ dependsOn:
+ - ${{ format('coreclr_{0}_product_build_{1}{2}_{3}_{4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, coalesce(parameters.liveRuntimeBuildConfig, parameters.buildConfig)) }}
+ - ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
+ - ${{ format('libraries_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveLibrariesBuildConfig) }}
+
+
+ ${{ if eq(parameters.testGroup, 'innerloop') }}:
+ timeoutInMinutes: 90
+
+ ${{ if ne(parameters.testGroup, 'innerloop') }}:
+ timeoutInMinutes: 160
+
+ steps:
+
+ # Install test build dependencies
+ - ${{ if eq(parameters.osGroup, 'OSX') }}:
+ - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
+ displayName: Install native dependencies
+ - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
+ # Necessary to install correct cmake version
+ - script: $(Build.SourcesDirectory)\eng\common\init-tools-native.cmd -InstallDirectory $(Build.SourcesDirectory)\native-tools -Force
+ displayName: Install native dependencies
+
+
+ # Optionally download live-built libraries
+ - ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
+ - template: /eng/pipelines/common/download-artifact-step.yml
+ parameters:
+ unpackFolder: $(librariesDownloadDir)
+ cleanUnpackFolder: false
+ artifactFileName: '$(librariesBuildArtifactName)$(archiveExtension)'
+ artifactName: '$(librariesBuildArtifactName)'
+ displayName: 'live-built libraries'
+
+ # We need to explictly download CoreCLR, even if building Mono because the CoreCLR tests depend on it
+ - template: /eng/pipelines/common/download-artifact-step.yml
+ parameters:
+ unpackFolder: $(coreClrProductRootFolderPath)
+ artifactFileName: '$(coreClrProductArtifactName)$(archiveExtension)'
+ artifactName: '$(coreClrProductArtifactName)'
+ displayName: 'CoreCLR product build'
+
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage before Build
+
+ # Build managed test components
+ - script: $(coreClrRepoRootDir)build-test$(scriptExt) skipnative skipgeneratelayout skiptestwrappers $(buildConfig) $(archType) $(crossArg) $(priorityArg) ci $(librariesOverrideArg)
+ displayName: Build managed test components
+
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage after Build
+
+ # Zip and publish managed test components
+ - template: /eng/pipelines/common/upload-artifact-step.yml
+ parameters:
+ rootFolder: $(managedTestArtifactRootFolderPath)
+ includeRootFolder: false
+ archiveType: $(archiveType)
+ tarCompression: $(tarCompression)
+ archiveExtension: $(archiveExtension)
+ artifactName: $(managedTestArtifactName)
+ displayName: 'managed test components'
+
+
+ # Publish .packages/microsoft.net.sdk.il needed for traversing
+ # test projects during the copynativeonly command in run test job.
+ - template: /eng/pipelines/common/upload-artifact-step.yml
+ parameters:
+ rootFolder: $(microsoftNetSdkIlFolderPath)
+ includeRootFolder: false
+ archiveType: $(archiveType)
+ tarCompression: $(tarCompression)
+ archiveExtension: $(archiveExtension)
+ artifactName: $(microsoftNetSdkIlArtifactName)
+ displayName: 'Microsoft.NET.Sdk.IL package'
+
+
+ # Publish Logs
+ - task: PublishPipelineArtifact@1
+ displayName: Publish Logs
+ inputs:
+ targetPath: $(Build.SourcesDirectory)/artifacts/log
+ artifactName: '${{ parameters.runtimeFlavor }}_Common_Runtime_TestBuildLogs_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)_${{ parameters.testGroup }}'
+ continueOnError: true
+ condition: always()
diff --git a/eng/pipelines/coreclr/templates/run-test-job.yml b/eng/pipelines/common/templates/runtimes/run-test-job.yml
similarity index 81%
rename from eng/pipelines/coreclr/templates/run-test-job.yml
rename to eng/pipelines/common/templates/runtimes/run-test-job.yml
index 4bdb1d38891bf2..a98e8cd1c57cfd 100644
--- a/eng/pipelines/coreclr/templates/run-test-job.yml
+++ b/eng/pipelines/common/templates/runtimes/run-test-job.yml
@@ -11,6 +11,7 @@ parameters:
readyToRun: false
liveLibrariesBuildConfig: ''
crossgen2: false
+ compositeBuildMode: false
helixQueues: ''
# If true, run the corefx tests instead of the coreclr ones
corefxTests: false
@@ -18,8 +19,11 @@ parameters:
stagedBuild: false
displayNameArgs: ''
runInUnloadableContext: false
+ runtimeVariant: ''
variables: {}
pool: ''
+ runtimeFlavor: 'coreclr'
+ runtimeFlavorDisplayName: 'CoreCLR'
### Test run job
@@ -27,7 +31,7 @@ parameters:
### buildConfig and archType.
jobs:
-- template: xplat-pipeline-job.yml
+- template: /eng/pipelines/${{ parameters.runtimeFlavor }}/templates/xplat-pipeline-job.yml
parameters:
buildConfig: ${{ parameters.buildConfig }}
archType: ${{ parameters.archType }}
@@ -42,6 +46,7 @@ jobs:
stagedBuild: ${{ parameters.stagedBuild }}
liveLibrariesBuildConfig: ${{ parameters.liveLibrariesBuildConfig }}
helixType: 'build/tests/'
+ runtimeVariant: ${{ parameters.runtimeVariant }}
pool: ${{ parameters.pool }}
condition: ${{ parameters.condition }}
@@ -52,22 +57,22 @@ jobs:
dependsOn:
- ${{ if ne(parameters.corefxTests, true) }}:
- ${{ if eq(parameters.testGroup, 'innerloop') }}:
- - 'coreclr_test_build_p0_${{ parameters.managedTestBuildOsGroup }}${{ parameters.managedTestBuildOsSubgroup }}_${{ parameters.archType }}_${{parameters.buildConfig }}'
+ - '${{ parameters.runtimeFlavor }}_common_test_build_p0_${{ parameters.managedTestBuildOsGroup }}${{ parameters.managedTestBuildOsSubgroup }}_${{ parameters.archType }}_${{parameters.buildConfig }}'
- ${{ if ne(parameters.testGroup, 'innerloop') }}:
- - 'coreclr_test_build_p1_${{ parameters.managedTestBuildOsGroup }}${{ parameters.managedTestBuildOsSubgroup }}_${{ parameters.archType }}_${{parameters.buildConfig }}'
+ - '${{ parameters.runtimeFlavor }}_common_test_build_p1_${{ parameters.managedTestBuildOsGroup }}${{ parameters.managedTestBuildOsSubgroup }}_${{ parameters.archType }}_${{parameters.buildConfig }}'
- ${{ if ne(parameters.stagedBuild, true) }}:
- - ${{ format('coreclr_product_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
+ - ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}', parameters.runtimeFlavor, parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
- ${{ format('libraries_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveLibrariesBuildConfig) }}
# Compute job name from template parameters
${{ if eq(parameters.testGroup, 'innerloop') }}:
- name: 'run_test_p0_${{ parameters.displayNameArgs }}_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }}'
- displayName: 'CoreCLR Pri0 Test Run ${{ parameters.displayNameArgs }} ${{ parameters.osGroup }}${{ parameters.osSubgroup }} ${{ parameters.archType }} ${{ parameters.buildConfig }}'
+ name: 'run_test_p0_${{ parameters.runtimeFlavor }}${{ parameters.runtimeVariant }}_${{ parameters.displayNameArgs }}_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }}'
+ displayName: '${{ parameters.runtimeFlavorDisplayName }} ${{ parameters.runtimeVariant}} Pri0 Runtime Tests Run ${{ parameters.displayNameArgs }} ${{ parameters.osGroup }}${{ parameters.osSubgroup }} ${{ parameters.archType }} ${{ parameters.buildConfig }}'
${{ if ne(parameters.testGroup, 'innerloop') }}:
name: 'run_test_p1_${{ parameters.displayNameArgs }}_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }}'
- displayName: 'CoreCLR Pri1 Test Run ${{ parameters.displayNameArgs }} ${{ parameters.osGroup }}${{ parameters.osSubgroup }} ${{ parameters.archType }} ${{ parameters.buildConfig }}'
+ displayName: '${{ parameters.runtimeFlavorDisplayName }} ${{ parameters.runtimeVariant }} Pri1 Runtime Tests Run ${{ parameters.displayNameArgs }} ${{ parameters.osGroup }}${{ parameters.osSubgroup }} ${{ parameters.archType }} ${{ parameters.buildConfig }}'
variables:
- name: testhostArg
@@ -76,6 +81,13 @@ jobs:
- name: testhostArg
value: 'buildtesthostonly'
+ - name: runtimeFlavorArgs
+ value: ''
+
+ - ${{ if eq(parameters.runtimeFlavor, 'mono') }}:
+ - name: runtimeFlavorArgs
+ value: '-excludemonofailures'
+
- name: crossgenArg
value: ''
- name: LogNamePrefix
@@ -91,6 +103,9 @@ jobs:
value: 'crossgen2'
- name: LogNamePrefix
value: TestRunLogs_R2R_CG2
+ - ${{ if eq(parameters.compositeBuildMode, true) }}:
+ - name: crossgenArg
+ value: 'composite'
# Set job timeouts
#
@@ -141,6 +156,10 @@ jobs:
- name: timeoutPerTestInMinutes
value: 90
+ - ${{ if eq(parameters.compositeBuildMode, true) }}:
+ - name: crossgenArg
+ value: 'composite'
+
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- group: DotNet-HelixApi-Access
@@ -148,7 +167,7 @@ jobs:
# TODO: update these numbers as they were determined long ago
${{ if eq(parameters.testGroup, 'innerloop') }}:
- timeoutInMinutes: 150
+ timeoutInMinutes: 200
${{ if in(parameters.testGroup, 'outerloop', 'jit-experimental') }}:
timeoutInMinutes: 270
${{ if in(parameters.testGroup, 'gc-longrunning', 'gc-simulator') }}:
@@ -190,6 +209,15 @@ jobs:
displayName: 'product build'
+ - ${{ if eq(parameters.runtimeFlavor, 'mono') }}:
+ # We need to explictly download CoreCLR for Mono
+ - template: /eng/pipelines/common/download-artifact-step.yml
+ parameters:
+ unpackFolder: $(coreClrProductRootFolderPath)
+ artifactFileName: '$(coreClrProductArtifactName)$(archiveExtension)'
+ artifactName: '$(coreClrProductArtifactName)'
+ displayName: 'CoreCLR product download for Mono'
+
# Download and unzip the Microsoft.NET.Sdk.IL package needed for traversing
# ilproj test projects during copynativeonly.
- ${{ if ne(parameters.corefxTests, true) }}:
@@ -227,8 +255,8 @@ jobs:
displayName: Generate test host
- # Generate test wrappers
- - script: $(coreClrRepoRootDir)build-test$(scriptExt) buildtestwrappersonly $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg)
+ # Generate test wrappers. This is the step that examines issues.targets to exclude tests.
+ - script: $(coreClrRepoRootDir)build-test$(scriptExt) buildtestwrappersonly $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg)
displayName: Generate test wrappers
@@ -237,15 +265,25 @@ jobs:
- script: $(coreClrRepoRootDir)build-test$(scriptExt) skipmanaged skipnative $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg)
displayName: Crossgen framework assemblies
+ # Overwrite coreclr runtime binaries with mono ones
+ - ${{ if eq(parameters.runtimeFlavor, 'mono') }}:
+ - script: $(_msbuildCommand)
+ $(Build.SourcesDirectory)/src/mono/mono.proj
+ /t:PatchCoreClrCoreRoot
+ /p:Configuration=$(buildConfigUpper)
+ /p:TargetArchitecture=$(archType)
+ displayName: "Patch dotnet with mono"
# Send tests to Helix
- - template: /eng/pipelines/coreclr/templates/send-to-helix-step.yml
+ - template: /eng/pipelines/common/templates/runtimes/send-to-helix-step.yml
parameters:
displayName: Send tests to Helix
buildConfig: $(buildConfigUpper)
archType: ${{ parameters.archType }}
osGroup: ${{ parameters.osGroup }}
+ osSubgroup: ${{ parameters.osSubgroup}}
coreClrRepoRoot: $(coreClrRepoRoot)
+ runtimeFlavorDisplayName: ${{ parameters.runtimeFlavorDisplayName }}
${{ if eq(variables['System.TeamProject'], 'public') }}:
creator: $(Build.DefinitionName)
@@ -277,6 +315,7 @@ jobs:
runCrossGen: ${{ and(eq(parameters.readyToRun, true), ne(parameters.crossgen2, true)) }}
runCrossGen2: ${{ and(eq(parameters.readyToRun, true), eq(parameters.crossgen2, true)) }}
+ compositeBuildMode: ${{ parameters.compositeBuildMode }}
runInUnloadableContext: ${{ parameters.runInUnloadableContext }}
${{ if eq(variables['System.TeamProject'], 'internal') }}:
@@ -293,7 +332,10 @@ jobs:
${{ if in(parameters.testGroup, 'innerloop', 'outerloop') }}:
scenarios:
- normal
- - no_tiered_compilation
+ - ${{ if eq(parameters.runtimeFlavor, 'coreclr') }}:
+ - no_tiered_compilation
+ - ${{ if eq(parameters.runtimeFlavor, 'mono') }}:
+ - interpreter
${{ if in(parameters.testGroup, 'jitstress') }}:
scenarios:
- jitminopts
@@ -411,12 +453,13 @@ jobs:
- jitguardeddevirtualization
- jitehwritethru
- jitobjectstackallocation
+ - jitpgo
# Publish Logs
- task: PublishPipelineArtifact@1
displayName: Publish Logs
inputs:
targetPath: $(Build.SourcesDirectory)/artifacts/log
- artifactName: '$(LogNamePrefix)_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)_${{ parameters.testGroup }}'
+ artifactName: '${{ parameters.runtimeFlavor }}_${{ parameters.runtimeVariant }}_$(LogNamePrefix)_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)_${{ parameters.testGroup }}'
continueOnError: true
condition: always()
diff --git a/eng/pipelines/coreclr/templates/send-to-helix-step.yml b/eng/pipelines/common/templates/runtimes/send-to-helix-step.yml
similarity index 87%
rename from eng/pipelines/coreclr/templates/send-to-helix-step.yml
rename to eng/pipelines/common/templates/runtimes/send-to-helix-step.yml
index 7209065b570b5e..3602929653dc36 100644
--- a/eng/pipelines/coreclr/templates/send-to-helix-step.yml
+++ b/eng/pipelines/common/templates/runtimes/send-to-helix-step.yml
@@ -3,6 +3,7 @@ parameters:
condition: ''
archType: ''
osGroup: ''
+ osSubgroup: ''
buildConfig: ''
creator: ''
publishTestResults: ''
@@ -16,11 +17,14 @@ parameters:
timeoutPerTestInMinutes: ''
runCrossGen: ''
runCrossGen2: ''
+ compositeBuildMode: false
helixProjectArguments: ''
runInUnloadableContext: ''
longRunningGcTests: ''
gcSimulatorTests: ''
coreClrRepoRoot: ''
+ runtimeFlavorDisplayName: 'CoreCLR'
+ runtimeVariant: ''
steps:
- ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
@@ -36,7 +40,7 @@ steps:
condition: ${{ parameters.condition }}
env:
__BuildArch: ${{ parameters.archType }}
- __TargetOS: ${{ parameters.osGroup }}
+ __TargetOS: ${{ parameters.osGroup }}${{ parameters.osSubgroup }}
__BuildType: ${{ parameters.buildConfig }}
_Creator: ${{ parameters.creator }}
_PublishTestResults: ${{ parameters.publishTestResults }}
@@ -47,12 +51,15 @@ steps:
_HelixType: ${{ parameters.helixType }}
_RunCrossGen: ${{ parameters.runCrossGen }}
_RunCrossGen2: ${{ parameters.runCrossGen2 }}
+ _CompositeBuildMode: ${{ parameters.compositeBuildMode }}
_RunInUnloadableContext: ${{ parameters.runInUnloadableContext }}
_LongRunningGcTests: ${{ parameters.longRunningGcTests }}
_GcSimulatorTests: ${{ parameters.gcSimulatorTests }}
_Scenarios: ${{ join(',', parameters.scenarios) }}
_TimeoutPerTestCollectionInMinutes: ${{ parameters.timeoutPerTestCollectionInMinutes }}
_TimeoutPerTestInMinutes: ${{ parameters.timeoutPerTestInMinutes }}
+ runtimeFlavorDisplayName: ${{ parameters.runtimeFlavorDisplayName }}
+ _RuntimeVariant: ${{ parameters.runtimeVariant }}
${{ if eq(parameters.publishTestResults, 'true') }}:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
# TODO: remove NUGET_PACKAGES once https://github.com/dotnet/arcade/issues/1578 is fixed
@@ -75,7 +82,7 @@ steps:
condition: ${{ parameters.condition }}
env:
__BuildArch: ${{ parameters.archType }}
- __TargetOS: ${{ parameters.osGroup }}
+ __TargetOS: ${{ parameters.osGroup }}${{ parameters.osSubgroup }}
__BuildType: ${{ parameters.buildConfig }}
_Creator: ${{ parameters.creator }}
_PublishTestResults: ${{ parameters.publishTestResults }}
@@ -86,12 +93,15 @@ steps:
_HelixType: ${{ parameters.helixType }}
_RunCrossGen: ${{ parameters.runCrossGen }}
_RunCrossGen2: ${{ parameters.runCrossGen2 }}
+ _CompositeBuildMode: ${{ parameters.compositeBuildMode }}
_RunInUnloadableContext: ${{ parameters.runInUnloadableContext }}
_LongRunningGcTests: ${{ parameters.longRunningGcTests }}
_GcSimulatorTests: ${{ parameters.gcSimulatorTests }}
_Scenarios: ${{ join(',', parameters.scenarios) }}
_TimeoutPerTestCollectionInMinutes: ${{ parameters.timeoutPerTestCollectionInMinutes }}
_TimeoutPerTestInMinutes: ${{ parameters.timeoutPerTestInMinutes }}
+ runtimeFlavorDisplayName: ${{ parameters.runtimeFlavorDisplayName }}
+ _RuntimeVariant: ${{ parameters.runtimeVariant }}
${{ if eq(parameters.publishTestResults, 'true') }}:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
# TODO: remove NUGET_PACKAGES once https://github.com/dotnet/arcade/issues/1578 is fixed
diff --git a/eng/pipelines/common/xplat-setup.yml b/eng/pipelines/common/xplat-setup.yml
index 4467951602b7e7..54da4233adaff3 100644
--- a/eng/pipelines/common/xplat-setup.yml
+++ b/eng/pipelines/common/xplat-setup.yml
@@ -11,6 +11,10 @@ parameters:
jobs:
- template: ${{ coalesce(parameters.helixQueuesTemplate, parameters.jobTemplate) }}
parameters:
+ ${{ if eq(parameters.jobParameters.runtimeFlavor, 'coreclr') }}:
+ runtimeFlavorDisplayName: 'CoreCLR'
+ ${{ if eq(parameters.jobParameters.runtimeFlavor, 'mono') }}:
+ runtimeFlavorDisplayName: 'Mono'
variables:
# Disable component governance in our CI builds. These builds are not shipping nor
# are they a service. Also the component governance jobs issue lots of inconsequential
@@ -64,10 +68,6 @@ jobs:
- name: ROOTFS_DIR
value: ${{ parameters.jobParameters.crossrootfsDir }}
- - ${{ if eq(parameters.osGroup, 'Android') }}:
- - name: ANDROID_NDK_HOME
- value: /usr/local/ndk
-
- name: runtimeFlavorName
${{ if eq(parameters.jobParameters.runtimeFlavor, 'mono') }}:
value: Mono
@@ -88,19 +88,15 @@ jobs:
${{ if eq(parameters.jobParameters.pool, '') }}:
pool:
# Public Linux Build Pool
- ${{ if and(eq(parameters.osGroup, 'Linux'), eq(variables['System.TeamProject'], 'public')) }}:
+ ${{ if and(in(parameters.osGroup, 'Linux', 'FreeBSD'), eq(variables['System.TeamProject'], 'public')) }}:
name: NetCorePublic-Pool
queue: BuildPool.Ubuntu.1604.Amd64.Open
# Official Build Linux Pool
- ${{ if and(eq(parameters.osGroup, 'Linux'), ne(variables['System.TeamProject'], 'public')) }}:
+ ${{ if and(in(parameters.osGroup, 'Linux', 'FreeBSD'), ne(variables['System.TeamProject'], 'public')) }}:
name: NetCoreInternal-Pool
queue: BuildPool.Ubuntu.1604.Amd64
- # FreeBSD builds only in the internal project
- ${{ if and(eq(parameters.osGroup, 'FreeBSD'), ne(variables['System.TeamProject'], 'public')) }}:
- name: dnceng-freebsd-internal
-
# Public OSX Build Pool
${{ if eq(parameters.osGroup, 'OSX') }}:
vmImage: 'macOS-10.14'
diff --git a/eng/pipelines/coreclr/ci.yml b/eng/pipelines/coreclr/ci.yml
index 0249dc33eba230..ec430007258404 100644
--- a/eng/pipelines/coreclr/ci.yml
+++ b/eng/pipelines/coreclr/ci.yml
@@ -8,6 +8,7 @@ trigger:
- '*'
- src/libraries/System.Private.CoreLib/*
exclude:
+ - .github/*
- docs/*
- CODE-OF-CONDUCT.md
- CONTRIBUTING.md
@@ -94,7 +95,7 @@ jobs:
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/build-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
buildConfig: checked
platforms:
- Linux_arm
@@ -113,7 +114,7 @@ jobs:
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: checked
platformGroup: all
helixQueueGroup: ci
@@ -127,7 +128,7 @@ jobs:
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: checked
platforms:
- Linux_arm64
diff --git a/eng/pipelines/coreclr/corefx-jitstress.yml b/eng/pipelines/coreclr/corefx-jitstress.yml
index 4ea57cb95ba3d7..07acd4100062a4 100644
--- a/eng/pipelines/coreclr/corefx-jitstress.yml
+++ b/eng/pipelines/coreclr/corefx-jitstress.yml
@@ -33,7 +33,7 @@ jobs:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: checked
platforms:
# TODO: add Windows_NT_arm64, when we have hardware available. Note: platform-matrix.yml needs to enable a Helix queue for this.
diff --git a/eng/pipelines/coreclr/corefx-jitstress2-jitstressregs.yml b/eng/pipelines/coreclr/corefx-jitstress2-jitstressregs.yml
index df6417a3c080a8..c58f8f575f3831 100644
--- a/eng/pipelines/coreclr/corefx-jitstress2-jitstressregs.yml
+++ b/eng/pipelines/coreclr/corefx-jitstress2-jitstressregs.yml
@@ -33,7 +33,7 @@ jobs:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: checked
platforms:
# TODO: add Windows_NT_arm64, when we have hardware available. Note: platform-matrix.yml needs to enable a Helix queue for this.
diff --git a/eng/pipelines/coreclr/corefx-jitstressregs.yml b/eng/pipelines/coreclr/corefx-jitstressregs.yml
index a74c2ec0801624..ce064af729f91c 100644
--- a/eng/pipelines/coreclr/corefx-jitstressregs.yml
+++ b/eng/pipelines/coreclr/corefx-jitstressregs.yml
@@ -33,7 +33,7 @@ jobs:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: checked
platforms:
# TODO: add Windows_NT_arm64, when we have hardware available. Note: platform-matrix.yml needs to enable a Helix queue for this.
diff --git a/eng/pipelines/coreclr/corefx.yml b/eng/pipelines/coreclr/corefx.yml
index c251b0236d3af7..2f70f3f7083031 100644
--- a/eng/pipelines/coreclr/corefx.yml
+++ b/eng/pipelines/coreclr/corefx.yml
@@ -33,7 +33,7 @@ jobs:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: checked
platforms:
# TODO: add Windows_NT_arm64, when we have hardware available. Note: platform-matrix.yml needs to enable a Helix queue for this.
diff --git a/eng/pipelines/coreclr/crossgen2-composite.yml b/eng/pipelines/coreclr/crossgen2-composite.yml
new file mode 100644
index 00000000000000..0a2e5405878e0d
--- /dev/null
+++ b/eng/pipelines/coreclr/crossgen2-composite.yml
@@ -0,0 +1,56 @@
+trigger: none
+
+pr: none
+
+schedules:
+- cron: "0 6 * * *"
+ displayName: Mon through Sun at 10:00 PM (UTC-8:00)
+ branches:
+ include:
+ - master
+ always: true
+
+jobs:
+#
+# Checkout repository
+#
+- template: /eng/pipelines/common/checkout-job.yml
+
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/common/build-coreclr-and-libraries-job.yml
+ buildConfig: checked
+ platforms:
+ - Linux_x64
+ - OSX_x64
+ - Windows_NT_x64
+ jobParameters:
+ testGroup: innerloop
+
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
+ buildConfig: checked
+ platforms:
+ - OSX_x64
+ - Windows_NT_x64
+ jobParameters:
+ testGroup: innerloop
+ liveLibrariesBuildConfig: Release
+
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
+ helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
+ buildConfig: checked
+ platforms:
+ - Linux_x64
+ - OSX_x64
+ - Windows_NT_x64
+ jobParameters:
+ testGroup: innerloop
+ readyToRun: true
+ crossgen2: true
+ compositeBuildMode: true
+ displayNameArgs: Composite
+ liveLibrariesBuildConfig: Release
diff --git a/eng/pipelines/coreclr/crossgen2-outerloop.yml b/eng/pipelines/coreclr/crossgen2-outerloop.yml
index d31a45088687b1..3802f6222f0379 100644
--- a/eng/pipelines/coreclr/crossgen2-outerloop.yml
+++ b/eng/pipelines/coreclr/crossgen2-outerloop.yml
@@ -29,7 +29,7 @@ jobs:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/build-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
buildConfig: checked
platforms:
- OSX_x64
@@ -40,7 +40,7 @@ jobs:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
buildConfig: checked
platforms:
diff --git a/eng/pipelines/coreclr/crossgen2.yml b/eng/pipelines/coreclr/crossgen2.yml
index 3d1ea01d4f69d6..ab6ccdf94246b2 100644
--- a/eng/pipelines/coreclr/crossgen2.yml
+++ b/eng/pipelines/coreclr/crossgen2.yml
@@ -29,7 +29,7 @@ jobs:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/build-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
buildConfig: checked
platforms:
- OSX_x64
@@ -40,7 +40,7 @@ jobs:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
buildConfig: checked
platforms:
diff --git a/eng/pipelines/coreclr/gc-longrunning.yml b/eng/pipelines/coreclr/gc-longrunning.yml
index 5d3ec8f9e5335b..e706868dc49314 100644
--- a/eng/pipelines/coreclr/gc-longrunning.yml
+++ b/eng/pipelines/coreclr/gc-longrunning.yml
@@ -30,7 +30,7 @@ jobs:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/build-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
buildConfig: release
platforms:
- Linux_x64
@@ -43,7 +43,7 @@ jobs:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: release
platforms:
- Linux_x64
diff --git a/eng/pipelines/coreclr/jitstress-isas-x86.yml b/eng/pipelines/coreclr/jitstress-isas-x86.yml
index 52d977d4b7ea46..8c1241a1b371ab 100644
--- a/eng/pipelines/coreclr/jitstress-isas-x86.yml
+++ b/eng/pipelines/coreclr/jitstress-isas-x86.yml
@@ -30,7 +30,7 @@ jobs:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/build-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
buildConfig: checked
platforms:
- OSX_x64
@@ -42,7 +42,7 @@ jobs:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: checked
platforms:
- Linux_x64
diff --git a/eng/pipelines/coreclr/jitstress.yml b/eng/pipelines/coreclr/jitstress.yml
index 94ee7eb62c6bb9..04107ea4b05732 100644
--- a/eng/pipelines/coreclr/jitstress.yml
+++ b/eng/pipelines/coreclr/jitstress.yml
@@ -28,8 +28,7 @@ jobs:
- Linux_x64
- Windows_NT_x64
- Windows_NT_x86
- # Currently no Windows arm32 testing. https://github.com/dotnet/runtime/issues/1097
- #- Windows_NT_arm
+ - Windows_NT_arm
- Windows_NT_arm64
jobParameters:
testGroup: jitstress
@@ -46,8 +45,7 @@ jobs:
- Linux_x64
- Windows_NT_x64
- Windows_NT_x86
- # Currently no Windows arm32 testing. https://github.com/dotnet/runtime/issues/1097
- #- Windows_NT_arm
+ - Windows_NT_arm
- Windows_NT_arm64
helixQueueGroup: ci
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
diff --git a/eng/pipelines/coreclr/jitstress2-jitstressregs.yml b/eng/pipelines/coreclr/jitstress2-jitstressregs.yml
index 8f196635e89e5b..24953b5ad92196 100644
--- a/eng/pipelines/coreclr/jitstress2-jitstressregs.yml
+++ b/eng/pipelines/coreclr/jitstress2-jitstressregs.yml
@@ -28,8 +28,7 @@ jobs:
- Linux_x64
- Windows_NT_x64
- Windows_NT_x86
- # Currently no Windows arm32 testing. https://github.com/dotnet/runtime/issues/1097
- #- Windows_NT_arm
+ - Windows_NT_arm
- Windows_NT_arm64
jobParameters:
testGroup: jitstress2-jitstressregs
@@ -46,8 +45,7 @@ jobs:
- Linux_x64
- Windows_NT_x64
- Windows_NT_x86
- # Currently no Windows arm32 testing. https://github.com/dotnet/runtime/issues/1097
- #- Windows_NT_arm
+ - Windows_NT_arm
- Windows_NT_arm64
helixQueueGroup: ci
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
diff --git a/eng/pipelines/coreclr/jitstressregs.yml b/eng/pipelines/coreclr/jitstressregs.yml
index af6e2faba56891..322458047125b5 100644
--- a/eng/pipelines/coreclr/jitstressregs.yml
+++ b/eng/pipelines/coreclr/jitstressregs.yml
@@ -28,8 +28,7 @@ jobs:
- Linux_x64
- Windows_NT_x64
- Windows_NT_x86
- # Currently no Windows arm32 testing. https://github.com/dotnet/runtime/issues/1097
- #- Windows_NT_arm
+ - Windows_NT_arm
- Windows_NT_arm64
jobParameters:
testGroup: jitstressregs
@@ -46,8 +45,7 @@ jobs:
- Linux_x64
- Windows_NT_x64
- Windows_NT_x86
- # Currently no Windows arm32 testing. https://github.com/dotnet/runtime/issues/1097
- #- Windows_NT_arm
+ - Windows_NT_arm
- Windows_NT_arm64
helixQueueGroup: ci
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
diff --git a/eng/pipelines/coreclr/perf.yml b/eng/pipelines/coreclr/perf.yml
index ffa22b8afc7515..d2ed639d434bdc 100644
--- a/eng/pipelines/coreclr/perf.yml
+++ b/eng/pipelines/coreclr/perf.yml
@@ -8,6 +8,7 @@ trigger:
- '*'
- src/libraries/System.Private.CoreLib/*
exclude:
+ - .github/*
- docs/*
- CODE-OF-CONDUCT.md
- CONTRIBUTING.md
@@ -60,11 +61,32 @@ jobs:
- Windows_NT_x86
jobParameters:
testGroup: perf
-
+
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/mono/templates/build-job.yml
+ runtimeFlavor: mono
+ buildConfig: release
+ platforms:
+ - Linux_x64
+
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/coreclr/templates/perf-job.yml
+ buildConfig: release
+ runtimeFlavor: mono
+ platforms:
+ - Linux_x64
+ jobParameters:
+ testGroup: perf
+ liveLibrariesBuildConfig: Release
+ runtimeType: mono
+
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/coreclr/templates/perf-job.yml
buildConfig: release
+ runtimeFlavor: coreclr
platforms:
- Linux_x64
- Windows_NT_x64
diff --git a/eng/pipelines/coreclr/r2r.yml b/eng/pipelines/coreclr/r2r.yml
index 04ef6d73c06bf2..781e934c6d6e3b 100644
--- a/eng/pipelines/coreclr/r2r.yml
+++ b/eng/pipelines/coreclr/r2r.yml
@@ -24,6 +24,8 @@ jobs:
- Linux_arm
- Linux_arm64
- Linux_x64
+ - Windows_NT_arm
+ - Windows_NT_arm64
- Windows_NT_x64
- Windows_NT_x86
jobParameters:
@@ -37,6 +39,8 @@ jobs:
- Linux_arm
- Linux_arm64
- Linux_x64
+ - Windows_NT_arm
+ - Windows_NT_arm64
- Windows_NT_x64
- Windows_NT_x86
helixQueueGroup: ci
diff --git a/eng/pipelines/coreclr/release-tests.yml b/eng/pipelines/coreclr/release-tests.yml
index 29342df4f6153c..f597bc1623d1a9 100644
--- a/eng/pipelines/coreclr/release-tests.yml
+++ b/eng/pipelines/coreclr/release-tests.yml
@@ -32,7 +32,7 @@ jobs:
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/build-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
buildConfig: release
platformGroup: all
jobParameters:
@@ -44,7 +44,7 @@ jobs:
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: release
platformGroup: all
helixQueueGroup: ci
@@ -58,7 +58,7 @@ jobs:
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: release
platformGroup: all
helixQueueGroup: ci
diff --git a/eng/pipelines/coreclr/templates/build-job.yml b/eng/pipelines/coreclr/templates/build-job.yml
index b343975a710b53..c23db63f956668 100644
--- a/eng/pipelines/coreclr/templates/build-job.yml
+++ b/eng/pipelines/coreclr/templates/build-job.yml
@@ -10,6 +10,7 @@ parameters:
osSubgroup: ''
platform: ''
pool: ''
+ runtimeVariant: ''
signBinaries: false
stagedBuild: false
testGroup: ''
@@ -25,6 +26,7 @@ jobs:
archType: ${{ parameters.archType }}
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
+ runtimeVariant: ${{ parameters.runtimeVariant }}
testGroup: ${{ parameters.testGroup }}
helixType: 'build/product/'
enableMicrobuild: true
@@ -37,8 +39,8 @@ jobs:
name: ${{ format('coreclr_{0}_product_build_{1}{1}_{3}_{4}', parameters.compilerName, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
displayName: ${{ format('CoreCLR GCC Product Build {0}{1} {2} {3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
${{ if eq(parameters.compilerName, 'clang') }}:
- name: ${{ format('coreclr_product_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- displayName: ${{ format('CoreCLR Product Build {0}{1} {2} {3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
+ name: ${{ format('coreclr_{0}_product_build_{1}{2}_{3}_{4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
+ displayName: ${{ format('CoreCLR {0} Product Build {1}{2} {3} {4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
# Run all steps in the container.
# Note that the containers are defined in platform-matrix.yml
@@ -66,10 +68,6 @@ jobs:
- ${{ if and(ne(parameters.osGroup, 'Windows_NT'), eq(parameters.compilerName, 'clang')) }}:
- name: compilerArg
value: '-clang9'
- # Our FreeBSD doesn't yet detect available clang versions, so pass it explicitly.
- - ${{ if eq(parameters.osGroup, 'FreeBSD') }}:
- - name: compilerArg
- value: '-clang6.0'
# Building for x64 MUSL happens on Alpine Linux and we need to use the stable version available there
- ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubgroup, '_musl'), eq(parameters.archType, 'x64')) }}:
- name: compilerArg
@@ -108,7 +106,7 @@ jobs:
# and FreeBSD builds use a build agent with dependencies
# preinstalled, so we only need this step for OSX and Windows.
- ${{ if eq(parameters.osGroup, 'OSX') }}:
- - script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
+ - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
displayName: Install native dependencies
- ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
# Necessary to install python
@@ -122,28 +120,36 @@ jobs:
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- template: /eng/pipelines/common/restore-internal-tools.yml
- # Build CoreCLR tools needed by the native runtime build
- - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.buildtools $(crossArg) -arch $(archType) -c $(buildConfig) $(officialBuildIdArg) -ci /bl:$(Build.SourcesDirectory)/artifacts/log/clr.buildtools.binlog
- displayName: Build CoreCLR Diagnostic Tools
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage before Build
# Build CoreCLR Runtime
- ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
- - script: $(coreClrRepoRootDir)build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) -ci $(compilerArg) $(officialBuildIdArg)
+ - script: $(coreClrRepoRootDir)build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) $(osArg) -ci $(compilerArg) $(officialBuildIdArg)
displayName: Build CoreCLR Runtime
- ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
- script: set __TestIntermediateDir=int&&$(coreClrRepoRootDir)build-runtime$(scriptExt) $(buildConfig) $(archType) -ci $(enforcePgoArg) $(officialBuildIdArg)
displayName: Build CoreCLR Runtime
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage after Build
+
- ${{ if and(eq(parameters.osGroup, 'Windows_NT'), ne(parameters.archType, 'x86')) }}:
- script: set __TestIntermediateDir=int&&$(coreClrRepoRootDir)build-runtime$(scriptExt) $(buildConfig) $(archType) -ci -linuxdac $(officialBuildIdArg)
displayName: Build Cross OS Linux DAC for Windows
# Build CoreCLR Managed Components
- - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.tools+clr.packages $(crossArg) -arch $(archType) -c $(buildConfig) $(officialBuildIdArg) -ci
+ - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.tools+clr.packages $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(officialBuildIdArg) -ci
displayName: Build managed product components and packages
# Build native test components
- - script: $(coreClrRepoRootDir)build-test$(scriptExt) skipmanaged $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(compilerArg) skipgeneratelayout
+ - script: $(coreClrRepoRootDir)build-test$(scriptExt) skipmanaged $(buildConfig) $(archType) $(crossArg) $(osArg) $(priorityArg) $(compilerArg) skipgeneratelayout
displayName: Build native test components
# Sign on Windows
diff --git a/eng/pipelines/coreclr/templates/build-test-job.yml b/eng/pipelines/coreclr/templates/build-test-job.yml
deleted file mode 100644
index 75650136520d55..00000000000000
--- a/eng/pipelines/coreclr/templates/build-test-job.yml
+++ /dev/null
@@ -1,148 +0,0 @@
-parameters:
- buildConfig: ''
- archType: ''
- osGroup: ''
- osSubgroup: ''
- container: ''
- testGroup: ''
-
- # When set to a non-empty value (Debug / Release), it determines libraries
- # build configuration to use for the tests. Setting this property implies
- # a dependency of this job on the appropriate libraries build and is used
- # to construct the name of the Azure artifact representing libraries build
- # to use for building the tests.
- liveLibrariesBuildConfig: ''
-
- displayNameArgs: ''
- condition: true
- stagedBuild: false
- variables: {}
- pool: ''
-
-### Build managed test components (native components are getting built as part
-### of the the product build job).
-
-### TODO: As of today, build of managed test components requires the product build
-### as a prerequisite due to dependency on System.Private.Corelib. After switching
-### over to its reference assembly we should be able to remove this dependency and
-### run managed test builds in parallel with the product build job.
-
-jobs:
-- template: xplat-pipeline-job.yml
- parameters:
- buildConfig: ${{ parameters.buildConfig }}
- archType: ${{ parameters.archType }}
- osGroup: ${{ parameters.osGroup }}
- osSubgroup: ${{ parameters.osSubgroup }}
- managedTestBuildOsGroup: ${{ parameters.osGroup }}
- managedTestBuildOsSubgroup: ${{ parameters.osSubgroup }}
- container: ${{ parameters.container }}
- testGroup: ${{ parameters.testGroup }}
- stagedBuild: ${{ parameters.stagedBuild }}
- liveLibrariesBuildConfig: ${{ parameters.liveLibrariesBuildConfig }}
- variables: ${{ parameters.variables }}
- pool: ${{ parameters.pool }}
-
- # Test jobs should continue on error for internal builds
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- continueOnError: true
-
- # Compute job name from template parameters
- ${{ if eq(parameters.testGroup, 'innerloop') }}:
- name: 'coreclr_test_build_p0_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }}'
- displayName: 'CoreCLR Pri0 Test Build ${{ parameters.osGroup }}${{ parameters.osSubgroup }} ${{ parameters.archType }} ${{ parameters.buildConfig }}'
-
- ${{ if ne(parameters.testGroup, 'innerloop') }}:
- name: 'coreclr_test_build_p1_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }}'
- displayName: 'CoreCLR Pri1 Test Build ${{ parameters.osGroup }}${{ parameters.osSubgroup }} ${{ parameters.archType }} ${{ parameters.buildConfig }}'
-
- # Since the condition is being altered, merge the default with the additional conditions.
- # See https://docs.microsoft.com/azure/devops/pipelines/process/conditions
- condition: and(succeeded(), ${{ parameters.condition }})
-
- # TODO: Build of managed test components currently depends on the corresponding build job
- # because it needs System.Private.Corelib; we should be able to remove this dependency
- # by switching over to using reference assembly.
- ${{ if ne(parameters.stagedBuild, true) }}:
- dependsOn:
- - ${{ format('coreclr_product_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- - ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
- - ${{ format('libraries_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveLibrariesBuildConfig) }}
-
-
- ${{ if eq(parameters.testGroup, 'innerloop') }}:
- timeoutInMinutes: 90
-
- ${{ if ne(parameters.testGroup, 'innerloop') }}:
- timeoutInMinutes: 160
-
- steps:
-
- # Install test build dependencies
- - ${{ if eq(parameters.osGroup, 'OSX') }}:
- - script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
- displayName: Install native dependencies
- - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
- # Necessary to install correct cmake version
- - script: $(Build.SourcesDirectory)\eng\common\init-tools-native.cmd -InstallDirectory $(Build.SourcesDirectory)\native-tools -Force
- displayName: Install native dependencies
-
-
- # Optionally download live-built libraries
- - ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
- - template: /eng/pipelines/common/download-artifact-step.yml
- parameters:
- unpackFolder: $(librariesDownloadDir)
- cleanUnpackFolder: false
- artifactFileName: '$(librariesBuildArtifactName)$(archiveExtension)'
- artifactName: '$(librariesBuildArtifactName)'
- displayName: 'live-built libraries'
-
-
- # Download product binaries directory
- - template: /eng/pipelines/common/download-artifact-step.yml
- parameters:
- unpackFolder: $(buildProductRootFolderPath)
- artifactFileName: '$(buildProductArtifactName)$(archiveExtension)'
- artifactName: '$(buildProductArtifactName)'
- displayName: 'product build'
-
-
- # Build managed test components
- - script: $(coreClrRepoRootDir)build-test$(scriptExt) skipnative skipgeneratelayout skiptestwrappers $(buildConfig) $(archType) $(crossArg) $(priorityArg) ci $(librariesOverrideArg)
- displayName: Build managed test components
-
-
- # Zip and publish managed test components
- - template: /eng/pipelines/common/upload-artifact-step.yml
- parameters:
- rootFolder: $(managedTestArtifactRootFolderPath)
- includeRootFolder: false
- archiveType: $(archiveType)
- tarCompression: $(tarCompression)
- archiveExtension: $(archiveExtension)
- artifactName: $(managedTestArtifactName)
- displayName: 'managed test components'
-
-
- # Publish .packages/microsoft.net.sdk.il needed for traversing
- # test projects during the copynativeonly command in run test job.
- - template: /eng/pipelines/common/upload-artifact-step.yml
- parameters:
- rootFolder: $(microsoftNetSdkIlFolderPath)
- includeRootFolder: false
- archiveType: $(archiveType)
- tarCompression: $(tarCompression)
- archiveExtension: $(archiveExtension)
- artifactName: $(microsoftNetSdkIlArtifactName)
- displayName: 'Microsoft.NET.Sdk.IL package'
-
-
- # Publish Logs
- - task: PublishPipelineArtifact@1
- displayName: Publish Logs
- inputs:
- targetPath: $(Build.SourcesDirectory)/artifacts/log
- artifactName: 'TestBuildLogs_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)_${{ parameters.testGroup }}'
- continueOnError: true
- condition: always()
diff --git a/eng/pipelines/coreclr/templates/crossgen-comparison-job.yml b/eng/pipelines/coreclr/templates/crossgen-comparison-job.yml
index cfecf9bbd5c06f..0e537cb6c7e171 100644
--- a/eng/pipelines/coreclr/templates/crossgen-comparison-job.yml
+++ b/eng/pipelines/coreclr/templates/crossgen-comparison-job.yml
@@ -5,6 +5,7 @@ parameters:
osSubgroup: ''
container: ''
helixQueues: ''
+ runtimeVariant: ''
crossrootfsDir: ''
stagedBuild: false
variables: {}
@@ -30,6 +31,7 @@ jobs:
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
stagedBuild: ${{ parameters.stagedBuild }}
+ runtimeVariant: ${{ parameters.runtimeVariant }}
liveLibrariesBuildConfig: ${{ parameters.liveLibrariesBuildConfig }}
helixType: 'test/crossgen-comparison/'
pool: ${{ parameters.pool }}
@@ -72,7 +74,7 @@ jobs:
# Test job depends on the corresponding build job
dependsOn:
- - ${{ format('coreclr_product_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
+ - ${{ format('coreclr_{0}_product_build_{1}{2}_{3}_{4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
- ${{ format('libraries_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveLibrariesBuildConfig) }}
diff --git a/eng/pipelines/coreclr/templates/helix-queues-setup.yml b/eng/pipelines/coreclr/templates/helix-queues-setup.yml
index e35a69e6f7d5b0..5f970ca5367c8c 100644
--- a/eng/pipelines/coreclr/templates/helix-queues-setup.yml
+++ b/eng/pipelines/coreclr/templates/helix-queues-setup.yml
@@ -7,6 +7,7 @@ parameters:
container: ''
pool: ''
platform: ''
+ runtimeFlavorDisplayName: ''
jobParameters: {}
jobs:
@@ -18,6 +19,7 @@ jobs:
archType: ${{ parameters.archType }}
container: ${{ parameters.container }}
pool: ${{ parameters.pool }}
+ runtimeFlavorDisplayName: ${{ parameters.runtimeFlavorDisplayName }}
helixQueues:
# Linux arm
diff --git a/eng/pipelines/coreclr/templates/perf-job.yml b/eng/pipelines/coreclr/templates/perf-job.yml
index d71e26001c44c1..003e58f276146d 100644
--- a/eng/pipelines/coreclr/templates/perf-job.yml
+++ b/eng/pipelines/coreclr/templates/perf-job.yml
@@ -4,9 +4,11 @@ parameters:
osGroup: ''
osSubgroup: ''
container: ''
- framework: netcoreapp5.0 # Specify the appropriate framework when running release branches (ie netcoreapp3.0 for release/3.0)
+ runtimeVariant: ''
+ framework: net5.0 # Specify the appropriate framework when running release branches (ie netcoreapp3.0 for release/3.0)
liveLibrariesBuildConfig: ''
variables: {}
+ runtimeType: 'coreclr'
pool: ''
### Perf job
@@ -18,24 +20,34 @@ jobs:
- template: run-performance-job.yml
parameters:
# Compute job name from template parameters
- jobName: ${{ format('perfbuild_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- displayName: ${{ format('Performance {0}{1} {2} {3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
+ jobName: ${{ format('perfbuild_{0}{1}_{2}_{3}_{4}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig, parameters.runtimeType) }}
+ displayName: ${{ format('Performance {0}{1} {2} {3} {4}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig, parameters.runtimeType) }}
pool: ${{ parameters.pool }}
buildConfig: ${{ parameters.buildConfig }}
archType: ${{ parameters.archType }}
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
+ runtimeVariant: ${{ parameters.runtimeVariant }}
liveLibrariesBuildConfig: ${{ parameters.liveLibrariesBuildConfig }}
+ runtimeType: ${{ parameters.runtimeType }}
# Test job depends on the corresponding build job
dependsOn:
- - ${{ format('coreclr_product_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
+ - ${{ format('coreclr_{0}_product_build_{1}{2}_{3}_{4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
- ${{ format('libraries_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveLibrariesBuildConfig) }}
+ - ${{ if eq(parameters.runtimeType, 'mono') }}:
+ - ${{ format('mono_{0}_product_build_{1}{2}_{3}_{4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
${{ if eq(parameters.osGroup, 'Windows_NT') }}:
- extraSetupParameters: -CoreRootDirectory $(Build.SourcesDirectory)\artifacts\tests\coreclr\${{ parameters.osGroup }}.${{ parameters.archType }}.Release\Tests\Core_Root -Architecture ${{ parameters.archType }}
+ ${{ if eq(parameters.runtimeType, 'mono') }}:
+ extraSetupParameters: -Architecture ${{ parameters.archType }} -MonoDotnet $(Build.SourcesDirectory)\.dotnet-mono -Kind micro_mono
+ ${{ if ne(parameters.runtimeType, 'mono') }}:
+ extraSetupParameters: -CoreRootDirectory $(Build.SourcesDirectory)\artifacts\tests\coreclr\${{ parameters.osGroup }}.${{ parameters.archType }}.Release\Tests\Core_Root -Architecture ${{ parameters.archType }}
${{ if ne(parameters.osGroup, 'Windows_NT') }}:
- extraSetupParameters: --corerootdirectory $(Build.SourcesDirectory)/artifacts/tests/coreclr/${{ parameters.osGroup }}.${{ parameters.archType }}.Release/Tests/Core_Root --architecture ${{ parameters.archType }}
+ ${{ if eq(parameters.runtimeType, 'mono') }}:
+ extraSetupParameters: --architecture ${{ parameters.archType }} --monodotnet $(Build.SourcesDirectory)/.dotnet-mono --kind micro_mono
+ ${{ if ne(parameters.runtimeType, 'mono') }}:
+ extraSetupParameters: --corerootdirectory $(Build.SourcesDirectory)/artifacts/tests/coreclr/${{ parameters.osGroup }}.${{ parameters.archType }}.Release/Tests/Core_Root --architecture ${{ parameters.archType }}
variables: ${{ parameters.variables }}
@@ -44,7 +56,6 @@ jobs:
steps:
# Extra steps that will be passed to the performance template and run before sending the job to helix (all of which is done in the template)
-
# Optionally download live-built libraries
- ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
- template: /eng/pipelines/common/download-artifact-step.yml
@@ -64,7 +75,24 @@ jobs:
artifactName: '$(buildProductArtifactName)'
displayName: 'product build'
+ - ${{ if eq(parameters.runtimeType, 'mono') }}:
+ - template: /eng/pipelines/common/download-artifact-step.yml
+ parameters:
+ unpackFolder: $(librariesDownloadDir)/bin/mono/$(osGroup).$(archType).$(buildConfigUpper)
+ cleanUnpackFolder: false
+ artifactFileName: 'MonoProduct_${{ parameters.runtimeVariant }}_$(osGroup)_$(archType)_$(buildConfig)$(archiveExtension)'
+ artifactName: 'MonoProduct_${{ parameters.runtimeVariant }}_$(osGroup)_$(archType)_$(buildConfig)'
+ displayName: 'Mono runtime'
# Create Core_Root
- script: $(coreClrRepoRootDir)build-test$(scriptExt) $(buildConfig) $(archType) generatelayoutonly $(librariesOverrideArg)
displayName: Create Core_Root
+ condition: and(succeeded(), ne(variables.runtimeFlavorName, 'Mono'))
+
+ - script: "build.cmd -subset libs.pretest -configuration release -ci -arch $(archType) -testscope innerloop /p:RuntimeArtifactsPath=$(librariesDownloadDir)\\bin\\mono\\$(osGroup).$(archType).$(buildConfigUpper) /p:RuntimeFlavor=mono;xcopy $(Build.SourcesDirectory)\\artifacts\\bin\\testhost\\$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)\\* $(Build.SourcesDirectory)\\.dotnet-mono /E /I /Y;copy $(Build.SourcesDirectory)\\artifacts\\bin\\coreclr\\$(osGroup).$(archType).$(buildConfigUpper)\\corerun.exe $(Build.SourcesDirectory)\\.dotnet-mono\\shared\\Microsoft.NETCore.App\\5.0.0\\corerun.exe"
+ displayName: "Create mono dotnet (Windows)"
+ condition: and(and(succeeded(), eq(variables.runtimeFlavorName, 'Mono')), eq(variables.osGroup, 'Windows_NT'))
+
+ - script: "mkdir $(Build.SourcesDirectory)/.dotnet-mono;./build.sh -subset libs.pretest -configuration release -ci -arch $(archType) -testscope innerloop /p:RuntimeArtifactsPath=$(librariesDownloadDir)/bin/mono/$(osGroup).$(archType).$(buildConfigUpper) /p:RuntimeFlavor=mono;cp $(Build.SourcesDirectory)/artifacts/bin/testhost/$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)/* $(Build.SourcesDirectory)/.dotnet-mono -r;cp $(Build.SourcesDirectory)/artifacts/bin/coreclr/$(osGroup).$(archType).$(buildConfigUpper)/corerun $(Build.SourcesDirectory)/.dotnet-mono/shared/Microsoft.NETCore.App/5.0.0/corerun"
+ displayName: "Create mono dotnet (Linux)"
+ condition: and(and(succeeded(), eq(variables.runtimeFlavorName, 'Mono')), ne(variables.osGroup, 'Windows_NT'))
diff --git a/eng/pipelines/coreclr/templates/run-performance-job.yml b/eng/pipelines/coreclr/templates/run-performance-job.yml
index 1e37e86c8a6459..881a498fbd20de 100644
--- a/eng/pipelines/coreclr/templates/run-performance-job.yml
+++ b/eng/pipelines/coreclr/templates/run-performance-job.yml
@@ -16,6 +16,7 @@ parameters:
timeoutInMinutes: 320 # optional -- timeout for the job
enableTelemetry: false # optional -- enable for telemetry
liveLibrariesBuildConfig: '' # optional -- live-live libraries configuration to use for the run
+ runtimeType: 'coreclr'
jobs:
- template: xplat-pipeline-job.yml
@@ -103,3 +104,10 @@ jobs:
WorkItemTimeout: 4:00 # 4 hours
WorkItemDirectory: '$(WorkItemDirectory)' # WorkItemDirectory can not be empty, so we send it some docs to keep it happy
CorrelationPayloadDirectory: '$(PayloadDirectory)' # it gets checked out to a folder with shorter path than WorkItemDirectory so we can avoid file name too long exceptions
+ - task: PublishPipelineArtifact@1
+ displayName: Publish Logs
+ inputs:
+ targetPath: $(Build.SourcesDirectory)/artifacts/log
+ artifactName: 'Performance_Run_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)_${{ parameters.runtimeType }}'
+ continueOnError: true
+ condition: always()
diff --git a/eng/pipelines/coreclr/templates/test-job.yml b/eng/pipelines/coreclr/templates/test-job.yml
index e1679923841cb2..9c0cf47dd7f730 100644
--- a/eng/pipelines/coreclr/templates/test-job.yml
+++ b/eng/pipelines/coreclr/templates/test-job.yml
@@ -27,7 +27,7 @@ parameters:
jobs:
- ${{ if and(ne(parameters.corefxTests, true), eq(parameters.osSubgroup, parameters.managedTestBuildOsSubgroup), eq(parameters.osGroup, parameters.managedTestBuildOsGroup)) }}:
- - template: /eng/pipelines/coreclr/templates/build-test-job.yml
+ - template: /eng/pipelines/common/templates/runtimes/build-test-job.yml
parameters:
buildConfig: ${{ parameters.buildConfig }}
liveLibrariesBuildConfig: ${{ parameters.liveLibrariesBuildConfig }}
@@ -42,7 +42,7 @@ jobs:
variables: ${{ parameters.variables }}
pool: ${{ parameters.pool }}
-- template: /eng/pipelines/coreclr/templates/run-test-job.yml
+- template: /eng/pipelines/common/templates/runtimes/run-test-job.yml
parameters:
buildConfig: ${{ parameters.buildConfig }}
liveLibrariesBuildConfig: ${{ parameters.liveLibrariesBuildConfig }}
diff --git a/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml b/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml
index aad6f7bf69fa40..daa189d88d6da3 100644
--- a/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml
+++ b/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml
@@ -68,13 +68,21 @@ jobs:
- name: binTestsPath
value: '$(Build.SourcesDirectory)/artifacts/tests/coreclr'
-
+
+ # Build product defines what we are trying to build, either coreclr or mono
- name: buildProductArtifactName
- value: 'CoreCLRProduct_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
+ value: 'CoreCLRProduct_${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
- name: buildProductRootFolderPath
value: '$(Build.SourcesDirectory)/artifacts/bin/coreclr/$(osGroup).$(archType).$(buildConfigUpper)'
+ # We need this because both mono and coreclr build currently depends on CoreClr
+ - name: coreClrProductArtifactName
+ value: 'CoreCLRProduct_${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
+
+ - name: coreClrProductRootFolderPath
+ value: '$(Build.SourcesDirectory)/artifacts/bin/coreclr/$(osGroup).$(archType).$(buildConfigUpper)'
+
- name: corelibProductArtifactName
value: 'CoreLib_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
@@ -119,4 +127,11 @@ jobs:
- ${{ each variable in parameters.variables }}:
- ${{insert}}: ${{ variable }}
+ - name: osArg
+ value: ''
+
+ - ${{ if eq(parameters.osGroup, 'FreeBSD') }}:
+ - name: osArg
+ value: -os FreeBSD
+
steps: ${{ parameters.steps }}
diff --git a/eng/pipelines/evaluate-changed-paths.sh b/eng/pipelines/evaluate-changed-paths.sh
index 0df618957245b4..bfc5c857b64fe6 100755
--- a/eng/pipelines/evaluate-changed-paths.sh
+++ b/eng/pipelines/evaluate-changed-paths.sh
@@ -162,7 +162,7 @@ probePaths() {
if [[ "$include_path_string" == "" ]]; then
include_path_string=":$_path"
else
- include_path_string="$exclude_path_string :$_path"
+ include_path_string="$include_path_string :$_path"
fi
done
diff --git a/eng/pipelines/global-build.yml b/eng/pipelines/global-build.yml
index 8006c888ee00c2..ff9600d83fea6f 100644
--- a/eng/pipelines/global-build.yml
+++ b/eng/pipelines/global-build.yml
@@ -15,6 +15,7 @@ pr:
- docs/manpages/*
- eng/pipelines/global-build.yml
exclude:
+ - .github/*
- docs/*
- eng/pipelines/coreclr/*.*
- eng/pipelines/libraries/*.*
@@ -91,4 +92,17 @@ jobs:
jobParameters:
testGroup: innerloop
nameSuffix: Mono_Libraries
- buildArgs: -subset mono+libs /p:RuntimeFlavor=Mono
\ No newline at end of file
+ buildArgs: -subset mono+libs /p:RuntimeFlavor=Mono
+
+#
+# SourceBuild Build
+#
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/common/global-build-job.yml
+ buildConfig: release
+ platforms:
+ - Linux_x64
+ jobParameters:
+ nameSuffix: SourceBuild
+ buildArgs: /p:DotNetBuildFromSource=true
\ No newline at end of file
diff --git a/eng/pipelines/installer/installer-matrix.yml b/eng/pipelines/installer/installer-matrix.yml
index bb5e6e46f96c43..e9ae06bf267690 100644
--- a/eng/pipelines/installer/installer-matrix.yml
+++ b/eng/pipelines/installer/installer-matrix.yml
@@ -3,6 +3,7 @@ parameters:
platforms: []
jobParameters: []
buildConfig: Release
+ runtimeVariant: ''
jobs:
@@ -16,5 +17,6 @@ jobs:
platforms: ${{ parameters.platforms }}
passPlatforms: true
runtimeFlavor: ${{ parameters.runtimeFlavor }}
+ runtimeVariant: ${{ parameters.runtimeVariant }}
jobParameters:
${{ insert }}: ${{ parameters.jobParameters }}
diff --git a/eng/pipelines/installer/jobs/base-job.yml b/eng/pipelines/installer/jobs/base-job.yml
index 3a6494b0b23df9..8e9c3f1824bb20 100644
--- a/eng/pipelines/installer/jobs/base-job.yml
+++ b/eng/pipelines/installer/jobs/base-job.yml
@@ -13,6 +13,7 @@ parameters:
variables: []
name: ''
displayName: ''
+ runtimeVariant: ''
pool: ''
packageDistroList:
@@ -38,8 +39,8 @@ parameters:
platforms: []
jobs:
-- job: ${{ format('installer_{0}_{1}', coalesce(parameters.name, parameters.platform), parameters.buildConfig) }}
- displayName: ${{ format('Installer Build and Test {0} {1}', coalesce(parameters.name, parameters.platform), parameters.buildConfig) }}
+- job: ${{ format('installer_{0}_{1}_{2}_{3}', parameters.runtimeFlavor, parameters.runtimeVariant, coalesce(parameters.name, parameters.platform), parameters.buildConfig) }}
+ displayName: ${{ format('Installer Build and Test {0} {1} {2} {3}', parameters.runtimeFlavor, parameters.runtimeVariant, coalesce(parameters.name, parameters.platform), parameters.buildConfig) }}
condition: and(succeeded(), ${{ parameters.condition }})
pool: ${{ parameters.pool }}
@@ -65,13 +66,28 @@ jobs:
- name: SkipTests
value: ${{ or(
not(in(parameters.archType, 'x64', 'x86')),
- in(parameters.osGroup, 'iOS', 'tvOS', 'Android'),
+ eq(parameters.runtimeFlavor, 'mono'),
eq(parameters.isOfficialBuild, true),
ne(parameters.crossrootfsDir, '')) }}
+ - name: BuildAction
+ value: -test
+
+ - ${{ if eq(variables.SkipTests, true) }}:
+ - name: BuildAction
+ value: ''
+
- name: SignType
value: test
+ - ${{ if eq(parameters.runtimeVariant, 'llvmjit') }}:
+ - name: llvmParameter
+ value: /p:MonoEnableLLVM=true
+
+ - ${{ if eq(parameters.runtimeVariant, 'llvmaot') }}:
+ - name: llvmParameter
+ value: /p:MonoEnableLLVM=true /p:MonoBundleLLVMOptimizer=true
+
# Set up non-PR build from internal project
- ${{ if eq(parameters.isOfficialBuild, true) }}:
- name: SignType
@@ -80,10 +96,10 @@ jobs:
value: /p:OfficialBuildId=$(Build.BuildNumber)
- name: buildCommandSourcesDirectory
- ${{ if ne(parameters.osGroup, 'Linux') }}:
+ ${{ if not(in(parameters.osGroup, 'Linux', 'FreeBSD')) }}:
value: '$(Build.SourcesDirectory)/'
# This job runs within Docker containers, so Build.SourcesDirectory is not accurate.
- ${{ if eq(parameters.osGroup, 'Linux') }}:
+ ${{ if in(parameters.osGroup, 'Linux', 'FreeBSD') }}:
value: '/root/runtime/'
###
@@ -97,6 +113,8 @@ jobs:
/p:TargetArchitecture=${{ parameters.archType }}
/p:PortableBuild=true
/p:SkipTests=$(SkipTests)
+ /p:RuntimeFlavor=${{ parameters.runtimeFlavor }}
+ $(llvmParameter)
$(OfficialBuildArg)
- name: MsbuildSigningArguments
value: >-
@@ -107,7 +125,8 @@ jobs:
- name: BaseJobBuildCommand
value: >-
- build.cmd -subset installer -test -ci
+ build.cmd -subset installer -ci
+ $(BuildAction)
-configuration $(_BuildConfig)
$(LiveOverridePathArgs)
$(CommonMSBuildArgs)
@@ -119,25 +138,30 @@ jobs:
value: >-
/p:PortableBuild=true
/p:SkipTests=$(SkipTests)
+ /p:RuntimeFlavor=${{ parameters.runtimeFlavor }}
+ $(llvmParameter)
- name: BaseJobBuildCommand
value: >-
- $(Build.SourcesDirectory)/build.sh -subset installer -test -ci
+ $(Build.SourcesDirectory)/build.sh -subset installer -ci
+ $(BuildAction)
-configuration $(_BuildConfig)
$(LiveOverridePathArgs)
$(CommonMSBuildArgs)
$(OfficialBuildArg)
- - ${{ if in(parameters.osGroup, 'iOS', 'tvOS', 'Android') }}:
+ - ${{ if in(parameters.osGroup, 'iOS', 'tvOS', 'Android', 'Browser') }}:
- name: CommonMSBuildArgs
value: >-
/p:PortableBuild=true
/p:SkipTests=$(SkipTests)
+ $(llvmParameter)
- name: BaseJobBuildCommand
value: >-
- $(Build.SourcesDirectory)/build.sh -subset installer --ci --test
+ $(Build.SourcesDirectory)/build.sh -subset installer -ci
+ $(BuildAction)
-configuration $(_BuildConfig)
-os ${{ parameters.osGroup }}
-arch ${{ parameters.archType }}
@@ -146,7 +170,7 @@ jobs:
$(CommonMSBuildArgs)
$(OfficialBuildArg)
- - ${{ if eq(parameters.osGroup, 'Linux') }}:
+ - ${{ if in(parameters.osGroup, 'Linux', 'FreeBSD') }}:
# Preserve the NuGet authentication env vars into the Docker container.
# The 'NuGetAuthenticate' build step may have set these.
@@ -165,10 +189,6 @@ jobs:
-e ROOTFS_DIR=${{ parameters.crossrootfsDir }}
${{ parameters.container }}
- - ${{ if eq(parameters.name, 'FreeBSD_x64') }}:
- - name: RunArguments
- value: export DotNetBootstrapCliTarPath=/dotnet-sdk-freebsd-x64.tar &&
-
- name: BuildScript
value: ./build.sh
- name: MSBuildScript
@@ -183,8 +203,11 @@ jobs:
- name: CommonMSBuildArgs
value: >-
/p:Configuration=$(_BuildConfig)
+ /p:TargetOS=${{ parameters.osGroup }}
/p:TargetArchitecture=${{ parameters.archType }}
+ /p:RuntimeFlavor=${{ parameters.runtimeFlavor }}
$(OfficialBuildArg)
+ $(llvmParameter)
- name: _PortableBuild
value: ${{ eq(parameters.osSubgroup, '') }}
@@ -199,7 +222,8 @@ jobs:
- name: BuildArguments
value: >-
- -subset installer -test -ci
+ -subset installer -ci
+ $(BuildAction)
/p:CrossBuild=${{ ne(parameters.crossrootfsDir, '') }}
/p:PortableBuild=$(_PortableBuild)
/p:SkipTests=$(SkipTests)
@@ -281,7 +305,7 @@ jobs:
/p:RuntimeArtifactsPath=$(buildCommandSourcesDirectory)$(RuntimeDownloadPath)
/p:RuntimeConfiguration=${{ parameters.liveRuntimeBuildConfig }}
- name: RuntimeArtifactName
- value: $(runtimeFlavorName)Product_$(liveRuntimeLegName)
+ value: $(runtimeFlavorName)Product_${{ parameters.runtimeVariant }}_$(liveRuntimeLegName)
- ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
- name: liveLibrariesLegName
@@ -320,8 +344,9 @@ jobs:
- checkout
- ${{ parameters.dependsOn }}
- ${{ if ne(parameters.liveRuntimeBuildConfig, '') }}:
- - ${{ format('{0}_product_build_{1}{2}_{3}_{4}',
+ - ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}',
parameters.runtimeFlavor,
+ parameters.runtimeVariant,
parameters.osGroup,
parameters.osSubgroup,
parameters.archType,
@@ -336,7 +361,7 @@ jobs:
- libraries_build_allconfigurations_Windows_NT_x64_Release
- ${{ if eq(parameters.buildFullPlatformManifest, true) }}:
- ${{ each platform in parameters.platforms }}:
- - ${{ parameters.runtimeFlavor }}_product_build_${{ platform }}_${{ parameters.liveRuntimeBuildConfig }}
+ - ${{ parameters.runtimeFlavor }}_${{ parameters.runtimeVariant }}_product_build_${{ platform }}_${{ parameters.liveRuntimeBuildConfig }}
- libraries_build_${{ platform }}_${{ parameters.liveLibrariesBuildConfig }}
steps:
@@ -431,11 +456,26 @@ jobs:
displayName: 'Libraries artifacts (AllConfigurations)'
cleanUnpackFolder: false
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
+ - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
+ displayName: Install Build Dependencies
+
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage before Build
+
- script: $(BaseJobBuildCommand)
displayName: Build
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage after Build
+
# Only in glibc leg, we produce RPMs and Debs
- - ${{ if and(eq(parameters.platform, 'Linux_x64'), eq(parameters.osSubgroup, ''))}}:
+ - ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), eq(parameters.platform, 'Linux_x64'), eq(parameters.osSubgroup, ''))}}:
- task: CopyFiles@2
displayName: 'Copy built Portable linux-x64 binaries to staging directory'
inputs:
@@ -448,7 +488,6 @@ jobs:
# independent installers on this leg, but we need to do it somewhere.)
- template: steps/build-linux-package.yml
parameters:
- buildTraversalBuildDependencies: true
distroRid: ${{ packageBuild.imageRid }}
image: ${{ packageBuild.image }}
packageStepDescription: Runtime Deps, Runtime, Framework Packs installers
@@ -496,6 +535,8 @@ jobs:
- template: steps/upload-job-artifacts.yml
parameters:
name: ${{ coalesce(parameters.name, parameters.platform) }}
+ runtimeFlavor: ${{ parameters.runtimeFlavor }}
+ runtimeVariant: ${{ parameters.runtimeVariant }}
skipTests: $(SkipTests)
isOfficialBuild: ${{ eq(parameters.isOfficialBuild, true) }}
diff --git a/eng/pipelines/installer/jobs/steps/build-linux-package.yml b/eng/pipelines/installer/jobs/steps/build-linux-package.yml
index e9e342b618c1e8..e0129ccff6317c 100644
--- a/eng/pipelines/installer/jobs/steps/build-linux-package.yml
+++ b/eng/pipelines/installer/jobs/steps/build-linux-package.yml
@@ -1,5 +1,4 @@
parameters:
- buildTraversalBuildDependencies: false
distroRid: null
image: null
outputRidArg: ''
@@ -8,18 +7,6 @@ parameters:
subsetArg: ''
steps:
-- ${{ if eq(parameters.buildTraversalBuildDependencies, true) }}:
- - script: |
- set -x
- df -h
- $(DockerRunMSBuild) ${{ parameters.image }} $(MSBuildScript) \
- --ci \
- /root/runtime/tools-local/tasks/installer.tasks/installer.tasks.csproj \
- /t:Restore /t:Build /t:CreateHostMachineInfoFile \
- $(CommonMSBuildArgs) \
- /bl:msbuild.${{ parameters.distroRid }}.traversaldependencies.binlog
- displayName: ====== Build traversal build dependencies - ${{ parameters.distroRid }}
-
- script: |
set -x
df -h
@@ -32,5 +19,6 @@ steps:
${{ parameters.packagingArgs }} \
$(CommonMSBuildArgs) \
${{ parameters.outputRidArg }} \
+ $(LiveOverridePathArgs) \
/bl:artifacts/log/$(_BuildConfig)/msbuild.${{ parameters.distroRid }}.installers.binlog
displayName: Package ${{ parameters.packageStepDescription }} - ${{ parameters.distroRid }}
diff --git a/eng/pipelines/installer/jobs/steps/upload-job-artifacts.yml b/eng/pipelines/installer/jobs/steps/upload-job-artifacts.yml
index 05232836e569c5..884ca0177e7f81 100644
--- a/eng/pipelines/installer/jobs/steps/upload-job-artifacts.yml
+++ b/eng/pipelines/installer/jobs/steps/upload-job-artifacts.yml
@@ -1,6 +1,7 @@
parameters:
name: ''
-
+ runtimeFlavor: 'coreclr'
+ runtimeVariant: ''
isOfficialBuild: false
steps:
@@ -17,7 +18,7 @@ steps:
testResultsFiles: '*.xml'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
mergeTestResults: true
- testRunTitle: Installer-${{ parameters.name }}-$(_BuildConfig)
+ testRunTitle: Installer-${{ parameters.runtimeFlavor }}-${{ parameters.name }}-$(_BuildConfig)
continueOnError: true
condition: eq(variables.SkipTests, false)
@@ -37,6 +38,6 @@ steps:
displayName: Publish BuildLogs
inputs:
targetPath: '$(Build.StagingDirectory)/BuildLogs'
- artifactName: Installer-Logs-${{ parameters.name }}-$(_BuildConfig)
+ artifactName: Installer-Logs-${{ parameters.runtimeFlavor }}-${{ parameters.runtimeVariant }}-${{ parameters.name }}-$(_BuildConfig)
continueOnError: true
condition: succeededOrFailed()
diff --git a/eng/pipelines/libraries/base-job.yml b/eng/pipelines/libraries/base-job.yml
index df6f5e31a73468..b1a801f9657897 100644
--- a/eng/pipelines/libraries/base-job.yml
+++ b/eng/pipelines/libraries/base-job.yml
@@ -5,8 +5,8 @@ parameters:
osSubgroup: ''
crossrootfsDir: ''
framework: ''
- isOfficialBuild: false
isOfficialAllConfigurations: false
+ isSourceBuild: false
liveRuntimeBuildConfig: ''
runtimeFlavor: 'coreclr'
timeoutInMinutes: 150
@@ -54,7 +54,7 @@ jobs:
- ${{ if ne(parameters.testScope, '') }}:
- _testScopeArg: -testscope ${{ parameters.testScope }}
- - ${{ if eq(parameters.osGroup, 'Linux') }}:
+ - ${{ if in(parameters.osGroup, 'Linux', 'FreeBSD') }}:
- _crossBuildPropertyArg: /p:CrossBuild=${{ ne(parameters.crossrootfsDir, '') }}
- ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubGroup, '_musl')) }}:
@@ -63,20 +63,8 @@ jobs:
- ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubGroup, ''), eq(parameters.archType, 'arm')) }}:
- _runtimeOSArg: /p:RuntimeOS=ubuntu.16.04
- # force a value for OS when cross-building WebAssembly
- - ${{ if eq(parameters.osGroup, 'WebAssembly') }}:
- - _runtimeOSArg: -os ${{ parameters.osGroup }}
-
- # force a value for OS when cross-building tvOS on OSX
- - ${{ if eq(parameters.osGroup, 'tvOS') }}:
- - _runtimeOSArg: -os ${{ parameters.osGroup }}
-
- # force a value for OS when cross-building iOS on OSX
- - ${{ if eq(parameters.osGroup, 'iOS') }}:
- - _runtimeOSArg: -os ${{ parameters.osGroup }}
-
- # force a value for OS when cross-building Android on Linux
- - ${{ if eq(parameters.osGroup, 'Android') }}:
+ # force a value for OS when cross-building
+ - ${{ if in(parameters.osGroup, 'Browser', 'iOS', 'tvOS', 'Android', 'FreeBSD') }}:
- _runtimeOSArg: -os ${{ parameters.osGroup }}
- ${{ if ne(parameters.framework, '') }}:
@@ -103,7 +91,7 @@ jobs:
- _runtimeConfigurationArg: -rc ${{ parameters.liveRuntimeBuildConfig }}
# Download full product dependencies for mono or test
- ${{ if or(ne(parameters.runtimeFlavor, 'coreclr'), ne(parameters.testScope, '')) }}:
- - _runtimeArtifactName: '$(runtimeFlavorName)Product_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.liveRuntimeBuildConfig }}'
+ - _runtimeArtifactName: '$(runtimeFlavorName)Product_${{ parameters.runtimeVariant}}_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.liveRuntimeBuildConfig }}'
- _runtimeArtifactsPathArg: ' /p:RuntimeArtifactsPath=$(_runtimeDownloadPath)'
- _testRunNamePrefixSuffix: $(runtimeFlavorName)_${{ parameters.liveRuntimeBuildConfig }}
diff --git a/eng/pipelines/libraries/build-job.yml b/eng/pipelines/libraries/build-job.yml
index c541e688803d21..f33f413f457eef 100644
--- a/eng/pipelines/libraries/build-job.yml
+++ b/eng/pipelines/libraries/build-job.yml
@@ -7,6 +7,7 @@ parameters:
framework: ''
isOfficialBuild: false
isOfficialAllConfigurations: false
+ runtimeVariant: ''
# When set to a non-empty value (Debug / Release), it determines the runtime's
# build configuration to use for building libraries and tests. Setting this
@@ -43,6 +44,7 @@ jobs:
container: ${{ parameters.container }}
condition: ${{ parameters.condition }}
pool: ${{ parameters.pool }}
+ runtimeVariant: ${{ parameters.runtimeVariant }}
testScope: ${{ parameters.testScope }}
name: build
displayName: 'Build'
@@ -51,13 +53,13 @@ jobs:
dependsOn:
# Use full product dependency for non-coreclr and test builds
- ${{ if or(ne(parameters.runtimeFlavor, 'coreclr'), ne(parameters.testScope, '')) }}:
- - ${{ format('{0}_product_build_{1}{2}_{3}_{4}', parameters.runtimeFlavor, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveRuntimeBuildConfig) }}
+ - ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}', parameters.runtimeFlavor, parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveRuntimeBuildConfig) }}
variables:
- _subset: libs
- _additionalBuildArguments: ''
- ${{ parameters.variables }}
- - ${{ if eq(parameters.osGroup, 'WebAssembly') }}:
+ - ${{ if eq(parameters.osGroup, 'Browser') }}:
- EMSDK_PATH: /usr/local/emscripten
# for coreclr library builds (when not testing) build corelib as well.
- ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), eq(parameters.testScope, '')) }}:
@@ -70,24 +72,30 @@ jobs:
- ${{ parameters.variables }}
steps:
- - ${{ if eq(parameters.osGroup, 'OSX') }}:
- - script: |
- brew install pkgconfig icu4c openssl
- brew link --force icu4c
- ln -s /usr/local/opt/openssl/lib/pkgconfig/libcrypto.pc /usr/local/lib/pkgconfig/
- ln -s /usr/local/opt/openssl/lib/pkgconfig/libssl.pc /usr/local/lib/pkgconfig/
- ln -s /usr/local/opt/openssl/lib/pkgconfig/openssl.pc /usr/local/lib/pkgconfig/
- displayName: Install Build Dependencies
-
- ${{ if eq(parameters.isOfficialBuild, true) }}:
- template: /eng/pipelines/common/restore-internal-tools.yml
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
+ - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
+ displayName: Install Build Dependencies
+
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage before Build
+
- script: $(_buildScript)
-subset $(_subset)
$(_buildArguments)
$(_additionalBuildArguments)
displayName: Restore and Build Product
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage after Build
+
- ${{ if eq(parameters.runTests, false) }}:
- ${{ if ne(parameters.isOfficialBuild, true) }}:
- task: CopyFiles@2
@@ -145,12 +153,6 @@ jobs:
targetFolder: $(Build.ArtifactStagingDirectory)/artifacts/packages
condition: and(succeeded(), eq(variables['_librariesBuildProducedPackages'], true))
- - task: CopyFiles@2
- displayName: Prepare tmp assets to publish
- inputs:
- sourceFolder: $(Build.SourcesDirectory)/artifacts/tmp
- targetFolder: $(Build.ArtifactStagingDirectory)/artifacts/tmp
-
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.ArtifactStagingDirectory)/artifacts
diff --git a/eng/pipelines/libraries/build-test-job.yml b/eng/pipelines/libraries/build-test-job.yml
index 82da2388581bf7..0ce715add47c9d 100644
--- a/eng/pipelines/libraries/build-test-job.yml
+++ b/eng/pipelines/libraries/build-test-job.yml
@@ -7,6 +7,7 @@ parameters:
isOfficialBuild: false
liveRuntimeBuildConfig: ''
runtimeFlavor: 'coreclr'
+ runtimeVariant: ''
timeoutInMinutes: 150
container: ''
publishTestArtifacs: true
@@ -29,6 +30,7 @@ jobs:
liveRuntimeBuildConfig: ${{ parameters.liveRuntimeBuildConfig }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
container: ${{ parameters.container }}
+ runtimeVariant: ${{ parameters.runtimeVariant }}
pool: ${{ parameters.pool }}
testScope: ${{ parameters.testScope }}
name: test_build
@@ -38,7 +40,7 @@ jobs:
- ${{ format('libraries_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
# Libraries Test also depends on Product, now that the libraries build only depends on corelib
- ${{ if ne(parameters.liveRuntimeBuildConfig, '') }}:
- - ${{ format('{0}_product_build_{1}{2}_{3}_{4}', parameters.runtimeFlavor, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveRuntimeBuildConfig) }}
+ - ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}', parameters.runtimeFlavor, parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveRuntimeBuildConfig) }}
variables:
- librariesTestsArtifactName: ${{ format('libraries_test_assets_{0}_{1}_{2}', parameters.osGroup, parameters.archType, parameters.buildConfig) }}
@@ -55,12 +57,24 @@ jobs:
unpackFolder: $(Build.SourcesDirectory)/artifacts
cleanUnpackFolder: false
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage before Build
+
- script: $(_buildScript)
-subset libs.pretest+libs.tests
$(_buildArguments)
$(_archiveTestsParameter)
displayName: Restore and Build
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage after Build
+
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.SourcesDirectory)/artifacts/helix
diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml
index 10b99697d0b734..7e450f8f4c0d00 100644
--- a/eng/pipelines/libraries/helix-queues-setup.yml
+++ b/eng/pipelines/libraries/helix-queues-setup.yml
@@ -7,6 +7,7 @@ parameters:
container: ''
pool: ''
platform: ''
+ runtimeFlavorDisplayName: ''
jobParameters: {}
jobs:
@@ -18,6 +19,7 @@ jobs:
archType: ${{ parameters.archType }}
container: ${{ parameters.container }}
pool: ${{ parameters.pool }}
+ runtimeFlavorDisplayName: ${{ parameters.runtimeFlavorDisplayName }}
helixQueues:
# Linux arm
@@ -56,8 +58,8 @@ jobs:
- Ubuntu.1804.Amd64.Open
- SLES.12.Amd64.Open
- SLES.15.Amd64.Open
- - (Fedora.29.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-29-helix-a12566d-20191210224553
- (Fedora.30.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-30-helix-4f8cef7-20200121150022
+ - (Fedora.32.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-32-helix-20200512010618-efb9f14
- (Ubuntu.1910.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-19.10-helix-amd64-cfcfd50-20191030180623
- (Debian.10.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64-bfcd90a-20200121150006
- ${{ if eq(parameters.jobParameters.isFullMatrix, false) }}:
@@ -67,7 +69,7 @@ jobs:
- Ubuntu.1604.Amd64.Open
- Ubuntu.1804.Amd64.Open
- SLES.15.Amd64.Open
- - (Fedora.29.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-29-helix-a12566d-20191210224553
+ - (Fedora.30.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-30-helix-4f8cef7-20200121150022
# OSX x64
- ${{ if eq(parameters.platform, 'OSX_x64') }}:
@@ -86,14 +88,16 @@ jobs:
# netcoreapp
- ${{ if notIn(parameters.jobParameters.framework, 'allConfigurations', 'net472') }}:
- ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}:
- - Windows.7.Amd64.Open
+ # Bring back once: https://github.com/dotnet/runtime/issues/35689 is fixed
+ # - Windows.7.Amd64.Open
- Windows.81.Amd64.Open
- Windows.10.Amd64.ServerRS5.Open
- Windows.10.Amd64.Server19H1.Open
- ${{ if ne(parameters.jobParameters.runtimeFlavor, 'mono') }}:
- (Windows.Nano.1809.Amd64.Open)windows.10.amd64.serverrs5.open@mcr.microsoft.com/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504
- ${{ if eq(parameters.jobParameters.isFullMatrix, false) }}:
- - Windows.7.Amd64.Open
+ # Bring back once: https://github.com/dotnet/runtime/issues/35689 is fixed
+ # - Windows.7.Amd64.Open
- Windows.81.Amd64.Open
- Windows.10.Amd64.Server19H1.ES.Open
- ${{ if ne(parameters.jobParameters.runtimeFlavor, 'mono') }}:
@@ -112,22 +116,30 @@ jobs:
# netcoreapp
- ${{ if notIn(parameters.jobParameters.framework, 'allConfigurations', 'net472') }}:
- ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}:
- # TODO: Reopen when https://github.com/dotnet/runtime/issues/32231 is fixed
- #- Windows.7.Amd64.Open
- #- Windows.81.Amd64.Open
+ - Windows.7.Amd64.Open
+ # Bring back once: https://github.com/dotnet/runtime/issues/35689 is fixed
+ # - Windows.81.Amd64.Open
- Windows.10.Amd64.ServerRS5.Open
- Windows.10.Amd64.Server19H1.Open
- ${{ if eq(parameters.jobParameters.isFullMatrix, false) }}:
- ${{ if eq(parameters.jobParameters.buildConfig, 'Release') }}:
- # TODO: Reopen when https://github.com/dotnet/runtime/issues/32231 is fixed
- #- Windows.7.Amd64.Open
- #- Windows.81.Amd64.Open
- Windows.10.Amd64.Server19H1.ES.Open
- ${{ if eq(parameters.jobParameters.buildConfig, 'Debug') }}:
+ - Windows.7.Amd64.Open
+ # Bring back once: https://github.com/dotnet/runtime/issues/35689 is fixed
+ # - Windows.81.Amd64.Open
- Windows.10.Amd64.Server19H1.Open
# NET472
- ${{ if eq(parameters.jobParameters.framework, 'net472') }}:
- Windows.10.Amd64.Client19H1.Open
+ # Windows_NT arm
+ - ${{ if eq(parameters.platform, 'Windows_NT_arm') }}:
+ - Windows.10.Arm64v8.Open
+
+ # Windows_NT arm64
+ - ${{ if eq(parameters.platform, 'Windows_NT_arm64') }}:
+ - Windows.10.Arm64.Open
+
${{ insert }}: ${{ parameters.jobParameters }}
diff --git a/eng/pipelines/libraries/run-test-job.yml b/eng/pipelines/libraries/run-test-job.yml
index 7d982c09e72024..053d7f90044ae1 100644
--- a/eng/pipelines/libraries/run-test-job.yml
+++ b/eng/pipelines/libraries/run-test-job.yml
@@ -9,6 +9,7 @@ parameters:
runtimeFlavor: 'coreclr'
timeoutInMinutes: 150
pool: ''
+ runtimeVariant: ''
testScope: ''
helixQueues: []
dependsOnTestBuildConfiguration: Debug
@@ -27,6 +28,7 @@ jobs:
isOfficialBuild: ${{ parameters.isOfficialBuild }}
liveRuntimeBuildConfig: ${{ parameters.liveRuntimeBuildConfig }}
runtimeFlavor: ${{ parameters.runtimeFlavor }}
+ runtimeVariant: ${{ parameters.runtimeVariant }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
container: '' # we just send to helix, no need to use a container.
condition: ${{ parameters.condition }}
@@ -47,7 +49,7 @@ jobs:
- ${{ format('libraries_build_{0}_{1}{2}_{3}_{4}', parameters.framework, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- ${{ format('libraries_test_build_{0}_{1}_{2}_{3}', parameters.framework, parameters.osGroup, parameters.dependsOnTestArchitecture, parameters.dependsOnTestBuildConfiguration) }}
- ${{ if ne(parameters.liveRuntimeBuildConfig, '') }}:
- - ${{ format('{0}_product_build_{1}{2}_{3}_{4}', parameters.runtimeFlavor, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveRuntimeBuildConfig) }}
+ - ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}', parameters.runtimeFlavor, parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveRuntimeBuildConfig) }}
variables:
- librariesTestsArtifactName: ${{ format('libraries_test_assets_{0}_{1}_{2}', parameters.osGroup, parameters.dependsOnTestArchitecture, parameters.dependsOnTestBuildConfiguration) }}
diff --git a/eng/pipelines/libraries/stress/http.yml b/eng/pipelines/libraries/stress/http.yml
index 9c34a658bfe0a6..2d7dbb6860b2b4 100644
--- a/eng/pipelines/libraries/stress/http.yml
+++ b/eng/pipelines/libraries/stress/http.yml
@@ -56,7 +56,7 @@ jobs:
steps:
- checkout: self
clean: true
- fetchDepth: 1
+ fetchDepth: 5
lfs: false
- pwsh: |
diff --git a/eng/pipelines/libraries/stress/ssl.yml b/eng/pipelines/libraries/stress/ssl.yml
index 11e3f0dba5f234..88e20efce027a1 100644
--- a/eng/pipelines/libraries/stress/ssl.yml
+++ b/eng/pipelines/libraries/stress/ssl.yml
@@ -57,7 +57,7 @@ jobs:
steps:
- checkout: self
clean: true
- fetchDepth: 1
+ fetchDepth: 5
lfs: false
- pwsh: |
diff --git a/eng/pipelines/mono/templates/build-job.yml b/eng/pipelines/mono/templates/build-job.yml
index 40f952dac00522..901bab9a0f6609 100644
--- a/eng/pipelines/mono/templates/build-job.yml
+++ b/eng/pipelines/mono/templates/build-job.yml
@@ -9,7 +9,7 @@ parameters:
variables: {}
pool: ''
condition: true
- llvm: false
+ runtimeVariant: ''
isOfficialBuild: false
crossrootfsDir: ''
@@ -24,20 +24,13 @@ jobs:
helixType: 'build/product/'
enableMicrobuild: true
pool: ${{ parameters.pool }}
- llvm: ${{ parameters.llvm }}
+ runtimeVariant: ${{ parameters.runtimeVariant }}
crossrootfsDir: ${{ parameters.crossroofsDir }}
condition: ${{ parameters.condition }}
# Compute job name from template parameters
- ${{ if ne(parameters.llvm, true) }}:
- name: ${{ format('mono_product_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- displayName: ${{ format('Mono Product Build {0}{1} {2} {3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
-
- # if LLVM enabled, set a variable we can consume
- ${{ if eq(parameters.llvm, true) }}:
- name: ${{ format('mono_llvm_product_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- displayName: ${{ format('Mono LLVM Product Build {0}{1} {2} {3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
-
+ name: ${{ format('mono_{0}_product_build_{1}{2}_{3}_{4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
+ displayName: ${{ format('Mono {0} Product Build {1}{2} {3} {4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
# Run all steps in the container.
# Note that the containers are defined in platform-matrix.yml
@@ -74,13 +67,19 @@ jobs:
- ${{ if eq(parameters.osGroup, 'Android') }}:
- name: osOverride
value: -os Android
- - ${{ if eq(parameters.osGroup, 'WebAssembly') }}:
+ - ${{ if eq(parameters.osGroup, 'Browser') }}:
- name: EMSDK_PATH
value: /usr/local/emscripten
- name: archType
value: wasm
- name: osOverride
- value: '-os WebAssembly'
+ value: '-os Browser'
+ - ${{ if eq(parameters.runtimeVariant, 'llvmjit') }}:
+ - name: llvmParameter
+ value: /p:MonoEnableLLVM=true /p:MonoBundleLLVMOptimizer=false
+ - ${{ if eq(parameters.runtimeVariant, 'llvmaot') }}:
+ - name: llvmParameter
+ value: /p:MonoEnableLLVM=true /p:MonoBundleLLVMOptimizer=true
- ${{ parameters.variables }}
steps:
@@ -90,21 +89,33 @@ jobs:
# and FreeBSD builds use a build agent with dependencies
# preinstalled, so we only need this step for OSX and Windows.
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
- - script: sh $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
+ - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup)
displayName: Install native dependencies
- ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
# Necessary to install python
- script: $(Build.SourcesDirectory)\eng\common\init-tools-native.cmd -InstallDirectory $(Build.SourcesDirectory)\native-tools -Force
displayName: Install native dependencies
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage before Build
+
# Build
- ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
- - script: ./build$(scriptExt) -subset mono -c $(buildConfig) -arch $(archType) $(osOverride) -ci /p:MonoEnableLLVM=${{ parameters.llvm }}
+ - script: ./build$(scriptExt) -subset mono -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(llvmParameter)
displayName: Build product
- ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
- - script: build$(scriptExt) -subset mono -c $(buildConfig) -arch $(archType) $(osOverride) -ci /p:MonoEnableLLVM=${{ parameters.llvm }}
+ - script: build$(scriptExt) -subset mono -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(llvmParameter)
displayName: Build product
+ - ${{ if in(parameters.osGroup, 'OSX', 'iOS','tvOS') }}:
+ - script: |
+ du -sh $(Build.SourcesDirectory)/*
+ df -h
+ displayName: Disk Usage after Build
+
# Publish product output directory for consumption by tests.
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
@@ -117,15 +128,15 @@ jobs:
displayName: 'product build'
# Build packages
- - ${{ if and(ne(parameters.llvm, true), ne(parameters.osGroup, 'Windows_NT')) }}:
- - script: ./build$(scriptExt) -subset mono -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) /p:MonoEnableLLVM=${{ parameters.llvm }} -pack $(OutputRidArg)
+ - ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
+ - script: ./build$(scriptExt) -subset mono -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(llvmParameter) -pack $(OutputRidArg)
displayName: Build nupkg
- - ${{ if and(ne(parameters.llvm, true), eq(parameters.osGroup, 'Windows_NT')) }}:
- - script: build$(scriptExt) -subset mono -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) /p:MonoEnableLLVM=${{ parameters.llvm }} -pack $(OutputRidArg)
+ - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
+ - script: build$(scriptExt) -subset mono -c $(buildConfig) -arch $(archType) $(osOverride) -ci $(officialBuildIdArg) $(llvmParameter) -pack $(OutputRidArg)
displayName: Build nupkg
# Publish official build
- - ${{ if and(ne(parameters.llvm, true), eq(parameters.publishToBlobFeed, 'true')) }}:
+ - ${{ if eq(parameters.publishToBlobFeed, 'true') }}:
- ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
- script: $(Build.SourcesDirectory)/eng/common/build.sh --ci --restore --publish --configuration $(_BuildConfig) /p:DotNetPublishUsingPipelines=true /p:DotNetPublishToBlobFeed=true /p:DotNetPublishBlobFeedUrl=$(dotnetfeedUrl) /p:DotNetPublishBlobFeedKey=$(dotnetfeedPAT) /p:Configuration=$(_BuildConfig) /p:TargetArchitecture=$(archType) /p:TargetOS=$(osGroup) /p:OSIdentifier=$(osGroup)$(osSubgroup) /bl:"$(Build.SourcesDirectory)/artifacts/log/publish-pkgs.binlog" --projects $(Build.SourcesDirectory)/eng/empty.csproj
displayName: Publish packages to blob feed
@@ -148,9 +159,6 @@ jobs:
displayName: Publish Logs
inputs:
targetPath: $(Build.SourcesDirectory)/artifacts/log
- ${{ if ne(parameters.llvm, true) }}:
- artifactName: 'BuildLogs_Mono_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
- ${{ if eq(parameters.llvm, true) }}:
- artifactName: 'BuildLogs_Mono_LLVM_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
+ artifactName: 'BuildLogs_Mono_${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
continueOnError: true
condition: always()
diff --git a/eng/pipelines/mono/templates/xplat-job.yml b/eng/pipelines/mono/templates/xplat-job.yml
index 2cd61dc7e7f3e4..899f36ef85ad81 100644
--- a/eng/pipelines/mono/templates/xplat-job.yml
+++ b/eng/pipelines/mono/templates/xplat-job.yml
@@ -90,6 +90,12 @@ jobs:
- name: osSubgroup
value: ${{ parameters.osSubgroup }}
+ - name: coreClrRepoRoot
+ value: '$(Build.SourcesDirectory)/src/coreclr'
+
+ - name: coreClrRepoRootDir
+ value: '$(coreClrRepoRoot)$(dir)'
+
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- name: _HelixSource
value: official/dotnet/runtime/$(Build.SourceBranch)
diff --git a/eng/pipelines/mono/templates/xplat-pipeline-job.yml b/eng/pipelines/mono/templates/xplat-pipeline-job.yml
index a0d65845203929..0701073c669c61 100644
--- a/eng/pipelines/mono/templates/xplat-pipeline-job.yml
+++ b/eng/pipelines/mono/templates/xplat-pipeline-job.yml
@@ -9,7 +9,8 @@ parameters:
liveLibrariesBuildConfig: ''
strategy: ''
pool: ''
- llvm: false
+ runtimeVariant: ''
+ liveRuntimeBuildConfig: 'release'
# arcade-specific parameters
condition: true
@@ -34,7 +35,7 @@ jobs:
container: ${{ parameters.container }}
strategy: ${{ parameters.strategy }}
pool: ${{ parameters.pool }}
- llvm: ${{ parameters.llvm }}
+ runtimeVariant: ${{ parameters.runtimeVariant }}
# arcade-specific parameters
condition: and(succeeded(), ${{ parameters.condition }})
@@ -46,15 +47,50 @@ jobs:
gatherAssetManifests: ${{ parameters.gatherAssetManifests }}
variables:
+ - name: coreClrProductArtifactName
+ value: 'CoreCLRProduct_${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_${{ parameters.liveRuntimeBuildConfig }}'
+
+ - name: coreClrProductRootFolderPath
+ value: '$(Build.SourcesDirectory)/artifacts/bin/coreclr/$(osGroup).$(archType).$(liveRuntimeBuildConfigUpper)'
+
- name: buildProductArtifactName
- ${{ if ne(parameters.llvm, true) }}:
- value: 'MonoProduct_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
- ${{ if eq(parameters.llvm, true) }}:
- value: 'MonoProduct_LLVM_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
+ value: 'MonoProduct_${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
+
+ - name: binTestsPath
+ value: '$(Build.SourcesDirectory)/artifacts/tests/coreclr'
- name: buildProductRootFolderPath
value: '$(Build.SourcesDirectory)/artifacts/bin/mono/$(osGroup).$(archType).$(buildConfigUpper)'
+ - name: managedTestArtifactRootFolderPath
+ value: '$(binTestsPath)/$(osGroup).$(archType).$(buildConfigUpper)'
+
+ - name: managedTestArtifactName
+ value: 'CoreCLRManagedTestArtifacts_${{ parameters.managedTestBuildOsGroup }}${{ parameters.managedTestBuildOsSubgroup }}_$(archType)_$(buildConfig)'
+
+ - name: microsoftNetSdkIlFolderPath
+ value: '$(Build.SourcesDirectory)/.packages/microsoft.net.sdk.il'
+
+ - name: microsoftNetSdkIlArtifactName
+ value: 'MicrosoftNetSdkIlPackage_${{ parameters.managedTestBuildOsGroup }}${{ parameters.managedTestBuildOsSubgroup }}_$(archType)_$(buildConfig)'
+
+ - name: monoRepoRoot
+ value: '$(Build.SourcesDirectory)/src/mono'
+
+ - name: nativeTestArtifactName
+ value: 'CoreCLRNativeTestArtifacts_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
+
+ - name: nativeTestArtifactRootFolderPath
+ value: '$(binTestsPath)/obj/$(osGroup).$(archType).$(buildConfigUpper)'
+
+ - name: liveRuntimeBuildConfigUpper
+ ${{ if eq(parameters.liveRuntimeBuildConfig, 'release') }}:
+ value: 'Release'
+ ${{ if eq(parameters.liveRuntimeBuildConfig, 'checked') }}:
+ value: 'Checked'
+ ${{ if eq(parameters.liveRuntimeBuildConfig, 'debug') }}:
+ value: 'Debug'
+
- librariesBuildArtifactName: ''
- librariesOverrideArg: ''
- librariesDownloadDir: ''
diff --git a/eng/pipelines/official/stages/publish.yml b/eng/pipelines/official/stages/publish.yml
index 260931d01cb438..48171955c3709d 100644
--- a/eng/pipelines/official/stages/publish.yml
+++ b/eng/pipelines/official/stages/publish.yml
@@ -18,8 +18,7 @@ stages:
publishUsingPipelines: true
dependsOn: PrepareSignedArtifacts
pool:
- name: NetCoreInternal-Pool
- queue: buildpool.windows.10.amd64.vs2017
+ vmImage: vs2017-win2016
# Stages-based publishing entry point
- template: /eng/common/templates/post-build/post-build.yml
diff --git a/eng/pipelines/runtime-official.yml b/eng/pipelines/runtime-official.yml
index e2cd3a2d67d962..45715a7bf11832 100644
--- a/eng/pipelines/runtime-official.yml
+++ b/eng/pipelines/runtime-official.yml
@@ -9,6 +9,7 @@ trigger:
- '*'
- docs/manpages/*
exclude:
+ - .github/*
- docs/*
- CODE-OF-CONDUCT.md
- CONTRIBUTING.md
@@ -76,13 +77,15 @@ stages:
- tvOS_x64
- tvOS_arm64
- iOS_x64
- # - iOS_arm # https://github.com/dotnet/runtime/issues/34465
+ - iOS_x86
+ - iOS_arm
- iOS_arm64
- OSX_x64
- Linux_x64
- Linux_arm
- Linux_arm64
- Linux_musl_x64
+ - Browser_wasm
# - Linux_musl_arm64
- Windows_NT_x64
# - Windows_NT_x86
@@ -91,6 +94,49 @@ stages:
jobParameters:
isOfficialBuild: ${{ variables.isOfficialBuild }}
+ #
+ # Build Mono LLVM release
+ #
+ - template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/mono/templates/build-job.yml
+ runtimeFlavor: mono
+ buildConfig: release
+ platforms:
+ - OSX_x64
+ - Linux_x64
+ # - Linux_arm
+ # - Linux_arm64
+ # - Linux_musl_x64
+ # - Linux_musl_arm64
+ # - Windows_NT_x64
+ # - Windows_NT_x86
+ # - Windows_NT_arm
+ # - Windows_NT_arm64
+ jobParameters:
+ runtimeVariant: LLVMJIT
+ isOfficialBuild: ${{ variables.isOfficialBuild }}
+
+ - template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/mono/templates/build-job.yml
+ runtimeFlavor: mono
+ buildConfig: release
+ platforms:
+ - OSX_x64
+ - Linux_x64
+ # - Linux_arm
+ # - Linux_arm64
+ # - Linux_musl_x64
+ # - Linux_musl_arm64
+ # - Windows_NT_x64
+ # - Windows_NT_x86
+ # - Windows_NT_arm
+ # - Windows_NT_arm64
+ jobParameters:
+ runtimeVariant: LLVMAOT
+ isOfficialBuild: ${{ variables.isOfficialBuild }}
+
#
# Build libraries using live CoreLib from CoreCLR
#
@@ -129,8 +175,10 @@ stages:
- tvOS_x64
- tvOS_arm64
- iOS_x64
- # - iOS_arm # https://github.com/dotnet/runtime/issues/34465
+ - iOS_x86
+ - iOS_arm
- iOS_arm64
+ - Browser_wasm
jobParameters:
isOfficialBuild: ${{ variables.isOfficialBuild }}
liveRuntimeBuildConfig: release
@@ -186,15 +234,50 @@ stages:
buildFullPlatformManifest: false
runtimeFlavor: mono
platforms:
+ - OSX_x64
+ - Linux_x64
- tvOS_x64
- tvOS_arm64
- # - iOS_arm # https://github.com/dotnet/runtime/issues/34465
+ - iOS_arm
- iOS_arm64
- iOS_x64
+ - iOS_x86
- Android_arm
- Android_arm64
- Android_x64
- Android_x86
+ - Browser_wasm
+
+ #
+ # Installer Build for platforms using Mono
+ #
+ - template: /eng/pipelines/installer/installer-matrix.yml
+ parameters:
+ jobParameters:
+ liveRuntimeBuildConfig: release
+ liveLibrariesBuildConfig: Release
+ isOfficialBuild: ${{ variables.isOfficialBuild }}
+ useOfficialAllConfigurations: false
+ buildFullPlatformManifest: false
+ runtimeVariant: LLVMJIT
+ runtimeFlavor: mono
+ platforms:
+ - OSX_x64
+ - Linux_x64
+
+ - template: /eng/pipelines/installer/installer-matrix.yml
+ parameters:
+ jobParameters:
+ liveRuntimeBuildConfig: release
+ liveLibrariesBuildConfig: Release
+ isOfficialBuild: ${{ variables.isOfficialBuild }}
+ useOfficialAllConfigurations: false
+ buildFullPlatformManifest: false
+ runtimeVariant: LLVMAOT
+ runtimeFlavor: mono
+ platforms:
+ - OSX_x64
+ - Linux_x64
- ${{ if eq(variables.isOfficialBuild, true) }}:
- template: /eng/pipelines/official/stages/publish.yml
diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml
index 9a7b6d8ef5ea41..8d69c7586b860d 100644
--- a/eng/pipelines/runtime.yml
+++ b/eng/pipelines/runtime.yml
@@ -7,6 +7,7 @@ trigger:
branches:
include:
- master
+ - dev/infrastructure
- release/*.*
paths:
include:
@@ -14,6 +15,7 @@ trigger:
- docs/manpages/*
exclude:
- eng/Version.Details.xml
+ - .github/*
- docs/*
- CODE-OF-CONDUCT.md
- CONTRIBUTING.md
@@ -27,6 +29,7 @@ pr:
branches:
include:
- master
+ - dev/infrastructure
- release/*.*
paths:
include:
@@ -34,6 +37,7 @@ pr:
- docs/manpages/*
exclude:
- eng/Version.Details.xml
+ - .github/*
- docs/*
- CODE-OF-CONDUCT.md
- CONTRIBUTING.md
@@ -74,6 +78,8 @@ jobs:
- subset: mono
include:
- src/libraries/System.Private.CoreLib/*
+ - src/libraries/Native/Unix/System.Globalization.Native/*
+ - src/libraries/Native/Unix/Common/*
exclude:
- eng/Version.Details.xml
- '*.md'
@@ -101,6 +107,10 @@ jobs:
- eng/pipelines/coreclr/*
- eng/pipelines/mono/*
- eng/pipelines/installer/*
+ - subset: runtimetests
+ include:
+ - src/coreclr/tests/*
+ - src/coreclr/build-test.sh
- subset: installer
include:
- docs/manpages/*
@@ -197,6 +207,7 @@ jobs:
- Windows_NT_x86
- Windows_NT_arm
- Windows_NT_arm64
+ - FreeBSD_x64
jobParameters:
testGroup: innerloop
@@ -238,6 +249,7 @@ jobs:
- tvOS_x64
- tvOS_arm64
- iOS_x64
+ - iOS_x86
- iOS_arm
- iOS_arm64
- OSX_x64
@@ -245,7 +257,7 @@ jobs:
- Linux_arm
- Linux_arm64
- Linux_musl_x64
- - WebAssembly_wasm
+ - Browser_wasm
# - Linux_musl_arm64
- Windows_NT_x64
# - Windows_NT_x86
@@ -275,14 +287,14 @@ jobs:
- tvOS_x64
- tvOS_arm64
- iOS_x64
+ - iOS_x86
- iOS_arm
- iOS_arm64
- - OSX_x64
- Linux_x64
- Linux_arm
- Linux_arm64
- Linux_musl_x64
- - WebAssembly_wasm
+ - Browser_wasm
# - Linux_musl_arm64
- Windows_NT_x64
# - Windows_NT_x86
@@ -295,6 +307,27 @@ jobs:
eq(dependencies.checkout.outputs['SetPathVars_mono.containsChange'], true),
eq(variables['isFullMatrix'], true))
+#
+# Build Mono release
+# Only when libraries, mono, or the runtime tests changed
+# Currently only these architectures are needed for the runtime tests.
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/mono/templates/build-job.yml
+ runtimeFlavor: mono
+ buildConfig: release
+ platforms:
+ - OSX_x64
+ jobParameters:
+ condition: >-
+ or(
+ eq(dependencies.checkout.outputs['SetPathVars_libraries.containsChange'], true),
+ eq(dependencies.checkout.outputs['SetPathVars_runtimetests.containsChange'], true),
+ eq(dependencies.checkout.outputs['SetPathVars_mono.containsChange'], true),
+ eq(variables['isFullMatrix'], true))
+
+
+
#
# Build Mono LLVM debug
# Only when libraries or mono changed
@@ -316,7 +349,31 @@ jobs:
# - Windows_NT_arm
# - Windows_NT_arm64
jobParameters:
- llvm: true
+ runtimeVariant: LLVMJIT
+ condition: >-
+ or(
+ eq(dependencies.checkout.outputs['SetPathVars_libraries.containsChange'], true),
+ eq(dependencies.checkout.outputs['SetPathVars_mono.containsChange'], true),
+ eq(variables['isFullMatrix'], true))
+
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/mono/templates/build-job.yml
+ runtimeFlavor: mono
+ buildConfig: debug
+ platforms:
+ - OSX_x64
+ - Linux_x64
+ # - Linux_arm
+ # - Linux_arm64
+ # - Linux_musl_x64
+ # - Linux_musl_arm64
+ # - Windows_NT_x64
+ # - Windows_NT_x86
+ # - Windows_NT_arm
+ # - Windows_NT_arm64
+ jobParameters:
+ runtimeVariant: LLVMAOT
condition: >-
or(
eq(dependencies.checkout.outputs['SetPathVars_libraries.containsChange'], true),
@@ -344,7 +401,31 @@ jobs:
# - Windows_NT_arm
# - Windows_NT_arm64
jobParameters:
- llvm: true
+ runtimeVariant: LLVMJIT
+ condition: >-
+ or(
+ eq(dependencies.checkout.outputs['SetPathVars_libraries.containsChange'], true),
+ eq(dependencies.checkout.outputs['SetPathVars_mono.containsChange'], true),
+ eq(variables['isFullMatrix'], true))
+
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/mono/templates/build-job.yml
+ runtimeFlavor: mono
+ buildConfig: release
+ platforms:
+ - OSX_x64
+ - Linux_x64
+ # - Linux_arm
+ # - Linux_arm64
+ # - Linux_musl_x64
+ # - Linux_musl_arm64
+ # - Windows_NT_x64
+ # - Windows_NT_x86
+ # - Windows_NT_arm
+ # - Windows_NT_arm64
+ jobParameters:
+ runtimeVariant: LLVMAOT
condition: >-
or(
eq(dependencies.checkout.outputs['SetPathVars_libraries.containsChange'], true),
@@ -380,6 +461,7 @@ jobs:
- Linux_x64
- OSX_x64
- Windows_NT_x64
+ - FreeBSD_x64
jobParameters:
liveRuntimeBuildConfig: release
@@ -395,7 +477,7 @@ jobs:
- Android_x64
- Android_arm
- tvOS_arm64
- # - iOS_arm # https://github.com/dotnet/runtime/issues/34465
+ - iOS_arm
- iOS_x64
jobParameters:
liveRuntimeBuildConfig: release
@@ -410,7 +492,8 @@ jobs:
- Android_arm64
- tvOS_x64
- iOS_arm64
- - WebAssembly_wasm
+ - iOS_x86
+ - Browser_wasm
jobParameters:
liveRuntimeBuildConfig: debug
@@ -487,26 +570,27 @@ jobs:
- template: /eng/pipelines/installer/installer-matrix.yml
parameters:
- buildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
+ buildConfig: Release
platforms:
- OSX_x64
- Linux_x64
- Linux_arm64
- Linux_musl_x64
- Windows_NT_x64
+ - FreeBSD_x64
jobParameters:
liveRuntimeBuildConfig: release
liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
- template: /eng/pipelines/installer/installer-matrix.yml
parameters:
- buildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
+ buildConfig: Release
runtimeFlavor: mono
platforms:
- Android_x64
- Android_arm
- tvOS_arm64
- # - iOS_arm # https://github.com/dotnet/runtime/issues/34465
+ - iOS_arm
- iOS_x64
jobParameters:
liveRuntimeBuildConfig: release
@@ -521,7 +605,35 @@ jobs:
- Android_arm64
- tvOS_x64
- iOS_arm64
+ - iOS_x86
+ - OSX_x64
+ - Linux_x64
+ - Browser_wasm
+ jobParameters:
+ liveRuntimeBuildConfig: release
+ liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
+
+- template: /eng/pipelines/installer/installer-matrix.yml
+ parameters:
+ buildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
+ runtimeFlavor: mono
+ platforms:
+ - OSX_x64
+ - Linux_x64
jobParameters:
+ runtimeVariant: LLVMJIT
+ liveRuntimeBuildConfig: release
+ liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
+
+- template: /eng/pipelines/installer/installer-matrix.yml
+ parameters:
+ buildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
+ runtimeFlavor: mono
+ platforms:
+ - OSX_x64
+ - Linux_x64
+ jobParameters:
+ runtimeVariant: LLVMAOT
liveRuntimeBuildConfig: release
liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
@@ -573,7 +685,7 @@ jobs:
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/build-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
buildConfig: checked
platforms:
- Linux_arm
@@ -594,7 +706,7 @@ jobs:
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/build-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
buildConfig: checked
platforms:
- OSX_x64
@@ -615,7 +727,7 @@ jobs:
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: checked
platforms:
- Linux_arm
@@ -634,7 +746,7 @@ jobs:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/coreclr/templates/run-test-job.yml
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
buildConfig: checked
platforms:
- OSX_x64
@@ -651,6 +763,50 @@ jobs:
eq(dependencies.checkout.outputs['SetPathVars_coreclr.containsChange'], true),
eq(variables['isFullMatrix'], true))
+#
+# Mono Test builds with CoreCLR runtime tests using live libraries debug build
+# Only when Mono is changed
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
+ buildConfig: release
+ runtimeFlavor: mono
+ platforms:
+ - OSX_x64
+ - Linux_arm64
+ jobParameters:
+ testGroup: innerloop
+ liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
+ liveRuntimeBuildConfig: release
+ condition: >-
+ or(
+ eq(dependencies.checkout.outputs['SetPathVars_mono.containsChange'], true),
+ eq(dependencies.checkout.outputs['SetPathVars_runtimetests.containsChange'], true),
+ eq(variables['isFullMatrix'], true))
+
+#
+# Mono CoreCLR runtime Test executions using live libraries
+# Only when Mono is changed
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
+ buildConfig: release
+ runtimeFlavor: mono
+ platforms:
+ - OSX_x64
+ - Linux_arm64
+ helixQueueGroup: pr
+ helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
+ jobParameters:
+ testGroup: innerloop
+ liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
+ liveRuntimeBuildConfig: release
+ condition: >-
+ or(
+ eq(dependencies.checkout.outputs['SetPathVars_mono.containsChange'], true),
+ eq(dependencies.checkout.outputs['SetPathVars_runtimetests.containsChange'], true),
+ eq(variables['isFullMatrix'], true))
+
#
# Libraries Release Test Execution against a release mono runtime.
# Only when libraries or mono changed
@@ -689,6 +845,9 @@ jobs:
buildConfig: Release
platforms:
- Windows_NT_x86
+ - ${{ if eq(variables['isFullMatrix'], true) }}:
+ - Windows_NT_arm
+ - Windows_NT_arm64
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
isOfficialBuild: false
diff --git a/eng/referenceFromRuntime.targets b/eng/referenceFromRuntime.targets
index 873e7e5ff40192..34d0eb49199c8c 100644
--- a/eng/referenceFromRuntime.targets
+++ b/eng/referenceFromRuntime.targets
@@ -1,5 +1,5 @@
-
+
AddRuntimeProjectReference;
$(PrepareProjectReferencesDependsOn);
@@ -19,7 +19,7 @@
+ Condition="'$(IsTestProject)' != 'true' and '$(IsTestSupportProject)' != 'true' and '@(ReferenceFromRuntime)' != ''">
@@ -65,7 +65,7 @@
<_referencePathFromRuntime Include="@(RuntimeFiles)" Private="false" />
<_referencePathFromRuntime Include="@(_referencePathFromRestoredRuntime)" Private="false" />
- <_referencePathFromRuntime Include="@(ReferenceFromRuntime->'$(RuntimePath)%(Identity).dll')" Condition="'$(IsTestProject)' == 'true'" />
+ <_referencePathFromRuntime Include="@(ReferenceFromRuntime->'$(RuntimePath)%(Identity).dll')" Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true'" />
<_referencePathFromRuntimeByFileName Include="@(_referencePathFromRuntime->'%(FileName)')" Condition="'%(_referencePathFromRuntime.Extension)' == '.dll'" >
%(Identity)
@@ -111,7 +111,7 @@
-
+
diff --git a/eng/references.targets b/eng/references.targets
index 0c104db2bb27bc..efcac7d0515214 100644
--- a/eng/references.targets
+++ b/eng/references.targets
@@ -21,7 +21,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
diff --git a/eng/restore/runtimeprops.targets b/eng/restore/runtimeprops.targets
deleted file mode 100644
index 945d0830f8cc90..00000000000000
--- a/eng/restore/runtimeprops.targets
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/eng/run-test.sh b/eng/run-test.sh
index abd1d920b1615a..5f14e6f6121bec 100644
--- a/eng/run-test.sh
+++ b/eng/run-test.sh
@@ -15,12 +15,12 @@ wait_on_pids()
usage()
{
- echo "Runs .NET CoreFX tests on FreeBSD, NetBSD or Linux"
+ echo "Runs .NET CoreFX tests on FreeBSD, Linux, NetBSD or SunOS"
echo "usage: run-test [options]"
echo
echo "Input sources:"
echo " --runtime Location of root of the binaries directory"
- echo " containing the FreeBSD, NetBSD or Linux runtime"
+ echo " containing the FreeBSD, Linux, NetBSD or SunOS runtime"
echo " default: /bin/testhost/netcoreapp---"
echo " --corefx-tests Location of the root binaries location containing"
echo " the tests to run"
@@ -29,7 +29,7 @@ usage()
echo "Flavor/OS/Architecture options:"
echo " --configuration Configuration to run (Debug/Release)"
echo " default: Debug"
- echo " --os OS to run (FreeBSD, NetBSD or Linux)"
+ echo " --os OS to run (FreeBSD, Linux, NetBSD or SunOS)"
echo " default: detect current OS"
echo " --arch Architecture to run (x64, arm, armel, x86, arm64)"
echo " default: detect current architecture"
@@ -236,34 +236,34 @@ done
# Compute paths to the binaries if they haven't already been computed
-if [ "$Runtime" == "" ]
+if [ -z "$Runtime" ]
then
Runtime="$ProjectRoot/artifacts/bin/testhost/netcoreapp-$OS-$Configuration-$__Arch"
fi
-if [ "$CoreFxTests" == "" ]
+if [ -z "$CoreFxTests" ]
then
CoreFxTests="$ProjectRoot/artifacts/bin"
fi
# Check parameters up front for valid values:
-if [ ! "$Configuration" == "Debug" ] && [ ! "$Configuration" == "Release" ]
+if [ "$Configuration" != "Debug" ] && [ "$Configuration" != "Release" ]
then
echo "error: Configuration should be Debug or Release"
exit 1
fi
-if [ ! "$OS" == "FreeBSD" ] && [ ! "$OS" == "NetBSD" ] && [ ! "$OS" == "Linux" ]
+if [ "$OS" != "FreeBSD" ] && [ "$OS" != "Linux" ] && [ "$OS" != "NetBSD" ] && [ "$OS" != "SunOS" ]
then
- echo "error: OS should be FreeBSD, NetBSD or Linux"
+ echo "error: OS should be FreeBSD, Linux, NetBSD or Linux"
exit 1
fi
export CORECLR_SERVER_GC="$serverGC"
export PAL_OUTPUTDEBUGSTRING="1"
-if [ "$LANG" == "" ]
+if [ -z "$LANG" ]
then
export LANG="en_US.UTF-8"
fi
@@ -285,7 +285,10 @@ if [ $RunTestSequential -eq 1 ]
then
maxProcesses=1;
else
- if [ `uname` = "NetBSD" ] || [ `uname` = "FreeBSD" ]; then
+ platform="$(uname)"
+ if [ "$platform" = "FreeBSD" ]; then
+ maxProcesses=$(sysctl hw.ncpu | awk '{ print $2+1 }')
+ if [ "$platform" = "NetBSD" ] || [ "$platform" = "SunOS" ] ; then
maxProcesses=$(($(getconf NPROCESSORS_ONLN)+1))
else
maxProcesses=$(($(getconf _NPROCESSORS_ONLN)+1))
diff --git a/eng/sdl-tsa-vars.config b/eng/sdl-tsa-vars.config
new file mode 100644
index 00000000000000..0b4659a0fe4f78
--- /dev/null
+++ b/eng/sdl-tsa-vars.config
@@ -0,0 +1,11 @@
+-SourceToolsList @("policheck","credscan")
+-TsaInstanceURL https://devdiv.visualstudio.com/
+-TsaProjectName DEVDIV
+-TsaNotificationEmail runtimerepo-infra@microsoft.com
+-TsaCodebaseAdmin REDMOND\danmose
+-TsaBugAreaPath "DevDiv\NET Runtime\Reliability\Docs"
+-TsaIterationPath DevDiv
+-TsaRepositoryName Runtime
+-TsaCodebaseName Runtime
+-TsaOnboard $True
+-TsaPublish $True
\ No newline at end of file
diff --git a/eng/targetframeworksuffix.props b/eng/targetframeworksuffix.props
new file mode 100644
index 00000000000000..f89923d3ab86ce
--- /dev/null
+++ b/eng/targetframeworksuffix.props
@@ -0,0 +1,84 @@
+
+
+
+
+ true
+ win
+
+
+
+
+ true
+ unix
+
+
+
+
+ true
+ true
+ linux
+
+
+
+
+ true
+ true
+ true
+ android
+
+
+
+
+ true
+ true
+ osx
+
+
+
+
+ true
+ true
+ tvos
+
+
+
+
+ true
+ true
+ ios
+
+
+
+
+ true
+ true
+ freebsd
+
+
+
+
+ true
+ true
+ netbsd
+
+
+
+
+ true
+ true
+ sunos
+
+
+
+
+ true
+ true
+
+
+
+
+ true
+
+
+
+
diff --git a/eng/testing/.runsettings b/eng/testing/.runsettings
new file mode 100644
index 00000000000000..fabc0310a7aa51
--- /dev/null
+++ b/eng/testing/.runsettings
@@ -0,0 +1,53 @@
+
+
+
+
+ 300000
+
+ .\TestResults\
+
+ .\
+
+ $$MAXCPUCOUNT$$
+
+ $$TARGETPLATFORM$$
+
+ $$DISABLEPARALLELIZATION$$
+
+ $$DISABLEAPPDOMAIN$$
+
+ $$TESTCASEFILTER$$
+ $$DOTNETHOSTPATH$$
+
+
+ $$DEVPATH$$
+
+
+
+
+
+
+
+
+ Minimal
+
+
+
+
+
+
+
+
+ $$COVERAGE_INCLUDE$$
+ $$COVERAGE_EXCLUDEBYFILE$$
+ $$COVERAGE_INCLUDEDIRECTORY$$
+ opencover
+ false
+ true
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/eng/testing/AndroidRunnerTemplate.sh b/eng/testing/AndroidRunnerTemplate.sh
new file mode 100644
index 00000000000000..1a683aa348986c
--- /dev/null
+++ b/eng/testing/AndroidRunnerTemplate.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+EXECUTION_DIR=$(dirname $0)
+TEST_NAME=$1
+TARGET_ARCH=$2
+
+APK=$EXECUTION_DIR/bin/$TEST_NAME.apk
+
+# it doesn't support parallel execution yet, so, here is a hand-made semaphore:
+LOCKDIR=/tmp/androidtests.lock
+while true; do
+ if mkdir "$LOCKDIR"
+ then
+ trap 'rm -rf "$LOCKDIR"' 0
+ break
+ else
+ sleep 5
+ fi
+done
+
+dotnet xharness android test -i="net.dot.MonoRunner" \
+ --package-name="net.dot.$TEST_NAME" \
+ --app=$APK -o=$EXECUTION_DIR/TestResults -v
diff --git a/eng/testing/AppleRunnerTemplate.sh b/eng/testing/AppleRunnerTemplate.sh
new file mode 100644
index 00000000000000..c146f7e0364b13
--- /dev/null
+++ b/eng/testing/AppleRunnerTemplate.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+
+EXECUTION_DIR=$(dirname $0)
+TEST_NAME=$1
+TARGET_ARCH=$2
+TARGET=
+SCHEME_SDK=
+
+if [ "$TARGET_ARCH" == "arm" ]; then
+ TARGET=ios-device
+ SCHEME_SDK=Release-iphoneos
+elif [ "$TARGET_ARCH" == "arm64" ]; then
+ TARGET=ios-device
+ SCHEME_SDK=Release-iphoneos
+elif [ "$TARGET_ARCH" == "x64" ]; then
+ TARGET=ios-simulator-64
+ SCHEME_SDK=Release-iphonesimulator
+elif [ "$TARGET_ARCH" == "x86" ]; then
+ TARGET=ios-simulator-32
+ SCHEME_SDK=Release-iphonesimulator
+else
+ echo "Unknown architecture: $TARGET_ARCH"
+ exit 1
+fi
+
+# "Release" in SCHEME_SDK is what xcode produces (see "bool Optimized" property in AppleAppBuilderTask)
+
+APP_BUNDLE=$EXECUTION_DIR/$TEST_NAME/$SCHEME_SDK/$TEST_NAME.app
+
+# it doesn't support parallel execution yet, so, here is a hand-made semaphore:
+LOCKDIR=/tmp/runonsim.lock
+while true; do
+ if mkdir "$LOCKDIR"
+ then
+ trap 'rm -rf "$LOCKDIR"' 0
+ break
+ else
+ sleep 5
+ fi
+done
+
+XHARNESS_OUT="$EXECUTION_DIR/xharness-output"
+
+dotnet xharness ios test --app="$APP_BUNDLE" \
+ --targets=$TARGET \
+ --output-directory=$XHARNESS_OUT
+
+_exitCode=$?
+
+echo "Xharness artifacts: $XHARNESS_OUT"
+
+exit $_exitCode
diff --git a/eng/testing/WasmRunnerTemplate.sh b/eng/testing/WasmRunnerTemplate.sh
new file mode 100644
index 00000000000000..2d4b8f95d4f491
--- /dev/null
+++ b/eng/testing/WasmRunnerTemplate.sh
@@ -0,0 +1,12 @@
+set -ev
+
+EXECUTION_DIR=$(dirname $0)
+TEST_NAME=$1
+TARGET_ARCH=$2
+
+echo "Test: $1 Arch: $2"
+
+cd $EXECUTION_DIR
+v8 --expose_wasm runtime.js -- --enable-gc --run WasmTestRunner.dll $TEST_NAME
+
+exit 0
diff --git a/eng/testing/coverage.props b/eng/testing/coverage.props
deleted file mode 100644
index 7af30267a5625a..00000000000000
--- a/eng/testing/coverage.props
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- coverage.xml
- 0
- line,branch,method
- opencover
- true
- normal
-
- $(CoverageOutputPath)
- Html
- Info
-
-
diff --git a/eng/testing/coverage.targets b/eng/testing/coverage.targets
index 3638e3efd7ca6b..6f8ac2648f06e7 100644
--- a/eng/testing/coverage.targets
+++ b/eng/testing/coverage.targets
@@ -1,44 +1,10 @@
-
-
-
- "$(TargetFileName)" --target "$(RunCommand)" --targetargs "$(RunArguments)" --format "$(CoverageFormat)" --output "$(CoverageOutputPath)" --threshold "$(CoverageThreshold)" --threshold-type "$(CoverageThresholdType)" --verbosity "$(CoverageVerbosity)"
- $(RunArguments) --use-source-link
- "$(DotNetTool)" tool run coverlet
-
-
-
-
- $([MSBuild]::NormalizeDirectory('$(OutDir)', 'report'))
- $([MSBuild]::NormalizePath('$(CoverageReportDir)', 'index.htm'))
- "$(DotNetTool)" tool run reportgenerator "-reports:$(CoverageReportInputPath)" "-targetdir:$(CoverageReportDir.TrimEnd('\/'))" "-reporttypes:$(CoverageReportTypes)" "-verbosity:$(CoverageReportVerbosity)"
-
-
-
-
-
-
-
+
-
- --exclude-by-file @(CoverageExcludeFile -> '"%(Identity)"', ' --exclude-by-file ')
- $(RunArguments) $(CoverageExcludeByFileFilter)
-
-
-
- --include-directory @(CoverageProbePath -> '"$(RunScriptHostDir)%(Identity)"', ' --include-directory ')
- $(RunArguments) $(IncludeDirectoriesFilter)
-
-
-
- --exclude @(CoverageExclude -> '"%(Identity)"', ' --exclude ')
- $(RunArguments) $(CoverageExcludeFilter)
-
-
-
+
<_ProjectDirectoryUnderSourceDir>$(MSBuildProjectDirectory.SubString($(LibrariesProjectRoot.Length)))
$(_ProjectDirectoryUnderSourceDir.SubString(0, $(_ProjectDirectoryUnderSourceDir.IndexOfAny("\\/"))))
@@ -48,15 +14,76 @@
CoverageAssemblies can be passed in to the build to gather coverage on additional assemblies.
-->
- <_CoverageAssemblies Include="$(AssemblyBeingTested)" />
- <_CoverageAssemblies Include="System.Private.CoreLib" Condition="'$(TestRuntime)' == 'true'" />
- <_CoverageAssemblies Include="@(AssembliesBeingTested)" />
- <_CoverageAssemblies Include="$(CoverageAssemblies)" Condition="'$(CoverageAssemblies)' != ''" />
+
+
+
+
-
- --include @(_CoverageAssemblies -> '"[%(Identity)]*"', ' --include ')
- $(RunArguments) $(CoverageFilter)
+
+ @(CoverageInclude -> '[%(Identity)]*', ',')
+
+
+ @(CoverageExcludeByFile -> '%(Identity)', ',')
+
+
+
+ @(CoverageIncludeDirectory -> '$(TestHostRootPath)%(Identity)', ',')
+
+
+
+
+
+
+ coverage.opencover.xml
+ $(CoverageOutputPath)
+ $([MSBuild]::NormalizeDirectory('$(OutDir)', 'report'))
+
+ "$(DotNetTool)" tool run coverlet "$(TargetFileName)" --target "$(RunScriptHost)" --targetargs "$(RunScriptCommand.Replace('"$(RunScriptHost)"', ''))" --format "opencover" --output "$(CoverageOutputPath)" --verbosity "normal" --use-source-link
+ $(RunScriptCommand) --exclude-by-file @(CoverageExcludeByFile -> '"%(Identity)"', ' --exclude-by-file ')
+ $(RunScriptCommand) --include-directory @(CoverageIncludeDirectory -> '"$(RunScriptHostDir)%(Identity)"', ' --include-directory ')
+ $(RunScriptCommand) --include @(CoverageInclude -> '"[%(Identity)]*"', ' --include ')
+ "$(DotNetTool)" tool run reportgenerator "-reports:$(CoverageReportInputPath)" "-targetdir:$(CoverageReportDir.TrimEnd('\/'))" "-reporttypes:Html" "-verbosity:Info"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %(CoverageOutputFile.Identity)
+ Html
+ Info
+ $([MSBuild]::NormalizeDirectory('$(OutDir)', 'TestResults', 'report'))
+ "$(DotNetTool)" tool run reportgenerator "-reports:$(CoverageReportInputPath)" "-targetdir:$(CoverageReportDir.TrimEnd('\/'))" "-reporttypes:$(CoverageReportTypes)" "-verbosity:$(CoverageReportVerbosity)"
+
+
+
+
+
+
+
+
+
diff --git a/eng/testing/launchSettings.json b/eng/testing/launchSettings.json
deleted file mode 100644
index 62d099feb3b7d8..00000000000000
--- a/eng/testing/launchSettings.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "profiles": {
- ".NET Core xUnit Console": {
- "commandName": "Executable",
- "executablePath": "$(TestHostRootPath)dotnet.exe",
- "commandLineArgs": "$(RunArguments) -parallel none",
- "workingDirectory": "$(RunWorkingDirectory)"
- },
- ".NET Framework xUnit Console": {
- "commandName": "Executable",
- "executablePath": "$(RunWorkingDirectory)$(RunCommand)",
- "commandLineArgs": "$(RunArguments) -parallel none",
- "workingDirectory": "$(RunWorkingDirectory)",
- "environmentVariables": {
- "DEVPATH": "$(TestHostRootPath)"
- }
- }
- }
-}
diff --git a/eng/testing/launchSettings.targets b/eng/testing/launchSettings.targets
deleted file mode 100644
index 6caf9475304570..00000000000000
--- a/eng/testing/launchSettings.targets
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- $(MSBuildThisFileDirectory)launchSettings.json
- $([MSBuild]::NormalizePath('$(MSBuildProjectDirectory)', '$(AppDesignerFolder)', 'launchSettings.json'))
- GenerateLaunchSettingsFile;$(PrepareForRunDependsOn);
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/eng/testing/runsettings.targets b/eng/testing/runsettings.targets
new file mode 100644
index 00000000000000..10496127b8a90a
--- /dev/null
+++ b/eng/testing/runsettings.targets
@@ -0,0 +1,53 @@
+
+
+ $(MSBuildThisFileDirectory).runsettings
+ $(ArtifactsObjDir)$(TargetOS)-$(Configuration)-$(TargetArchitecture).runsettings
+ $(OutDir).runsettings
+
+ false
+ $(RunSettingsIntermediateOutputFilePath)
+ $(RunSettingsAppOutputFilePath)
+
+
+ $(RunSettingsAppOutputFilePath)
+
+ $(RunSettingsIntermediateOutputFilePath)
+
+ GenerateRunSettingsFile;$(PrepareForRunDependsOn)
+
+
+
+ <_testFilter Condition="'$(_withCategories)' != ''">$(_withCategories.Replace(';', '&category='))
+ <_testFilter Condition="'$(_withoutCategories)' != ''">$(_testFilter)$(_withoutCategories.Replace(';', '&category!='))
+ <_testFilter>$(_testFilter.Trim('&'))
+
+
+
+
+ $([System.IO.File]::ReadAllText('$(RunSettingsInputFilePath)'))
+ $(RunSettingsFileContent.Replace('$$MAXCPUCOUNT$$', '1'))
+ $(RunSettingsFileContent.Replace('$$MAXCPUCOUNT$$', '0'))
+ $(RunSettingsFileContent.Replace('$$COVERAGE_INCLUDE$$', '$(CoverageIncludeFilter)')
+ .Replace('$$COVERAGE_EXCLUDEBYFILE$$', '$(CoverageExcludeByFileFilter)')
+ .Replace('$$COVERAGE_INCLUDEDIRECTORY$$', '$(CoverageIncludeDirectoryFilter)')
+ .Replace('$$COVERAGE_ENABLED$$', '$([MSBuild]::ValueOrDefault('$(Coverage)', 'false'))')
+ .Replace('$$TARGETPLATFORM$$', '$(TargetArchitecture)')
+ .Replace('$$DISABLEPARALLELIZATION$$', '$([MSBuild]::ValueOrDefault('$(TestDisableParallelization)', 'false'))')
+ .Replace('$$DISABLEAPPDOMAIN$$', '$([MSBuild]::ValueOrDefault('$(TestDisableAppDomain)', 'false'))')
+ .Replace('$$TESTCASEFILTER$$', '$(_testFilter)')
+ .Replace('$$DEVPATH$$', '$(TestHostRootPath)')
+ .Replace('$$DOTNETHOSTPATH$$', '$(TestHostRootPath)$([System.IO.Path]::GetFileName('$(DotNetTool)'))'))
+
+
+
+
+
+
+ $(RunSettingsOutputFilePath)
+
+
+
diff --git a/eng/testing/runtimeConfiguration.targets b/eng/testing/runtimeConfiguration.targets
index fdb81abbb18929..f687adfad40f97 100644
--- a/eng/testing/runtimeConfiguration.targets
+++ b/eng/testing/runtimeConfiguration.targets
@@ -1,10 +1,10 @@
- $(MSBuildThisFileDirectory)netfx.exe.config
+ $(MSBuildThisFileDirectory)netfx.exe.config
- true
+ true
@@ -19,11 +19,11 @@
Tracking issue: https://github.com/dotnet/sdk/issues/1675
-->
diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets
new file mode 100644
index 00000000000000..3fd1594b73bd55
--- /dev/null
+++ b/eng/testing/tests.mobile.targets
@@ -0,0 +1,154 @@
+
+
+
+ $([MSBuild]::NormalizeDirectory('$(OutDir)', 'AppBundle'))
+ $([MSBuild]::NormalizePath('$(BundleDir)', '$(RunScriptOutputName)'))
+ true
+
+
+
+
+
+
+
+ arm64-v8a
+ armeabi-v7a
+ x86_64
+ x86
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @(MonoAOTCompilerDefaultAotArguments, ';')
+ @(MonoAOTCompilerDefaultProcessArguments, ';')
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_runnerFilesToPublish Include="$(AndroidTestRunnerDir)*" Condition="'$(TargetOS)' == 'Android'" />
+ <_runnerFilesToPublish Include="$(AppleTestRunnerDir)*" Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS'" />
+ <_runnerFilesToPublish Include="$(WasmTestRunnerDir)*" Condition="'$(TargetOS)' == 'Browser'" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/eng/testing/tests.props b/eng/testing/tests.props
index dfaabfa18db038..cccce13b1c4546 100644
--- a/eng/testing/tests.props
+++ b/eng/testing/tests.props
@@ -5,12 +5,33 @@
Build$(TestDependsOn);GenerateRunScript;RunTests
+ true
-
-
-
-
+
+
+ <_withCategories Condition="'$(WithCategories)' != ''">;$(WithCategories.Trim(';'))
+ <_withoutCategories Condition="'$(WithoutCategories)' != ''">;$(WithoutCategories.Trim(';'))
+
+ all
+ <_withCategories Condition="'$(TestScope)' == 'outerloop'">$(_withCategories);OuterLoop
+ <_withoutCategories Condition="'$(ArchiveTests)' == 'true'">$(_withoutCategories);IgnoreForCI
+ <_withoutCategories Condition="'$(TestScope)' == '' or '$(TestScope)' == 'innerloop'">$(_withoutCategories);OuterLoop
+ <_withoutCategories Condition="!$(_withCategories.Contains('failing'))">$(_withoutCategories);failing
+
+
+
+
+ $(NetCoreAppCurrent)-$(Configuration)
+ $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleTestRunner', '$(MobileRunnersDirSuffix)'))
+ $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidTestRunner', '$(MobileRunnersDirSuffix)'))
+ $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WasmTestRunner', '$(MobileRunnersDirSuffix)'))
+
+ $(PackageRID)
+ true
+ false
+
+
+
+
+
+
- $(RunArguments) %RSP_FILE%
- $(RunArguments) $RSP_FILE
+ $(RunScriptCommand) %RSP_FILE%
+ $(RunScriptCommand) $RSP_FILE
-
- $([MSBuild]::Escape('$(RunArguments)'))
-
- $(RunCommand) $(RunArguments)
+
+ $([MSBuild]::Escape('$(RunScriptCommand)'))
@@ -71,42 +75,26 @@
TemplatePath="$(RunScriptInputPath)"
OutputPath="$(RunScriptOutputPath)" />
-
-
-
-
-
-
-
-
-
-
- true
-
-
-
-
-
+
-
+ "$(RunScriptOutputPath)" --runtime-path "$(TestHostRootPath.TrimEnd('\/'))"$(RunTestsCommand) --rsp-file "$(TestRspFile)"
+ "$(RunScriptOutputPath)" $(AssemblyName) $(TargetArchitecture)
- $(RunWorkingDirectory)$(TestResultsName)
+ $(OutputPath)$(TestResultsName)One or more tests failed while running tests from '$(TestProjectName)'.$(TestRunErrorMessage) Please check $(TestResultsPath) for details!
@@ -114,6 +102,7 @@
+
diff --git a/eng/testing/xunit/vstest.props b/eng/testing/xunit/vstest.props
deleted file mode 100644
index 0cc370f2761714..00000000000000
--- a/eng/testing/xunit/vstest.props
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- en
- testResults.trx
- testResults.html
- $(HtmlTestResultsName)
- $(MSBuildThisFileDirectory)vstest.xunit.json
-
-
-
-
-
-
-
-
diff --git a/eng/testing/xunit/vstest.targets b/eng/testing/xunit/vstest.targets
deleted file mode 100644
index 3a638a442c0998..00000000000000
--- a/eng/testing/xunit/vstest.targets
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
- "$(DotNetTool)"
- dotnet
- test $(TargetFileName)
-
-
- $(RunArguments) --nologo
- $(RunArguments) --logger "trx;LogFileName=$(TrxTestResultsName)"
- $(RunArguments) --logger "html;LogFileName=$(HtmlTestResultsName)"
- $(RunArguments) --framework $(TargetFramework)
- $(RunArguments) --platform $(TargetArchitecture)
- $(RunArguments) --parallel
- $(RunArguments) --blame
-
-
- <_testFilter Condition="'$(_withCategories)' != ''">$(_withCategories.Replace(';', '&category='))
- <_testFilter Condition="'$(_withoutCategories)' != ''">$(_testFilter)$(_withoutCategories.Replace(';', '&category!='))
-
- <_testFilter Condition="'$(TargetOS)' == 'Windows_NT'">$(_testFilter.Replace('!=', '^!='))
- <_testFilter>$(_testFilter.Trim('&'))
-
- <_testFilter Condition="'$(TestFilter)' != ''">$(_testFilter)&$(TestFilter.Replace('!=', '^!='))
-
- $(RunArguments) --filter "($(_testFilter))"
-
-
- $(RunArguments) $(XUnitOptions)
-
-
- $(RunSettingsOptions) RunConfiguration.DisableParallelization=true
- $(RunSettingsOptions) RunConfiguration.DisableAppDomain=true
- $(RunSettingsOptions) RunConfiguration.DotNetHostPath="$(RunScriptHost)"
- $(RunArguments) --$(RunSettingsOptions)
-
-
\ No newline at end of file
diff --git a/eng/testing/xunit/vstest.xunit.json b/eng/testing/xunit/vstest.xunit.json
deleted file mode 100644
index b81a78d00ad56e..00000000000000
--- a/eng/testing/xunit/vstest.xunit.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "diagnosticMessages": false,
- "longRunningTestSeconds": 120,
- "shadowCopy": false
-}
\ No newline at end of file
diff --git a/eng/testing/xunit/xunit.console.json b/eng/testing/xunit/xunit.console.json
deleted file mode 100644
index 5d2ac0433c91fe..00000000000000
--- a/eng/testing/xunit/xunit.console.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "diagnosticMessages": true,
- "longRunningTestSeconds": 120,
- "shadowCopy": false
-}
\ No newline at end of file
diff --git a/eng/testing/xunit/xunit.console.props b/eng/testing/xunit/xunit.console.props
deleted file mode 100644
index ad7ffdb52587fd..00000000000000
--- a/eng/testing/xunit/xunit.console.props
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- true
- testResults.xml
- $(MSBuildThisFileDirectory)xunit.console.json
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/eng/testing/xunit/xunit.console.targets b/eng/testing/xunit/xunit.console.targets
index 059eede7dcf42b..2824bd84107806 100644
--- a/eng/testing/xunit/xunit.console.targets
+++ b/eng/testing/xunit/xunit.console.targets
@@ -1,33 +1,51 @@
- $(TargetFileName)
- $(RunArguments) -xml $(TestResultsName)
- $(RunArguments) -nologo
- $(RunArguments) -nocolor
+ true
+ testResults.xml
+
+
+
+ <_depsFileArgument Condition="'$(GenerateDependencyFile)' == 'true'">--depsfile $(AssemblyName).deps.json
+ "$(RunScriptHost)" exec --runtimeconfig $(AssemblyName).runtimeconfig.json $(_depsFileArgument) xunit.console.dll
+ xunit.console.exe
+
+ $(RunScriptCommand) $(TargetFileName)
+ $(RunScriptCommand) -xml $(TestResultsName)
+ $(RunScriptCommand) -nologo
+ $(RunScriptCommand) -nocolor
- $(RunArguments) -maxthreads 1
- $(RunArguments) -method $(XUnitMethodName)
- $(RunArguments) -class $(XUnitClassName)
- $(RunArguments) -verbose
- $(RunArguments) -noappdomain
+ $(RunScriptCommand) -maxthreads 1
+ $(RunScriptCommand) -method $(XUnitMethodName)
+ $(RunScriptCommand) -class $(XUnitClassName)
+ $(RunScriptCommand) -verbose
+ $(RunScriptCommand) -noappdomain
- $(RunArguments)$(_withCategories.Replace(';', ' -trait category='))
- $(RunArguments)$(_withoutCategories.Replace(';', ' -notrait category='))
+ $(RunScriptCommand)$(_withCategories.Replace(';', ' -trait category='))
+ $(RunScriptCommand)$(_withoutCategories.Replace(';', ' -notrait category='))
- $(RunArguments) $(XUnitOptions)
+ $(RunScriptCommand) $(XUnitOptions)
+
+
+
+
+
<_testRunnerConfigSourceFile Include="$(TargetDir)$(TargetName).exe.config" />
- <_testRunnerConfigDestFile Include="$(TargetDir)$(_testRunnerName).config" />
+ <_testRunnerConfigDestFile Include="$(TargetDir)xunit.console.exe.config" />
-
-
- "$(RunScriptHost)"
- <_depsFileRunArgument Condition="'$(GenerateDependencyFile)' == 'true'">--depsfile $(AssemblyName).deps.json
- exec --runtimeconfig $(AssemblyName).runtimeconfig.json $(_depsFileRunArgument) xunit.console.dll $(RunArguments)
-
-
-
- <_testRunnerName>xunit.console.exe
- $(_testRunnerName)
-
-
<_xunitConsoleNetCoreExclude Condition="'$(GenerateDependencyFile)' != 'true' and '$(XunitConsoleNetCore21AppPath)' != ''" Include="$([System.IO.Path]::GetDirectoryName('$(XunitConsoleNetCore21AppPath)'))\xunit.console.deps.json" />
diff --git a/eng/testing/xunit/xunit.props b/eng/testing/xunit/xunit.props
index 0b6289b9a22669..4032da19347661 100644
--- a/eng/testing/xunit/xunit.props
+++ b/eng/testing/xunit/xunit.props
@@ -1,6 +1,8 @@
- xunit.console
+
+ en
+ $(MSBuildThisFileDirectory)xunit.runner.json
@@ -11,6 +13,22 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/eng/testing/xunit/xunit.runner.json b/eng/testing/xunit/xunit.runner.json
new file mode 100644
index 00000000000000..a879e62a4379e4
--- /dev/null
+++ b/eng/testing/xunit/xunit.runner.json
@@ -0,0 +1,6 @@
+{
+ "diagnosticMessages": true,
+ "longRunningTestSeconds": 120,
+ "shadowCopy": false,
+ "preEnumerateTheories": false
+}
\ No newline at end of file
diff --git a/eng/testing/xunit/xunit.targets b/eng/testing/xunit/xunit.targets
index 4583d682cfb705..b14d3b7cbf227c 100644
--- a/eng/testing/xunit/xunit.targets
+++ b/eng/testing/xunit/xunit.targets
@@ -1,41 +1,18 @@
+
- nonwindowstests
- nonlinuxtests
- nonosxtests
- nonfreebsdtests
- nonnetbsdtests
-
-
- <_withCategories Condition="'$(WithCategories)' != ''">;$(WithCategories.Trim(';'))
- <_withoutCategories Condition="'$(WithoutCategories)' != ''">;$(WithoutCategories.Trim(';'))
-
- all
- <_withCategories Condition="'$(TestScope)' == 'outerloop'">$(_withCategories);OuterLoop
- <_withoutCategories Condition="'$(ArchiveTests)' == 'true'">$(_withoutCategories);IgnoreForCI
- <_withoutCategories Condition="'$(TestScope)' == '' or '$(TestScope)' == 'innerloop'">$(_withoutCategories);OuterLoop
- <_withoutCategories Condition="!$(_withCategories.Contains('failing'))">$(_withoutCategories);failing
-
- <_targetCategory Condition="'$(TargetsNetCoreApp)' == 'true'">netcoreapp
- <_targetCategory Condition="'$(TargetsNetFx)' == 'true'">netfx
-
- <_withoutCategories>$(_withoutCategories);non$(_targetCategory)tests
- <_withoutCategories Condition="'$(TargetOSCategory)' != ''">$(_withoutCategories);$(TargetOSCategory)
+ $(OutDir)
-
-
-
+
+ $(DotNetTool)
+ test $(TargetPath) --settings $(OutDir).runsettings
+
-
-
-
+
+ $(DevEnvDir)Extensions\TestPlatform\vstest.console.exe
+ $(TargetPath) --settings:$(OutDir).runsettings
+
-
-
+
diff --git a/eng/versioning.targets b/eng/versioning.targets
index 9c2fc1cf8b3b51..21a442a03f3c0d 100644
--- a/eng/versioning.targets
+++ b/eng/versioning.targets
@@ -10,7 +10,7 @@
-
+
@@ -23,7 +23,7 @@
+ Condition="'$(IsDotNetFrameworkProductAssembly)' == 'true' and '$(IsTestProject)' != 'true' and '$(IsTestSupportProject)' != 'true'">
@@ -97,4 +97,39 @@
+
+
+
+
+ $(ArtifactsObjDir)runtime_version.h
+
+ <_RuntimeVersionFileContents>
+
+
+
+
+
+
+
+
+
diff --git a/global.json b/global.json
index 1c7dd9061e282d..1f55cf7ca46f2f 100644
--- a/global.json
+++ b/global.json
@@ -1,21 +1,21 @@
{
"sdk": {
- "version": "5.0.100-preview.4.20202.8",
+ "version": "5.0.100-preview.5.20251.2",
"allowPrerelease": true,
"rollForward": "major"
},
"tools": {
- "dotnet": "5.0.100-preview.4.20202.8"
+ "dotnet": "5.0.100-preview.5.20251.2"
},
"native-tools": {
"cmake": "3.14.2",
"python3": "3.7.1"
},
"msbuild-sdks": {
- "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "5.0.0-beta.20201.2",
- "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20201.2",
- "Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk": "5.0.0-beta.20201.2",
- "Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20201.2",
+ "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "5.0.0-beta.20261.9",
+ "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20261.9",
+ "Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk": "5.0.0-beta.20261.9",
+ "Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20261.9",
"FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0",
"Microsoft.NET.Sdk.IL": "5.0.0-preview.4.20202.18",
"Microsoft.Build.NoTargets": "1.0.53",
diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt
index 5fa572c4fcdf9c..efad61086e853d 100644
--- a/src/coreclr/CMakeLists.txt
+++ b/src/coreclr/CMakeLists.txt
@@ -25,12 +25,6 @@ set(GENERATED_EVENTING_DIR ${CMAKE_CURRENT_BINARY_DIR}/Eventing)
set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/version.c")
set(PAL_REDEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/dlls/mscordac/palredefines.S)
-if(CLR_CMAKE_HOST_UNIX)
- set(CLR_DOTNET_COMMAND ${CLR_REPO_ROOT_DIR}/dotnet.sh)
-elseif(CLR_CMAKE_HOST_WIN32)
- set(CLR_DOTNET_COMMAND ${CLR_REPO_ROOT_DIR}/dotnet.cmd)
-endif(CLR_CMAKE_HOST_UNIX)
-
# Avoid logging when skipping up-to-date copies
set(CMAKE_INSTALL_MESSAGE LAZY)
diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd
index 7ba07fedafd874..2c1d7db98ee7a5 100644
--- a/src/coreclr/build-runtime.cmd
+++ b/src/coreclr/build-runtime.cmd
@@ -81,6 +81,7 @@ set __CommonMSBuildArgs=
set __BuildNative=1
set __BuildCrossArchNative=0
set __SkipCrossArchNative=0
+set __SkipGenerateVersion=0
set __RestoreOptData=1
set __CrossArch=
set __PgoOptDataPath=
@@ -154,6 +155,7 @@ if /i "%1" == "-configureonly" (set __ConfigureOnly=1&set __BuildNative=1&
if /i "%1" == "-skipconfigure" (set __SkipConfigure=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-skipnative" (set __BuildNative=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-skipcrossarchnative" (set __SkipCrossArchNative=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "-skipgenerateversion" (set __SkipGenerateVersion=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-skiprestoreoptdata" (set __RestoreOptData=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-usenmakemakefiles" (set __NMakeMakefiles=1&set __ConfigureOnly=1&set __BuildNative=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-pgoinstrument" (set __PgoInstrument=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
@@ -166,6 +168,7 @@ if /i "%1" == "configureonly" (set __ConfigureOnly=1&set __BuildNative=1&s
if /i "%1" == "skipconfigure" (set __SkipConfigure=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "skipnative" (set __BuildNative=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "skipcrossarchnative" (set __SkipCrossArchNative=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "skipgenerateversion" (set __SkipGenerateVersion=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "skiprestoreoptdata" (set __RestoreOptData=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "usenmakemakefiles" (set __NMakeMakefiles=1&set __ConfigureOnly=1&set __BuildNative=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "pgoinstrument" (set __PgoInstrument=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
@@ -317,16 +320,19 @@ REM ============================================================================
@if defined _echo @echo on
-echo %__MsgPrefix%Generating native version headers
-set "__BinLog=%__LogsDir%\GenerateVersionHeaders_%__TargetOS%__%__BuildArch%__%__BuildType%.binlog"
-powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__RepoRootDir%\eng\common\msbuild.ps1" /clp:nosummary %__ArcadeScriptArgs%^
- %__RepoRootDir%\eng\empty.csproj /p:NativeVersionFile="%__RootBinDir%\obj\coreclr\_version.h"^
- /t:GenerateNativeVersionFile /restore^
- %__CommonMSBuildArgs% %__UnprocessedBuildArgs% /bl:!__BinLog!
-if not !errorlevel! == 0 (
- set __exitCode=!errorlevel!
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: Failed to generate version headers.
- goto ExitWithCode
+if %__SkipGenerateVersion% EQU 0 (
+ echo %__MsgPrefix%Generating native version headers
+ set "__BinLog=%__LogsDir%\GenerateVersionHeaders_%__TargetOS%__%__BuildArch%__%__BuildType%.binlog"
+ powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__RepoRootDir%\eng\common\msbuild.ps1" /clp:nosummary %__ArcadeScriptArgs%^
+ %__RepoRootDir%\eng\empty.csproj /t:GenerateRuntimeVersionFile /restore^
+ /p:NativeVersionFile="%__RootBinDir%\obj\coreclr\_version.h"^
+ /p:RuntimeVersionFile="%__RootBinDir%\obj\coreclr\runtime_version.h"^
+ %__CommonMSBuildArgs% %__UnprocessedBuildArgs% /bl:!__BinLog!
+ if not !errorlevel! == 0 (
+ set __exitCode=!errorlevel!
+ echo %__ErrMsgPrefix%%__MsgPrefix%Error: Failed to generate version headers.
+ goto ExitWithCode
+ )
)
REM =========================================================================================
@@ -690,6 +696,7 @@ echo -skipconfigure: skip CMake ^(default: CMake is run^)
echo -skipnative: skip building native components ^(default: native components are built^).
echo -skipcrossarchnative: skip building cross-architecture native components ^(default: components are built^).
echo -skiprestoreoptdata: skip restoring optimization data used by profile-based optimizations.
+echo -skipgenerateversion: skip generating the native version headers.
echo -priority=^ : specify a set of test that will be built and run, with priority N.
echo portable : build for portable RID.
echo.
diff --git a/src/coreclr/build-test.cmd b/src/coreclr/build-test.cmd
index 6ae3904d022f18..01a41c0a91118a 100644
--- a/src/coreclr/build-test.cmd
+++ b/src/coreclr/build-test.cmd
@@ -59,6 +59,7 @@ set __RuntimeId=
set __TargetsWindows=1
set __DoCrossgen=
set __DoCrossgen2=
+set __CompositeBuildMode=
set __CopyNativeTestBinaries=0
set __CopyNativeProjectsAfterCombinedTestBuild=true
set __SkipGenerateLayout=0
@@ -106,6 +107,7 @@ if /i "%1" == "buildagainstpackages" (echo error: Remove /BuildAgainstPackages
if /i "%1" == "skiprestorepackages" (set __SkipRestorePackages=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "crossgen" (set __DoCrossgen=1&set __TestBuildMode=crossgen&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "crossgen2" (set __DoCrossgen2=1&set __TestBuildMode=crossgen2&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "composite" (set __CompositeBuildMode=1&set __DoCrossgen2=1&set __TestBuildMode=crossgen2&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "runtimeid" (set __RuntimeId=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
if /i "%1" == "targetsNonWindows" (set __TargetsWindows=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "Exclude" (set __Exclude=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
@@ -115,6 +117,7 @@ if /i "%1" == "targetSpecific" (set "__BuildNeedTargetArg=/p:CLRTestNeedT
if /i "%1" == "copynativeonly" (set __CopyNativeTestBinaries=1&set __SkipNative=1&set __CopyNativeProjectsAfterCombinedTestBuild=false&set __SkipCrossgenFramework=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "skipgeneratelayout" (set __SkipGenerateLayout=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "generatelayoutonly" (set __SkipManaged=1&set __SkipNative=1&set __CopyNativeProjectsAfterCombinedTestBuild=false&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "-excludemonofailures" (set __Mono=1&set processedArgs=!processedArgs!&shift&goto Arg_Loop)
if /i "%1" == "--" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if [!processedArgs!]==[] (
@@ -154,6 +157,9 @@ set "__BinDir=%__RootBinDir%\bin\coreclr\%__TargetOS%.%__BuildArch%.%__BuildType
set "__TestRootDir=%__RootBinDir%\tests\coreclr"
set "__TestBinDir=%__TestRootDir%\%__TargetOS%.%__BuildArch%.%__BuildType%"
+if not defined XunitTestBinBase set XunitTestBinBase=%__TestBinDir%\
+set "CORE_ROOT=%XunitTestBinBase%\Tests\Core_Root"
+
REM We have different managed and native intermediate dirs because the managed bits will include
REM the configuration information deeper in the intermediates path.
REM These variables are used by the msbuild project files.
@@ -287,9 +293,6 @@ if "%__SkipRestorePackages%" == "1" goto SkipRestoreProduct
echo %__MsgPrefix%Restoring CoreCLR product from packages
-if not defined XunitTestBinBase set XunitTestBinBase=%__TestBinDir%\
-set "CORE_ROOT=%XunitTestBinBase%\Tests\Core_Root"
-
set __BuildLogRootName=Restore_Product
set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__TargetOS%__%__BuildArch%__%__BuildType%.log
set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__TargetOS%__%__BuildArch%__%__BuildType%.wrn
@@ -434,12 +437,8 @@ REM Remove any lock folder used for synchronization from previous runs.
powershell -NoProfile "Get-ChildItem -path %__TestBinDir% -Include 'lock' -Recurse -Force | where {$_.Attributes -eq 'Directory'}| Remove-Item -force -Recurse"
set CORE_ROOT=%__TestBinDir%\Tests\Core_Root
-set CORE_ROOT_STAGE=%__TestBinDir%\Tests\Core_Root_Stage
if exist "%CORE_ROOT%" rd /s /q "%CORE_ROOT%"
-if exist "%CORE_ROOT_STAGE%" rd /s /q "%CORE_ROOT_STAGE%"
md "%CORE_ROOT%"
-md "%CORE_ROOT_STAGE%"
-xcopy /s "%__BinDir%" "%CORE_ROOT_STAGE%"
REM =========================================================================================
REM ===
@@ -477,8 +476,6 @@ if errorlevel 1 (
exit /b 1
)
-xcopy /s /y /i "%CORE_ROOT_STAGE%" "%CORE_ROOT%"
-
REM =========================================================================================
REM ===
REM === Create test wrappers.
@@ -502,8 +499,14 @@ set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
set __Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr!
+if %%__Mono%%==1 (
+ set RuntimeFlavor="mono"
+) else (
+ set RuntimeFlavor="coreclr"
+)
+
REM Build wrappers using the local SDK's msbuild. As we move to arcade, the other builds should be moved away from run.exe as well.
-call "%__RepoRootDir%\dotnet.cmd" msbuild %__ProjectDir%\tests\src\runtest.proj /nodereuse:false /p:BuildWrappers=true /p:TestBuildMode=%__TestBuildMode% !__Logging! %__msbuildArgs% %TargetsWindowsMsbuildArg% %__SkipFXRestoreArg% %__UnprocessedBuildArgs%
+call "%__RepoRootDir%\dotnet.cmd" msbuild %__ProjectDir%\tests\src\runtest.proj /nodereuse:false /p:BuildWrappers=true /p:TestBuildMode=%__TestBuildMode% !__Logging! %__msbuildArgs% %TargetsWindowsMsbuildArg% %__SkipFXRestoreArg% %__UnprocessedBuildArgs% /p:RuntimeFlavor=%RuntimeFlavor%
if errorlevel 1 (
echo %__ErrMsgPrefix%%__MsgPrefix%Error: XUnit wrapper build failed. Refer to the build log files for details:
echo %__BuildLog%
@@ -556,8 +559,6 @@ if defined __DoCrossgen2 (
:SkipCrossgen
-rd /s /q "%CORE_ROOT_STAGE%"
-
REM =========================================================================================
REM ===
REM === All builds complete!
@@ -627,18 +628,47 @@ exit /b 1
set __TotalPrecompiled=0
set __FailedToPrecompile=0
set __FailedAssemblies=
-for %%F in ("%CORE_ROOT%\System.*.dll";"%CORE_ROOT%\Microsoft.*.dll") do (
+set __CompositeOutputDir=%CORE_ROOT%\composite.out
+set __CompositeResponseFile=%__CompositeOutputDir%\framework-r2r.dll.rsp
+
+if defined __CompositeBuildMode (
+ mkdir !__CompositeOutputDir!
+ echo --composite>>!__CompositeResponseFile!
+ echo -O>>!__CompositeResponseFile!
+ echo --out^:%__CompositeOutputDir%\framework-r2r.dll>>!__CompositeResponseFile!
+)
+
+for %%F in ("%CORE_ROOT%\System.*.dll";"%CORE_ROOT%\Microsoft.*.dll";%CORE_ROOT%\netstandard.dll;%CORE_ROOT%\mscorlib.dll) do (
if not "%%~nxF"=="Microsoft.CodeAnalysis.VisualBasic.dll" (
if not "%%~nxF"=="Microsoft.CodeAnalysis.CSharp.dll" (
if not "%%~nxF"=="Microsoft.CodeAnalysis.dll" (
if not "%%~nxF"=="System.Runtime.WindowsRuntime.dll" (
- call :PrecompileAssembly "%%F" %%~nxF __TotalPrecompiled __FailedToPrecompile __FailedAssemblies
- echo Processed: !__TotalPrecompiled!, failed !__FailedToPrecompile!
+ if defined __CompositeBuildMode (
+ echo %%F>>!__CompositeResponseFile!
+ ) else (
+ call :PrecompileAssembly "%%F" %%~nxF __TotalPrecompiled __FailedToPrecompile __FailedAssemblies
+ echo Processed: !__TotalPrecompiled!, failed !__FailedToPrecompile!
+ )
)))))
)
+if defined __CompositeBuildMode (
+ echo Composite response line^: %__CompositeResponseFile%
+ type "%__CompositeResponseFile%"
+)
+
+if defined __CompositeBuildMode (
+ set __CompositeCommandLine="%__RepoRootDir%\dotnet.cmd"
+ set __CompositeCommandLine=!__CompositeCommandLine! "%CORE_ROOT%\crossgen2\crossgen2.dll"
+ set __CompositeCommandLine=!__CompositeCommandLine! "@%__CompositeResponseFile%"
+ echo Building composite R2R framework^: !__CompositeCommandLine!
+ call !__CompositeCommandLine!
+ set __FailedToPrecompile=!ERRORLEVEL!
+ copy /Y "!__CompositeOutputDir!\*.*" "!CORE_ROOT!\"
+)
+
if !__FailedToPrecompile! NEQ 0 (
- echo Failed assemblies:
+ @echo Failed assemblies:
FOR %%G IN (!__FailedAssemblies!) do echo %%G
)
@@ -650,13 +680,13 @@ REM Compile the managed assemblies in Core_ROOT before running the tests
set AssemblyPath=%1
set AssemblyName=%2
-set __CrossgenExe="%CORE_ROOT%\crossgen.exe"
-if /i "%__BuildArch%" == "arm" ( set __CrossgenExe="%CORE_ROOT%\x86\crossgen.exe" )
-if /i "%__BuildArch%" == "arm64" ( set __CrossgenExe="%CORE_ROOT%\x64\crossgen.exe" )
+set __CrossgenExe="%__BinDir%\crossgen.exe"
+if /i "%__BuildArch%" == "arm" ( set __CrossgenExe="%__BinDir%\x86\crossgen.exe" )
+if /i "%__BuildArch%" == "arm64" ( set __CrossgenExe="%__BinDir%\x64\crossgen.exe" )
set __CrossgenExe=%__CrossgenExe%
if defined __DoCrossgen2 (
- set __CrossgenExe="%CORE_ROOT%\corerun" "%CORE_ROOT%\crossgen2\crossgen2.dll"
+ set __CrossgenExe="%__RepoRootDir%\dotnet.cmd" "%CORE_ROOT%\crossgen2\crossgen2.dll"
)
REM Intentionally avoid using the .dll extension to prevent
@@ -666,12 +696,14 @@ set __CrossgenCmd=
if defined __DoCrossgen (
set __CrossgenCmd=!__CrossgenExe! /Platform_Assemblies_Paths "!CORE_ROOT!" /in !AssemblyPath! /out !__CrossgenOutputFile!
+ echo !__CrossgenCmd!
+ !__CrossgenCmd!
) else (
set __CrossgenCmd=!__CrossgenExe! -r:"!CORE_ROOT!\System.*.dll" -r:"!CORE_ROOT!\Microsoft.*.dll" -r:"!CORE_ROOT!\mscorlib.dll" -r:"!CORE_ROOT!\netstandard.dll" -O --inputbubble --out:!__CrossgenOutputFile! !AssemblyPath!
+ echo !__CrossgenCmd!
+ call !__CrossgenCmd!
)
-echo %__CrossgenCmd%
-%__CrossgenCmd%
set /a __exitCode = !errorlevel!
set /a "%~3+=1"
diff --git a/src/coreclr/build-test.sh b/src/coreclr/build-test.sh
index 65110b5ef3b21c..78d294bd83564f 100755
--- a/src/coreclr/build-test.sh
+++ b/src/coreclr/build-test.sh
@@ -6,9 +6,9 @@ build_test_wrappers()
echo "${__MsgPrefix}Creating test wrappers..."
if [[ $__Mono -eq 1 ]]; then
- export RuntimeFlavor="mono"
+ __RuntimeFlavor="mono"
else
- export RuntimeFlavor="coreclr"
+ __RuntimeFlavor="coreclr"
fi
__Exclude="${__ProjectDir}/tests/issues.targets"
@@ -32,7 +32,7 @@ build_test_wrappers()
__MsbuildErr="/fileloggerparameters2:\"ErrorsOnly;LogFile=${__BuildErr}\""
__Logging="$__MsbuildLog $__MsbuildWrn $__MsbuildErr /consoleloggerparameters:$buildVerbosity"
- nextCommand="\"${__DotNetCli}\" msbuild \"${__ProjectDir}/tests/src/runtest.proj\" /nodereuse:false /p:BuildWrappers=true /p:TestBuildMode=$__TestBuildMode /p:TargetsWindows=false $__Logging /p:TargetOS=$__TargetOS /p:Configuration=$__BuildType /p:TargetArchitecture=$__BuildArch"
+ nextCommand="\"${__DotNetCli}\" msbuild \"${__ProjectDir}/tests/src/runtest.proj\" /nodereuse:false /p:BuildWrappers=true /p:TestBuildMode=$__TestBuildMode /p:TargetsWindows=false $__Logging /p:TargetOS=$__TargetOS /p:Configuration=$__BuildType /p:TargetArchitecture=$__BuildArch /p:RuntimeFlavor=$__RuntimeFlavor \"/bl:${__RepoRootDir}/artifacts/log/${__BuildType}/build_test_wrappers_${__RuntimeFlavor}.binlog\""
eval $nextCommand
local exitCode="$?"
@@ -119,13 +119,10 @@ generate_layout()
mkdir -p "$CORE_ROOT"
- build_MSBuild_projects "Tests_Overlay_Managed" "${__ProjectDir}/tests/src/runtest.proj" "Creating test overlay" "/t:CreateTestOverlay"
-
chmod +x "$__BinDir"/corerun
chmod +x "$__CrossgenExe"
- # Make sure to copy over the pulled down packages
- cp -r "$__BinDir"/* "$CORE_ROOT/" > /dev/null
+ build_MSBuild_projects "Tests_Overlay_Managed" "${__ProjectDir}/tests/src/runtest.proj" "Creating test overlay" "/t:CreateTestOverlay"
if [[ "$__TargetOS" != "OSX" ]]; then
nextCommand="\"$__TestDir/setup-stress-dependencies.sh\" --arch=$__BuildArch --outputDir=$CORE_ROOT"
@@ -183,15 +180,25 @@ precompile_coreroot_fx()
local totalPrecompiled=0
local failedToPrecompile=0
+ local compositeCommandLine="${__DotNetCli}"
+ compositeCommandLine+=" $__BinDir/crossgen2/crossgen2.dll"
+ compositeCommandLine+=" --composite"
+ compositeCommandLine+=" -O"
+ compositeCommandLine+=" --out:$outputDir/framework-r2r.dll"
declare -a failedAssemblies
- filesToPrecompile=$(find -L "$overlayDir" -maxdepth 1 -iname Microsoft.\*.dll -o -iname System.\*.dll -type f)
+ filesToPrecompile=$(find -L "$overlayDir" -maxdepth 1 -iname Microsoft.\*.dll -o -iname System.\*.dll -o -iname netstandard.dll -o -iname mscorlib.dll -type f)
for fileToPrecompile in ${filesToPrecompile}; do
local filename="$fileToPrecompile"
if is_skip_crossgen_test "$(basename $filename)"; then
continue
fi
+ if [[ "$__CompositeBuildMode" != 0 ]]; then
+ compositeCommandLine+=" $filename"
+ continue
+ fi
+
local commandLine=""
if [[ "$__DoCrossgen" != 0 ]]; then
@@ -199,7 +206,7 @@ precompile_coreroot_fx()
fi
if [[ "$__DoCrossgen2" != 0 ]]; then
- commandLine="$overlayDir/corerun $overlayDir/crossgen2/crossgen2.dll $crossgen2References -O --inputbubble --out $outputDir/$(basename $filename) $filename"
+ commandLine="${__DotNetCli} $overlayDir/crossgen2/crossgen2.dll $crossgen2References -O --inputbubble --out $outputDir/$(basename $filename) $filename"
fi
echo Precompiling "$filename"
@@ -224,6 +231,17 @@ precompile_coreroot_fx()
echo "Processed: $totalPrecompiled, failed $failedToPrecompile"
done
+ if [[ "$__CompositeBuildMode" != 0 ]]; then
+ # Compile the entire framework in composite build mode
+ echo "Compiling composite R2R framework: $compositeCommandLine"
+ $compositeCommandLine
+ local exitCode="$?"
+ if [[ "$exitCode" != 0 ]]; then
+ echo Unable to precompile composite framework, exit code is "$exitCode".
+ exit 1
+ fi
+ fi
+
if [[ "$__DoCrossgen2" != 0 ]]; then
# Copy the Crossgen-compiled assemblies back to CORE_ROOT
mv -f "$outputDir"/* "$overlayDir"/
@@ -536,6 +554,12 @@ handle_arguments_local() {
__TestBuildMode=crossgen2
;;
+ composite|-composite)
+ __CompositeBuildMode=1
+ __DoCrossgen2=1
+ __TestBuildMode=crossgen2
+ ;;
+
generatetesthostonly|-generatetesthostonly)
__GenerateTestHostOnly=1
;;
@@ -603,6 +627,7 @@ __CrossBuild=0
__DistroRid=""
__DoCrossgen=0
__DoCrossgen2=0
+__CompositeBuildMode=0
__DotNetCli="$__RepoRootDir/dotnet.sh"
__GenerateLayoutOnly=
__GenerateTestHostOnly=
diff --git a/src/coreclr/build.cmd b/src/coreclr/build.cmd
deleted file mode 100644
index a4955fb4c52a35..00000000000000
--- a/src/coreclr/build.cmd
+++ /dev/null
@@ -1,1017 +0,0 @@
-@if not defined _echo @echo off
-setlocal EnableDelayedExpansion EnableExtensions
-
-:: Define a prefix for most output progress messages that come from this script. That makes
-:: it easier to see where these are coming from. Note that there is a trailing space here.
-set "__MsgPrefix=BUILD: "
-
-echo %__MsgPrefix%Starting Build at %TIME%
-echo %__MsgPrefix%WARNING: This build script is deprecated and will be deleted soon. Use the root build script to build CoreCLR. If you want to build the CoreCLR runtime without using MSBuild, use the build-native.cmd script.
-echo %__MsgPrefix%See https://github.com/dotnet/runtime/issues/32991 for more information.
-
-set __ThisScriptFull="%~f0"
-set __ThisScriptDir="%~dp0"
-
-call "%__ThisScriptDir%"\setup_vs_tools.cmd
-if NOT '%ERRORLEVEL%' == '0' goto ExitWithError
-
-if defined VS160COMNTOOLS (
- set "__VSToolsRoot=%VS160COMNTOOLS%"
- set "__VCToolsRoot=%VS160COMNTOOLS%\..\..\VC\Auxiliary\Build"
- set __VSVersion=vs2019
-) else if defined VS150COMNTOOLS (
- set "__VSToolsRoot=%VS150COMNTOOLS%"
- set "__VCToolsRoot=%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build"
- set __VSVersion=vs2017
-)
-
-:: Note that the msbuild project files (specifically, dir.proj) will use the following variables, if set:
-:: __BuildArch -- default: x64
-:: __BuildType -- default: Debug
-:: __TargetOS -- default: Windows_NT
-:: __ProjectDir -- default: directory of the dir.props file
-:: __RepoRootDir -- default: directory two levels above the dir.props file
-:: __SourceDir -- default: %__ProjectDir%\src\
-:: __RootBinDir -- default: %__RepoRootDir%\artifacts\
-:: __BinDir -- default: %__RootBinDir%\%__TargetOS%.%__BuildArch.%__BuildType%\
-:: __IntermediatesDir
-:: __PackagesBinDir -- default: %__BinDir%\.nuget
-::
-:: Thus, these variables are not simply internal to this script!
-
-:: Set the default arguments for build
-set __BuildArch=x64
-set __BuildType=Debug
-set __TargetOS=Windows_NT
-
-:: Set the various build properties here so that CMake and MSBuild can pick them up
-set "__ProjectDir=%~dp0"
-:: remove trailing slash
-if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
-set "__RepoRootDir=%__ProjectDir%\..\.."
-
-set "__ProjectFilesDir=%__ProjectDir%"
-set "__SourceDir=%__ProjectDir%\src"
-set "__RootBinDir=%__RepoRootDir%\artifacts"
-
-set __BuildAll=
-
-set __BuildArchX64=0
-set __BuildArchX86=0
-set __BuildArchArm=0
-set __BuildArchArm64=0
-
-set __BuildTypeDebug=0
-set __BuildTypeChecked=0
-set __BuildTypeRelease=0
-
-set __PgoInstrument=0
-set __PgoOptimize=1
-set __EnforcePgo=0
-set __IbcTuning=
-
-REM __PassThroughArgs is a set of things that will be passed through to nested calls to build.cmd
-REM when using "all".
-set __PassThroughArgs=
-
-REM __UnprocessedBuildArgs are args that we pass to msbuild (e.g. /p:TargetArchitecture=x64)
-set "__args= %*"
-set processedArgs=
-set __UnprocessedBuildArgs=
-set __CommonMSBuildArgs=
-
-set __BuildCoreLib=1
-set __BuildNative=1
-set __BuildCrossArchNative=0
-set __SkipCrossArchNative=0
-set __BuildTests=1
-set __BuildPackages=1
-set __BuildNativeCoreLib=1
-set __BuildManagedTools=1
-set __RestoreOptData=1
-set __GenerateLayout=0
-set __CrossgenAltJit=
-set __SkipRestoreArg=/p:RestoreDuringBuild=true
-set __OfficialBuildIdArg=
-set __CrossArch=
-set __PgoOptDataPath=
-
-@REM CMD has a nasty habit of eating "=" on the argument list, so passing:
-@REM -priority=1
-@REM appears to CMD parsing as "-priority 1". Handle -priority specially to avoid problems,
-@REM and allow the "-priority=1" syntax.
-set __Priority=
-
-:Arg_Loop
-if "%1" == "" goto ArgsDone
-
-if /i "%1" == "/?" goto Usage
-if /i "%1" == "-?" goto Usage
-if /i "%1" == "/h" goto Usage
-if /i "%1" == "-h" goto Usage
-if /i "%1" == "/help" goto Usage
-if /i "%1" == "-help" goto Usage
-if /i "%1" == "--help" goto Usage
-
-if /i "%1" == "-all" (set __BuildAll=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-x64" (set __BuildArchX64=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-x86" (set __BuildArchX86=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-arm" (set __BuildArchArm=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-arm64" (set __BuildArchArm64=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-
-if /i "%1" == "-debug" (set __BuildTypeDebug=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-checked" (set __BuildTypeChecked=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-release" (set __BuildTypeRelease=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-
-
-REM TODO these are deprecated remove them eventually
-REM don't add more, use the - syntax instead
-if /i "%1" == "all" (set __BuildAll=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "x64" (set __BuildArchX64=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "x86" (set __BuildArchX86=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "arm" (set __BuildArchArm=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "arm64" (set __BuildArchArm64=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-
-if /i "%1" == "debug" (set __BuildTypeDebug=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "checked" (set __BuildTypeChecked=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "release" (set __BuildTypeRelease=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-
-if /i "%1" == "-priority" (set __Priority=%2&shift&set processedArgs=!processedArgs! %1=%2&shift&goto Arg_Loop)
-
-REM Explicitly block -Rebuild.
-if /i "%1" == "Rebuild" (
- echo "ERROR: 'Rebuild' is not supported. Please remove it."
- goto Usage
-)
-if /i "%1" == "-Rebuild" (
- echo "ERROR: 'Rebuild' is not supported. Please remove it."
- goto Usage
-)
-
-
-REM All arguments after this point will be passed through directly to build.cmd on nested invocations
-REM using the "all" argument, and must be added to the __PassThroughArgs variable.
-if [!__PassThroughArgs!]==[] (
- set __PassThroughArgs=%1
-) else (
- set __PassThroughArgs=%__PassThroughArgs% %1
-)
-
-if /i "%1" == "-ci" (set __ArcadeScriptArgs="-ci"&set __ErrMsgPrefix=##vso[task.logissue type=error]&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-OfficialBuildId" (set __OfficialBuildIdArg=/p:OfficialBuildId=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1=%2&shift&shift&goto Arg_Loop)
-
-if /i "%1" == "-alpinedac" (set __BuildCoreLib=0&set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildCrossArchNative=1&set __CrossArch=x64&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set __TargetOS=alpine&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-linuxdac" (set __BuildCoreLib=0&set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildCrossArchNative=1&set __CrossArch=x64&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set __TargetOS=Linux&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-
-if /i "%1" == "-freebsdmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set __TargetOS=FreeBSD&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-linuxmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set __TargetOS=Linux&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-netbsdmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set __TargetOS=NetBSD&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-osxmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set __TargetOS=OSX&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-windowsmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set __TargetOS=Windows_NT&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-nativemscorlib" (set __BuildNativeCoreLib=1&set __BuildCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-configureonly" (set __ConfigureOnly=1&set __BuildNative=1&set __BuildNativeCoreLib=0&set __BuildCoreLib=0&set __BuildTests=0&set __BuildPackages=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-skipconfigure" (set __SkipConfigure=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-skipmscorlib" (set __BuildCoreLib=0&set __BuildNativeCoreLib=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-skipnative" (set __BuildNative=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-skipcrossarchnative" (set __SkipCrossArchNative=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-skiptests" (set __BuildTests=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-skipbuildpackages" (set __BuildPackages=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-skipmanagedtools" (set __BuildManagedTools=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-skiprestoreoptdata" (set __RestoreOptData=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-generatelayout" (set __GenerateLayout=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-usenmakemakefiles" (set __NMakeMakefiles=1&set __ConfigureOnly=1&set __BuildNative=1&set __BuildNativeCoreLib=0&set __BuildCoreLib=0&set __BuildTests=0&set __BuildPackages=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-pgoinstrument" (set __PgoInstrument=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-enforcepgo" (set __EnforcePgo=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-nopgooptimize" (set __PgoOptimize=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-ibcinstrument" (set __IbcTuning=/Tuning&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-crossgenaltjit" (set __CrossgenAltJit=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
-REM TODO remove these once they are no longer used in buildpipeline
-if /i "%1" == "-skiprestore" (set __SkipRestoreArg=/p:RestoreDuringBuild=false&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-
-REM TODO these are deprecated remove them eventually
-REM don't add more, use the - syntax instead
-if /i "%1" == "freebsdmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set __TargetOS=FreeBSD&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "linuxmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set __TargetOS=Linux&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "netbsdmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set __TargetOS=NetBSD&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "osxmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set __TargetOS=OSX&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "windowsmscorlib" (set __BuildNativeCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set __TargetOS=Windows_NT&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "nativemscorlib" (set __BuildNativeCoreLib=1&set __BuildCoreLib=0&set __BuildNative=0&set __BuildTests=0&set __BuildPackages=0&set __BuildManagedTools=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "configureonly" (set __ConfigureOnly=1&set __BuildNative=1&set __BuildNativeCoreLib=0&set __BuildCoreLib=0&set __BuildTests=0&set __BuildPackages=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "skipconfigure" (set __SkipConfigure=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "skipmscorlib" (set __BuildCoreLib=0&set __BuildNativeCoreLib=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "skipnative" (set __BuildNative=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "skipcrossarchnative" (set __SkipCrossArchNative=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "skiptests" (set __BuildTests=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "skipbuildpackages" (set __BuildPackages=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "skiprestoreoptdata" (set __RestoreOptData=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "generatelayout" (set __GenerateLayout=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "usenmakemakefiles" (set __NMakeMakefiles=1&set __ConfigureOnly=1&set __BuildNative=1&set __BuildNativeCoreLib=0&set __BuildCoreLib=0&set __BuildTests=0&set __BuildPackages=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "pgoinstrument" (set __PgoInstrument=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "nopgooptimize" (set __PgoOptimize=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "enforcepgo" (set __EnforcePgo=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "ibcinstrument" (set __IbcTuning=/Tuning&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "crossgenaltjit" (set __CrossgenAltJit=%2&set __PassThroughArgs=%__PassThroughArgs% %2set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
-REM TODO remove this once it's no longer used in buildpipeline
-if /i "%1" == "--" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-
-if [!processedArgs!]==[] (
- set __UnprocessedBuildArgs=%__args%
-) else (
- set __UnprocessedBuildArgs=%__args%
- for %%t in (!processedArgs!) do (
- set __UnprocessedBuildArgs=!__UnprocessedBuildArgs:*%%t=!
- )
-)
-
-:ArgsDone
-
-@REM Special handling for -priority=N argument.
-if defined __Priority (
- if defined __PassThroughArgs (
- set __PassThroughArgs=%__PassThroughArgs% -priority=%__Priority%
- ) else (
- set __PassThroughArgs=-priority=%__Priority%
- )
-)
-
-if defined __BuildAll goto BuildAll
-
-set /A __TotalSpecifiedBuildArch=__BuildArchX64 + __BuildArchX86 + __BuildArchArm + __BuildArchArm64
-if %__TotalSpecifiedBuildArch% GTR 1 (
- echo Error: more than one build architecture specified, but "all" not specified.
- goto Usage
-)
-
-if %__BuildArchX64%==1 set __BuildArch=x64
-if %__BuildArchX86%==1 set __BuildArch=x86
-if %__BuildArchArm%==1 (
- set __BuildArch=arm
- set __CrossArch=x86
-)
-if %__BuildArchArm64%==1 (
- set __BuildArch=arm64
- set __CrossArch=x64
-)
-
-set /A __TotalSpecifiedBuildType=__BuildTypeDebug + __BuildTypeChecked + __BuildTypeRelease
-if %__TotalSpecifiedBuildType% GTR 1 (
- echo Error: more than one build type specified, but "all" not specified.
- goto Usage
-)
-
-if %__BuildTypeDebug%==1 set __BuildType=Debug
-if %__BuildTypeChecked%==1 set __BuildType=Checked
-if %__BuildTypeRelease%==1 set __BuildType=Release
-
-set __CommonMSBuildArgs=/p:TargetOS=%__TargetOS% /p:Configuration=%__BuildType% /p:TargetArchitecture=%__BuildArch% !__SkipRestoreArg! !__OfficialBuildIdArg!
-
-if %__EnforcePgo%==1 (
- if %__BuildArchArm%==1 (
- echo NOTICE: enforcepgo does nothing on arm architecture
- )
- if %__BuildArchArm64%==1 (
- echo NOTICE: enforcepgo does nothing on arm64 architecture
- )
-)
-
-REM Determine if this is a cross-arch build. Only do cross-arch build if we're also building native.
-
-if %__SkipCrossArchNative% EQU 0 (
- if %__BuildNative% EQU 1 (
- if %__BuildCrossArchNative% EQU 0 (
- if /i not "%__BuildArch%"=="x86" (
- REM Make recursive calls to build the cross OS DAC
- call :BuildCrossOSDac -linuxdac
- if not !errorlevel! == 0 (
- goto ExitWithError
- )
- )
- )
- if /i "%__BuildArch%"=="arm64" (
- set __BuildCrossArchNative=1
- )
- if /i "%__BuildArch%"=="arm" (
- set __BuildCrossArchNative=1
- )
- )
-)
-
-REM Set the remaining variables based upon the determined build configuration
-
-if %__PgoOptimize%==0 (
- set __RestoreOptData=0
-)
-
-set "__BinDir=%__RootBinDir%\bin\coreclr\%__TargetOS%.%__BuildArch%.%__BuildType%"
-set "__IntermediatesDir=%__RootBinDir%\obj\coreclr\%__TargetOS%.%__BuildArch%.%__BuildType%"
-set "__ArtifactsIntermediatesDir=%__RepoRootDir%\artifacts\obj\coreclr\"
-if "%__NMakeMakefiles%"=="1" (set "__IntermediatesDir=%__RootBinDir%\nmakeobj\%__TargetOS%.%__BuildArch%.%__BuildType%")
-set "__PackagesBinDir=%__BinDir%\.nuget"
-set "__CrossComponentBinDir=%__BinDir%"
-set "__CrossCompIntermediatesDir=%__IntermediatesDir%\crossgen"
-set "__LogsDir=%__RootBinDir%\log\!__BuildType!"
-set "__MsbuildDebugLogsDir=%__LogsDir%\MsbuildDebugLogs"
-
-
-if NOT "%__CrossArch%" == "" set __CrossComponentBinDir=%__CrossComponentBinDir%\%__CrossArch%
-set "__CrossGenCoreLibLog=%__LogsDir%\CrossgenCoreLib_%__TargetOS%__%__BuildArch%__%__BuildType%.log"
-set "__CrossgenExe=%__CrossComponentBinDir%\crossgen.exe"
-
-REM Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
-set "__CMakeBinDir=%__BinDir%"
-set "__CMakeBinDir=%__CMakeBinDir:\=/%"
-
-if not exist "%__BinDir%" md "%__BinDir%"
-if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%"
-if not exist "%__LogsDir%" md "%__LogsDir%"
-if not exist "%__MsbuildDebugLogsDir%" md "%__MsbuildDebugLogsDir%"
-
-if not exist "%__RootBinDir%\Directory.Build.props" copy %__ProjectDir%\EmptyProps.props %__RootBinDir%\Directory.Build.props
-if not exist "%__RootBinDir%\Directory.Build.targets" copy %__ProjectDir%\EmptyProps.props %__RootBinDir%\Directory.Build.targets
-
-REM Set up the directory for MSBuild debug logs.
-set MSBUILDDEBUGPATH=%__MsbuildDebugLogsDir%
-
-REM It is convenient to have your Nuget search path include the location where the build
-REM will place packages. However nuget used during the build will fail if that directory
-REM does not exist. Avoid this in at least one case by aggressively creating the directory.
-if not exist "%__BinDir%\.nuget\pkg" md "%__BinDir%\.nuget\pkg"
-
-echo %__MsgPrefix%Commencing CoreCLR product build
-
-REM Set the remaining variables based upon the determined build configuration
-
-echo %__MsgPrefix%Checking prerequisites
-
-set __CMakeNeeded=1
-if %__BuildNative%==0 if %__BuildCrossArchNative%==0 if %__BuildNativeCoreLib%==0 if %__BuildTests%==0 set __CMakeNeeded=0
-if %__CMakeNeeded%==1 (
- REM Eval the output from set-cmake-path.ps1
- for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& ""%__SourceDir%\pal\tools\set-cmake-path.ps1"""') do %%a
- echo %__MsgPrefix%Using CMake from !CMakePath!
-)
-
-REM NumberOfCores is an WMI property providing number of physical cores on machine
-REM processor(s). It is used to set optimal level of CL parallelism during native build step
-if not defined NumberOfCores (
- REM Determine number of physical processor cores available on machine
- set TotalNumberOfCores=0
- for /f "tokens=*" %%I in (
- 'wmic cpu get NumberOfCores /value ^| find "=" 2^>NUL'
- ) do set %%I & set /a TotalNumberOfCores=TotalNumberOfCores+NumberOfCores
- set NumberOfCores=!TotalNumberOfCores!
-)
-echo %__MsgPrefix%Number of processor cores %NumberOfCores%
-
-REM =========================================================================================
-REM ===
-REM === Start the build steps
-REM ===
-REM =========================================================================================
-
-@if defined _echo @echo on
-
-echo %__MsgPrefix%Generating native version headers
-set "__BinLog=%__LogsDir%\GenerateVersionHeaders_%__TargetOS%__%__BuildArch%__%__BuildType%.binlog"
-powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__RepoRootDir%\eng\common\msbuild.ps1" /clp:nosummary %__ArcadeScriptArgs%^
- %__RepoRootDir%\eng\empty.csproj /p:NativeVersionFile="%__RootBinDir%\obj\coreclr\_version.h"^
- /t:GenerateNativeVersionFile /restore^
- %__CommonMSBuildArgs% %__UnprocessedBuildArgs% /bl:!__BinLog!
-if not !errorlevel! == 0 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: Failed to generate version headers.
- echo !__BinLog!
- set __exitCode=!errorlevel!
- goto ExitWithCode
-)
-
-REM =========================================================================================
-REM ===
-REM === Restore optimization profile data
-REM ===
-REM =========================================================================================
-
-set OptDataProjectFilePath=%__ProjectDir%\src\.nuget\optdata\optdata.csproj
-if %__RestoreOptData% EQU 1 (
- echo %__MsgPrefix%Restoring the OptimizationData Package
- set "__BinLog=%__LogsDir%\OptRestore_%__TargetOS%__%__BuildArch%__%__BuildType%.binlog"
-
- powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__RepoRootDir%\eng\common\msbuild.ps1" /clp:nosummary %__ArcadeScriptArgs%^
- %OptDataProjectFilePath% /t:Restore^
- %__CommonMSBuildArgs% %__UnprocessedBuildArgs%^
- /nodereuse:false /bl:!__BinLog!
- if not !errorlevel! == 0 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: Failed to restore the optimization data package.
- echo !__BinLog!
- set __exitCode=!errorlevel!
- goto ExitWithCode
- )
-)
-set __PgoOptDataPath=
-if %__PgoOptimize% EQU 1 (
- set PgoDataPackagePathOutputFile="%__IntermediatesDir%\optdatapath.txt"
- set "__BinLog=%__LogsDir%\PgoVersionRead_%__TargetOS%__%__BuildArch%__%__BuildType%.binlog"
-
- REM Parse the optdata package versions out of msbuild so that we can pass them on to CMake
- powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__RepoRootDir%\eng\common\msbuild.ps1" /clp:nosummary %__ArcadeScriptArgs%^
- "%OptDataProjectFilePath%" /t:DumpPgoDataPackagePath %__CommonMSBuildArgs% /bl:!__BinLog! /p:PgoDataPackagePathOutputFile="!PgoDataPackagePathOutputFile!"
-
- if not !errorlevel! == 0 (
- echo %__ErrMsgPrefix%Failed to get PGO data package path.
- echo !__BinLog!
- set __exitCode=!errorlevel!
- goto ExitWithCode
- )
- if not exist "!PgoDataPackagePathOutputFile!" (
- echo %__ErrMsgPrefix%Failed to get PGO data package path.
- echo !__BinLog!
- goto ExitWithError
- )
-
- set /p __PgoOptDataPath=<"!PgoDataPackagePathOutputFile!"
-)
-
-REM =========================================================================================
-REM ===
-REM === Generate source files for eventing
-REM ===
-REM =========================================================================================
-
-set __IntermediatesIncDir=%__IntermediatesDir%\src\inc
-set __IntermediatesEventingDir=%__ArtifactsIntermediatesDir%\Eventing\%__BuildArch%\%__BuildType%
-
-REM Find python and set it to the variable PYTHON
-set _C=-c "import sys; sys.stdout.write(sys.executable)"
-(py -3 %_C% || py -2 %_C% || python3 %_C% || python2 %_C% || python %_C%) > %TEMP%\pythonlocation.txt 2> NUL
-set _C=
-set /p PYTHON=<%TEMP%\pythonlocation.txt
-
-if NOT DEFINED PYTHON (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: Could not find a python installation
- goto ExitWithError
-)
-
-if %__BuildCoreLib% EQU 1 (
- echo %__MsgPrefix%Laying out dynamically generated EventSource classes
- "!PYTHON!" -B -Wall %__SourceDir%\scripts\genRuntimeEventSources.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate %__IntermediatesEventingDir% || goto ExitWithError
-)
-
-REM =========================================================================================
-REM ===
-REM === Build Cross-Architecture Native Components (if applicable)
-REM ===
-REM =========================================================================================
-
-if %__BuildCrossArchNative% EQU 1 (
- REM Scope environment changes start {
- setlocal
-
- echo %__MsgPrefix%Commencing build of cross architecture native components for %__TargetOS%.%__BuildArch%.%__BuildType%
-
- REM Set the environment for the cross-arch native build
- set __VCBuildArch=x86_amd64
- if /i "%__CrossArch%" == "x86" ( set __VCBuildArch=x86 )
-
- echo %__MsgPrefix%Using environment: "%__VCToolsRoot%\vcvarsall.bat" !__VCBuildArch!
- call "%__VCToolsRoot%\vcvarsall.bat" !__VCBuildArch!
- @if defined _echo @echo on
-
- if not exist "%__CrossCompIntermediatesDir%" md "%__CrossCompIntermediatesDir%"
- if defined __SkipConfigure goto SkipConfigureCrossBuild
-
- set __CMakeBinDir=%__CrossComponentBinDir%
- set "__CMakeBinDir=!__CMakeBinDir:\=/!"
- set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%"
- call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__CrossCompIntermediatesDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs!
-
- if not !errorlevel! == 0 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate native component build project!
- goto ExitWithError
- )
- @if defined _echo @echo on
-
-:SkipConfigureCrossBuild
- if not exist "%__CrossCompIntermediatesDir%\CMakeCache.txt" (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: unable to find generated native component build project!
- goto ExitWithError
- )
-
- if defined __ConfigureOnly goto SkipCrossCompBuild
-
- set __BuildLogRootName=Cross
- set "__BuildLog=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.log"
- set "__BuildWrn=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.wrn"
- set "__BuildErr=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.err"
- set "__BinLog=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.binlog"
- set "__MsbuildLog=/flp:Verbosity=normal;LogFile=!__BuildLog!"
- set "__MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!"
- set "__MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!"
- set "__MsbuildBinLog=/bl:!__BinLog!"
- set "__Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! !__MsbuildBinLog!"
-
- REM We pass the /m flag directly to MSBuild so that we can get both MSBuild and CL parallelism, which is fastest for our builds.
- "%CMakePath%" --build %__CrossCompIntermediatesDir% --target install --config %__BuildType% -- /nologo /m !__Logging!
-
- if not !errorlevel! == 0 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: cross-arch components build failed.
- echo !__BinLog!
- set __exitCode=!errorlevel!
- goto ExitWithCode
- )
-
-:SkipCrossCompBuild
- REM } Scope environment changes end
- endlocal
-)
-
-REM =========================================================================================
-REM ===
-REM === Build the CLR VM
-REM ===
-REM =========================================================================================
-
-if %__BuildNative% EQU 1 (
- REM Scope environment changes start {
- setlocal
-
- echo %__MsgPrefix%Commencing build of native components for %__TargetOS%.%__BuildArch%.%__BuildType%
-
- REM Set the environment for the native build
- set __VCBuildArch=x86_amd64
- if /i "%__BuildArch%" == "x86" ( set __VCBuildArch=x86 )
- if /i "%__BuildArch%" == "arm" (
- set __VCBuildArch=x86_arm
- set ___CrossBuildDefine="-DCLR_CMAKE_CROSS_ARCH=1" "-DCLR_CMAKE_CROSS_HOST_ARCH=%__CrossArch%"
- )
- if /i "%__BuildArch%" == "arm64" (
- set __VCBuildArch=x86_arm64
- set ___CrossBuildDefine="-DCLR_CMAKE_CROSS_ARCH=1" "-DCLR_CMAKE_CROSS_HOST_ARCH=%__CrossArch%"
- )
-
- echo %__MsgPrefix%Using environment: "%__VCToolsRoot%\vcvarsall.bat" !__VCBuildArch!
- call "%__VCToolsRoot%\vcvarsall.bat" !__VCBuildArch!
- @if defined _echo @echo on
-
- if not defined VSINSTALLDIR (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: VSINSTALLDIR variable not defined.
- goto ExitWithError
- )
- if not exist "!VSINSTALLDIR!DIA SDK" goto NoDIA
-
- if defined __SkipConfigure goto SkipConfigure
-
- echo %__MsgPrefix%Regenerating the Visual Studio solution
-
- set __ExtraCmakeArgs="-DCMAKE_SYSTEM_VERSION=10.0" !___CrossBuildDefine! "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%"
- call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__IntermediatesDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs!
- if not !errorlevel! == 0 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate native component build project!
- goto ExitWithError
- )
-
- @if defined _echo @echo on
-
-:SkipConfigure
- if not exist "%__IntermediatesDir%\CMakeCache.txt" (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: unable to find generated native component build project!
- goto ExitWithError
- )
-
- if defined __ConfigureOnly goto SkipNativeBuild
-
- set __BuildLogRootName=CoreCLR
- set "__BuildLog=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.log"
- set "__BuildWrn=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.wrn"
- set "__BuildErr=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.err"
- set "__BinLog=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.binlog"
- set "__MsbuildLog=/flp:Verbosity=normal;LogFile=!__BuildLog!"
- set "__MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!"
- set "__MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!"
- set "__MsbuildBinLog=/bl:!__BinLog!"
- set "__Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! !__MsbuildBinLog!"
-
- REM We pass the /m flag directly to MSBuild so that we can get both MSBuild and CL parallelism, which is fastest for our builds.
- "%CMakePath%" --build %__IntermediatesDir% --target install --config %__BuildType% -- /nologo /m !__Logging!
-
- if not !errorlevel! == 0 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: native component build failed.
- echo !__BinLog!
- set __exitCode=!errorlevel!
- goto ExitWithCode
- )
-
-:SkipNativeBuild
- REM } Scope environment changes end
- endlocal
-)
-
-REM =========================================================================================
-REM ===
-REM === CoreLib and NuGet package build section.
-REM ===
-REM =========================================================================================
-
-if %__BuildCoreLib% EQU 1 (
- REM Scope environment changes start {
- setlocal
-
- echo %__MsgPrefix%Commencing build of System.Private.CoreLib for %__TargetOS%.%__BuildArch%.%__BuildType%
- rem Explicitly set Platform causes conflicts in CoreLib project files. Clear it to allow building from VS x64 Native Tools Command Prompt
- set Platform=
-
- set __ExtraBuildArgs=
-
- if "%__BuildManagedTools%" == "1" (
- set __ExtraBuildArgs=!__ExtraBuildArgs! /p:BuildManagedTools=true
- )
-
- set __BuildLogRootName=System.Private.CoreLib
- set "__BuildLog=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.log"
- set "__BuildWrn=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.wrn"
- set "__BuildErr=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.err"
- set "__Binlog=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.binlog"
- set "__MsbuildLog=/flp:Verbosity=normal;LogFile=!__BuildLog!"
- set "__MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!"
- set "__MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!"
- set "__MsbuildBinLog=/bl:!__Binlog!"
- set "__Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! !__MsbuildBinLog!"
-
- powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__RepoRootDir%\eng\common\msbuild.ps1" /clp:nosummary %__ArcadeScriptArgs%^
- %__ProjectDir%\src\build.proj /t:Restore^
- /nodeReuse:false /p:PortableBuild=true /maxcpucount /p:IncludeRestoreOnlyProjects=true^
- !__Logging! /bl: %__CommonMSBuildArgs% !__ExtraBuildArgs! %__UnprocessedBuildArgs%
- if not !errorlevel! == 0 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: Managed Product assemblies restore failed. Refer to the build log files for details.
- echo !__BuildLog!
- echo !__BuildWrn!
- echo !__BuildErr!
- echo !__Binlog!
- set __exitCode=!errorlevel!
- goto ExitWithCode
- )
-
- powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -Command "%__RepoRootDir%\eng\common\msbuild.ps1" /clp:nosummary %__ArcadeScriptArgs%^
- %__ProjectDir%\src\build.proj /nodeReuse:false /p:PortableBuild=true /maxcpucount^
- '!__MsbuildLog!' '!__MsbuildWrn!' '!__MsbuildErr!' %__CommonMSBuildArgs% !__ExtraBuildArgs! %__UnprocessedBuildArgs%
- if not !errorlevel! == 0 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: Managed Product assemblies build failed. Refer to the build log files for details.
- echo !__BuildLog!
- echo !__BuildWrn!
- echo !__BuildErr!
- echo !__Binlog!
- set __exitCode=!errorlevel!
- goto ExitWithCode
- )
-
- if "%__BuildManagedTools%" == "1" (
- echo %__MsgPrefix%Publishing crossgen2...
- call %__RepoRootDir%\dotnet.cmd publish --self-contained -r win-%__BuildArch% -c %__BuildType% -o "%__BinDir%\crossgen2" "%__ProjectDir%\src\tools\crossgen2\crossgen2\crossgen2.csproj" /nologo /p:TargetArchitecture=%__BuildArch%
-
- if not !errorlevel! == 0 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: Failed to build crossgen2.
- echo !__BuildLog!
- echo !__BuildWrn!
- echo !__BuildErr!
- set __exitCode=!errorlevel!
- goto ExitWithCode
- )
-
- copy /Y "%__BinDir%\clrjit.dll" "%__BinDir%\crossgen2\clrjitilc.dll" | find /i /v "file(s) copied"
- copy /Y "%__BinDir%\jitinterface.dll" "%__BinDir%\crossgen2\jitinterface.dll" | find /i /v "file(s) copied"
- )
- REM } Scope environment changes end
- endlocal
-)
-
-REM =========================================================================================
-REM ===
-REM === Build native System.Private.CoreLib.
-REM ===
-REM =========================================================================================
-
-REM Scope environment changes start {
-setlocal
-
-REM Need diasymreader.dll on your path for /CreatePdb
-set PATH=%PATH%;%WinDir%\Microsoft.Net\Framework64\V4.0.30319;%WinDir%\Microsoft.Net\Framework\V4.0.30319
-
-if %__BuildNativeCoreLib% EQU 1 (
- echo %__MsgPrefix%Generating native image of System.Private.CoreLib for %__TargetOS%.%__BuildArch%.%__BuildType%. Logging to "%__CrossGenCoreLibLog%".
- if exist "%__CrossGenCoreLibLog%" del "%__CrossGenCoreLibLog%"
-
- REM Need VS native tools environment for the **target** arch when running instrumented binaries
- if %__PgoInstrument% EQU 1 (
- set __VCExecArch=%__BuildArch%
- if /i [%__BuildArch%] == [x64] set __VCExecArch=amd64
- echo %__MsgPrefix%Using environment: "%__VCToolsRoot%\vcvarsall.bat" !__VCExecArch!
- call "%__VCToolsRoot%\vcvarsall.bat" !__VCExecArch!
- @if defined _echo @echo on
- if NOT !errorlevel! == 0 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: Failed to load native tools environment for !__VCExecArch!
- goto ExitWithError
- )
-
- REM HACK: Workaround for [dotnet/coreclr#13970](https://github.com/dotnet/coreclr/issues/13970)
- set __PgoRtPath=
- for /f "tokens=*" %%f in ('where pgort*.dll') do (
- if not defined __PgoRtPath set "__PgoRtPath=%%~f"
- )
- echo %__MsgPrefix%Copying "!__PgoRtPath!" into "%__BinDir%"
- copy /y "!__PgoRtPath!" "%__BinDir%" || (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: copy failed
- goto ExitWithError
- )
- REM End HACK
- )
-
- if defined __CrossgenAltJit (
- REM Set altjit flags for the crossgen run. Note that this entire crossgen section is within a setlocal/endlocal scope,
- REM so we don't need to save or unset these afterwards.
- echo %__MsgPrefix%Setting altjit environment variables for %__CrossgenAltJit%.
- echo %__MsgPrefix%Setting altjit environment variables for %__CrossgenAltJit%. >> "%__CrossGenCoreLibLog%"
- set COMPlus_AltJit=*
- set COMPlus_AltJitNgen=*
- set COMPlus_AltJitName=%__CrossgenAltJit%
- set COMPlus_AltJitAssertOnNYI=1
- set COMPlus_NoGuiOnAssert=1
- set COMPlus_ContinueOnAssert=0
- )
-
- set NEXTCMD="%__CrossgenExe%" /nologo %__IbcTuning% /Platform_Assemblies_Paths "%__BinDir%\IL" /out "%__BinDir%\System.Private.CoreLib.dll" "%__BinDir%\IL\System.Private.CoreLib.dll"
- echo %__MsgPrefix%!NEXTCMD!
- echo %__MsgPrefix%!NEXTCMD! >> "%__CrossGenCoreLibLog%"
- !NEXTCMD! >> "%__CrossGenCoreLibLog%" 2>&1
- if NOT !errorlevel! == 0 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: CrossGen System.Private.CoreLib build failed. Refer to %__CrossGenCoreLibLog%
- REM Put it in the same log, helpful for Jenkins
- type %__CrossGenCoreLibLog%
- goto ExitWithError
- )
-
- set NEXTCMD="%__CrossgenExe%" /nologo /Platform_Assemblies_Paths "%__BinDir%" /CreatePdb "%__BinDir%\PDB" "%__BinDir%\System.Private.CoreLib.dll"
- echo %__MsgPrefix%!NEXTCMD!
- echo %__MsgPrefix%!NEXTCMD! >> "%__CrossGenCoreLibLog%"
- !NEXTCMD! >> "%__CrossGenCoreLibLog%" 2>&1
- if NOT !errorlevel! == 0 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: CrossGen /CreatePdb System.Private.CoreLib build failed. Refer to %__CrossGenCoreLibLog%
- REM Put it in the same log, helpful for Jenkins
- type %__CrossGenCoreLibLog%
- goto ExitWithError
- )
-)
-
-REM } Scope environment changes end
-endlocal
-
-REM =========================================================================================
-REM ===
-REM === Build packages
-REM ===
-REM =========================================================================================
-
-if %__BuildPackages% EQU 1 (
- REM Scope environment changes start {
- setlocal
-
- echo %__MsgPrefix%Building Packages for %__TargetOS%.%__BuildArch%.%__BuildType%
-
- set __BuildLog="%__LogsDir%\Nuget_%__TargetOS%__%__BuildArch%__%__BuildType%.binlog"
-
- REM The conditions as to what to build are captured in the builds file.
- REM Package build uses the Arcade system and scripts, relying on it to restore required toolsets as part of build
- powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__RepoRootDir%\eng\common\build.ps1"^
- -r -b -projects %__SourceDir%\.nuget\coreclr-packages.proj^
- -verbosity minimal /clp:nosummary /nodeReuse:false /bl:!__BuildLog!^
- /p:PortableBuild=true^
- /p:Platform=%__BuildArch% %__CommonMSBuildArgs% %__UnprocessedBuildArgs%
- if not !errorlevel! == 0 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: Nuget package generation failed. Refer to the build log file for details.
- echo !__BuildLog!
- set __exitCode=!errorlevel!
- goto ExitWithCode
- )
-
- REM } Scope environment changes end
- endlocal
-)
-
-REM =========================================================================================
-REM ===
-REM === Test build section
-REM ===
-REM =========================================================================================
-
-if %__BuildTests% EQU 1 (
- echo %__MsgPrefix%Commencing build of tests for %__TargetOS%.%__BuildArch%.%__BuildType%
-
- set __PriorityArg=
- if defined __Priority (
- set __PriorityArg=-priority=%__Priority%
- )
- set NEXTCMD=call %__ProjectDir%\build-test.cmd %__BuildArch% %__BuildType% !__PriorityArg! %__UnprocessedBuildArgs%
- echo %__MsgPrefix%!NEXTCMD!
- !NEXTCMD!
-
- if not !errorlevel! == 0 (
- REM buildtest.cmd has already emitted an error message and mentioned the build log file to examine.
- goto ExitWithError
- )
-) else if %__GenerateLayout% EQU 1 (
- echo %__MsgPrefix%Generating layout for %__TargetOS%.%__BuildArch%.%__BuildType%
-
- set NEXTCMD=call %__ProjectDir%\build-test.cmd %__BuildArch% %__BuildType% generatelayoutonly %__UnprocessedBuildArgs%
- echo %__MsgPrefix%!NEXTCMD!
- !NEXTCMD!
-
- if not !errorlevel! == 0 (
- REM runtest.cmd has already emitted an error message and mentioned the build log file to examine.
- goto ExitWithError
- )
-)
-
-REM =========================================================================================
-REM ===
-REM === All builds complete!
-REM ===
-REM =========================================================================================
-
-echo %__MsgPrefix%Build succeeded. Finished at %TIME%
-echo %__MsgPrefix%Product binaries are available at !__BinDir!
-exit /b 0
-
-REM =========================================================================================
-REM ===
-REM === Handle the "all" case.
-REM ===
-REM =========================================================================================
-
-:BuildAll
-
-set __BuildArchList=
-
-set /A __TotalSpecifiedBuildArch=__BuildArchX64 + __BuildArchX86 + __BuildArchArm + __BuildArchArm64
-if %__TotalSpecifiedBuildArch% EQU 0 (
- REM Nothing specified means we want to build all architectures.
- set __BuildArchList=x64 x86 arm arm64
-)
-
-REM Otherwise, add all the specified architectures to the list.
-
-if %__BuildArchX64%==1 set __BuildArchList=%__BuildArchList% x64
-if %__BuildArchX86%==1 set __BuildArchList=%__BuildArchList% x86
-if %__BuildArchArm%==1 set __BuildArchList=%__BuildArchList% arm
-if %__BuildArchArm64%==1 set __BuildArchList=%__BuildArchList% arm64
-
-set __BuildTypeList=
-
-set /A __TotalSpecifiedBuildType=__BuildTypeDebug + __BuildTypeChecked + __BuildTypeRelease
-if %__TotalSpecifiedBuildType% EQU 0 (
- REM Nothing specified means we want to build all build types.
- set __BuildTypeList=Debug Checked Release
-)
-
-if %__BuildTypeDebug%==1 set __BuildTypeList=%__BuildTypeList% Debug
-if %__BuildTypeChecked%==1 set __BuildTypeList=%__BuildTypeList% Checked
-if %__BuildTypeRelease%==1 set __BuildTypeList=%__BuildTypeList% Release
-
-REM Create a temporary file to collect build results. We always build all flavors specified, and
-REM report a summary of the results at the end.
-
-set __AllBuildSuccess=true
-set __BuildResultFile=%TEMP%\build-all-summary-%RANDOM%.txt
-if exist %__BuildResultFile% del /f /q %__BuildResultFile%
-
-for %%i in (%__BuildArchList%) do (
- for %%j in (%__BuildTypeList%) do (
- call :BuildOne %%i %%j
- )
-)
-
-if %__AllBuildSuccess%==true (
- echo %__MsgPrefix%All builds succeeded!
- exit /b 0
-) else (
- echo %__MsgPrefix%Builds failed:
- type %__BuildResultFile%
- del /f /q %__BuildResultFile%
- goto ExitWithError
-)
-
-REM This code is unreachable, but leaving it nonetheless, just in case things change.
-exit /b 99
-
-:BuildOne
-set __BuildArch=%1
-set __BuildType=%2
-set __NextCmd=call %__ThisScriptFull% %__BuildArch% %__BuildType% %__PassThroughArgs%
-echo %__MsgPrefix%Invoking: %__NextCmd%
-%__NextCmd%
-if not !errorlevel! == 0 (
- echo %__MsgPrefix% %__BuildArch% %__BuildType% %__PassThroughArgs% >> %__BuildResultFile%
- set __AllBuildSuccess=false
-)
-
-
-echo %__MsgPrefix%WARNING: This build script is deprecated and will be deleted soon. Use the root build script to build CoreCLR. If you want to build the CoreCLR runtime without using MSBuild, use the build-native.cmd script.
-echo %__MsgPrefix%See https://github.com/dotnet/runtime/issues/32991 for more information.
-
-exit /b 0
-
-REM =========================================================================================
-REM ===
-REM === Helper routines
-REM ===
-REM =========================================================================================
-
-
-REM =========================================================================================
-REM === These two routines are intended for the exit code to propagate to the parent process
-REM === Like MSBuild or Powershell. If we directly exit /b 1 from within a if statement in
-REM === any of the routines, the exit code is not propagated.
-REM =========================================================================================
-:ExitWithError
-echo %__MsgPrefix%WARNING: This build script is deprecated and will be deleted soon. Use the root build script to build CoreCLR. If you want to build the CoreCLR runtime without using MSBuild, use the build-native.cmd script.
-echo %__MsgPrefix%See https://github.com/dotnet/runtime/issues/32991 for more information.
-exit /b 1
-
-:ExitWithCode
-echo %__MsgPrefix%WARNING: This build script is deprecated and will be deleted soon. Use the root build script to build CoreCLR. If you want to build the CoreCLR runtime without using MSBuild, use the build-native.cmd script.
-echo %__MsgPrefix%See https://github.com/dotnet/runtime/issues/32991 for more information.
-exit /b !__exitCode!
-
-:BuildCrossOSDac
-setlocal
-set __BuildDacOption=%1
-set __NextCmd=call %__ThisScriptFull% %__BuildDacOption% %__BuildArch% %__BuildType% %__PassThroughArgs%
-echo %__MsgPrefix%Invoking: %__NextCmd%
-%__NextCmd%
-if not !errorlevel! == 0 (
- echo %__MsgPrefix% %__BuildDacOption% %__BuildArch% %__BuildType% %__PassThroughArgs%
- endlocal
- goto ExitWithError
-)
-endlocal
-exit /b 0
-
-:Usage
-echo.
-echo Build the CoreCLR repo.
-echo.
-echo Usage:
-echo build.cmd [option1] [option2]
-echo or:
-echo build.cmd all [option1] [option2]
-echo.
-echo All arguments are optional. The options are:
-echo.
-echo.-? -h -help --help: view this message.
-echo -all: Builds all configurations and platforms.
-echo Build architecture: one of -x64, -x86, -arm, -arm64 ^(default: -x64^).
-echo Build type: one of -Debug, -Checked, -Release ^(default: -Debug^).
-echo mscorlib version: one of -freebsdmscorlib, -linuxmscorlib, -netbsdmscorlib, -osxmscorlib,
-echo or -windowsmscorlib. If one of these is passed, only System.Private.CoreLib is built,
-echo for the specified platform ^(FreeBSD, Linux, NetBSD, OS X or Windows,
-echo respectively^).
-echo add nativemscorlib to go further and build the native image for designated mscorlib.
-echo -nopgooptimize: do not use profile guided optimizations.
-echo -enforcepgo: verify after the build that PGO was used for key DLLs, and fail the build if not
-echo -pgoinstrument: generate instrumented code for profile guided optimization enabled binaries.
-echo -ibcinstrument: generate IBC-tuning-enabled native images when invoking crossgen.
-echo -configureonly: skip all builds; only run CMake ^(default: CMake and builds are run^)
-echo -alpinedac: Build a linux musl DAC with minimal support for printing exceptions in a dump on a windows host.
-echo -linuxdac: Build a linux DAC with minimal support for printing exceptions in a dump on a windows host.
-
-echo -skipconfigure: skip CMake ^(default: CMake is run^)
-echo -skipmscorlib: skip building System.Private.CoreLib ^(default: System.Private.CoreLib is built^).
-echo -skipnative: skip building native components ^(default: native components are built^).
-echo -skipcrossarchnative: skip building cross-architecture native components ^(default: components are built^).
-echo -skiptests: skip building tests ^(default: tests are built^).
-echo -skipbuildpackages: skip building nuget packages ^(default: packages are built^).
-echo -skipmanagedtools: skip build tools such as R2R dump and RunInContext
-echo -skiprestoreoptdata: skip restoring optimization data used by profile-based optimizations.
-echo -skiprestore: skip restoring packages ^(default: packages are restored during build^).
-echo -disableoss: Disable Open Source Signing for System.Private.CoreLib.
-echo -priority=^ : specify a set of test that will be built and run, with priority N.
-echo -officialbuildid=^: specify the official build ID to be used by this build.
-echo -crossgenaltjit ^: run crossgen using specified altjit ^(used for JIT testing^).
-echo portable : build for portable RID.
-echo.
-echo If "all" is specified, then all build architectures and types are built. If, in addition,
-echo one or more build architectures or types is specified, then only those build architectures
-echo and types are built.
-echo.
-echo For example:
-echo build -all
-echo -- builds all architectures, and all build types per architecture
-echo build -all -x86
-echo -- builds all build types for x86
-echo build -all -x64 -x86 -Checked -Release
-echo -- builds x64 and x86 architectures, Checked and Release build types for each
-exit /b 1
-
-:NoDIA
-echo Error: DIA SDK is missing at "%VSINSTALLDIR%DIA SDK". ^
-Did you install all the requirements for building on Windows, including the "Desktop Development with C++" workload? ^
-Please see https://github.com/dotnet/runtime/blob/master/docs/workflow/requirements/windows-requirements.md ^
-Another possibility is that you have a parallel installation of Visual Studio and the DIA SDK is there. In this case it ^
-may help to copy its "DIA SDK" folder into "%VSINSTALLDIR%" manually, then try again.
-exit /b 1
diff --git a/src/coreclr/build.sh b/src/coreclr/build.sh
deleted file mode 100755
index 634bcb7af3106e..00000000000000
--- a/src/coreclr/build.sh
+++ /dev/null
@@ -1,553 +0,0 @@
-#!/usr/bin/env bash
-
-# resolve python-version to use
-if [[ -z "$PYTHON" ]]; then
- if ! PYTHON=$(command -v python3 || command -v python2 || command -v python || command -v py)
- then
- echo "Unable to locate build-dependency python!" 1>&2
- exit 1
- fi
-fi
-# validate python-dependency
-# useful in case of explicitly set option.
-if ! command -v "$PYTHON" > /dev/null
-then
- echo "Unable to locate build-dependency python ($PYTHON)!" 1>&2
- exit 1
-fi
-
-export PYTHON
-
-usage_list=("-crossgenonly: only run native image generation.")
-usage_list+=("-disableoss: Disable Open Source Signing for System.Private.CoreLib.")
-usage_list+=("-ibcinstrument: generate IBC-tuning-enabled native images when invoking crossgen.")
-usage_list+=("-nopgooptimize: do not use profile guided optimizations.")
-usage_list+=("-officialbuildid=^: specify the official build ID to be used by this build.")
-usage_list+=("-partialngen: build CoreLib as PartialNGen.")
-usage_list+=("-pgoinstrument: generate instrumented code for profile guided optimization enabled binaries.")
-usage_list+=("-skipcrossgen: skip native image generation.")
-usage_list+=("-skipcrossarchnative: Disable Open Source Signing for System.Private.CoreLib.")
-usage_list+=("-skipmanagedtools: generate instrumented code for profile guided optimization enabled binaries.")
-usage_list+=("-skipmscorlib: generate IBC-tuning-enabled native images when invoking crossgen.")
-usage_list+=("-skipnuget: skip NuGet package generation.")
-usage_list+=("-skiprestore: specify the official build ID to be used by this build.")
-usage_list+=("-skiprestoreoptdata: build CoreLib as PartialNGen.")
-usage_list+=("-staticanalyzer: skip native image generation.")
-
-setup_dirs_local()
-{
- setup_dirs
-
- mkdir -p "$__LogsDir"
- mkdir -p "$__MsbuildDebugLogsDir"
-
- if [[ "$__CrossBuild" == 1 ]]; then
- mkdir -p "$__CrossComponentBinDir"
- fi
-}
-
-restore_optdata()
-{
- local OptDataProjectFilePath="$__ProjectRoot/src/.nuget/optdata/optdata.csproj"
- if [[ "$__SkipRestoreOptData" == 0 && "$__IsMSBuildOnNETCoreSupported" == 1 ]]; then
- echo "Restoring the OptimizationData package"
- "$__RepoRootDir/eng/common/msbuild.sh" /clp:nosummary $__ArcadeScriptArgs \
- $OptDataProjectFilePath /t:Restore /m \
- -bl:"$__LogsDir/OptRestore_$__ConfigTriplet.binlog"\
- $__CommonMSBuildArgs $__UnprocessedBuildArgs \
- /nodereuse:false
- local exit_code="$?"
- if [[ "$exit_code" != 0 ]]; then
- echo "${__ErrMsgPrefix}Failed to restore the optimization data package."
- exit "$exit_code"
- fi
- fi
-
- if [[ "$__PgoOptimize" == 1 && "$__IsMSBuildOnNETCoreSupported" == 1 ]]; then
- # Parse the optdata package versions out of msbuild so that we can pass them on to CMake
-
- local PgoDataPackagePathOutputFile="${__IntermediatesDir}/optdatapath.txt"
-
- # Writes into ${PgoDataPackagePathOutputFile}
- "$__RepoRootDir/eng/common/msbuild.sh" /clp:nosummary $__ArcadeScriptArgs $OptDataProjectFilePath /t:DumpPgoDataPackagePath\
- ${__CommonMSBuildArgs} /p:PgoDataPackagePathOutputFile=${PgoDataPackagePathOutputFile} \
- -bl:"$__LogsDir/PgoVersionRead_$__ConfigTriplet.binlog" > /dev/null 2>&1
- local exit_code="$?"
- if [[ "$exit_code" != 0 || ! -f "${PgoDataPackagePathOutputFile}" ]]; then
- echo "${__ErrMsgPrefix}Failed to get PGO data package path."
- exit "$exit_code"
- fi
-
- __PgoOptDataPath=$(<"${PgoDataPackagePathOutputFile}")
- fi
-}
-
-generate_event_logging_sources()
-{
- __OutputEventingDir="$1"
-
- __PythonWarningFlags="-Wall"
- if [[ "$__IgnoreWarnings" == 0 ]]; then
- __PythonWarningFlags="$__PythonWarningFlags -Werror"
- fi
-
- echo "Laying out dynamically generated EventSource classes"
- "$PYTHON" -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genRuntimeEventSources.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__OutputEventingDir"
-}
-
-generate_event_logging()
-{
- # Event Logging Infrastructure
- if [[ "$__SkipMSCorLib" == 0 ]]; then
- generate_event_logging_sources "$__ArtifactsIntermediatesDir/Eventing/$__BuildArch/$__BuildType"
- fi
-}
-
-build_cross_architecture_components()
-{
- local intermediatesForBuild="$__IntermediatesDir/Host$__CrossArch/crossgen"
- local crossArchBinDir="$__BinDir/$__CrossArch"
-
- mkdir -p "$intermediatesForBuild"
- mkdir -p "$crossArchBinDir"
-
- generate_event_logging_sources "$intermediatesForBuild" "the crossarch build system"
-
- __SkipCrossArchBuild=1
- # check supported cross-architecture components host(__HostArch)/target(__BuildArch) pair
- if [[ ("$__BuildArch" == "arm" || "$__BuildArch" == "armel") && ("$__CrossArch" == "x86" || "$__CrossArch" == "x64") ]]; then
- __SkipCrossArchBuild=0
- elif [[ "$__BuildArch" == "arm64" && "$__CrossArch" == "x64" ]]; then
- __SkipCrossArchBuild=0
- else
- # not supported
- return
- fi
-
- __CMakeBinDir="$crossArchBinDir"
- CROSSCOMPILE=0
- export __CMakeBinDir CROSSCOMPILE
-
- __CMakeArgs="-DCLR_CMAKE_TARGET_ARCH=$__BuildArch -DCLR_CROSS_COMPONENTS_BUILD=1 $__CMakeArgs"
- build_native "$__CrossArch" "$__ProjectRoot" "$__ProjectRoot" "$intermediatesForBuild" "cross-architecture components"
-
- CROSSCOMPILE=1
- export CROSSCOMPILE
-}
-
-build_CoreLib_ni()
-{
- local __CrossGenExec=$1
- local __CoreLibILDir=$2
-
- if [[ "$__PartialNgen" == 1 ]]; then
- COMPlus_PartialNGen=1
- export COMPlus_PartialNGen
- fi
-
- if [[ -e "$__CrossGenCoreLibLog" ]]; then
- rm "$__CrossGenCoreLibLog"
- fi
- echo "Generating native image of System.Private.CoreLib.dll for $__TargetOS.$__BuildArch.$__BuildType. Logging to \"$__CrossGenCoreLibLog\"."
- echo "$__CrossGenExec /Platform_Assemblies_Paths $__CoreLibILDir $__IbcTuning /out $__BinDir/System.Private.CoreLib.dll $__CoreLibILDir/System.Private.CoreLib.dll"
- "$__CrossGenExec" /nologo /Platform_Assemblies_Paths $__CoreLibILDir $__IbcTuning /out $__BinDir/System.Private.CoreLib.dll $__CoreLibILDir/System.Private.CoreLib.dll >> $__CrossGenCoreLibLog 2>&1
- local exit_code="$?"
- if [[ "$exit_code" != 0 ]]; then
- echo "${__ErrMsgPrefix}Failed to generate native image for System.Private.CoreLib. Refer to $__CrossGenCoreLibLog"
- exit "$exit_code"
- fi
-
- if [[ "$__TargetOS" == "Linux" ]]; then
- echo "Generating symbol file for System.Private.CoreLib.dll"
- echo "$__CrossGenExec /Platform_Assemblies_Paths $__BinDir /CreatePerfMap $__BinDir $__BinDir/System.Private.CoreLib.dll"
- "$__CrossGenExec" /nologo /Platform_Assemblies_Paths $__BinDir /CreatePerfMap $__BinDir $__BinDir/System.Private.CoreLib.dll >> $__CrossGenCoreLibLog 2>&1
- local exit_code="$?"
- if [[ "$exit_code" != 0 ]]; then
- echo "${__ErrMsgPrefix}Failed to generate symbol file for System.Private.CoreLib. Refer to $__CrossGenCoreLibLog"
- exit "$exit_code"
- fi
- fi
-}
-
-build_CoreLib()
-{
- if [[ "$__IsMSBuildOnNETCoreSupported" == 0 ]]; then
- echo "System.Private.CoreLib.dll build unsupported."
- return
- fi
-
- if [[ "$__SkipMSCorLib" == 1 ]]; then
- echo "Skipping building System.Private.CoreLib."
- return
- fi
-
- echo "Commencing build of managed components for $__TargetOS.$__BuildArch.$__BuildType"
-
- # Invoke MSBuild
- __ExtraBuildArgs=""
-
- if [[ "$__BuildManagedTools" -eq "1" ]]; then
- __ExtraBuildArgs="$__ExtraBuildArgs /p:BuildManagedTools=true"
- fi
-
- "$__RepoRootDir/eng/common/msbuild.sh" /clp:nosummary $__ArcadeScriptArgs \
- $__ProjectDir/src/build.proj /t:Restore \
- /p:PortableBuild=true /maxcpucount /p:IncludeRestoreOnlyProjects=true \
- /flp:Verbosity=normal\;LogFile=$__LogsDir/System.Private.CoreLib_$__ConfigTriplet.log \
- -bl:"$__LogsDir/System.Private.CoreLib_$__ConfigTriplet.binlog" \
- /p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir \
- $__CommonMSBuildArgs $__ExtraBuildArgs $__UnprocessedBuildArgs
-
- local exit_code="$?"
- if [[ "$exit_code" != 0 ]]; then
- echo "${__ErrMsgPrefix}Failed to restore managed components."
- exit "$exit_code"
- fi
-
- "$__RepoRootDir/eng/common/msbuild.sh" /clp:nosummary $__ArcadeScriptArgs \
- $__ProjectDir/src/build.proj \
- /p:PortableBuild=true /maxcpucount \
- /flp:Verbosity=normal\;LogFile=$__LogsDir/System.Private.CoreLib_$__TargetOS__$__BuildArch__$__BuildType.log \
- -bl:"$__LogsDir/System.Private.CoreLib_$__ConfigTriplet.binlog" \
- /p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir \
- $__CommonMSBuildArgs $__ExtraBuildArgs $__UnprocessedBuildArgs
-
- local exit_code="$?"
- if [[ "$exit_code" != 0 ]]; then
- echo "${__ErrMsgPrefix}Failed to build managed components."
- exit "$exit_code"
- fi
-
- if [[ "$__BuildManagedTools" -eq "1" ]]; then
- echo "Publishing crossgen2 for $__DistroRid"
- "$__RepoRootDir/dotnet.sh" publish --self-contained -r $__DistroRid -c $__BuildType -o "$__BinDir/crossgen2" "$__ProjectRoot/src/tools/crossgen2/crossgen2/crossgen2.csproj" /nologo /p:TargetArchitecture=$__BuildArch
-
- local exit_code="$?"
- if [[ "$exit_code" != 0 ]]; then
- echo "${__ErrMsgPrefix}Failed to build crossgen2."
- exit "$exit_code"
- fi
-
- if [[ "$__HostOS" == "OSX" ]]; then
- cp "$__BinDir/libclrjit.dylib" "$__BinDir/crossgen2/libclrjitilc.dylib"
- cp "$__BinDir/libjitinterface.dylib" "$__BinDir/crossgen2/libjitinterface.dylib"
- else
- cp "$__BinDir/libclrjit.so" "$__BinDir/crossgen2/libclrjitilc.so"
- cp "$__BinDir/libjitinterface.so" "$__BinDir/crossgen2/libjitinterface.so"
- fi
- fi
-
- local __CoreLibILDir="$__BinDir"/IL
-
- if [[ "$__SkipCrossgen" == 1 ]]; then
- echo "Skipping generating native image"
-
- if [[ "$__CrossBuild" == 1 ]]; then
- # Crossgen not performed, so treat the IL version as the final version
- cp "$__CoreLibILDir"/System.Private.CoreLib.dll "$__BinDir"/System.Private.CoreLib.dll
- fi
-
- return
- fi
-
- # The cross build generates a crossgen with the target architecture.
- if [[ "$__CrossBuild" == 0 ]]; then
- if [[ "$__SkipCoreCLR" == 1 ]]; then
- return
- fi
-
- # The architecture of host pc must be same architecture with target.
- if [[ "$__HostArch" == "$__BuildArch" ]]; then
- build_CoreLib_ni "$__BinDir/crossgen" "$__CoreLibILDir"
- elif [[ ( "$__HostArch" == "x64" ) && ( "$__BuildArch" == "x86" ) ]]; then
- build_CoreLib_ni "$__BinDir/crossgen" "$__CoreLibILDir"
- elif [[ ( "$__HostArch" == "arm64" ) && ( "$__BuildArch" == "arm" ) ]]; then
- build_CoreLib_ni "$__BinDir/crossgen" "$__CoreLibILDir"
- else
- exit 1
- fi
- else
- if [[ ( "$__CrossArch" == "x86" ) && ( "$__BuildArch" == "arm" ) ]]; then
- build_CoreLib_ni "$__CrossComponentBinDir/crossgen" "$__CoreLibILDir"
- elif [[ ( "$__CrossArch" == "x64" ) && ( "$__BuildArch" == "arm" ) ]]; then
- build_CoreLib_ni "$__CrossComponentBinDir/crossgen" "$__CoreLibILDir"
- elif [[ ( "$__HostArch" == "x64" ) && ( "$__BuildArch" == "arm64" ) ]]; then
- build_CoreLib_ni "$__CrossComponentBinDir/crossgen" "$__CoreLibILDir"
- else
- # Crossgen not performed, so treat the IL version as the final version
- cp "$__CoreLibILDir"/System.Private.CoreLib.dll "$__BinDir"/System.Private.CoreLib.dll
- fi
- fi
-}
-
-generate_NugetPackages()
-{
- # We can only generate nuget package if we also support building mscorlib as part of this build.
- if [[ "$__IsMSBuildOnNETCoreSupported" == 0 ]]; then
- echo "Nuget package generation unsupported."
- return
- fi
-
- # Since we can build mscorlib for this OS, did we build the native components as well?
- if [[ "$__SkipCoreCLR" == 1 && "$__CrossgenOnly" == 0 ]]; then
- echo "Unable to generate nuget packages since native components were not built."
- return
- fi
-
- echo "Generating nuget packages for $__TargetOS"
- echo "DistroRid is $__DistroRid"
- echo "ROOTFS_DIR is $ROOTFS_DIR"
- # Build the packages
- # Package build uses the Arcade system and scripts, relying on it to restore required toolsets as part of build
- "$__RepoRootDir"/eng/common/build.sh -r -b -projects "$__SourceDir"/.nuget/coreclr-packages.proj \
- -verbosity minimal -bl:"$__LogsDir/Nuget_$__TargetOS__$__BuildArch__$__BuildType.binlog" \
- /p:PortableBuild=true \
- /p:"__IntermediatesDir=$__IntermediatesDir" /p:"__RootBinDir=$__RootBinDir" /p:"__DoCrossArchBuild=$__CrossBuild" \
- $__CommonMSBuildArgs $__UnprocessedBuildArgs
-
- local exit_code="$?"
- if [[ "$exit_code" != 0 ]]; then
- echo "${__ErrMsgPrefix}Failed to generate Nuget packages."
- exit "$exit_code"
- fi
-}
-
-handle_arguments_local() {
- case "$1" in
- crossgenonly|-crossgenonly)
- __SkipMSCorLib=1
- __SkipCoreCLR=1
- __CrossgenOnly=1
- ;;
-
- disableoss|-disableoss)
- __SignTypeArg="/p:SignType=real"
- ;;
-
- ibcinstrument|-ibcinstrument)
- __IbcTuning="/Tuning"
- ;;
-
- ignorewarnings|-ignorewarnings)
- __IgnoreWarnings=1
- __CMakeArgs="-DCLR_CMAKE_WARNINGS_ARE_ERRORS=OFF $__CMakeArgs"
- ;;
-
- nopgooptimize|-nopgooptimize)
- __PgoOptimize=0
- __SkipRestoreOptData=1
- ;;
-
- officialbuildid=*|-officialbuildid=*)
- __Id=$(echo "$1" | cut -d'=' -f 2)
- __OfficialBuildIdArg="/p:OfficialBuildId=$__Id"
- ;;
-
- partialngen|-partialngen)
- __PartialNgen=1
- ;;
-
- pgoinstrument|-pgoinstrument)
- __PgoInstrument=1
- ;;
-
- skipcoreclr|-skipcoreclr)
- # Accept "skipcoreclr" for backwards-compatibility.
- __SkipCoreCLR=1
- ;;
-
- skipcrossarchnative|-skipcrossarchnative)
- __SkipCrossArchNative=1
- ;;
-
- skipcrossgen|-skipcrossgen)
- __SkipCrossgen=1
- ;;
-
- skipmanagedtools|-skipmanagedtools)
- __BuildManagedTools=0
- ;;
-
- skipmscorlib|-skipmscorlib)
- __SkipMSCorLib=1
- ;;
-
- skipnuget|-skipnuget|skipbuildpackages|-skipbuildpackages)
- __SkipNuget=1
- ;;
-
- skiprestore|-skiprestore)
- __SkipRestoreArg="/p:RestoreDuringBuild=false"
- ;;
-
- staticanalyzer|-staticanalyzer)
- __StaticAnalyzer=1
- ;;
-
- *)
- __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1"
- ;;
- esac
-}
-
-echo "Commencing CoreCLR Repo build"
-echo "WARNING: This build script is deprecated and will be deleted soon. Use the root build script to build CoreCLR. If you want to build the CoreCLR runtime without using MSBuild, use the build-native.sh script."
-echo "See https://github.com/dotnet/runtime/issues/32991 for more information."
-
-# Argument types supported by this script:
-#
-# Build architecture - valid values are: x64, ARM.
-# Build Type - valid values are: Debug, Checked, Release
-#
-# Set the default arguments for build
-
-# Obtain the location of the bash script to figure out where the root of the repo is.
-__ProjectRoot="$(cd "$(dirname "$0")"; pwd -P)"
-__RepoRootDir="$(cd "$__ProjectRoot"/../..; pwd -P)"
-
-__BuildArch=
-__BuildType=Debug
-__CodeCoverage=0
-__IgnoreWarnings=0
-
-# Set the various build properties here so that CMake and MSBuild can pick them up
-__BuildManagedTools=1
-__Compiler=clang
-__CompilerMajorVersion=
-__CompilerMinorVersion=
-__CommonMSBuildArgs=
-__ConfigureOnly=0
-__CrossBuild=0
-__CrossgenOnly=0
-__DistroRid=""
-__IbcOptDataPath=""
-__IbcTuning=""
-__IsMSBuildOnNETCoreSupported=0
-__MSBCleanBuildArgs=
-__OfficialBuildIdArg=""
-__PartialNgen=0
-__PgoInstrument=0
-__PgoOptDataPath=""
-__PgoOptimize=1
-__PortableBuild=1
-__ProjectDir="$__ProjectRoot"
-__RootBinDir="$__RepoRootDir/artifacts"
-__SignTypeArg=""
-__SkipConfigure=0
-__SkipCoreCLR=0
-__SkipCrossArchNative=0
-__SkipCrossgen=0
-__SkipGenerateVersion=0
-__SkipMSCorLib=0
-__SkipManaged=0
-__SkipNuget=0
-__SkipRestore=""
-__SkipRestoreArg="/p:RestoreDuringBuild=true"
-__SkipRestoreOptData=0
-__SourceDir="$__ProjectDir/src"
-__StaticAnalyzer=0
-__UnprocessedBuildArgs=
-__UseNinja=0
-__VerboseBuild=0
-__ValidateCrossArg=1
-__CMakeArgs=""
-
-source "$__ProjectRoot"/_build-commons.sh
-
-if [[ "${__BuildArch}" != "${__HostArch}" ]]; then
- __CrossBuild=1
-fi
-
-# Set dependent variables
-__LogsDir="$__RootBinDir/log/$__BuildType"
-__MsbuildDebugLogsDir="$__LogsDir/MsbuildDebugLogs"
-__ConfigTriplet=$__TargetOS__$__BuildArch__$__BuildType
-
-# Set the remaining variables based upon the determined build configuration
-__BinDir="$__RootBinDir/bin/coreclr/$__TargetOS.$__BuildArch.$__BuildType"
-__PackagesBinDir="$__BinDir/.nuget"
-__IntermediatesDir="$__RootBinDir/obj/coreclr/$__TargetOS.$__BuildArch.$__BuildType"
-__ArtifactsIntermediatesDir="$__RepoRootDir/artifacts/obj/coreclr"
-export __IntermediatesDir __ArtifactsIntermediatesDir
-
-__CrossComponentBinDir="$__BinDir"
-
-__CrossArch="$__HostArch"
-if [[ "$__CrossBuild" == 1 ]]; then
- __CrossComponentBinDir="$__CrossComponentBinDir/$__CrossArch"
-fi
-__CrossGenCoreLibLog="$__LogsDir/CrossgenCoreLib_$__ConfigTriplet.log"
-
-# CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to set.
-# This is needed by CLI to function.
-if [[ -z "$HOME" ]]; then
- if [[ ! -d "$__ProjectDir/temp_home" ]]; then
- mkdir temp_home
- fi
- HOME="$__ProjectDir"/temp_home
- export HOME
- echo "HOME not defined; setting it to $HOME"
-fi
-
-# Specify path to be set for CMAKE_INSTALL_PREFIX.
-# This is where all built CoreClr libraries will copied to.
-__CMakeBinDir="$__BinDir"
-export __CMakeBinDir
-
-# Make the directories necessary for build if they don't exist
-setup_dirs_local
-
-# Set up the directory for MSBuild debug logs.
-MSBUILDDEBUGPATH="${__MsbuildDebugLogsDir}"
-export MSBUILDDEBUGPATH
-
-# Check prereqs.
-check_prereqs
-
-# Restore the package containing profile counts for profile-guided optimizations
-restore_optdata
-
-# Generate event logging infrastructure sources
-generate_event_logging
-
-# Build the coreclr (native) components.
-__CMakeArgs="-DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_PATH=$__PgoOptDataPath -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize -DCLR_REPO_ROOT_DIR=\"$__RepoRootDir\" $__CMakeArgs"
-
-if [[ "$__SkipConfigure" == 0 && "$__CodeCoverage" == 1 ]]; then
- __CMakeArgs="-DCLR_CMAKE_ENABLE_CODE_COVERAGE=1 $__CMakeArgs"
-fi
-
-if [[ "$__SkipCoreCLR" == 1 ]]; then
- echo "Skipping CoreCLR component build."
-else
- build_native "$__BuildArch" "$__ProjectRoot" "$__ProjectRoot" "$__IntermediatesDir" "CoreCLR component"
-fi
-
-# Build cross-architecture components
-if [[ "$__SkipCrossArchNative" != 1 ]]; then
- if [[ "$__CrossBuild" == 1 ]]; then
- build_cross_architecture_components
- fi
-fi
-
-# Build System.Private.CoreLib.
-
-build_CoreLib
-
-if [[ "$__CrossgenOnly" == 1 ]]; then
- build_CoreLib_ni "$__BinDir/crossgen"
-fi
-
-# Generate nuget packages
-if [[ "$__SkipNuget" != 1 ]]; then
- generate_NugetPackages
-fi
-
-
-# Build complete
-
-echo "Repo successfully built."
-echo "Product binaries are available at $__BinDir"
-echo "WARNING: This build script is deprecated and will be deleted soon. Use the root build script to build CoreCLR. If you want to build the CoreCLR runtime without using MSBuild, use the build-native.sh script."
-echo "See https://github.com/dotnet/runtime/issues/32991 for more information."
-exit 0
diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake
index ce2bc382a99377..469e0090271094 100644
--- a/src/coreclr/clrdefinitions.cmake
+++ b/src/coreclr/clrdefinitions.cmake
@@ -105,7 +105,6 @@ endif(CLR_CMAKE_TARGET_WIN32)
add_definitions(-DFEATURE_BASICFREEZE)
add_definitions(-DFEATURE_CORECLR)
add_definitions(-DFEATURE_CORESYSTEM)
-add_definitions(-DFEATURE_CORRUPTING_EXCEPTIONS)
if(FEATURE_DBGIPC)
add_definitions(-DFEATURE_DBGIPC_TRANSPORT_DI)
add_definitions(-DFEATURE_DBGIPC_TRANSPORT_VM)
@@ -196,6 +195,7 @@ add_compile_definitions($<$>>:F
if (CLR_CMAKE_TARGET_ARCH_AMD64)
add_compile_definitions($<$>>:FEATURE_ON_STACK_REPLACEMENT>)
endif (CLR_CMAKE_TARGET_ARCH_AMD64)
+add_compile_definitions($<$>>:FEATURE_PGO>)
if (CLR_CMAKE_TARGET_WIN32)
add_definitions(-DFEATURE_TYPEEQUIVALENCE)
endif(CLR_CMAKE_TARGET_WIN32)
diff --git a/src/coreclr/crosscomponents.cmake b/src/coreclr/crosscomponents.cmake
index 30d53d585dff58..f8ea417471ca6e 100644
--- a/src/coreclr/crosscomponents.cmake
+++ b/src/coreclr/crosscomponents.cmake
@@ -14,10 +14,6 @@ endif()
if(NOT CLR_CMAKE_HOST_LINUX AND NOT FEATURE_CROSSBITNESS)
list (APPEND CLR_CROSS_COMPONENTS_LIST
mscordaccore
+ mscordbi
)
- if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS)
- list (APPEND CLR_CROSS_COMPONENTS_LIST
- mscordbi
- )
- endif (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS)
endif()
diff --git a/src/coreclr/crossgen-corelib.sh b/src/coreclr/crossgen-corelib.sh
index 73811315afefa0..8350da0f636b74 100755
--- a/src/coreclr/crossgen-corelib.sh
+++ b/src/coreclr/crossgen-corelib.sh
@@ -103,6 +103,7 @@ __LogsDir="$__RootBinDir/log/$__BuildType"
# Set the remaining variables based upon the determined build configuration
__BinDir="$__RootBinDir/bin/coreclr/$__TargetOS.$__BuildArch.$__BuildType"
+__IntermediatesDir="$__RootBinDir/obj/coreclr/$__TargetOS.$__BuildArch.$__BuildType"
__CrossComponentBinDir="$__BinDir"
__CrossArch="$__HostArch"
diff --git a/src/coreclr/dir.common.props b/src/coreclr/dir.common.props
index e4d212b2aee164..2ff54f14de24a2 100644
--- a/src/coreclr/dir.common.props
+++ b/src/coreclr/dir.common.props
@@ -55,10 +55,11 @@
truetruetrue
+ truetruetrue
- true
+ true$(__DistroRid)
diff --git a/src/coreclr/run-cppcheck.sh b/src/coreclr/run-cppcheck.sh
index c505fd184dedc3..46e51e1e7471fc 100755
--- a/src/coreclr/run-cppcheck.sh
+++ b/src/coreclr/run-cppcheck.sh
@@ -17,13 +17,13 @@ usage()
check_dependencies()
{
# Check presence of cppcheck on the path
- if [ "$RunCppCheck" == true ]
+ if [ "$RunCppCheck" = "true" ]
then
hash cppcheck 2>/dev/null || { echo >&2 "Please install cppcheck before running this script"; exit 1; }
fi
-
+
# Check presence of sloccount on the path
- if [ "$RunSlocCount" == true ]
+ if [ "$RunSlocCount" = "true" ]
then
hash sloccount 2>/dev/null || { echo >&2 "Please install sloccount before running this script"; exit 1; }
fi
@@ -39,9 +39,10 @@ SloccountOutput="sloccount.sc"
# Get the number of processors available to the scheduler
# Other techniques such as `nproc` only get the number of
# processors available to a single process.
-if [ `uname` = "FreeBSD" ]; then
-NumProc=`sysctl hw.ncpu | awk '{ print $2+1 }'`
-elif [ `uname` = "NetBSD" ]; then
+platform="$(uname)"
+if [ "$platform" = "FreeBSD" ]; then
+NumProc=$(sysctl hw.ncpu | awk '{ print $2+1 }')
+elif [ "$platform" = "NetBSD" || "$platform" = "SunOS" ]; then
NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
else
NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
@@ -80,19 +81,19 @@ do
esac
done
-if [ "$FilesFromArgs" != "" ];
+if [ -n "$FilesFromArgs" ];
then
Files=$FilesFromArgs
fi
-if [ "$CppCheckOutput" == "" ];
+if [ -z "$CppCheckOutput" ];
then
echo "Expected: file for cppcheck output"
usage
exit 1
fi
-if [ "$SloccountOutput" == "" ];
+if [ -z "$SloccountOutput" ];
then
echo "Expected: file for sloccount output"
usage
@@ -101,14 +102,14 @@ fi
check_dependencies
-if [ "$RunCppCheck" == true ]
+if [ "$RunCppCheck" = "true" ]
then
echo "Running cppcheck for files: $Files"
cppcheck --enable=all -j $NumProc --xml --xml-version=2 --force $Files 2> $CppCheckOutput
CppCheckOutputs="$CppCheckOutput (cppcheck)"
fi
-if [ "$RunSlocCount" == true ]
+if [ "$RunSlocCount" = "true" ]
then
echo "Running sloccount for files: $Files"
sloccount --wide --details $Files > $SloccountOutput
diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj
index 02c4c5e205205d..a78af666926bf2 100644
--- a/src/coreclr/runtime.proj
+++ b/src/coreclr/runtime.proj
@@ -12,9 +12,14 @@
<_CoreClrBuildArg Condition="'$(CrossBuild)' == 'true'" Include="-cross" />
<_CoreClrBuildArg Condition="!$([MSBuild]::IsOsPlatform(Windows))" Include="-os $(TargetOS)" />
- <_CoreClrBuildArg Condition="$([MSBuild]::IsOsPlatform(Windows)) and ('$(TargetArchitecture)' == 'x86' or '$(TargetArchitecture)' == 'x64') and '$(Configuration)' == 'Release'" Include="-enforcepgo" />
+ <_CoreClrBuildArg Condition="$([MSBuild]::IsOsPlatform(Windows)) and
+ ('$(TargetArchitecture)' == 'x86' or '$(TargetArchitecture)' == 'x64') and
+ '$(Configuration)' == 'Release' and
+ '$(NoPgoOptimize)' != 'true'"
+ Include="-enforcepgo" />
<_CoreClrBuildArg Condition="$([MSBuild]::IsOsPlatform(Windows)) and '$(CrossDac)' != ''" Include="-$(CrossDac)dac" />
<_CoreClrBuildArg Condition="'$(OfficialBuildId)' != ''" Include="/p:OfficialBuildId=$(OfficialBuildId)" />
+ <_CoreClrBuildArg Condition="'$(NoPgoOptimize)' == 'true'" Include="-nopgooptimize" />
diff --git a/src/coreclr/scripts/superpmi.py b/src/coreclr/scripts/superpmi.py
index 1c7f2f22a76f42..8bef741ce7234e 100755
--- a/src/coreclr/scripts/superpmi.py
+++ b/src/coreclr/scripts/superpmi.py
@@ -533,7 +533,7 @@ def collect(self):
if not os.path.isdir(final_mch_dir):
os.makedirs(final_mch_dir)
else:
- default_coreclr_bin_mch_location = os.path.join(coreclr_args.spmi_location, "mch", "{}.{}.{}".format(coreclr_args.host_os, coreclr_args.arch, coreclr_args.build_type))
+ default_coreclr_bin_mch_location = os.path.join(self.coreclr_args.spmi_location, "mch", "{}.{}.{}".format(self.coreclr_args.host_os, self.coreclr_args.arch, self.coreclr_args.build_type))
if not os.path.isdir(default_coreclr_bin_mch_location):
os.makedirs(default_coreclr_bin_mch_location)
self.final_mch_file = os.path.abspath(os.path.join(default_coreclr_bin_mch_location, "{}.{}.{}.mch".format(self.coreclr_args.host_os, self.coreclr_args.arch, self.coreclr_args.build_type)))
@@ -588,7 +588,9 @@ def __collect_mc_files__(self):
env_copy["SuperPMIShimLogPath"] = self.temp_location
env_copy["SuperPMIShimPath"] = self.jit_path
env_copy["COMPlus_AltJit"] = "*"
+ env_copy["COMPlus_AltJitNgen"] = "*"
env_copy["COMPlus_AltJitName"] = self.collection_shim_name
+ env_copy["COMPlus_EnableExtraSuperPmiQueries"] = "1"
if self.coreclr_args.use_zapdisable:
env_copy["COMPlus_ZapDisable"] = "1"
@@ -599,6 +601,7 @@ def __collect_mc_files__(self):
print_platform_specific_environment_vars(self.coreclr_args, "SuperPMIShimPath", self.jit_path)
print_platform_specific_environment_vars(self.coreclr_args, "COMPlus_AltJit", "*")
print_platform_specific_environment_vars(self.coreclr_args, "COMPlus_AltJitName", self.collection_shim_name)
+ print_platform_specific_environment_vars(self.coreclr_args, "COMPlus_AltJitNgen", "*")
print("")
if self.collection_command != None:
diff --git a/src/coreclr/src/.nuget/Directory.Build.props b/src/coreclr/src/.nuget/Directory.Build.props
index e321b384626e0e..2fd932c03b84ee 100644
--- a/src/coreclr/src/.nuget/Directory.Build.props
+++ b/src/coreclr/src/.nuget/Directory.Build.props
@@ -28,7 +28,7 @@
$(OSRid)
- Windows_NT;OSX;Android;Linux;FreeBSD
+ Windows_NT;OSX;Android;Linux;FreeBSD;NetBSD;SunOS;$(SupportedPackageOSGroups);
+ netbsd-$(TargetArchitecture)
+
+
+
+
+ sunos-$(TargetArchitecture)
+
+ sunos-$(TargetArchitecture)
+
+ android.21-$(TargetArchitecture)
@@ -159,6 +173,12 @@
+
+
+
+
+
+ x86
diff --git a/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.Common.targets b/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.Common.targets
index 0b60d9b5f46bf2..452353b37096b2 100644
--- a/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.Common.targets
+++ b/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.Common.targets
@@ -9,7 +9,7 @@ Copyright (c) .NET Foundation. All rights reserved.
-
+
diff --git a/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.targets b/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.targets
index 299511fa2a8be4..f2c0a3fb649733 100644
--- a/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.targets
+++ b/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.targets
@@ -7,7 +7,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
-Copyright (c) .NET Foundation. All rights reserved.
+Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
@@ -24,13 +24,15 @@ Copyright (c) .NET Foundation. All rights reserved.
<_OSPlatform Condition="$([MSBuild]::IsOSPlatform('linux'))">linux
<_OSPlatform Condition="$([MSBuild]::IsOSPlatform('osx'))">osx
<_OSPlatform Condition="$([MSBuild]::IsOSPlatform('freebsd'))">freebsd
+ <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('netbsd'))">netbsd
+ <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('sunos'))">sunos
<_OSArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)
$(_OSPlatform)-$(_OSArchitecture.ToLower())5.0.0runtime.$(MicrosoftNetCoreIlasmPackageRuntimeId).microsoft.netcore.ilasmruntime.$(MicrosoftNetCoreIlasmPackageRuntimeId).microsoft.netcore.ildasm
-
+
<_IlasmDir Condition="'$(ILAsmToolPath)' != ''">$([MSBuild]::NormalizeDirectory($(ILAsmToolPath)))
@@ -68,8 +70,8 @@ Copyright (c) .NET Foundation. All rights reserved.
-
@@ -122,7 +124,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<_KeyFileArgument Condition="'$(KeyOriginatorFile)' != ''">-KEY="$(KeyOriginatorFile)"
- <_IlasmSwitches>-QUIET -NOLOGO
+ <_IlasmSwitches>-QUIET -NOLOGO
<_IlasmSwitches Condition="'$(FoldIdenticalMethods)' == 'True'">$(_IlasmSwitches) -FOLD
<_IlasmSwitches Condition="'$(SizeOfStackReserve)' != ''">$(_IlasmSwitches) -STACK=$(SizeOfStackReserve)
<_IlasmSwitches Condition="'$(DebugType)' == 'Full'">$(_IlasmSwitches) -DEBUG
diff --git a/src/coreclr/src/.nuget/optdata/optdata.csproj b/src/coreclr/src/.nuget/optdata/optdata.csproj
index d19c3125fe5d3e..14ec28443321b3 100644
--- a/src/coreclr/src/.nuget/optdata/optdata.csproj
+++ b/src/coreclr/src/.nuget/optdata/optdata.csproj
@@ -6,6 +6,7 @@
TrueTruewin7-x64;win7-x86;linux-x64
+ true
<_TargetOSArchLowercase>$(TargetOS.ToLower())-$(TargetArchitecture.ToLower())
diff --git a/src/coreclr/src/System.Private.CoreLib/CreateRuntimeRootILLinkDescriptorFile.targets b/src/coreclr/src/System.Private.CoreLib/CreateRuntimeRootILLinkDescriptorFile.targets
index d06367c480c6f3..a40473eb98ac31 100644
--- a/src/coreclr/src/System.Private.CoreLib/CreateRuntimeRootILLinkDescriptorFile.targets
+++ b/src/coreclr/src/System.Private.CoreLib/CreateRuntimeRootILLinkDescriptorFile.targets
@@ -11,7 +11,7 @@
<_CortypeFilePath Condition=" '$(_CortypeFilePath)' == '' ">$(MSBuildThisFileDirectory)..\inc\cortypeinfo.h
<_RexcepFilePath Condition=" '$(_RexcepFilePath)' == '' ">$(MSBuildThisFileDirectory)..\vm\rexcep.h
<_ILLinkTrimXmlFilePath Condition=" '$(_ILLinkTrimXmlFilePath)' == '' ">$(MSBuildThisFileDirectory)ILLinkTrim.xml
- <_ILLinkTasksToolsDir>$(PkgILLink_Tasks)/tools
+ <_ILLinkTasksToolsDir>$(PkgMicrosoft_NET_ILLink_Tasks)/tools
<_ILLinkTasksDir>$(_ILLinkTasksToolsDir)/$(NetFrameworkCurrent)/
<_ILLinkTasksDir Condition="'$(MSBuildRuntimeType)' == 'Core'">$(_ILLinkTasksToolsDir)/netcoreapp3.0/
diff --git a/src/coreclr/src/System.Private.CoreLib/PinvokeAnalyzerExceptionList.analyzerdata b/src/coreclr/src/System.Private.CoreLib/PinvokeAnalyzerExceptionList.analyzerdata
index 141a5c2a73ce0d..e1c58c0c50381a 100644
--- a/src/coreclr/src/System.Private.CoreLib/PinvokeAnalyzerExceptionList.analyzerdata
+++ b/src/coreclr/src/System.Private.CoreLib/PinvokeAnalyzerExceptionList.analyzerdata
@@ -6,5 +6,5 @@ normaliz.dll!NormalizeString
user32.dll!GetProcessWindowStation
user32.dll!GetUserObjectInformationW
-
+
kernel32.dll!GetGeoInfo
\ No newline at end of file
diff --git a/src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj
index e1d9a09182ef60..323d68b052b19e 100644
--- a/src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj
+++ b/src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj
@@ -149,7 +149,6 @@
-
@@ -357,12 +356,8 @@
-
- Common\Interop\Windows\Interop.BOOL.cs
-
-
@@ -372,7 +367,6 @@
Common\Interop\Windows\OleAut32\Interop.VariantClear.cs
-
diff --git a/src/coreclr/src/System.Private.CoreLib/Tools/GenUnicodeProp/GenUnicodeProp.csproj b/src/coreclr/src/System.Private.CoreLib/Tools/GenUnicodeProp/GenUnicodeProp.csproj
index c40c22dbb8168d..73e115381ce756 100644
--- a/src/coreclr/src/System.Private.CoreLib/Tools/GenUnicodeProp/GenUnicodeProp.csproj
+++ b/src/coreclr/src/System.Private.CoreLib/Tools/GenUnicodeProp/GenUnicodeProp.csproj
@@ -7,7 +7,7 @@
-
+
@@ -43,7 +43,6 @@
-
diff --git a/src/coreclr/src/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs b/src/coreclr/src/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
index 8f7d8ecd550be9..ffecc9b0d493b0 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
@@ -124,7 +124,7 @@ public static object GetClassFactoryForType(ComActivationContext cxt)
if (!Path.IsPathRooted(cxt.AssemblyPath))
{
- throw new ArgumentException();
+ throw new ArgumentException(null, nameof(cxt));
}
Type classType = FindClassType(cxt.ClassId, cxt.AssemblyPath, cxt.AssemblyName, cxt.TypeName);
@@ -156,7 +156,7 @@ public static void ClassRegistrationScenarioForType(ComActivationContext cxt, bo
if (!Path.IsPathRooted(cxt.AssemblyPath))
{
- throw new ArgumentException();
+ throw new ArgumentException(null, nameof(cxt));
}
Type classType = FindClassType(cxt.ClassId, cxt.AssemblyPath, cxt.AssemblyName, cxt.TypeName);
@@ -231,7 +231,7 @@ public static void ClassRegistrationScenarioForType(ComActivationContext cxt, bo
///
/// Pointer to a instance
[CLSCompliant(false)]
- [NativeCallable]
+ [UnmanagedCallersOnly]
public static unsafe int GetClassFactoryForTypeInternal(ComActivationContextInternal* pCxtInt)
{
ref ComActivationContextInternal cxtInt = ref *pCxtInt;
@@ -268,7 +268,7 @@ public static unsafe int GetClassFactoryForTypeInternal(ComActivationContextInte
///
/// Pointer to a instance
[CLSCompliant(false)]
- [NativeCallable]
+ [UnmanagedCallersOnly]
public static unsafe int RegisterClassForTypeInternal(ComActivationContextInternal* pCxtInt)
{
ref ComActivationContextInternal cxtInt = ref *pCxtInt;
@@ -288,7 +288,7 @@ public static unsafe int RegisterClassForTypeInternal(ComActivationContextIntern
if (cxtInt.InterfaceId != Guid.Empty
|| cxtInt.ClassFactoryDest != IntPtr.Zero)
{
- throw new ArgumentException();
+ throw new ArgumentException(null, nameof(pCxtInt));
}
try
@@ -308,7 +308,7 @@ public static unsafe int RegisterClassForTypeInternal(ComActivationContextIntern
/// Internal entry point for unregistering a managed COM server API from native code
///
[CLSCompliant(false)]
- [NativeCallable]
+ [UnmanagedCallersOnly]
public static unsafe int UnregisterClassForTypeInternal(ComActivationContextInternal* pCxtInt)
{
ref ComActivationContextInternal cxtInt = ref *pCxtInt;
@@ -328,7 +328,7 @@ public static unsafe int UnregisterClassForTypeInternal(ComActivationContextInte
if (cxtInt.InterfaceId != Guid.Empty
|| cxtInt.ClassFactoryDest != IntPtr.Zero)
{
- throw new ArgumentException();
+ throw new ArgumentException(null, nameof(pCxtInt));
}
try
diff --git a/src/coreclr/src/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs b/src/coreclr/src/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs
index dd8feba56e8262..c571fcf2bf26e4 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs
@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
@@ -47,7 +48,8 @@ private static string MarshalToString(IntPtr arg, string argName)
/// Assembly qualified delegate type name
/// Extensibility parameter (currently unused)
/// Pointer where to store the function pointer result
- public static int LoadAssemblyAndGetFunctionPointer(IntPtr assemblyPathNative,
+ [UnmanagedCallersOnly]
+ public static unsafe int LoadAssemblyAndGetFunctionPointer(IntPtr assemblyPathNative,
IntPtr typeNameNative,
IntPtr methodNameNative,
IntPtr delegateTypeNative,
@@ -56,18 +58,36 @@ public static int LoadAssemblyAndGetFunctionPointer(IntPtr assemblyPathNative,
{
try
{
+ // Load the assembly and create a resolver callback for types.
string assemblyPath = MarshalToString(assemblyPathNative, nameof(assemblyPathNative));
+ IsolatedComponentLoadContext alc = GetIsolatedComponentLoadContext(assemblyPath);
+ Func resolver = name => alc.LoadFromAssemblyName(name);
+
+ // Get the requested type.
string typeName = MarshalToString(typeNameNative, nameof(typeNameNative));
+ Type type = Type.GetType(typeName, resolver, null, throwOnError: true)!;
+
+ // Get the method name on the type.
string methodName = MarshalToString(methodNameNative, nameof(methodNameNative));
- string delegateType;
+ // Determine the signature of the type. There are 3 possibilities:
+ // * No delegate type was supplied - use the default (i.e. ComponentEntryPoint).
+ // * A sentinel value was supplied - the function is marked UnmanagedCallersOnly. This means
+ // a function pointer can be returned without creating a delegate.
+ // * A delegate type was supplied - Load the type and create a delegate for that method.
+ Type? delegateType;
if (delegateTypeNative == IntPtr.Zero)
{
- delegateType = typeof(ComponentEntryPoint).AssemblyQualifiedName!;
+ delegateType = typeof(ComponentEntryPoint);
+ }
+ else if (delegateTypeNative == (IntPtr)(-1))
+ {
+ delegateType = null;
}
else
{
- delegateType = MarshalToString(delegateTypeNative, nameof(delegateTypeNative));
+ string delegateTypeName = MarshalToString(delegateTypeNative, nameof(delegateTypeNative));
+ delegateType = Type.GetType(delegateTypeName, resolver, null, throwOnError: true)!;
}
if (reserved != IntPtr.Zero)
@@ -80,17 +100,35 @@ public static int LoadAssemblyAndGetFunctionPointer(IntPtr assemblyPathNative,
throw new ArgumentNullException(nameof(functionHandle));
}
- Delegate d = CreateDelegate(assemblyPath, typeName, methodName, delegateType);
+ IntPtr functionPtr;
+ if (delegateType == null)
+ {
+ // Match search semantics of the CreateDelegate() function below.
+ BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
+ MethodInfo? methodInfo = type.GetMethod(methodName, bindingFlags);
+ if (methodInfo == null)
+ throw new MissingMethodException(typeName, methodName);
- IntPtr functionPtr = Marshal.GetFunctionPointerForDelegate(d);
+ // Verify the function is properly marked.
+ if (null == methodInfo.GetCustomAttribute())
+ throw new InvalidOperationException(SR.InvalidOperation_FunctionMissingUnmanagedCallersOnly);
- lock (s_delegates)
+ functionPtr = methodInfo.MethodHandle.GetFunctionPointer();
+ }
+ else
{
- // Keep a reference to the delegate to prevent it from being garbage collected
- s_delegates[functionPtr] = d;
+ Delegate d = Delegate.CreateDelegate(delegateType, type, methodName)!;
+
+ functionPtr = Marshal.GetFunctionPointerForDelegate(d);
+
+ lock (s_delegates)
+ {
+ // Keep a reference to the delegate to prevent it from being garbage collected
+ s_delegates[functionPtr] = d;
+ }
}
- Marshal.WriteIntPtr(functionHandle, functionPtr);
+ *(IntPtr*)functionHandle = functionPtr;
}
catch (Exception e)
{
@@ -100,23 +138,6 @@ public static int LoadAssemblyAndGetFunctionPointer(IntPtr assemblyPathNative,
return 0;
}
- private static Delegate CreateDelegate(string assemblyPath, string typeName, string methodName, string delegateTypeName)
- {
- // Throws
- IsolatedComponentLoadContext alc = GetIsolatedComponentLoadContext(assemblyPath);
-
- Func resolver = name => alc.LoadFromAssemblyName(name);
-
- // Throws
- Type type = Type.GetType(typeName, resolver, null, throwOnError: true)!;
-
- // Throws
- Type delegateType = Type.GetType(delegateTypeName, resolver, null, throwOnError: true)!;
-
- // Throws
- return Delegate.CreateDelegate(delegateType, type, methodName)!;
- }
-
private static IsolatedComponentLoadContext GetIsolatedComponentLoadContext(string assemblyPath)
{
IsolatedComponentLoadContext? alc;
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/ArgIterator.cs b/src/coreclr/src/System.Private.CoreLib/src/System/ArgIterator.cs
index d32d53ae753b6e..8c7039e557b457 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/ArgIterator.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/ArgIterator.cs
@@ -85,7 +85,9 @@ public TypedReference GetNextArg(RuntimeTypeHandle rth)
// malicious caller to increment the pointer to an arbitrary
// location in memory and read the contents.
if (ArgPtr == IntPtr.Zero)
+#pragma warning disable CA2208 // Instantiate argument exceptions correctly, the argument not applicable
throw new ArgumentNullException();
+#pragma warning restore CA2208
TypedReference result = default;
// reference to TypedReference is banned, so have to pass result as pointer
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Array.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Array.CoreCLR.cs
index 55ed9f70b082be..75f6aa40ce4d14 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Array.CoreCLR.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Array.CoreCLR.cs
@@ -9,13 +9,6 @@
using System.Reflection;
using Internal.Runtime.CompilerServices;
-#pragma warning disable SA1121 // explicitly using type aliases instead of built-in types
-#if TARGET_64BIT
-using nuint = System.UInt64;
-#else
-using nuint = System.UInt32;
-#endif
-
namespace System
{
// Note that we make a T[] (single-dimensional w/ zero as the lower bound) implement both
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Buffer.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Buffer.CoreCLR.cs
index 8c7bc784ad8961..5e1d8249e3ddda 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Buffer.CoreCLR.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Buffer.CoreCLR.cs
@@ -7,15 +7,6 @@
using System.Runtime.InteropServices;
using Internal.Runtime.CompilerServices;
-#pragma warning disable SA1121 // explicitly using type aliases instead of built-in types
-#if TARGET_64BIT
-using nuint = System.UInt64;
-using nint = System.UInt64;
-#else
-using nuint = System.UInt32;
-using nint = System.UInt32;
-#endif
-
namespace System
{
public partial class Buffer
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipe.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipe.CoreCLR.cs
index bd1ad774bea18b..7d3ab6c6af68d8 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipe.CoreCLR.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipe.CoreCLR.cs
@@ -33,7 +33,7 @@ private static unsafe extern ulong Enable(
internal static extern IntPtr CreateProvider(string providerName, Interop.Advapi32.EtwEnableCallback callbackFunc);
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
- internal static extern unsafe IntPtr DefineEvent(IntPtr provHandle, uint eventID, long keywords, uint eventVersion, uint level, void* pMetadata, uint metadataLength);
+ internal static extern unsafe IntPtr DefineEvent(IntPtr provHandle, uint eventID, long keywords, uint eventVersion, uint level, void *pMetadata, uint metadataLength);
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
internal static extern IntPtr GetProvider(string providerName);
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs
index 20a0c57492d8aa..41b1dd72e01023 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs
@@ -131,7 +131,7 @@ internal void InitializeSourceInfo(int iSkip, bool fNeedFileInfo, Exception? exc
object? target = Activator.CreateInstance(symbolsType);
// Create an instance delegate for the GetSourceLineInfo method
- GetSourceLineInfoDelegate getSourceLineInfo = (GetSourceLineInfoDelegate)symbolsMethodInfo.CreateDelegate(typeof(GetSourceLineInfoDelegate), target);
+ GetSourceLineInfoDelegate getSourceLineInfo = symbolsMethodInfo.CreateDelegate(target);
// We could race with another thread. It doesn't matter if we win or lose, the losing instance will be GC'ed and all threads including this one will
// use the winning instance
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/GC.cs b/src/coreclr/src/System.Private.CoreLib/src/System/GC.cs
index fc8a9650f63b7e..a44047cc4d8e95 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/GC.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/GC.cs
@@ -135,7 +135,7 @@ public static void AddMemoryPressure(long bytesAllocated)
if ((4 == IntPtr.Size) && (bytesAllocated > int.MaxValue))
{
- throw new ArgumentOutOfRangeException("pressure",
+ throw new ArgumentOutOfRangeException(nameof(bytesAllocated),
SR.ArgumentOutOfRange_MustBeNonNegInt32);
}
@@ -353,7 +353,7 @@ public static long GetTotalMemory(bool forceFullCollection)
}
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
- private static extern IntPtr _RegisterFrozenSegment(IntPtr sectionAddress, IntPtr sectionSize);
+ private static extern IntPtr _RegisterFrozenSegment(IntPtr sectionAddress, nint sectionSize);
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
private static extern void _UnregisterFrozenSegment(IntPtr segmentHandle);
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs
deleted file mode 100644
index dccd60c78ce0d5..00000000000000
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Globalization
-{
- internal static partial class GlobalizationMode
- {
- private static bool GetGlobalizationInvariantMode()
- {
- bool invariantEnabled = GetInvariantSwitchValue();
- if (!invariantEnabled)
- {
- if (Interop.Globalization.LoadICU() == 0)
- {
- string message = "Couldn't find a valid ICU package installed on the system. " +
- "Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.";
- Environment.FailFast(message);
- }
- }
- return invariantEnabled;
- }
- }
-}
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Windows.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Windows.cs
deleted file mode 100644
index f5def09ab96ab4..00000000000000
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Windows.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Globalization
-{
- internal static partial class GlobalizationMode
- {
- private static bool GetGlobalizationInvariantMode()
- {
- return GetInvariantSwitchValue();
- }
- }
-}
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.cs
deleted file mode 100644
index b216677e1a711b..00000000000000
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Globalization
-{
- internal static partial class GlobalizationMode
- {
- internal static bool Invariant { get; } = GetGlobalizationInvariantMode();
-
- // GetInvariantSwitchValue calls CLRConfig first to detect if the switch is defined in the config file.
- // if the switch is defined we just use the value of this switch. otherwise, we'll try to get the switch
- // value from the environment variable if it is defined.
- internal static bool GetInvariantSwitchValue()
- {
- bool ret = CLRConfig.GetBoolValue("System.Globalization.Invariant", out bool exist);
- if (!exist)
- {
- // Linux doesn't support environment variable names include dots
- string? switchValue = Environment.GetEnvironmentVariable("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT");
- if (switchValue != null)
- {
- ret = bool.IsTrueStringIgnoreCase(switchValue) || switchValue.Equals("1");
- }
- }
-
- return ret;
- }
- }
-}
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/IO/FileLoadException.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/IO/FileLoadException.CoreCLR.cs
index 2878b89a49cc41..b426926a95e3f8 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/IO/FileLoadException.CoreCLR.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/IO/FileLoadException.CoreCLR.cs
@@ -29,7 +29,7 @@ internal static string FormatFileLoadExceptionMessage(string? fileName, int hRes
else
GetMessageForHR(hResult, new StringHandleOnStack(ref message));
- return string.Format(format, fileName, message);
+ return string.Format(format!, fileName, message);
}
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Object.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Object.CoreCLR.cs
index 3c7cb5c23982a2..a65358449ee8ca 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Object.CoreCLR.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Object.CoreCLR.cs
@@ -4,13 +4,6 @@
using System.Runtime.CompilerServices;
-#pragma warning disable SA1121 // explicitly using type aliases instead of built-in types
-#if TARGET_64BIT
-using nuint = System.UInt64;
-#else
-using nuint = System.UInt32;
-#endif
-
namespace System
{
public partial class Object
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Assembly.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Assembly.CoreCLR.cs
index c227155ef46645..8ef9d01d3ee707 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Assembly.CoreCLR.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Assembly.CoreCLR.cs
@@ -62,7 +62,7 @@ internal static RuntimeAssembly GetExecutingAssembly(ref StackCrawlMark stackMar
{
RuntimeAssembly? retAssembly = null;
GetExecutingAssemblyNative(new StackCrawlMarkHandle(ref stackMark), ObjectHandleOnStack.Create(ref retAssembly));
- return retAssembly;
+ return retAssembly!;
}
// Get the assembly that the current code is running from.
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs
index 2e0acab5590163..1407f8705246e7 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs
@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.SymbolStore;
using System.Globalization;
using System.IO;
@@ -125,7 +126,7 @@ public sealed class AssemblyBuilder : Assembly
// This is only valid in the "external" AssemblyBuilder
internal AssemblyBuilderData _assemblyData;
private readonly InternalAssemblyBuilder _internalAssemblyBuilder;
- private ModuleBuilder _manifestModuleBuilder = null!;
+ private ModuleBuilder _manifestModuleBuilder;
// Set to true if the manifest module was returned by code:DefineDynamicModule to the user
private bool _isManifestModuleUsedAsDefinedModule;
@@ -191,7 +192,7 @@ internal AssemblyBuilder(AssemblyName name,
new StackCrawlMarkHandle(ref stackMark),
(int)access,
ObjectHandleOnStack.Create(ref retAssembly));
- _internalAssemblyBuilder = (InternalAssemblyBuilder)retAssembly;
+ _internalAssemblyBuilder = (InternalAssemblyBuilder)retAssembly!;
_assemblyData = new AssemblyBuilderData(_internalAssemblyBuilder, access);
@@ -208,6 +209,7 @@ internal AssemblyBuilder(AssemblyName name,
}
}
+ [MemberNotNull(nameof(_manifestModuleBuilder))]
private void InitManifestModule()
{
InternalModuleBuilder modBuilder = (InternalModuleBuilder)GetInMemoryAssemblyModule(GetNativeHandle());
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.cs
index 80cb55b796c501..fb6b4c623eab93 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.cs
@@ -19,7 +19,7 @@ internal ConstructorBuilder(string name, MethodAttributes attributes, CallingCon
m_methodBuilder = new MethodBuilder(name, attributes, callingConvention, null, null, null,
parameterTypes, requiredCustomModifiers, optionalCustomModifiers, mod, type);
- type.m_listMethods.Add(m_methodBuilder);
+ type.m_listMethods!.Add(m_methodBuilder);
m_methodBuilder.GetMethodSignature().InternalGetSignature(out _);
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/CustomAttributeBuilder.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/CustomAttributeBuilder.cs
index 506c98b28e5e2c..d1e89aaf0c3bf3 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/CustomAttributeBuilder.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/CustomAttributeBuilder.cs
@@ -14,91 +14,42 @@
===========================================================*/
using System.Buffers.Binary;
+using System.Diagnostics;
using System.IO;
using System.Text;
-using System.Diagnostics;
namespace System.Reflection.Emit
{
public class CustomAttributeBuilder
{
+ internal ConstructorInfo m_con;
+ private object?[] m_constructorArgs;
+ private byte[] m_blob;
+
// public constructor to form the custom attribute with constructor and constructor
// parameters.
- public CustomAttributeBuilder(ConstructorInfo con, object?[] constructorArgs)
+ public CustomAttributeBuilder(ConstructorInfo con, object?[] constructorArgs) :
+ this(con, constructorArgs, Array.Empty(), Array.Empty(), Array.Empty(), Array.Empty())
{
- InitCustomAttributeBuilder(con, constructorArgs,
- Array.Empty(), Array.Empty(),
- Array.Empty(), Array.Empty());
}
// public constructor to form the custom attribute with constructor, constructor
// parameters and named properties.
- public CustomAttributeBuilder(ConstructorInfo con, object?[] constructorArgs,
- PropertyInfo[] namedProperties, object?[] propertyValues)
+ public CustomAttributeBuilder(ConstructorInfo con, object?[] constructorArgs, PropertyInfo[] namedProperties, object?[] propertyValues) :
+ this(con, constructorArgs, namedProperties, propertyValues, Array.Empty(), Array.Empty())
{
- InitCustomAttributeBuilder(con, constructorArgs, namedProperties,
- propertyValues, Array.Empty(), Array.Empty());
}
// public constructor to form the custom attribute with constructor and constructor
// parameters.
- public CustomAttributeBuilder(ConstructorInfo con, object?[] constructorArgs,
- FieldInfo[] namedFields, object?[] fieldValues)
+ public CustomAttributeBuilder(ConstructorInfo con, object?[] constructorArgs, FieldInfo[] namedFields, object?[] fieldValues) :
+ this(con, constructorArgs, Array.Empty(), Array.Empty(), namedFields, fieldValues)
{
- InitCustomAttributeBuilder(con, constructorArgs, Array.Empty(),
- Array.Empty(), namedFields, fieldValues);
}
// public constructor to form the custom attribute with constructor and constructor
// parameters.
- public CustomAttributeBuilder(ConstructorInfo con, object?[] constructorArgs,
- PropertyInfo[] namedProperties, object?[] propertyValues,
- FieldInfo[] namedFields, object?[] fieldValues)
- {
- InitCustomAttributeBuilder(con, constructorArgs, namedProperties,
- propertyValues, namedFields, fieldValues);
- }
-
- // Check that a type is suitable for use in a custom attribute.
- private bool ValidateType(Type t)
- {
- if (t.IsPrimitive)
- {
- return t != typeof(IntPtr) && t != typeof(UIntPtr);
- }
- if (t == typeof(string) || t == typeof(Type))
- {
- return true;
- }
- if (t.IsEnum)
- {
- switch (Type.GetTypeCode(Enum.GetUnderlyingType(t)))
- {
- case TypeCode.SByte:
- case TypeCode.Byte:
- case TypeCode.Int16:
- case TypeCode.UInt16:
- case TypeCode.Int32:
- case TypeCode.UInt32:
- case TypeCode.Int64:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
- if (t.IsArray)
- {
- if (t.GetArrayRank() != 1)
- return false;
- return ValidateType(t.GetElementType()!);
- }
- return t == typeof(object);
- }
-
- internal void InitCustomAttributeBuilder(ConstructorInfo con, object?[] constructorArgs,
- PropertyInfo[] namedProperties, object?[] propertyValues,
- FieldInfo[] namedFields, object?[] fieldValues)
+ public CustomAttributeBuilder(ConstructorInfo con, object?[] constructorArgs, PropertyInfo[] namedProperties, object?[] propertyValues, FieldInfo[] namedFields, object?[] fieldValues)
{
if (con == null)
throw new ArgumentNullException(nameof(con));
@@ -289,6 +240,43 @@ internal void InitCustomAttributeBuilder(ConstructorInfo con, object?[] construc
m_blob = ((MemoryStream)writer.BaseStream).ToArray();
}
+ // Check that a type is suitable for use in a custom attribute.
+ private bool ValidateType(Type t)
+ {
+ if (t.IsPrimitive)
+ {
+ return t != typeof(IntPtr) && t != typeof(UIntPtr);
+ }
+ if (t == typeof(string) || t == typeof(Type))
+ {
+ return true;
+ }
+ if (t.IsEnum)
+ {
+ switch (Type.GetTypeCode(Enum.GetUnderlyingType(t)))
+ {
+ case TypeCode.SByte:
+ case TypeCode.Byte:
+ case TypeCode.Int16:
+ case TypeCode.UInt16:
+ case TypeCode.Int32:
+ case TypeCode.UInt32:
+ case TypeCode.Int64:
+ case TypeCode.UInt64:
+ return true;
+ default:
+ return false;
+ }
+ }
+ if (t.IsArray)
+ {
+ if (t.GetArrayRank() != 1)
+ return false;
+ return ValidateType(t.GetElementType()!);
+ }
+ return t == typeof(object);
+ }
+
private static void VerifyTypeAndPassedObjectType(Type type, Type passedType, string paramName)
{
if (type != typeof(object) && Type.GetTypeCode(passedType) != Type.GetTypeCode(type))
@@ -549,9 +537,5 @@ internal void CreateCustomAttribute(ModuleBuilder mod, int tkOwner, int tkAttrib
TypeBuilder.DefineCustomAttribute(mod, tkOwner, tkAttrib, m_blob, toDisk,
typeof(System.Diagnostics.DebuggableAttribute) == m_con.DeclaringType);
}
-
- internal ConstructorInfo m_con = null!;
- internal object?[] m_constructorArgs = null!;
- internal byte[] m_blob = null!;
}
}
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs
index a1a85b47d0bf3b..d8e330dd7f98b2 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs
@@ -345,7 +345,7 @@ public override void BeginExceptFilterBlock()
if (CurrExcStackCount == 0)
throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
- __ExceptionInfo current = CurrExcStack[CurrExcStackCount - 1];
+ __ExceptionInfo current = CurrExcStack![CurrExcStackCount - 1];
Label endLabel = current.GetEndLabel();
Emit(OpCodes.Leave, endLabel);
@@ -359,7 +359,7 @@ public override void BeginCatchBlock(Type exceptionType)
if (CurrExcStackCount == 0)
throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
- __ExceptionInfo current = CurrExcStack[CurrExcStackCount - 1];
+ __ExceptionInfo current = CurrExcStack![CurrExcStackCount - 1];
RuntimeType? rtType = exceptionType as RuntimeType;
@@ -558,7 +558,7 @@ private int GetTokenForSig(byte[] sig)
internal class DynamicResolver : Resolver
{
#region Private Data Members
- private __ExceptionInfo[] m_exceptions = null!;
+ private __ExceptionInfo[]? m_exceptions;
private byte[]? m_exceptionHeader;
private DynamicMethod m_method;
private byte[] m_code;
@@ -571,7 +571,7 @@ internal class DynamicResolver : Resolver
internal DynamicResolver(DynamicILGenerator ilGenerator)
{
m_stackSize = ilGenerator.GetMaxStackSize();
- m_exceptions = ilGenerator.GetExceptions()!;
+ m_exceptions = ilGenerator.GetExceptions();
m_code = ilGenerator.BakeByteArray()!;
m_localSignature = ilGenerator.m_localSignature.InternalGetSignatureArray();
m_scope = ilGenerator.m_scope;
@@ -586,7 +586,6 @@ internal DynamicResolver(DynamicILInfo dynamicILInfo)
m_code = dynamicILInfo.Code;
m_localSignature = dynamicILInfo.LocalSignature;
m_exceptionHeader = dynamicILInfo.Exceptions;
- // m_exceptions = dynamicILInfo.Exceptions;
m_scope = dynamicILInfo.DynamicScope;
m_method = dynamicILInfo.DynamicMethod;
@@ -740,6 +739,8 @@ internal override byte[] GetLocalsSignature()
internal override unsafe void GetEHInfo(int excNumber, void* exc)
{
+ Debug.Assert(m_exceptions != null);
+
CORINFO_EH_CLAUSE* exception = (CORINFO_EH_CLAUSE*)exc;
for (int i = 0; i < m_exceptions.Length; i++)
{
@@ -819,11 +820,13 @@ internal override void ResolveToken(int token, out IntPtr typeHandle, out IntPtr
{
if (vaMeth.m_dynamicMethod == null)
{
- methodHandle = vaMeth.m_method.MethodHandle.Value;
+ methodHandle = vaMeth.m_method!.MethodHandle.Value;
typeHandle = vaMeth.m_method.GetDeclaringTypeInternal().GetTypeHandleInternal().Value;
}
else
+ {
methodHandle = vaMeth.m_dynamicMethod.GetMethodDescriptor().Value;
+ }
return;
}
@@ -1098,8 +1101,8 @@ internal GenericFieldInfo(RuntimeFieldHandle fieldHandle, RuntimeTypeHandle cont
internal sealed class VarArgMethod
{
- internal RuntimeMethodInfo m_method = null!;
- internal DynamicMethod m_dynamicMethod = null!;
+ internal RuntimeMethodInfo? m_method;
+ internal DynamicMethod? m_dynamicMethod;
internal SignatureHelper m_signature;
internal VarArgMethod(DynamicMethod dm, SignatureHelper signature)
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs
index 35a708a1f867d0..c8c5468801d72e 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Text;
@@ -12,9 +13,9 @@ namespace System.Reflection.Emit
{
public sealed class DynamicMethod : MethodInfo
{
- private RuntimeType[] m_parameterTypes = null!;
+ private RuntimeType[] m_parameterTypes;
internal IRuntimeMethodInfo? m_methodHandle;
- private RuntimeType m_returnType = null!;
+ private RuntimeType m_returnType;
private DynamicILGenerator? m_ilGenerator;
private DynamicILInfo? m_DynamicILInfo;
private bool m_fInitLocals;
@@ -28,7 +29,7 @@ public sealed class DynamicMethod : MethodInfo
// If we allowed use of RTDynamicMethod, the creator of the DynamicMethod would
// not be able to bound access to the DynamicMethod. Hence, we need to ensure that
// we do not allow direct use of RTDynamicMethod.
- private RTDynamicMethod m_dynMethod = null!;
+ private RTDynamicMethod m_dynMethod;
// needed to keep the object alive during jitting
// assigned by the DynamicResolver ctor
@@ -249,6 +250,9 @@ private static RuntimeModule GetDynamicMethodsModule()
return s_anonymouslyHostedDynamicMethodsModule;
}
+ [MemberNotNull(nameof(m_parameterTypes))]
+ [MemberNotNull(nameof(m_returnType))]
+ [MemberNotNull(nameof(m_dynMethod))]
private void Init(string name,
MethodAttributes attributes,
CallingConventions callingConvention,
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.cs
index 4f58098617fdb3..3b0e0350bf9df1 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.cs
@@ -91,6 +91,8 @@ public FieldBuilder DefineLiteral(string literalName, object? literalValue)
public override Type? BaseType => m_typeBuilder.BaseType;
+ public override bool IsByRefLike => false;
+
protected override ConstructorInfo? GetConstructorImpl(BindingFlags bindingAttr, Binder? binder,
CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
{
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs
index 547d160a664262..d0f930e4c763ea 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs
@@ -52,6 +52,8 @@ public override bool Equals(object? o)
public override Module Module => m_type.Module;
+ public override bool IsByRefLike => false;
+
internal int MetadataTokenInternal => m_type.MetadataTokenInternal;
#endregion
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.cs
index 93c517fb23c5c7..354d470bb982a2 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.cs
@@ -40,20 +40,20 @@ internal static T[] EnlargeArray(T[] incoming, int requiredSize)
private int m_length;
private byte[] m_ILStream;
- private int[] m_labelList;
+ private int[]? m_labelList;
private int m_labelCount;
- private __FixupData[] m_fixupData;
+ private __FixupData[]? m_fixupData;
private int m_fixupCount;
- private int[] m_RelocFixupList;
+ private int[]? m_RelocFixupList;
private int m_RelocFixupCount;
private int m_exceptionCount;
private int m_currExcStackCount;
- private __ExceptionInfo[] m_exceptions; // This is the list of all of the exceptions in this ILStream.
- private __ExceptionInfo[] m_currExcStack; // This is the stack of exceptions which we're currently in.
+ private __ExceptionInfo[]? m_exceptions; // This is the list of all of the exceptions in this ILStream.
+ private __ExceptionInfo[]? m_currExcStack; // This is the stack of exceptions which we're currently in.
internal ScopeTree m_ScopeTree; // this variable tracks all debugging scope information
internal LineNumberInfo m_LineNumberInfo; // this variable tracks all line number information
@@ -69,7 +69,7 @@ internal static T[] EnlargeArray(T[] incoming, int requiredSize)
internal int CurrExcStackCount => m_currExcStackCount;
- internal __ExceptionInfo[] CurrExcStack => m_currExcStack;
+ internal __ExceptionInfo[]? CurrExcStack => m_currExcStack;
#endregion
@@ -87,29 +87,12 @@ internal ILGenerator(MethodInfo methodBuilder, int size)
m_ILStream = new byte[Math.Max(size, DefaultSize)];
- m_length = 0;
-
- m_labelCount = 0;
- m_fixupCount = 0;
- m_labelList = null!;
-
- m_fixupData = null!;
-
- m_exceptions = null!;
- m_exceptionCount = 0;
- m_currExcStack = null!;
- m_currExcStackCount = 0;
-
- m_RelocFixupList = null!;
- m_RelocFixupCount = 0;
-
// initialize the scope tree
m_ScopeTree = new ScopeTree();
m_LineNumberInfo = new LineNumberInfo();
m_methodBuilder = methodBuilder;
// initialize local signature
- m_localCount = 0;
MethodBuilder? mb = m_methodBuilder as MethodBuilder;
m_localSignature = SignatureHelper.GetLocalVarSigHelper(mb?.GetTypeBuilder().Module);
}
@@ -215,7 +198,7 @@ private SignatureHelper GetMemberRefSignature(CallingConventions call, Type? ret
// replacing them with their proper values.
for (int i = 0; i < m_fixupCount; i++)
{
- __FixupData fixupData = m_fixupData[i];
+ __FixupData fixupData = m_fixupData![i];
int updateAddr = GetLabelPos(fixupData.m_fixupLabel) - (fixupData.m_fixupPos + fixupData.m_fixupInstSize);
// Handle single byte instructions
@@ -253,7 +236,7 @@ private SignatureHelper GetMemberRefSignature(CallingConventions call, Type? ret
}
var temp = new __ExceptionInfo[m_exceptionCount];
- Array.Copy(m_exceptions, temp, m_exceptionCount);
+ Array.Copy(m_exceptions!, temp, m_exceptionCount);
SortExceptions(temp);
return temp;
}
@@ -288,7 +271,7 @@ private int GetLabelPos(Label lbl)
int index = lbl.GetLabelValue();
- if (index < 0 || index >= m_labelCount)
+ if (index < 0 || index >= m_labelCount || m_labelList is null)
throw new ArgumentException(SR.Argument_BadLabel);
if (m_labelList[index] < 0)
@@ -355,7 +338,7 @@ private static void SortExceptions(__ExceptionInfo[] exceptions)
}
int[] narrowTokens = new int[m_RelocFixupCount];
- Array.Copy(m_RelocFixupList, narrowTokens, m_RelocFixupCount);
+ Array.Copy(m_RelocFixupList!, narrowTokens, m_RelocFixupCount);
return narrowTokens;
}
#endregion
@@ -396,7 +379,90 @@ public virtual void Emit(OpCode opcode, short arg)
public virtual void Emit(OpCode opcode, int arg)
{
- // Puts opcode onto the stream of instructions followed by arg
+ // Special-case several opcodes that have shorter variants for common values.
+ if (opcode.Equals(OpCodes.Ldc_I4))
+ {
+ if (arg >= -1 && arg <= 8)
+ {
+ opcode = arg switch
+ {
+ -1 => OpCodes.Ldc_I4_M1,
+ 0 => OpCodes.Ldc_I4_0,
+ 1 => OpCodes.Ldc_I4_1,
+ 2 => OpCodes.Ldc_I4_2,
+ 3 => OpCodes.Ldc_I4_3,
+ 4 => OpCodes.Ldc_I4_4,
+ 5 => OpCodes.Ldc_I4_5,
+ 6 => OpCodes.Ldc_I4_6,
+ 7 => OpCodes.Ldc_I4_7,
+ _ => OpCodes.Ldc_I4_8,
+ };
+ Emit(opcode);
+ return;
+ }
+
+ if (arg >= -128 && arg <= 127)
+ {
+ Emit(OpCodes.Ldc_I4_S, (sbyte)arg);
+ return;
+ }
+ }
+ else if (opcode.Equals(OpCodes.Ldarg))
+ {
+ if ((uint)arg <= 3)
+ {
+ Emit(arg switch
+ {
+ 0 => OpCodes.Ldarg_0,
+ 1 => OpCodes.Ldarg_1,
+ 2 => OpCodes.Ldarg_2,
+ _ => OpCodes.Ldarg_3,
+ });
+ return;
+ }
+
+ if ((uint)arg <= byte.MaxValue)
+ {
+ Emit(OpCodes.Ldarg_S, (byte)arg);
+ return;
+ }
+
+ if ((uint)arg <= ushort.MaxValue) // this will be true except on misuse of the opcode
+ {
+ Emit(OpCodes.Ldarg, (short)arg);
+ return;
+ }
+ }
+ else if (opcode.Equals(OpCodes.Ldarga))
+ {
+ if ((uint)arg <= byte.MaxValue)
+ {
+ Emit(OpCodes.Ldarga_S, (byte)arg);
+ return;
+ }
+
+ if ((uint)arg <= ushort.MaxValue) // this will be true except on misuse of the opcode
+ {
+ Emit(OpCodes.Ldarga, (short)arg);
+ return;
+ }
+ }
+ else if (opcode.Equals(OpCodes.Starg))
+ {
+ if ((uint)arg <= byte.MaxValue)
+ {
+ Emit(OpCodes.Starg_S, (byte)arg);
+ return;
+ }
+
+ if ((uint)arg <= ushort.MaxValue) // this will be true except on misuse of the opcode
+ {
+ Emit(OpCodes.Starg, (short)arg);
+ return;
+ }
+ }
+
+ // For everything else, put the opcode followed by the arg onto the stream of instructions.
EnsureCapacity(7);
InternalEmit(opcode);
PutInteger4(arg);
@@ -881,7 +947,7 @@ public virtual void EndExceptionBlock()
}
// Pop the current exception block
- __ExceptionInfo current = m_currExcStack[m_currExcStackCount - 1];
+ __ExceptionInfo current = m_currExcStack![m_currExcStackCount - 1];
m_currExcStack[--m_currExcStackCount] = null!;
Label endLabel = current.GetEndLabel();
@@ -905,7 +971,7 @@ public virtual void EndExceptionBlock()
// Check if we've already set this label.
// The only reason why we might have set this is if we have a finally block.
- Label label = m_labelList[endLabel.GetLabelValue()] != -1
+ Label label = m_labelList![endLabel.GetLabelValue()] != -1
? current.m_finallyEndLabel
: endLabel;
@@ -921,7 +987,7 @@ public virtual void BeginExceptFilterBlock()
if (m_currExcStackCount == 0)
throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
- __ExceptionInfo current = m_currExcStack[m_currExcStackCount - 1];
+ __ExceptionInfo current = m_currExcStack![m_currExcStackCount - 1];
Emit(OpCodes.Leave, current.GetEndLabel());
@@ -936,7 +1002,7 @@ public virtual void BeginCatchBlock(Type exceptionType)
{
throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
}
- __ExceptionInfo current = m_currExcStack[m_currExcStackCount - 1];
+ __ExceptionInfo current = m_currExcStack![m_currExcStackCount - 1];
if (current.GetCurrentState() == __ExceptionInfo.State_Filter)
{
@@ -967,7 +1033,7 @@ public virtual void BeginFaultBlock()
{
throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
}
- __ExceptionInfo current = m_currExcStack[m_currExcStackCount - 1];
+ __ExceptionInfo current = m_currExcStack![m_currExcStackCount - 1];
// emit the leave for the clause before this one.
Emit(OpCodes.Leave, current.GetEndLabel());
@@ -981,7 +1047,7 @@ public virtual void BeginFinallyBlock()
{
throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
}
- __ExceptionInfo current = m_currExcStack[m_currExcStackCount - 1];
+ __ExceptionInfo current = m_currExcStack![m_currExcStackCount - 1];
int state = current.GetCurrentState();
Label endLabel = current.GetEndLabel();
int catchEndAddr = 0;
@@ -1031,8 +1097,8 @@ public virtual void MarkLabel(Label loc)
int labelIndex = loc.GetLabelValue();
- // This should never happen.
- if (labelIndex < 0 || labelIndex >= m_labelList.Length)
+ // This should only happen if a label from another generator is used with this one.
+ if (m_labelList is null || labelIndex < 0 || labelIndex >= m_labelList.Length)
{
throw new ArgumentException(SR.Argument_InvalidLabel);
}
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs
index c5ae82adaeed65..e3c189f910beb3 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs
@@ -620,7 +620,7 @@ public MethodToken GetToken()
// We need to lock here to prevent a method from being "tokenized" twice.
// We don't need to synchronize this with Type.DefineMethod because it only appends newly
// constructed MethodBuilders to the end of m_listMethods
- lock (m_containingType.m_listMethods)
+ lock (m_containingType.m_listMethods!)
{
if (m_tkMethod.Token != 0)
{
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs
index 0808335d3b8de7..a9db943c8ae588 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs
@@ -2,10 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System.Text;
using System.Buffers.Binary;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
+using System.Text;
namespace System.Reflection.Emit
{
@@ -185,7 +186,7 @@ internal static SignatureHelper GetTypeSigToken(Module module, Type type)
#endregion
#region Private Data Members
- private byte[] m_signature = null!;
+ private byte[] m_signature;
private int m_currSig; // index into m_signature buffer for next available byte
private int m_sizeLoc; // index into m_signature buffer to put m_argCount (will be NO_SIZE_IN_SIG if no arg count is needed)
private ModuleBuilder? m_module;
@@ -225,6 +226,7 @@ private SignatureHelper(Module mod, Type type)
AddOneArgTypeHelper(type);
}
+ [MemberNotNull(nameof(m_signature))]
private void Init(Module? mod)
{
m_signature = new byte[32];
@@ -238,11 +240,13 @@ private void Init(Module? mod)
throw new ArgumentException(SR.NotSupported_MustBeModuleBuilder);
}
+ [MemberNotNull(nameof(m_signature))]
private void Init(Module? mod, MdSigCallingConvention callingConvention)
{
Init(mod, callingConvention, 0);
}
+ [MemberNotNull(nameof(m_signature))]
private void Init(Module? mod, MdSigCallingConvention callingConvention, int cGenericParam)
{
Init(mod);
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
index f69d99e02a9ec8..65d61ca28adeec 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
@@ -396,15 +396,15 @@ internal static unsafe void SetConstantValue(ModuleBuilder module, int tk, Type
#region Private Data Members
private List? m_ca;
private TypeToken m_tdType;
- private readonly ModuleBuilder m_module = null!;
+ private readonly ModuleBuilder m_module;
private readonly string? m_strName;
private readonly string? m_strNameSpace;
private string? m_strFullQualName;
private Type? m_typeParent;
- private List m_typeInterfaces = null!;
+ private List? m_typeInterfaces;
private readonly TypeAttributes m_iAttr;
private GenericParameterAttributes m_genParamAttributes;
- internal List m_listMethods = null!;
+ internal List? m_listMethods;
internal int m_lastTokenizedMethod;
private int m_constructorCount;
private readonly int m_iTypeSize;
@@ -430,7 +430,7 @@ internal TypeBuilder(ModuleBuilder module)
{
m_tdType = new TypeToken((int)MetadataTokenType.TypeDef);
m_isHiddenGlobalType = true;
- m_module = (ModuleBuilder)module;
+ m_module = module;
m_listMethods = new List();
// No token has been created so let's initialize it to -1
// The first time we call MethodBuilder.GetToken this will incremented.
@@ -438,8 +438,13 @@ internal TypeBuilder(ModuleBuilder module)
}
// ctor for generic method parameter
- internal TypeBuilder(string szName, int genParamPos, MethodBuilder declMeth) : this(szName, genParamPos)
+ internal TypeBuilder(string szName, int genParamPos, MethodBuilder declMeth)
{
+ m_strName = szName;
+ m_genParamPos = genParamPos;
+ m_bIsGenParam = true;
+ m_typeInterfaces = new List();
+
Debug.Assert(declMeth != null);
m_declMeth = declMeth;
m_DeclaringType = m_declMeth.GetTypeBuilder();
@@ -447,20 +452,16 @@ internal TypeBuilder(string szName, int genParamPos, MethodBuilder declMeth) : t
}
// ctor for generic type parameter
- private TypeBuilder(string szName, int genParamPos, TypeBuilder declType) : this(szName, genParamPos)
- {
- Debug.Assert(declType != null);
- m_DeclaringType = declType;
- m_module = declType.GetModuleBuilder();
- }
-
- // only for delegating to by other ctors
- private TypeBuilder(string szName, int genParamPos)
+ private TypeBuilder(string szName, int genParamPos, TypeBuilder declType)
{
m_strName = szName;
m_genParamPos = genParamPos;
m_bIsGenParam = true;
m_typeInterfaces = new List();
+
+ Debug.Assert(declType != null);
+ m_DeclaringType = declType;
+ m_module = declType.GetModuleBuilder();
}
internal TypeBuilder(
@@ -721,6 +722,8 @@ public override string ToString()
public override Module Module => GetModuleBuilder();
+ public override bool IsByRefLike => false;
+
internal int MetadataTokenInternal => m_tdType.Token;
#endregion
@@ -1293,7 +1296,7 @@ private MethodBuilder DefineMethodNoLock(string name, MethodAttributes attribute
}
}
- m_listMethods.Add(method);
+ m_listMethods!.Add(method);
return method;
}
@@ -1379,7 +1382,7 @@ private MethodBuilder DefinePInvokeMethodHelper(
// and our equals check won't work.
_ = method.GetMethodSignature().InternalGetSignature(out _);
- if (m_listMethods.Contains(method))
+ if (m_listMethods!.Contains(method))
{
throw new ArgumentException(SR.Argument_MethodRedefined);
}
@@ -1952,7 +1955,7 @@ internal void CheckContext(params Type?[]? types)
}
}
- int size = m_listMethods.Count;
+ int size = m_listMethods!.Count;
for (int i = 0; i < size; i++)
{
@@ -2030,12 +2033,12 @@ internal void CheckContext(params Type?[]? types)
m_hasBeenCreated = true;
// Terminate the process.
- RuntimeType cls = null!;
+ RuntimeType? cls = null;
TermCreateClass(new QCallModule(ref module), m_tdType.Token, ObjectHandleOnStack.Create(ref cls));
if (!m_isHiddenGlobalType)
{
- m_bakedRuntimeType = cls;
+ m_bakedRuntimeType = cls!;
// if this type is a nested type, we need to invalidate the cached nested runtime type on the nesting type
if (m_DeclaringType != null && m_DeclaringType.m_bakedRuntimeType != null)
@@ -2103,7 +2106,7 @@ public void AddInterfaceImplementation(Type interfaceType)
ModuleBuilder module = m_module;
AddInterfaceImpl(new QCallModule(ref module), m_tdType.Token, tkInterface.Token);
- m_typeInterfaces.Add(interfaceType);
+ m_typeInterfaces!.Add(interfaceType);
}
public TypeToken TypeToken
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/MethodBase.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/MethodBase.CoreCLR.cs
index 3c467b743290dd..7ab2a594ab52fb 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/MethodBase.CoreCLR.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/MethodBase.CoreCLR.cs
@@ -69,7 +69,7 @@ internal object[] CheckArguments(object[] parameters, Binder? binder,
// copy the arguments in a different array so we detach from any user changes
object[] copyOfParameters = new object[parameters.Length];
- ParameterInfo[] p = null!;
+ ParameterInfo[]? p = null;
for (int i = 0; i < parameters.Length; i++)
{
object arg = parameters[i];
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs
index 60379a0cf9182e..fd6eeb2bc23cbb 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs
@@ -327,7 +327,7 @@ internal static RuntimeAssembly InternalLoad(AssemblyName assemblyName,
throwOnFileNotFound,
ObjectHandleOnStack.Create(ref assemblyLoadContext),
ObjectHandleOnStack.Create(ref retAssembly));
- return retAssembly;
+ return retAssembly!;
}
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs
index 77367461e462d3..133f825dbcc063 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs
@@ -18,11 +18,11 @@ internal sealed class RuntimeConstructorInfo : ConstructorInfo, IRuntimeMethodIn
private RuntimeTypeCache m_reflectedTypeCache;
private string? m_toString;
private ParameterInfo[]? m_parameters; // Created lazily when GetParameters() is called.
-#pragma warning disable CA1823, 414
- private object _empty1 = null!; // These empties are used to ensure that RuntimeConstructorInfo and RuntimeMethodInfo are have a layout which is sufficiently similar
- private object _empty2 = null!;
- private object _empty3 = null!;
-#pragma warning restore CA1823, 414
+#pragma warning disable CA1823, 414, 169
+ private object? _empty1; // These empties are used to ensure that RuntimeConstructorInfo and RuntimeMethodInfo are have a layout which is sufficiently similar
+ private object? _empty2;
+ private object? _empty3;
+#pragma warning restore CA1823, 414, 169
private IntPtr m_handle;
private MethodAttributes m_methodAttributes;
private BindingFlags m_bindingFlags;
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeEventInfo.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeEventInfo.cs
index 0b24a02472d5ad..2a14dc6b9a188c 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeEventInfo.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeEventInfo.cs
@@ -15,20 +15,16 @@ internal sealed unsafe class RuntimeEventInfo : EventInfo
private EventAttributes m_flags;
private string? m_name;
private void* m_utf8name;
- private RuntimeTypeCache m_reflectedTypeCache = null!;
+ private RuntimeTypeCache m_reflectedTypeCache;
private RuntimeMethodInfo? m_addMethod;
private RuntimeMethodInfo? m_removeMethod;
private RuntimeMethodInfo? m_raiseMethod;
private MethodInfo[]? m_otherMethod;
- private RuntimeType m_declaringType = null!;
+ private RuntimeType m_declaringType;
private BindingFlags m_bindingFlags;
#endregion
#region Constructor
- internal RuntimeEventInfo()
- {
- // Used for dummy head node during population
- }
internal RuntimeEventInfo(int tkEvent, RuntimeType declaredType, RuntimeTypeCache reflectedTypeCache, out bool isPrivate)
{
Debug.Assert(declaredType != null);
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs
index 5eb9a5fd3cc209..fc64e1d9713a69 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs
@@ -11,15 +11,11 @@ internal abstract class RuntimeFieldInfo : FieldInfo
{
#region Private Data Members
private BindingFlags m_bindingFlags;
- protected RuntimeTypeCache m_reflectedTypeCache = null!;
- protected RuntimeType m_declaringType = null!;
+ protected RuntimeTypeCache m_reflectedTypeCache;
+ protected RuntimeType m_declaringType;
#endregion
#region Constructor
- protected RuntimeFieldInfo()
- {
- // Used for dummy head node during population
- }
protected RuntimeFieldInfo(RuntimeTypeCache reflectedTypeCache, RuntimeType declaringType, BindingFlags bindingFlags)
{
m_bindingFlags = bindingFlags;
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs
index c7ad03319ddf3c..f8a0ff0b329cea 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs
@@ -113,7 +113,7 @@ internal static ParameterInfo[] GetParameters(
#region Private Data Members
private int m_tkParamDef;
private MetadataImport m_scope;
- private Signature m_signature = null!;
+ private Signature? m_signature;
private volatile bool m_nameIsCached = false;
private readonly bool m_noMetadata = false;
private bool m_noDefaultValue = false;
@@ -217,6 +217,8 @@ public override Type ParameterType
// only instance of ParameterInfo has ClassImpl, all its subclasses don't
if (ClassImpl == null)
{
+ Debug.Assert(m_signature != null);
+
RuntimeType parameterType;
if (PositionImpl == -1)
parameterType = m_signature.ReturnType;
@@ -481,12 +483,16 @@ private static DateTime GetRawDateTimeConstant(CustomAttributeData attr)
public override Type[] GetRequiredCustomModifiers()
{
- return m_signature.GetCustomModifiers(PositionImpl + 1, true);
+ return m_signature is null ?
+ Type.EmptyTypes :
+ m_signature.GetCustomModifiers(PositionImpl + 1, true);
}
public override Type[] GetOptionalCustomModifiers()
{
- return m_signature.GetCustomModifiers(PositionImpl + 1, false);
+ return m_signature is null ?
+ Type.EmptyTypes :
+ m_signature.GetCustomModifiers(PositionImpl + 1, false);
}
#endregion
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs
index 74148dda4ee6f3..15cad526595576 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs
@@ -9,13 +9,6 @@
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
-#pragma warning disable SA1121 // explicitly using type aliases instead of built-in types
-#if TARGET_64BIT
-using nuint = System.UInt64;
-#else
-using nuint = System.UInt32;
-#endif
-
namespace System.Runtime.CompilerServices
{
internal static unsafe class CastHelpers
@@ -46,13 +39,13 @@ private struct CastCacheEntry
};
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static int KeyToBucket(int[] table, nuint source, nuint target)
+ private static int KeyToBucket(ref int tableData, nuint source, nuint target)
{
// upper bits of addresses do not vary much, so to reduce loss due to cancelling out,
// we do `rotl(source, ) ^ target` for mixing inputs.
// then we use fibonacci hashing to reduce the value to desired size.
- int hashShift = HashShift(table);
+ int hashShift = HashShift(ref tableData);
#if TARGET_64BIT
ulong hash = (((ulong)source << 32) | ((ulong)source >> 32)) ^ (ulong)target;
return (int)((hash * 11400714819323198485ul) >> hashShift);
@@ -63,31 +56,31 @@ private static int KeyToBucket(int[] table, nuint source, nuint target)
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static ref int AuxData(int[] table)
+ private static ref int TableData(int[] table)
{
// element 0 is used for embedded aux data
return ref MemoryMarshal.GetArrayDataReference(table);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static ref CastCacheEntry Element(int[] table, int index)
+ private static ref CastCacheEntry Element(ref int tableData, int index)
{
// element 0 is used for embedded aux data, skip it
- return ref Unsafe.Add(ref Unsafe.As(ref AuxData(table)), index + 1);
+ return ref Unsafe.Add(ref Unsafe.As(ref tableData), index + 1);
}
- // TableMask is "size - 1"
- // we need that more often that we need size
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static int TableMask(int[] table)
+ private static int HashShift(ref int tableData)
{
- return AuxData(table);
+ return tableData;
}
+ // TableMask is "size - 1"
+ // we need that more often that we need size
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static int HashShift(int[] table)
+ private static int TableMask(ref int tableData)
{
- return Unsafe.Add(ref AuxData(table), 1);
+ return Unsafe.Add(ref tableData, 1);
}
private enum CastResult
@@ -104,57 +97,60 @@ private enum CastResult
private static CastResult TryGet(nuint source, nuint target)
{
const int BUCKET_SIZE = 8;
- int[]? table = s_table;
- // we use NULL as a sentinel for a rare case when a table could not be allocated
- // because we avoid OOMs.
- // we could use 0-element table instead, but then we would have to check the size here.
- if (table != null)
+ // table is initialized and updated by native code that guarantees it is not null.
+ ref int tableData = ref TableData(s_table!);
+
+ int index = KeyToBucket(ref tableData, source, target);
+ for (int i = 0; i < BUCKET_SIZE;)
{
- int index = KeyToBucket(table, source, target);
- for (int i = 0; i < BUCKET_SIZE;)
- {
- ref CastCacheEntry pEntry = ref Element(table, index);
+ ref CastCacheEntry pEntry = ref Element(ref tableData, index);
- // must read in this order: version -> entry parts -> version
- // if version is odd or changes, the entry is inconsistent and thus ignored
- int version = Volatile.Read(ref pEntry._version);
- nuint entrySource = pEntry._source;
+ // must read in this order: version -> [entry parts] -> version
+ // if version is odd or changes, the entry is inconsistent and thus ignored
+ int version = Volatile.Read(ref pEntry._version);
+ nuint entrySource = pEntry._source;
- // mask the lower version bit to make it even.
- // This way we can check if version is odd or changing in just one compare.
- version &= ~1;
+ // mask the lower version bit to make it even.
+ // This way we can check if version is odd or changing in just one compare.
+ version &= ~1;
- if (entrySource == source)
+ if (entrySource == source)
+ {
+ nuint entryTargetAndResult = pEntry._targetAndResult;
+ // target never has its lower bit set.
+ // a matching entryTargetAndResult would the have same bits, except for the lowest one, which is the result.
+ entryTargetAndResult ^= target;
+ if (entryTargetAndResult <= 1)
{
- nuint entryTargetAndResult = Volatile.Read(ref pEntry._targetAndResult);
- // target never has its lower bit set.
- // a matching entryTargetAndResult would the have same bits, except for the lowest one, which is the result.
- entryTargetAndResult ^= target;
- if (entryTargetAndResult <= 1)
+ // make sure 'version' is loaded after 'source' and 'targetAndResults'
+ //
+ // We can either:
+ // - use acquires for both _source and _targetAndResults or
+ // - issue a load barrier before reading _version
+ // benchmarks on available hardware show that use of a read barrier is cheaper.
+ Interlocked.ReadMemoryBarrier();
+ if (version != pEntry._version)
{
- if (version != pEntry._version)
- {
- // oh, so close, the entry is in inconsistent state.
- // it is either changing or has changed while we were reading.
- // treat it as a miss.
- break;
- }
-
- return (CastResult)entryTargetAndResult;
+ // oh, so close, the entry is in inconsistent state.
+ // it is either changing or has changed while we were reading.
+ // treat it as a miss.
+ break;
}
- }
- if (version == 0)
- {
- // the rest of the bucket is unclaimed, no point to search further
- break;
+ return (CastResult)entryTargetAndResult;
}
+ }
- // quadratic reprobe
- i++;
- index = (index + i) & TableMask(table);
+ if (version == 0)
+ {
+ // the rest of the bucket is unclaimed, no point to search further
+ break;
}
+
+ // quadratic reprobe
+ i++;
+ index = (index + i) & TableMask(ref tableData);
}
return CastResult.MaybeCast;
}
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/CrossLoaderAllocatorHashHelpers.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/CrossLoaderAllocatorHashHelpers.cs
index 9f45efa3df1c55..89d0773075d8a8 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/CrossLoaderAllocatorHashHelpers.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/CrossLoaderAllocatorHashHelpers.cs
@@ -30,7 +30,7 @@ internal class LAHashDependentHashTracker
[StructLayout(LayoutKind.Sequential)]
internal class LAHashKeyToTrackers
{
- private object _trackerOrTrackerSet = null!;
- private object _laLocalKeyValueStore = null!;
+ private object? _trackerOrTrackerSet;
+ private object? _laLocalKeyValueStore;
}
}
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/GCHeapHash.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/GCHeapHash.cs
index 763ab98ceb3ca3..396967048ff0be 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/GCHeapHash.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/GCHeapHash.cs
@@ -13,7 +13,7 @@ namespace System.Runtime.CompilerServices
[StructLayout(LayoutKind.Sequential)]
internal class GCHeapHash
{
- private Array _data = null!;
+ private Array? _data;
private int _count;
private int _deletedCount;
}
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/QCallHandles.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/QCallHandles.cs
index 63a8fbf6e9c335..6a3418ade5938e 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/QCallHandles.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/QCallHandles.cs
@@ -15,7 +15,7 @@ internal unsafe ref struct StringHandleOnStack
{
private void* _ptr;
- internal StringHandleOnStack([NotNull] ref string? s)
+ internal StringHandleOnStack(ref string? s)
{
_ptr = Unsafe.AsPointer(ref s);
}
@@ -31,7 +31,7 @@ private ObjectHandleOnStack(void* pObject)
_ptr = pObject;
}
- internal static ObjectHandleOnStack Create([NotNull] ref T o) where T : class?
+ internal static ObjectHandleOnStack Create(ref T o) where T : class?
{
return new ObjectHandleOnStack(Unsafe.AsPointer(ref o));
}
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs
index 705e611d7e1645..55d7ee78afc3a0 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs
@@ -7,13 +7,6 @@
using System.Runtime.InteropServices;
using Internal.Runtime.CompilerServices;
-#pragma warning disable SA1121 // explicitly using type aliases instead of built-in types
-#if TARGET_64BIT
-using nuint = System.UInt64;
-#else
-using nuint = System.UInt32;
-#endif
-
namespace System.Runtime.CompilerServices
{
public static partial class RuntimeHelpers
@@ -286,8 +279,22 @@ public static IntPtr AllocateTypeAssociatedMemory(Type type, int size)
[DllImport(RuntimeHelpers.QCall)]
private static extern IntPtr AllocateTypeAssociatedMemoryInternal(QCallTypeHandle type, uint size);
- }
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private static extern IntPtr AllocTailCallArgBuffer(int size, IntPtr gcDesc);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private static extern void FreeTailCallArgBuffer();
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private static unsafe extern TailCallTls* GetTailCallInfo(IntPtr retAddrSlot, IntPtr* retAddr);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal static extern long GetILBytesJitted();
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal static extern int GetMethodsJittedCount();
+ }
// Helper class to assist with unsafe pinning of arbitrary objects.
// It's used by VM code.
internal class RawData
@@ -340,31 +347,31 @@ internal unsafe struct MethodTable
| 0x40000000 // enum_flag_ComObject
| 0x00400000;// enum_flag_ICastable;
- private const int ParentMethodTableOffset = 0x10
+ private const int DebugClassNamePtr = // adjust for debug_m_szClassName
#if DEBUG
- + sizeof(nuint) // adjust for debug_m_szClassName
-#endif
- ;
-
#if TARGET_64BIT
- private const int ElementTypeOffset = 0x30
+ 8
#else
- private const int ElementTypeOffset = 0x20
+ 4
#endif
-#if DEBUG
- + sizeof(nuint) // adjust for debug_m_szClassName
+#else
+ 0
#endif
- ;
+ ;
+
+ private const int ParentMethodTableOffset = 0x10 + DebugClassNamePtr;
#if TARGET_64BIT
- private const int InterfaceMapOffset = 0x38
+ private const int ElementTypeOffset = 0x30 + DebugClassNamePtr;
#else
- private const int InterfaceMapOffset = 0x24
+ private const int ElementTypeOffset = 0x20 + DebugClassNamePtr;
#endif
-#if DEBUG
- + sizeof(nuint) // adjust for debug_m_szClassName
+
+#if TARGET_64BIT
+ private const int InterfaceMapOffset = 0x38 + DebugClassNamePtr;
+#else
+ private const int InterfaceMapOffset = 0x24 + DebugClassNamePtr;
#endif
- ;
public bool HasComponentSize
{
@@ -421,4 +428,24 @@ public int MultiDimensionalArrayRank
}
}
}
+
+ // Helper structs used for tail calls via helper.
+ [StructLayout(LayoutKind.Sequential)]
+ internal unsafe struct PortableTailCallFrame
+ {
+ public PortableTailCallFrame* Prev;
+ public IntPtr TailCallAwareReturnAddress;
+ public IntPtr NextCall;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal unsafe struct TailCallTls
+ {
+ public PortableTailCallFrame* Frame;
+ public IntPtr ArgBuffer;
+ private IntPtr _argBufferSize;
+ private IntPtr _argBufferGCDesc;
+ private fixed byte _argBufferInline[64];
+ }
+
}
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.cs
index 0229ac9c0dbc55..6bdd48d7290a90 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.cs
@@ -56,6 +56,16 @@ public enum CreateObjectFlags
UniqueInstance = 2,
}
+ ///
+ /// Internal enumeration used by the runtime to indicate the scenario for which ComWrappers is being used.
+ ///
+ internal enum ComWrappersScenario
+ {
+ Instance = 0,
+ TrackerSupportGlobalInstance = 1,
+ MarshallingGlobalInstance = 2,
+ }
+
///
/// Class for managing wrappers of COM IUnknown types.
///
@@ -107,9 +117,14 @@ private struct ComInterfaceInstance
}
///
- /// Globally registered instance of the ComWrappers class.
+ /// Globally registered instance of the ComWrappers class for reference tracker support.
///
- private static ComWrappers? s_globalInstance;
+ private static ComWrappers? s_globalInstanceForTrackerSupport;
+
+ ///
+ /// Globally registered instance of the ComWrappers class for marshalling.
+ ///
+ private static ComWrappers? s_globalInstanceForMarshalling;
///
/// Create a COM representation of the supplied object that can be passed to a non-managed environment.
@@ -121,7 +136,7 @@ public IntPtr GetOrCreateComInterfaceForObject(object instance, CreateComInterfa
{
IntPtr ptr;
if (!TryGetOrCreateComInterfaceForObjectInternal(this, instance, flags, out ptr))
- throw new ArgumentException();
+ throw new ArgumentException(null, nameof(instance));
return ptr;
}
@@ -164,10 +179,23 @@ private static bool TryGetOrCreateComInterfaceForObjectInternal(ComWrappers? imp
///
protected unsafe abstract ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count);
- // Call to execute the abstract instance function
- internal static unsafe void* CallComputeVtables(ComWrappers? comWrappersImpl, object obj, CreateComInterfaceFlags flags, out int count)
+ // Called by the runtime to execute the abstract instance function
+ internal static unsafe void* CallComputeVtables(ComWrappersScenario scenario, ComWrappers? comWrappersImpl, object obj, CreateComInterfaceFlags flags, out int count)
{
- ComWrappers? impl = comWrappersImpl ?? s_globalInstance;
+ ComWrappers? impl = null;
+ switch (scenario)
+ {
+ case ComWrappersScenario.Instance:
+ impl = comWrappersImpl;
+ break;
+ case ComWrappersScenario.TrackerSupportGlobalInstance:
+ impl = s_globalInstanceForTrackerSupport;
+ break;
+ case ComWrappersScenario.MarshallingGlobalInstance:
+ impl = s_globalInstanceForMarshalling;
+ break;
+ }
+
if (impl is null)
{
count = -1;
@@ -187,7 +215,7 @@ public object GetOrCreateObjectForComInstance(IntPtr externalComObject, CreateOb
{
object? obj;
if (!TryGetOrCreateObjectForComInstanceInternal(this, externalComObject, flags, null, out obj))
- throw new ArgumentNullException();
+ throw new ArgumentNullException(nameof(externalComObject));
return obj!;
}
@@ -203,10 +231,23 @@ public object GetOrCreateObjectForComInstance(IntPtr externalComObject, CreateOb
///
protected abstract object? CreateObject(IntPtr externalComObject, CreateObjectFlags flags);
- // Call to execute the abstract instance function
- internal static object? CallCreateObject(ComWrappers? comWrappersImpl, IntPtr externalComObject, CreateObjectFlags flags)
+ // Called by the runtime to execute the abstract instance function.
+ internal static object? CallCreateObject(ComWrappersScenario scenario, ComWrappers? comWrappersImpl, IntPtr externalComObject, CreateObjectFlags flags)
{
- ComWrappers? impl = comWrappersImpl ?? s_globalInstance;
+ ComWrappers? impl = null;
+ switch (scenario)
+ {
+ case ComWrappersScenario.Instance:
+ impl = comWrappersImpl;
+ break;
+ case ComWrappersScenario.TrackerSupportGlobalInstance:
+ impl = s_globalInstanceForTrackerSupport;
+ break;
+ case ComWrappersScenario.MarshallingGlobalInstance:
+ impl = s_globalInstanceForMarshalling;
+ break;
+ }
+
if (impl == null)
return null;
@@ -230,7 +271,7 @@ public object GetOrRegisterObjectForComInstance(IntPtr externalComObject, Create
object? obj;
if (!TryGetOrCreateObjectForComInstanceInternal(this, externalComObject, flags, wrapper, out obj))
- throw new ArgumentNullException();
+ throw new ArgumentNullException(nameof(externalComObject));
return obj!;
}
@@ -268,32 +309,69 @@ private static bool TryGetOrCreateObjectForComInstanceInternal(ComWrappers? impl
// Call to execute the virtual instance function
internal static void CallReleaseObjects(ComWrappers? comWrappersImpl, IEnumerable objects)
- => (comWrappersImpl ?? s_globalInstance!).ReleaseObjects(objects);
+ => (comWrappersImpl ?? s_globalInstanceForTrackerSupport!).ReleaseObjects(objects);
///
- /// Register this class's implementation to be used as the single global instance.
+ /// Register a instance to be used as the global instance for reference tracker support.
///
+ /// Instance to register
///
/// This function can only be called a single time. Subsequent calls to this function will result
/// in a being thrown.
///
- /// Scenarios where the global instance may be used are:
+ /// Scenarios where this global instance may be used are:
/// * Object tracking via the and flags.
- /// * Usage of COM related Marshal APIs.
///
- public void RegisterAsGlobalInstance()
+ public static void RegisterForTrackerSupport(ComWrappers instance)
+ {
+ if (instance == null)
+ throw new ArgumentNullException(nameof(instance));
+
+ if (null != Interlocked.CompareExchange(ref s_globalInstanceForTrackerSupport, instance, null))
+ {
+ throw new InvalidOperationException(SR.InvalidOperation_ResetGlobalComWrappersInstance);
+ }
+
+ SetGlobalInstanceRegisteredForTrackerSupport();
+ }
+
+
+ [DllImport(RuntimeHelpers.QCall)]
+ [SuppressGCTransition]
+ private static extern void SetGlobalInstanceRegisteredForTrackerSupport();
+
+ ///
+ /// Register a instance to be used as the global instance for marshalling in the runtime.
+ ///
+ /// Instance to register
+ ///
+ /// This function can only be called a single time. Subsequent calls to this function will result
+ /// in a being thrown.
+ ///
+ /// Scenarios where this global instance may be used are:
+ /// * Usage of COM-related Marshal APIs
+ /// * P/Invokes with COM-related types
+ /// * COM activation
+ ///
+ public static void RegisterForMarshalling(ComWrappers instance)
{
- if (null != Interlocked.CompareExchange(ref s_globalInstance, this, null))
+ if (instance == null)
+ throw new ArgumentNullException(nameof(instance));
+
+ if (null != Interlocked.CompareExchange(ref s_globalInstanceForMarshalling, instance, null))
{
throw new InvalidOperationException(SR.InvalidOperation_ResetGlobalComWrappersInstance);
}
- SetGlobalInstanceRegistered();
+ // Indicate to the runtime that a global instance has been registered for marshalling.
+ // This allows the native runtime know to call into the managed ComWrappers only if a
+ // global instance is registered for marshalling.
+ SetGlobalInstanceRegisteredForMarshalling();
}
[DllImport(RuntimeHelpers.QCall)]
[SuppressGCTransition]
- private static extern void SetGlobalInstanceRegistered();
+ private static extern void SetGlobalInstanceRegisteredForMarshalling();
///
/// Get the runtime provided IUnknown implementation.
@@ -319,4 +397,4 @@ internal static int CallICustomQueryInterface(object customQueryInterfaceMaybe,
return (int)customQueryInterface.GetInterface(ref iid, out ppObject);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs
index f19d63e4034492..d7cd618a076104 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs
@@ -78,9 +78,7 @@ private KeyValuePair[] CreateKeyValueArray(int count, IEnumerator<
public TValue Lookup(TKey key)
{
- bool found = TryGetValue(key, out TValue value);
-
- if (!found)
+ if (!TryGetValue(key, out TValue value))
{
Debug.Assert(key != null);
Exception e = new KeyNotFoundException(SR.Format(SR.Arg_KeyNotFoundWithKey, key.ToString()));
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs
index d24a0c9201d93c..bdacad0d07f3ba 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs
@@ -28,9 +28,7 @@ private DictionaryToMapAdapter()
internal V Lookup(K key) where K : notnull
{
IDictionary _this = Unsafe.As>(this);
- bool keyFound = _this.TryGetValue(key, out V value);
-
- if (!keyFound)
+ if (!_this.TryGetValue(key, out V value))
{
Debug.Assert(key != null);
Exception e = new KeyNotFoundException(SR.Format(SR.Arg_KeyNotFoundWithKey, key.ToString()));
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs
index 5ba246996dccb5..81c3a453b17a80 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs
@@ -28,9 +28,7 @@ private IReadOnlyDictionaryToIMapViewAdapter()
internal V Lookup(K key) where K : notnull
{
IReadOnlyDictionary _this = Unsafe.As>(this);
- bool keyFound = _this.TryGetValue(key, out V value);
-
- if (!keyFound)
+ if (!_this.TryGetValue(key, out V value))
{
Debug.Assert(key != null);
Exception e = new KeyNotFoundException(SR.Format(SR.Arg_KeyNotFoundWithKey, key.ToString()));
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.CoreCLR.cs
index 9027e3bd3598a9..997fa49107dcee 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.CoreCLR.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.CoreCLR.cs
@@ -95,6 +95,16 @@ internal Assembly LoadFromInMemoryModule(IntPtr moduleHandle)
}
#endif
+ // This method is invoked by the VM to resolve a satellite assembly reference
+ // after trying assembly resolution via Load override without success.
+ private static Assembly? ResolveSatelliteAssembly(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
+ {
+ AssemblyLoadContext context = (AssemblyLoadContext)(GCHandle.FromIntPtr(gchManagedAssemblyLoadContext).Target)!;
+
+ // Invoke the ResolveSatelliteAssembly method
+ return context.ResolveSatelliteAssembly(assemblyName);
+ }
+
// This method is invoked by the VM when using the host-provided assembly load context
// implementation.
private static IntPtr ResolveUnmanagedDll(string unmanagedDllName, IntPtr gchManagedAssemblyLoadContext)
@@ -111,6 +121,15 @@ private static IntPtr ResolveUnmanagedDllUsingEvent(string unmanagedDllName, Ass
return context.GetResolvedUnmanagedDll(assembly, unmanagedDllName);
}
+ // This method is invoked by the VM to resolve an assembly reference using the Resolving event
+ // after trying assembly resolution via Load override and TPA load context without success.
+ private static Assembly? ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
+ {
+ AssemblyLoadContext context = (AssemblyLoadContext)(GCHandle.FromIntPtr(gchManagedAssemblyLoadContext).Target)!;
+ // Invoke the AssemblyResolve event callbacks if wired up
+ return context.ResolveUsingEvent(assemblyName);
+ }
+
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
private static extern void LoadTypeForWinRTTypeNameInContextInternal(IntPtr ptrNativeAssemblyLoadContext, string typeName, ObjectHandleOnStack loadedType);
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/RuntimeHandles.cs b/src/coreclr/src/System.Private.CoreLib/src/System/RuntimeHandles.cs
index 5661ce8130ec5d..c95afb2036300c 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/RuntimeHandles.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/RuntimeHandles.cs
@@ -446,10 +446,10 @@ internal static RuntimeType GetTypeByNameUsingCARules(string name, RuntimeModule
if (string.IsNullOrEmpty(name))
throw new ArgumentException(null, nameof(name));
- RuntimeType type = null!;
+ RuntimeType? type = null;
GetTypeByNameUsingCARules(name, new QCallModule(ref scope), ObjectHandleOnStack.Create(ref type));
- return type;
+ return type!;
}
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
@@ -457,18 +457,18 @@ internal static RuntimeType GetTypeByNameUsingCARules(string name, RuntimeModule
internal RuntimeType[] GetInstantiationInternal()
{
- RuntimeType[] types = null!;
+ RuntimeType[]? types = null;
RuntimeTypeHandle nativeHandle = GetNativeHandle();
GetInstantiation(new QCallTypeHandle(ref nativeHandle), ObjectHandleOnStack.Create(ref types), Interop.BOOL.TRUE);
- return types;
+ return types!;
}
internal Type[] GetInstantiationPublic()
{
- Type[] types = null!;
+ Type[]? types = null;
RuntimeTypeHandle nativeHandle = GetNativeHandle();
GetInstantiation(new QCallTypeHandle(ref nativeHandle), ObjectHandleOnStack.Create(ref types), Interop.BOOL.FALSE);
- return types;
+ return types!;
}
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
@@ -481,11 +481,11 @@ internal RuntimeType Instantiate(Type[]? inst)
fixed (IntPtr* pInst = instHandles)
{
- RuntimeType type = null!;
+ RuntimeType? type = null;
RuntimeTypeHandle nativeHandle = GetNativeHandle();
Instantiate(new QCallTypeHandle(ref nativeHandle), pInst, instCount, ObjectHandleOnStack.Create(ref type));
GC.KeepAlive(inst);
- return type;
+ return type!;
}
}
@@ -494,10 +494,10 @@ internal RuntimeType Instantiate(Type[]? inst)
internal RuntimeType MakeArray(int rank)
{
- RuntimeType type = null!;
+ RuntimeType? type = null;
RuntimeTypeHandle nativeHandle = GetNativeHandle();
MakeArray(new QCallTypeHandle(ref nativeHandle), rank, ObjectHandleOnStack.Create(ref type));
- return type;
+ return type!;
}
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
@@ -505,10 +505,10 @@ internal RuntimeType MakeArray(int rank)
internal RuntimeType MakeSZArray()
{
- RuntimeType type = null!;
+ RuntimeType? type = null;
RuntimeTypeHandle nativeHandle = GetNativeHandle();
MakeSZArray(new QCallTypeHandle(ref nativeHandle), ObjectHandleOnStack.Create(ref type));
- return type;
+ return type!;
}
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
@@ -516,10 +516,10 @@ internal RuntimeType MakeSZArray()
internal RuntimeType MakeByRef()
{
- RuntimeType type = null!;
+ RuntimeType? type = null;
RuntimeTypeHandle nativeHandle = GetNativeHandle();
MakeByRef(new QCallTypeHandle(ref nativeHandle), ObjectHandleOnStack.Create(ref type));
- return type;
+ return type!;
}
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
@@ -527,10 +527,10 @@ internal RuntimeType MakeByRef()
internal RuntimeType MakePointer()
{
- RuntimeType type = null!;
+ RuntimeType? type = null;
RuntimeTypeHandle nativeHandle = GetNativeHandle();
MakePointer(new QCallTypeHandle(ref nativeHandle), ObjectHandleOnStack.Create(ref type));
- return type;
+ return type!;
}
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
@@ -665,15 +665,15 @@ public RuntimeMethodInfoStub(IntPtr methodHandleValue, object keepalive)
private readonly object m_keepalive;
// These unused variables are used to ensure that this class has the same layout as RuntimeMethodInfo
-#pragma warning disable CA1823, 414
- private object m_a = null!;
- private object m_b = null!;
- private object m_c = null!;
- private object m_d = null!;
- private object m_e = null!;
- private object m_f = null!;
- private object m_g = null!;
-#pragma warning restore CA1823, 414
+#pragma warning disable CA1823, 414, 169
+ private object? m_a;
+ private object? m_b;
+ private object? m_c;
+ private object? m_d;
+ private object? m_e;
+ private object? m_f;
+ private object? m_g;
+#pragma warning restore CA1823, 414, 169
public RuntimeMethodHandleInternal m_value;
@@ -861,25 +861,25 @@ internal static MdUtf8String GetUtf8Name(RuntimeMethodHandleInternal method)
internal static RuntimeType[] GetMethodInstantiationInternal(IRuntimeMethodInfo method)
{
- RuntimeType[] types = null!;
+ RuntimeType[]? types = null;
GetMethodInstantiation(EnsureNonNullMethodInfo(method).Value, ObjectHandleOnStack.Create(ref types), Interop.BOOL.TRUE);
GC.KeepAlive(method);
- return types;
+ return types!;
}
internal static RuntimeType[] GetMethodInstantiationInternal(RuntimeMethodHandleInternal method)
{
- RuntimeType[] types = null!;
+ RuntimeType[]? types = null;
GetMethodInstantiation(method, ObjectHandleOnStack.Create(ref types), Interop.BOOL.TRUE);
- return types;
+ return types!;
}
internal static Type[] GetMethodInstantiationPublic(IRuntimeMethodInfo method)
{
- RuntimeType[] types = null!;
+ RuntimeType[]? types = null;
GetMethodInstantiation(EnsureNonNullMethodInfo(method).Value, ObjectHandleOnStack.Create(ref types), Interop.BOOL.FALSE);
GC.KeepAlive(method);
- return types;
+ return types!;
}
[MethodImpl(MethodImplOptions.InternalCall)]
@@ -1000,14 +1000,14 @@ RuntimeFieldHandleInternal Value
internal class RuntimeFieldInfoStub : IRuntimeFieldInfo
{
// These unused variables are used to ensure that this class has the same layout as RuntimeFieldInfo
-#pragma warning disable 414
- private object m_keepalive = null!;
- private object m_c = null!;
- private object m_d = null!;
+#pragma warning disable 414, 169
+ private object? m_keepalive;
+ private object? m_c;
+ private object? m_d;
private int m_b;
- private object m_e = null!;
+ private object? m_e;
private RuntimeFieldHandleInternal m_fieldHandle;
-#pragma warning restore 414
+#pragma warning restore 414, 169
RuntimeFieldHandleInternal IRuntimeFieldInfo.Value => m_fieldHandle;
}
@@ -1209,11 +1209,11 @@ internal static RuntimeType ResolveTypeHandleInternal(RuntimeModule module, int
fixed (IntPtr* typeInstArgs = typeInstantiationContextHandles, methodInstArgs = methodInstantiationContextHandles)
{
- RuntimeType type = null!;
+ RuntimeType? type = null;
ResolveType(new QCallModule(ref module), typeToken, typeInstArgs, typeInstCount, methodInstArgs, methodInstCount, ObjectHandleOnStack.Create(ref type));
GC.KeepAlive(typeInstantiationContext);
GC.KeepAlive(methodInstantiationContext);
- return type;
+ return type!;
}
}
@@ -1288,11 +1288,11 @@ internal static IRuntimeFieldInfo ResolveFieldHandleInternal(RuntimeModule modul
fixed (IntPtr* typeInstArgs = typeInstantiationContextHandles, methodInstArgs = methodInstantiationContextHandles)
{
- IRuntimeFieldInfo field = null!;
+ IRuntimeFieldInfo? field = null;
ResolveField(new QCallModule(ref module), fieldToken, typeInstArgs, typeInstCount, methodInstArgs, methodInstCount, ObjectHandleOnStack.Create(ref field));
GC.KeepAlive(typeInstantiationContext);
GC.KeepAlive(methodInstantiationContext);
- return field;
+ return field!;
}
}
@@ -1318,9 +1318,9 @@ internal static bool ContainsPropertyMatchingHash(RuntimeModule module, int prop
internal static RuntimeType GetModuleType(RuntimeModule module)
{
- RuntimeType type = null!;
+ RuntimeType? type = null;
GetModuleType(new QCallModule(ref module), ObjectHandleOnStack.Create(ref type));
- return type;
+ return type!;
}
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
@@ -1375,6 +1375,8 @@ internal enum MdSigCallingConvention : byte
#endregion
#region FCalls
+ [MemberNotNull(nameof(m_arguments))]
+ [MemberNotNull(nameof(m_returnTypeORfieldType))]
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void GetSignature(
void* pCorSig, int cCorSig,
@@ -1386,9 +1388,9 @@ private extern void GetSignature(
//
// Keep the layout in sync with SignatureNative in the VM
//
- internal RuntimeType[] m_arguments = null!;
- internal RuntimeType m_declaringType = null!; // seems not used
- internal RuntimeType m_returnTypeORfieldType = null!;
+ internal RuntimeType[] m_arguments;
+ internal RuntimeType? m_declaringType;
+ internal RuntimeType m_returnTypeORfieldType;
internal object? m_keepalive;
internal void* m_sig;
internal int m_managedCallingConventionAndArgIteratorFlags; // lowest byte is CallingConvention, upper 3 bytes are ArgIterator flags
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
index 93cfd86bc167b1..38511276255bed 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
@@ -244,14 +244,17 @@ internal MethodBase AddMethod(RuntimeType declaringType, RuntimeMethodHandleInte
switch (cacheType)
{
case CacheType.Method:
- list = (T[])(object)new RuntimeMethodInfo[1] {
- new RuntimeMethodInfo(method, declaringType, m_runtimeTypeCache, methodAttributes, bindingFlags, null)
- };
+ list = (T[])(object)new RuntimeMethodInfo[1]
+ {
+ new RuntimeMethodInfo(method, declaringType, m_runtimeTypeCache, methodAttributes, bindingFlags, null)
+ };
break;
+
case CacheType.Constructor:
- list = (T[])(object)new RuntimeConstructorInfo[1] {
- new RuntimeConstructorInfo(method, declaringType, m_runtimeTypeCache, methodAttributes, bindingFlags)
- };
+ list = (T[])(object)new RuntimeConstructorInfo[1]
+ {
+ new RuntimeConstructorInfo(method, declaringType, m_runtimeTypeCache, methodAttributes, bindingFlags)
+ };
break;
}
@@ -2752,7 +2755,7 @@ public override InterfaceMapping GetInterfaceMap(Type ifaceType)
protected override PropertyInfo? GetPropertyImpl(
string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
{
- if (name == null) throw new ArgumentNullException();
+ if (name == null) throw new ArgumentNullException(nameof(name));
ListBuilder candidates = GetPropertyCandidates(name, bindingAttr, types, false);
@@ -2788,7 +2791,7 @@ public override InterfaceMapping GetInterfaceMap(Type ifaceType)
public override EventInfo? GetEvent(string name, BindingFlags bindingAttr)
{
- if (name is null) throw new ArgumentNullException();
+ if (name is null) throw new ArgumentNullException(nameof(name));
FilterHelper(bindingAttr, ref name, out _, out MemberListType listType);
@@ -2851,7 +2854,7 @@ public override InterfaceMapping GetInterfaceMap(Type ifaceType)
public override Type? GetInterface(string fullname, bool ignoreCase)
{
- if (fullname is null) throw new ArgumentNullException();
+ if (fullname is null) throw new ArgumentNullException(nameof(fullname));
BindingFlags bindingAttr = BindingFlags.Public | BindingFlags.NonPublic;
@@ -2885,7 +2888,7 @@ public override InterfaceMapping GetInterfaceMap(Type ifaceType)
public override Type? GetNestedType(string fullname, BindingFlags bindingAttr)
{
- if (fullname is null) throw new ArgumentNullException();
+ if (fullname is null) throw new ArgumentNullException(nameof(fullname));
bindingAttr &= ~BindingFlags.Static;
string name, ns;
@@ -2913,7 +2916,7 @@ public override InterfaceMapping GetInterfaceMap(Type ifaceType)
public override MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr)
{
- if (name is null) throw new ArgumentNullException();
+ if (name is null) throw new ArgumentNullException(nameof(name));
ListBuilder methods = default;
ListBuilder constructors = default;
@@ -4062,7 +4065,7 @@ internal static Type GetTypeFromCLSIDImpl(Guid clsid, string? server, bool throw
// Handle arguments that are passed as ByRef and those
// arguments that need to be wrapped.
- ParameterModifier[] aParamMod = null!;
+ ParameterModifier[]? aParamMod = null;
if (cArgs > 0)
{
ParameterModifier paramMod = new ParameterModifier(cArgs);
@@ -4087,7 +4090,7 @@ internal static Type GetTypeFromCLSIDImpl(Guid clsid, string? server, bool throw
for (int i = 0; i < cArgs; i++)
{
// Determine if the parameter is ByRef.
- if (aParamMod[0][i] && aArgs[i] != null)
+ if (aParamMod![0][i] && aArgs[i] != null)
{
Type argType = aArgsTypes[i];
if (!ReferenceEquals(argType, aArgs[i].GetType()))
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs b/src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs
index 81c1611be4f56a..51d0138d905d61 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs
@@ -1878,5 +1878,8 @@ internal static void CheckStringLength(uint length)
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void MulticastDebuggerTraceHelper(object o, int count);
#endif
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern IntPtr NextCallReturnAddress();
} // class StubHelpers
}
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Threading/Interlocked.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Threading/Interlocked.CoreCLR.cs
index 33437141e76121..c9153f3cda7539 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Threading/Interlocked.CoreCLR.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Threading/Interlocked.CoreCLR.cs
@@ -232,6 +232,15 @@ public static long Read(ref long location) =>
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void MemoryBarrier();
+ ///
+ /// Synchronizes memory access as follows:
+ /// The processor that executes the current thread cannot reorder instructions in such a way that memory reads before
+ /// the call to execute after memory accesses that follow the call to .
+ ///
+ [Intrinsic]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal static extern void ReadMemoryBarrier();
+
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
private static extern void _MemoryBarrierProcessWide();
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Threading/ThreadPool.CoreCLR.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Threading/ThreadPool.CoreCLR.cs
index c2d72e3915cae7..719576c06d0338 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/Threading/ThreadPool.CoreCLR.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/Threading/ThreadPool.CoreCLR.cs
@@ -192,6 +192,13 @@ public static partial class ThreadPool
// Time in ms for which ThreadPoolWorkQueue.Dispatch keeps executing work items before returning to the OS
private const uint DispatchQuantum = 30;
+ private static bool GetEnableWorkerTracking()
+ {
+ bool enableWorkerTracking = false;
+ InitializeVMTp(ref enableWorkerTracking);
+ return enableWorkerTracking;
+ }
+
internal static bool KeepDispatching(int startTickCount)
{
// Note: this function may incorrectly return false due to TickCount overflow
@@ -260,7 +267,7 @@ private static extern long PendingUnmanagedWorkItemCount
get;
}
- private static RegisteredWaitHandle RegisterWaitForSingleObject( // throws RegisterWaitException
+ private static RegisteredWaitHandle RegisterWaitForSingleObject(
WaitHandle waitObject,
WaitOrTimerCallback callBack,
object? state,
@@ -302,25 +309,6 @@ bool compressStack
public static unsafe bool UnsafeQueueNativeOverlapped(NativeOverlapped* overlapped) =>
PostQueuedCompletionStatus(overlapped);
- // The thread pool maintains a per-appdomain managed work queue.
- // New thread pool entries are added in the managed queue.
- // The VM is responsible for the actual growing/shrinking of
- // threads.
- private static void EnsureInitialized()
- {
- if (!ThreadPoolGlobals.threadPoolInitialized)
- {
- EnsureVMInitializedCore(); // separate out to help with inlining
- }
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
- private static void EnsureVMInitializedCore()
- {
- InitializeVMTp(ref ThreadPoolGlobals.enableWorkerTracking);
- ThreadPoolGlobals.threadPoolInitialized = true;
- }
-
// Native methods:
[MethodImpl(MethodImplOptions.InternalCall)]
@@ -346,7 +334,6 @@ private static void EnsureVMInitializedCore()
internal static void NotifyWorkItemProgress()
{
- EnsureInitialized();
NotifyWorkItemProgressNative();
}
diff --git a/src/coreclr/src/ToolBox/SOS/DacTableGen/CMakeLists.txt b/src/coreclr/src/ToolBox/SOS/DacTableGen/CMakeLists.txt
index dcd39e346c98e4..e3fc3ed9e3a5e1 100644
--- a/src/coreclr/src/ToolBox/SOS/DacTableGen/CMakeLists.txt
+++ b/src/coreclr/src/ToolBox/SOS/DacTableGen/CMakeLists.txt
@@ -2,6 +2,19 @@
project(DacTableGen LANGUAGES CSharp)
+file(TO_CMAKE_PATH "$ENV{VSInstallDir}\\DIA SDK" DIASDK_DIR)
+file(COPY "${DIASDK_DIR}/bin/msdia140.dll" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
+
+set (DIALib "${CMAKE_CURRENT_BINARY_DIR}/DIALib.dll")
+FIND_PROGRAM(TLBIMP tlbimp.exe)
+FIND_PROGRAM(MIDL midl.exe)
+add_custom_command(
+ OUTPUT "${DIALib}"
+ COMMAND ${MIDL} /I "${DIASDK_DIR}/include" "${DIASDK_DIR}/idl/dia2.idl" /tlb "${CMAKE_CURRENT_BINARY_DIR}/dia2.tlb"
+ COMMAND ${TLBIMP} dia2.tlb /out:"${DIALib}"
+)
+add_custom_target(gen_dialib DEPENDS "${DIALib}")
+
set(DACTABLEGEN_SOURCES
cvconst.cs
diautil.cs
@@ -13,6 +26,7 @@ set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "")
set(CMAKE_CSharp_FLAGS "/platform:anycpu32bitpreferred")
add_executable(dactablegen ${DACTABLEGEN_SOURCES})
+add_dependencies(dactablegen gen_dialib)
set_target_properties(dactablegen PROPERTIES VS_DOTNET_REFERENCES "System")
-set_target_properties(dactablegen PROPERTIES VS_DOTNET_REFERENCE_DIALib ${CMAKE_CURRENT_SOURCE_DIR}/DIALib.dll)
+set_target_properties(dactablegen PROPERTIES VS_DOTNET_REFERENCE_DIALib "${DIALib}")
diff --git a/src/coreclr/src/ToolBox/SOS/DacTableGen/DIALib.dll b/src/coreclr/src/ToolBox/SOS/DacTableGen/DIALib.dll
deleted file mode 100644
index 06665740dc94db..00000000000000
Binary files a/src/coreclr/src/ToolBox/SOS/DacTableGen/DIALib.dll and /dev/null differ
diff --git a/src/coreclr/src/ToolBox/SOS/DacTableGen/diautil.cs b/src/coreclr/src/ToolBox/SOS/DacTableGen/diautil.cs
index e5c994329de00d..e9e53494cf7b2d 100644
--- a/src/coreclr/src/ToolBox/SOS/DacTableGen/diautil.cs
+++ b/src/coreclr/src/ToolBox/SOS/DacTableGen/diautil.cs
@@ -5,7 +5,7 @@
using System;
using System.Text;
using System.IO;
-using Dia;
+using DIALib;
using System.Runtime.InteropServices;
using System.Diagnostics;
diff --git a/src/coreclr/src/ToolBox/SOS/DacTableGen/main.cs b/src/coreclr/src/ToolBox/SOS/DacTableGen/main.cs
index 0ed7f451d5def4..ab25537d75353a 100644
--- a/src/coreclr/src/ToolBox/SOS/DacTableGen/main.cs
+++ b/src/coreclr/src/ToolBox/SOS/DacTableGen/main.cs
@@ -8,7 +8,7 @@
using System.Collections.Generic;
#if !TARGET_UNIX
-using Dia;
+using DIALib;
using Dia.Util;
#endif // !TARGET_UNIX
using System.Globalization;
diff --git a/src/coreclr/src/ToolBox/superpmi/mcs/verbildump.cpp b/src/coreclr/src/ToolBox/superpmi/mcs/verbildump.cpp
index 8b552af3bdf73a..5a41401cc53d79 100644
--- a/src/coreclr/src/ToolBox/superpmi/mcs/verbildump.cpp
+++ b/src/coreclr/src/ToolBox/superpmi/mcs/verbildump.cpp
@@ -915,12 +915,9 @@ char* DumpAttributeToConsoleBare(DWORD attribute)
if (0)
;
- ifPrint(CORINFO_FLG_STATIC, s_static) ifPrint(CORINFO_FLG_DONT_INLINE, s_dontInline)
- ifPrint(CORINFO_FLG_CONSTRUCTOR, s_constructor) else
- {
- LogError("unknown attribute %x", attribute);
- __debugbreak();
- }
+ ifPrint(CORINFO_FLG_STATIC, s_static)
+ ifPrint(CORINFO_FLG_DONT_INLINE, s_dontInline)
+ ifPrint(CORINFO_FLG_CONSTRUCTOR, s_constructor)
return nullptr;
#undef ifPrint
diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h
index d57e7eae48d879..03c722caed8962 100644
--- a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h
+++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h
@@ -880,8 +880,11 @@ CORINFO_METHOD_HANDLE GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd,
void MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd);
-// return a thunk that will copy the arguments for the given signature.
-void* getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags);
+bool getTailCallHelpers(
+ CORINFO_RESOLVED_TOKEN* callToken,
+ CORINFO_SIG_INFO* sig,
+ CORINFO_GET_TAILCALL_HELPERS_FLAGS flags,
+ CORINFO_TAILCALL_HELPERS* pResult);
bool convertPInvokeCalliToCall(CORINFO_RESOLVED_TOKEN * pResolvedToken, bool fMustConvert);
diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/lwmlist.h b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/lwmlist.h
index c8aa01e3a6a03e..1922e7d0f5dfad 100644
--- a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/lwmlist.h
+++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/lwmlist.h
@@ -121,7 +121,7 @@ LWM(GetRelocTypeHint, DWORDLONG, DWORD)
LWM(GetSharedCCtorHelper, DWORDLONG, DWORD)
LWM(GetStringConfigValue, DWORD, DWORD)
LWM(GetSystemVAmd64PassStructInRegisterDescriptor, DWORDLONG, Agnostic_GetSystemVAmd64PassStructInRegisterDescriptor)
-LWM(GetTailCallCopyArgsThunk, Agnostic_GetTailCallCopyArgsThunk, DWORDLONG)
+LWM(GetTailCallHelpers, Agnostic_GetTailCallHelpers, Agnostic_CORINFO_TAILCALL_HELPERS)
LWM(GetThreadTLSIndex, DWORD, DLD)
LWM(GetTokenTypeAsHandle, GetTokenTypeAsHandleValue, DWORDLONG)
LWM(GetTypeForBox, DWORDLONG, DWORDLONG)
diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
index c2c4d8f5e78b83..77603de0a850c6 100644
--- a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
+++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
@@ -5940,44 +5940,76 @@ const WCHAR* MethodContext::repAppendClassName(CORINFO_CLASS_HANDLE cls,
return name;
}
-void MethodContext::recGetTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig,
- CorInfoHelperTailCallSpecialHandling flags,
- void* result)
+void MethodContext::recGetTailCallHelpers(
+ CORINFO_RESOLVED_TOKEN* callToken,
+ CORINFO_SIG_INFO* sig,
+ CORINFO_GET_TAILCALL_HELPERS_FLAGS flags,
+ CORINFO_TAILCALL_HELPERS* pResult)
{
- if (GetTailCallCopyArgsThunk == nullptr)
- GetTailCallCopyArgsThunk = new LightWeightMap();
+ if (GetTailCallHelpers == nullptr)
+ GetTailCallHelpers = new LightWeightMap();
- Agnostic_GetTailCallCopyArgsThunk key;
- ZeroMemory(&key, sizeof(Agnostic_GetTailCallCopyArgsThunk)); // We use the input structs as a key and use memcmp to
- // compare.. so we need to zero out padding too
- key.Sig = SpmiRecordsHelper::StoreAgnostic_CORINFO_SIG_INFO(*pSig, GetTailCallCopyArgsThunk);
+ Agnostic_GetTailCallHelpers key;
+ ZeroMemory(&key, sizeof(Agnostic_GetTailCallHelpers));
+
+ key.callToken = SpmiRecordsHelper::StoreAgnostic_CORINFO_RESOLVED_TOKEN(callToken, GetTailCallHelpers);
+ key.sig = SpmiRecordsHelper::StoreAgnostic_CORINFO_SIG_INFO(*sig, GetTailCallHelpers);
key.flags = (DWORD)flags;
- GetTailCallCopyArgsThunk->Add(key, (DWORDLONG)result);
- DEBUG_REC(dmpGetTailCallCopyArgsThunk(key, (DWORDLONG)result));
+ Agnostic_CORINFO_TAILCALL_HELPERS value;
+ ZeroMemory(&value, sizeof(Agnostic_CORINFO_TAILCALL_HELPERS));
+
+ value.result = pResult != nullptr;
+ if (pResult != nullptr)
+ {
+ value.flags = (DWORD)pResult->flags;
+ value.hStoreArgs = (DWORDLONG)pResult->hStoreArgs;
+ value.hCallTarget = (DWORDLONG)pResult->hCallTarget;
+ value.hDispatcher = (DWORDLONG)pResult->hDispatcher;
+ }
+ GetTailCallHelpers->Add(key, value);
+ DEBUG_REC(dmpGetTailCallHelpers(key, value));
}
-void MethodContext::dmpGetTailCallCopyArgsThunk(const Agnostic_GetTailCallCopyArgsThunk& key, DWORDLONG value)
+
+void MethodContext::dmpGetTailCallHelpers(const Agnostic_GetTailCallHelpers& key, const Agnostic_CORINFO_TAILCALL_HELPERS& value)
{
- printf("GetTailCallCopyArgsThunk key sig%s flg-%08X",
- SpmiDumpHelper::DumpAgnostic_CORINFO_SIG_INFO(key.Sig).c_str(), key.flags);
- printf(", value res-%016llX", value);
+ printf("GetTailCallHelpers key callToken-%s sig-%s flg-%08X",
+ SpmiDumpHelper::DumpAgnostic_CORINFO_RESOLVED_TOKEN(key.callToken).c_str(),
+ SpmiDumpHelper::DumpAgnostic_CORINFO_SIG_INFO(key.sig).c_str(),
+ key.flags);
+ printf(", value result-%s flg-%08X hStoreArgs-%016llX hCallTarget-%016llX hDispatcher-%016llX",
+ value.result ? "true" : "false",
+ value.flags,
+ value.hStoreArgs,
+ value.hCallTarget,
+ value.hDispatcher);
}
-void* MethodContext::repGetTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
+
+bool MethodContext::repGetTailCallHelpers(
+ CORINFO_RESOLVED_TOKEN* callToken,
+ CORINFO_SIG_INFO* sig,
+ CORINFO_GET_TAILCALL_HELPERS_FLAGS flags,
+ CORINFO_TAILCALL_HELPERS* pResult)
{
- AssertCodeMsg(GetTailCallCopyArgsThunk != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for ...");
+ AssertCodeMsg(GetTailCallHelpers != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for ...");
- Agnostic_GetTailCallCopyArgsThunk key;
- ZeroMemory(&key, sizeof(Agnostic_GetTailCallCopyArgsThunk)); // We use the input structs as a key and use memcmp to
- // compare.. so we need to zero out padding too
- key.Sig = SpmiRecordsHelper::RestoreAgnostic_CORINFO_SIG_INFO(*pSig, GetTailCallCopyArgsThunk);
+ Agnostic_GetTailCallHelpers key;
+ ZeroMemory(&key, sizeof(Agnostic_GetTailCallHelpers));
+ key.callToken = SpmiRecordsHelper::RestoreAgnostic_CORINFO_RESOLVED_TOKEN(callToken, GetTailCallHelpers);
+ key.sig = SpmiRecordsHelper::RestoreAgnostic_CORINFO_SIG_INFO(*sig, GetTailCallHelpers);
key.flags = (DWORD)flags;
- AssertCodeMsg(GetTailCallCopyArgsThunk->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
- (DWORDLONG)key.Sig.retTypeClass);
- void* result = (void*)GetTailCallCopyArgsThunk->Get(key);
- cr->recAddressMap((void*)0x424242, (void*)result, 1);
- DEBUG_REP(dmpGetTailCallCopyArgsThunk(key, (DWORDLONG)result));
- return result;
+ AssertCodeMsg(GetTailCallHelpers->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Could not find matching tail call helper call");
+ Agnostic_CORINFO_TAILCALL_HELPERS value = GetTailCallHelpers->Get(key);
+ if (!value.result)
+ return false;
+
+ pResult->flags = (CORINFO_TAILCALL_HELPERS_FLAGS)value.flags;
+ pResult->hStoreArgs = (CORINFO_METHOD_HANDLE)value.hStoreArgs;
+ pResult->hCallTarget = (CORINFO_METHOD_HANDLE)value.hCallTarget;
+ pResult->hDispatcher = (CORINFO_METHOD_HANDLE)value.hDispatcher;
+ DEBUG_REP(dmpGetTailCallHelpers(key, value));
+ return true;
}
void MethodContext::recGetMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod, mdMethodDef result)
diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.h
index 84c2042ee367af..1f34c4569e3358 100644
--- a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.h
+++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.h
@@ -436,10 +436,19 @@ class MethodContext
DWORDLONG ProfilerHandle;
DWORD bIndirectedHandles;
};
- struct Agnostic_GetTailCallCopyArgsThunk
+ struct Agnostic_GetTailCallHelpers
{
- Agnostic_CORINFO_SIG_INFO Sig;
- DWORD flags;
+ Agnostic_CORINFO_RESOLVED_TOKEN callToken;
+ Agnostic_CORINFO_SIG_INFO sig;
+ DWORD flags;
+ };
+ struct Agnostic_CORINFO_TAILCALL_HELPERS
+ {
+ bool result;
+ DWORD flags;
+ DWORDLONG hStoreArgs;
+ DWORDLONG hCallTarget;
+ DWORDLONG hDispatcher;
};
struct Agnostic_GetArgClass_Value
{
@@ -1255,9 +1264,17 @@ class MethodContext
void dmpAppendClassName(const Agnostic_AppendClassName& key, DWORD value);
const WCHAR* repAppendClassName(CORINFO_CLASS_HANDLE cls, BOOL fNamespace, BOOL fFullInst, BOOL fAssembly);
- void recGetTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags, void* result);
- void dmpGetTailCallCopyArgsThunk(const Agnostic_GetTailCallCopyArgsThunk& key, DWORDLONG value);
- void* repGetTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags);
+ void recGetTailCallHelpers(
+ CORINFO_RESOLVED_TOKEN* callToken,
+ CORINFO_SIG_INFO* sig,
+ CORINFO_GET_TAILCALL_HELPERS_FLAGS flags,
+ CORINFO_TAILCALL_HELPERS* pResult);
+ void dmpGetTailCallHelpers(const Agnostic_GetTailCallHelpers& key, const Agnostic_CORINFO_TAILCALL_HELPERS& value);
+ bool repGetTailCallHelpers(
+ CORINFO_RESOLVED_TOKEN* callToken,
+ CORINFO_SIG_INFO* sig,
+ CORINFO_GET_TAILCALL_HELPERS_FLAGS flags,
+ CORINFO_TAILCALL_HELPERS* pResult);
void recGetMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod, mdMethodDef result);
void dmpGetMethodDefFromMethod(DWORDLONG key, DWORD value);
@@ -1320,7 +1337,7 @@ class MethodContext
};
// ********************* Please keep this up-to-date to ease adding more ***************
-// Highest packet number: 177
+// Highest packet number: 178
// *************************************************************************************
enum mcPackets
{
@@ -1438,7 +1455,8 @@ enum mcPackets
Packet_GetRelocTypeHint = 84,
Packet_GetSecurityPrologHelper = 85, // Retired 2/18/2020
Packet_GetSharedCCtorHelper = 86,
- Packet_GetTailCallCopyArgsThunk = 87,
+ Packet_GetTailCallCopyArgsThunk = 87, // Retired 4/27/2020
+ Packet_GetTailCallHelpers = 178, // Added 3/18/2020
Packet_GetThreadTLSIndex = 88,
Packet_GetTokenTypeAsHandle = 89,
Packet_GetTypeForBox = 90,
diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp
index 505d46c114cfb6..2da8785f96bc23 100644
--- a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp
+++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp
@@ -1857,12 +1857,18 @@ void interceptor_ICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd)
original_ICorJitInfo->MethodCompileComplete(methHnd);
}
-// return a thunk that will copy the arguments for the given signature.
-void* interceptor_ICJI::getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
-{
- mc->cr->AddCall("getTailCallCopyArgsThunk");
- void* result = original_ICorJitInfo->getTailCallCopyArgsThunk(pSig, flags);
- mc->recGetTailCallCopyArgsThunk(pSig, flags, result);
+bool interceptor_ICJI::getTailCallHelpers(
+ CORINFO_RESOLVED_TOKEN* callToken,
+ CORINFO_SIG_INFO* sig,
+ CORINFO_GET_TAILCALL_HELPERS_FLAGS flags,
+ CORINFO_TAILCALL_HELPERS* pResult)
+{
+ mc->cr->AddCall("getTailCallHelpers");
+ bool result = original_ICorJitInfo->getTailCallHelpers(callToken, sig, flags, pResult);
+ if (result)
+ mc->recGetTailCallHelpers(callToken, sig, flags, pResult);
+ else
+ mc->recGetTailCallHelpers(callToken, sig, flags, nullptr);
return result;
}
@@ -2091,4 +2097,4 @@ DWORD interceptor_ICJI::getExpectedTargetArchitecture()
void interceptor_ICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instructionSet, bool supported)
{
original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supported);
-}
\ No newline at end of file
+}
diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
index ad18047e373749..febd952a655fab 100644
--- a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
+++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
@@ -1442,11 +1442,14 @@ void interceptor_ICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd)
original_ICorJitInfo->MethodCompileComplete(methHnd);
}
-// return a thunk that will copy the arguments for the given signature.
-void* interceptor_ICJI::getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
+bool interceptor_ICJI::getTailCallHelpers(
+ CORINFO_RESOLVED_TOKEN* callToken,
+ CORINFO_SIG_INFO* sig,
+ CORINFO_GET_TAILCALL_HELPERS_FLAGS flags,
+ CORINFO_TAILCALL_HELPERS* pResult)
{
- mcs->AddCall("getTailCallCopyArgsThunk");
- return original_ICorJitInfo->getTailCallCopyArgsThunk(pSig, flags);
+ mcs->AddCall("getTailCallHelpers");
+ return original_ICorJitInfo->getTailCallHelpers(callToken, sig, flags, pResult);
}
// Stuff directly on ICorJitInfo
@@ -1668,4 +1671,4 @@ void interceptor_ICJI::notifyInstructionSetUsage(CORINFO_InstructionSet instruct
{
mcs->AddCall("notifyInstructionSetUsage");
original_ICorJitInfo->notifyInstructionSetUsage(instructionSet, supported);
-}
\ No newline at end of file
+}
diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
index eab760a30d2926..26141d06068f46 100644
--- a/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
+++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
@@ -1285,10 +1285,13 @@ void interceptor_ICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd)
original_ICorJitInfo->MethodCompileComplete(methHnd);
}
-// return a thunk that will copy the arguments for the given signature.
-void* interceptor_ICJI::getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
+bool interceptor_ICJI::getTailCallHelpers(
+ CORINFO_RESOLVED_TOKEN* callToken,
+ CORINFO_SIG_INFO* sig,
+ CORINFO_GET_TAILCALL_HELPERS_FLAGS flags,
+ CORINFO_TAILCALL_HELPERS* pResult)
{
- return original_ICorJitInfo->getTailCallCopyArgsThunk(pSig, flags);
+ return original_ICorJitInfo->getTailCallHelpers(callToken, sig, flags, pResult);
}
// Stuff directly on ICorJitInfo
diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/coreclr/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
index 728bd3b2bef8b8..24bc4415e586e0 100644
--- a/src/coreclr/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
+++ b/src/coreclr/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
@@ -1540,11 +1540,14 @@ void MyICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd)
DebugBreakorAV(118);
}
-// return a thunk that will copy the arguments for the given signature.
-void* MyICJI::getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
+bool MyICJI::getTailCallHelpers(
+ CORINFO_RESOLVED_TOKEN* callToken,
+ CORINFO_SIG_INFO* sig,
+ CORINFO_GET_TAILCALL_HELPERS_FLAGS flags,
+ CORINFO_TAILCALL_HELPERS* pResult)
{
- jitInstance->mc->cr->AddCall("getTailCallCopyArgsThunk");
- return jitInstance->mc->repGetTailCallCopyArgsThunk(pSig, flags);
+ jitInstance->mc->cr->AddCall("getTailCallHelpers");
+ return jitInstance->mc->repGetTailCallHelpers(callToken, sig, flags, pResult);
}
bool MyICJI::convertPInvokeCalliToCall(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fMustConvert)
@@ -1575,6 +1578,18 @@ bool MyICJI::runWithErrorTrap(void (*function)(void*), void* param)
return RunWithErrorTrap(function, param);
}
+// Ideally we'd just use the copies of this in standardmacros.h
+// however, superpmi is missing various other dependencies as well
+static size_t ALIGN_UP_SPMI(size_t val, size_t alignment)
+{
+ return (val + (alignment - 1)) & ~(alignment - 1);
+}
+
+static void* ALIGN_UP_SPMI(void* val, size_t alignment)
+{
+ return (void*)ALIGN_UP_SPMI((size_t)val, alignment);
+}
+
// get a block of memory for the code, readonly data, and read-write data
void MyICJI::allocMem(ULONG hotCodeSize, /* IN */
ULONG coldCodeSize, /* IN */
@@ -1587,13 +1602,46 @@ void MyICJI::allocMem(ULONG hotCodeSize, /* IN */
)
{
jitInstance->mc->cr->AddCall("allocMem");
- // TODO-Cleanup: investigate if we need to check roDataBlock as well. Could hot block size be ever 0?
+
+ // TODO-Cleanup: Could hot block size be ever 0?
*hotCodeBlock = jitInstance->mc->cr->allocateMemory(hotCodeSize);
+
if (coldCodeSize > 0)
*coldCodeBlock = jitInstance->mc->cr->allocateMemory(coldCodeSize);
else
*coldCodeBlock = nullptr;
- *roDataBlock = jitInstance->mc->cr->allocateMemory(roDataSize);
+
+ if (roDataSize > 0)
+ {
+ size_t roDataAlignment = sizeof(void*);
+ size_t roDataAlignedSize = static_cast(roDataSize);
+
+ if ((flag & CORJIT_ALLOCMEM_FLG_RODATA_32BYTE_ALIGN) != 0)
+ {
+ roDataAlignment = 32;
+ }
+ else if ((flag & CORJIT_ALLOCMEM_FLG_RODATA_16BYTE_ALIGN) != 0)
+ {
+ roDataAlignment = 16;
+ }
+ else if (roDataSize >= 8)
+ {
+ roDataAlignment = 8;
+ }
+
+ // We need to round the roDataSize up to the alignment size and then
+ // overallocate by at most alignment - sizeof(void*) to ensure that
+ // we can offset roDataBlock to be an aligned address and that the
+ // allocation contains at least the originally requested size after
+
+ roDataAlignedSize = ALIGN_UP_SPMI(roDataAlignedSize, roDataAlignment);
+ roDataAlignedSize = roDataAlignedSize + (roDataAlignment - sizeof(void*));
+ *roDataBlock = jitInstance->mc->cr->allocateMemory(roDataAlignedSize);
+ *roDataBlock = ALIGN_UP_SPMI(*roDataBlock, roDataAlignment);
+ }
+ else
+ *roDataBlock = nullptr;
+
jitInstance->mc->cr->recAllocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock,
coldCodeBlock, roDataBlock);
}
diff --git a/src/coreclr/src/binder/assemblybinder.cpp b/src/coreclr/src/binder/assemblybinder.cpp
index 784b91260ee75d..362c2b867802f5 100644
--- a/src/coreclr/src/binder/assemblybinder.cpp
+++ b/src/coreclr/src/binder/assemblybinder.cpp
@@ -14,7 +14,6 @@
#include "assemblybinder.hpp"
#include "assemblyname.hpp"
-
#include "assembly.hpp"
#include "applicationcontext.hpp"
#include "bindertracing.h"
@@ -380,23 +379,36 @@ namespace BINDER_SPACE
_ASSERTE(ppSystemAssembly != NULL);
- StackSString sCoreLibDir(systemDirectory);
ReleaseHolder pSystemAssembly;
- if (!sCoreLibDir.EndsWith(DIRECTORY_SEPARATOR_CHAR_W))
- {
- sCoreLibDir.Append(DIRECTORY_SEPARATOR_CHAR_W);
- }
+ // At run-time, System.Private.CoreLib.dll is expected to be the NI image.
+ // System.Private.CoreLib.dll is expected to be found at one of the following locations:
+ // * Non-single-file app: In systemDirectory, beside coreclr.dll
+ // * Framework-dependent single-file app: In systemDirectory, beside coreclr.dll
+ // * Self-contained single-file app: Within the single-file bundle.
+ //
+ // CoreLib path (sCoreLib):
+ // * Absolute path when looking for a file on disk
+ // * Bundle-relative path when looking within the single-file bundle.
+ StackSString sCoreLibName(CoreLibName_IL_W);
StackSString sCoreLib;
+ BinderTracing::PathSource pathSource = BinderTracing::PathSource::Bundle;
+ BundleFileLocation bundleFileLocation = Bundle::ProbeAppBundle(sCoreLibName, /*pathIsBundleRelative */ true);
+ if (!bundleFileLocation.IsValid())
+ {
+ sCoreLib.Set(systemDirectory);
+ pathSource = BinderTracing::PathSource::ApplicationAssemblies;
+ }
+ CombinePath(sCoreLib, sCoreLibName, sCoreLib);
- // At run-time, System.Private.CoreLib.dll is expected to be the NI image.
- sCoreLib = sCoreLibDir;
- sCoreLib.Append(CoreLibName_IL_W);
IF_FAIL_GO(AssemblyBinder::GetAssembly(sCoreLib,
TRUE /* fIsInGAC */,
fBindToNativeImage,
- &pSystemAssembly));
+ &pSystemAssembly,
+ NULL /* szMDAssemblyPath */,
+ bundleFileLocation));
+ BinderTracing::PathProbed(sCoreLib, pathSource, hr);
*ppSystemAssembly = pSystemAssembly.Extract();
@@ -406,10 +418,10 @@ namespace BINDER_SPACE
/* static */
- HRESULT AssemblyBinder::BindToSystemSatellite(SString &systemDirectory,
- SString &simpleName,
- SString &cultureName,
- Assembly **ppSystemAssembly)
+ HRESULT AssemblyBinder::BindToSystemSatellite(SString& systemDirectory,
+ SString& simpleName,
+ SString& cultureName,
+ Assembly** ppSystemAssembly)
{
// Indirect check that binder was initialized.
_ASSERTE(g_BinderVariables != NULL);
@@ -418,25 +430,43 @@ namespace BINDER_SPACE
_ASSERTE(ppSystemAssembly != NULL);
- StackSString sMscorlibSatellite(systemDirectory);
- ReleaseHolder pSystemAssembly;
+ // Satellite assembly's relative path
+ StackSString relativePath;
// append culture name
if (!cultureName.IsEmpty())
{
- CombinePath(sMscorlibSatellite, cultureName, sMscorlibSatellite);
+ CombinePath(relativePath, cultureName, relativePath);
}
// append satellite assembly's simple name
- CombinePath(sMscorlibSatellite, simpleName, sMscorlibSatellite);
+ CombinePath(relativePath, simpleName, relativePath);
// append extension
- sMscorlibSatellite.Append(W(".dll"));
+ relativePath.Append(W(".dll"));
+ // Satellite assembly's path:
+ // * Absolute path when looking for a file on disk
+ // * Bundle-relative path when looking within the single-file bundle.
+ StackSString sMscorlibSatellite;
+
+ BinderTracing::PathSource pathSource = BinderTracing::PathSource::Bundle;
+ BundleFileLocation bundleFileLocation = Bundle::ProbeAppBundle(relativePath, /*pathIsBundleRelative */ true);
+ if (!bundleFileLocation.IsValid())
+ {
+ sMscorlibSatellite.Set(systemDirectory);
+ pathSource = BinderTracing::PathSource::ApplicationAssemblies;
+ }
+ CombinePath(sMscorlibSatellite, relativePath, sMscorlibSatellite);
+
+ ReleaseHolder pSystemAssembly;
IF_FAIL_GO(AssemblyBinder::GetAssembly(sMscorlibSatellite,
TRUE /* fIsInGAC */,
FALSE /* fExplicitBindToNativeImage */,
- &pSystemAssembly));
+ &pSystemAssembly,
+ NULL /* szMDAssemblyPath */,
+ bundleFileLocation));
+ BinderTracing::PathProbed(sMscorlibSatellite, pathSource, hr);
*ppSystemAssembly = pSystemAssembly.Extract();
@@ -553,7 +583,9 @@ namespace BINDER_SPACE
// specified. Generally only NGEN PDB generation has
// this TRUE.
fExplicitBindToNativeImage,
- &pAssembly));
+ &pAssembly,
+ NULL /* szMDAssemblyPath */,
+ Bundle::ProbeAppBundle(assemblyPath)));
AssemblyName *pAssemblyName;
pAssemblyName = pAssembly->GetAssemblyName();
@@ -721,36 +753,75 @@ namespace BINDER_SPACE
namespace
{
- typedef void (*OnPathProbed)(const WCHAR *path, HRESULT hr);
-
- HRESULT BindSatelliteResourceByProbingPaths(
- const StringArrayList *pResourceRoots,
- AssemblyName *pRequestedAssemblyName,
- BindResult *pBindResult,
- OnPathProbed onPathProbed)
+ HRESULT BindSatelliteResourceFromBundle(
+ AssemblyName* pRequestedAssemblyName,
+ SString &relativePath,
+ BindResult* pBindResult)
{
HRESULT hr = S_OK;
- SString &simpleNameRef = pRequestedAssemblyName->GetSimpleName();
- SString &cultureRef = pRequestedAssemblyName->GetCulture();
+ BundleFileLocation bundleFileLocation = Bundle::ProbeAppBundle(relativePath, /* pathIsBundleRelative */ true);
+ if (!bundleFileLocation.IsValid())
+ {
+ return hr;
+ }
- _ASSERTE(!cultureRef.IsEmpty() && !cultureRef.EqualsCaseInsensitive(g_BinderVariables->cultureNeutral));
+ ReleaseHolder pAssembly;
+ hr = AssemblyBinder::GetAssembly(relativePath,
+ FALSE /* fIsInGAC */,
+ FALSE /* fExplicitBindToNativeImage */,
+ &pAssembly,
+ NULL, // szMDAssemblyPath
+ bundleFileLocation);
+
+ BinderTracing::PathProbed(relativePath, BinderTracing::PathSource::Bundle, hr);
+
+ // Missing files are okay and expected when probing
+ if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
+ {
+ return S_OK;
+ }
+
+ pBindResult->SetAttemptResult(hr, pAssembly);
+ if (FAILED(hr))
+ return hr;
+
+ AssemblyName* pBoundAssemblyName = pAssembly->GetAssemblyName();
+ if (TestCandidateRefMatchesDef(pRequestedAssemblyName, pBoundAssemblyName, false /*tpaListAssembly*/))
+ {
+ pBindResult->SetResult(pAssembly);
+ hr = S_OK;
+ }
+ else
+ {
+ hr = FUSION_E_REF_DEF_MISMATCH;
+ }
+
+ pBindResult->SetAttemptResult(hr, pAssembly);
+ return hr;
+ }
+
+ HRESULT BindSatelliteResourceByProbingPaths(
+ const StringArrayList *pResourceRoots,
+ AssemblyName *pRequestedAssemblyName,
+ SString &relativePath,
+ BindResult *pBindResult,
+ BinderTracing::PathSource pathSource)
+ {
+ HRESULT hr = S_OK;
for (UINT i = 0; i < pResourceRoots->GetCount(); i++)
{
ReleaseHolder pAssembly;
SString &wszBindingPath = (*pResourceRoots)[i];
SString fileName(wszBindingPath);
-
- CombinePath(fileName, cultureRef, fileName);
- CombinePath(fileName, simpleNameRef, fileName);
- fileName.Append(W(".dll"));
+ CombinePath(fileName, relativePath, fileName);
hr = AssemblyBinder::GetAssembly(fileName,
FALSE /* fIsInGAC */,
FALSE /* fExplicitBindToNativeImage */,
&pAssembly);
- onPathProbed(fileName, hr);
+ BinderTracing::PathProbed(fileName, pathSource, hr);
// Missing files are okay and expected when probing
if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
@@ -781,6 +852,59 @@ namespace BINDER_SPACE
return S_OK;
}
+ HRESULT BindSatelliteResource(
+ ApplicationContext* pApplicationContext,
+ AssemblyName* pRequestedAssemblyName,
+ BindResult* pBindResult)
+ {
+ // Satellite resource probing strategy is to look:
+ // * First within the single-file bundle
+ // * Then under each of the Platform Resource Roots
+ // * Then under each of the App Paths.
+ //
+ // During each search, if we find a platform resource file with matching file name, but whose ref-def didn't match,
+ // fall back to application resource lookup to handle case where a user creates resources with the same
+ // names as platform ones.
+
+ HRESULT hr = S_OK;
+ SString& simpleNameRef = pRequestedAssemblyName->GetSimpleName();
+ SString& cultureRef = pRequestedAssemblyName->GetCulture();
+
+ _ASSERTE(!cultureRef.IsEmpty() && !cultureRef.EqualsCaseInsensitive(g_BinderVariables->cultureNeutral));
+
+ ReleaseHolder pAssembly;
+ SString fileName;
+ CombinePath(fileName, cultureRef, fileName);
+ CombinePath(fileName, simpleNameRef, fileName);
+ fileName.Append(W(".dll"));
+
+ hr = BindSatelliteResourceFromBundle(pRequestedAssemblyName, fileName, pBindResult);
+
+ if (pBindResult->HaveResult() || (FAILED(hr) && hr != FUSION_E_CONFIGURATION_ERROR))
+ {
+ return hr;
+ }
+
+ hr = BindSatelliteResourceByProbingPaths(pApplicationContext->GetPlatformResourceRoots(),
+ pRequestedAssemblyName,
+ fileName,
+ pBindResult,
+ BinderTracing::PathSource::PlatformResourceRoots);
+
+ if (pBindResult->HaveResult() || (FAILED(hr) && hr != FUSION_E_CONFIGURATION_ERROR))
+ {
+ return hr;
+ }
+
+ hr = BindSatelliteResourceByProbingPaths(pApplicationContext->GetAppPaths(),
+ pRequestedAssemblyName,
+ fileName,
+ pBindResult,
+ BinderTracing::PathSource::AppPaths);
+
+ return hr;
+ }
+
HRESULT BindAssemblyByProbingPaths(
const StringArrayList *pBindingPaths,
AssemblyName *pRequestedAssemblyName,
@@ -788,7 +912,6 @@ namespace BINDER_SPACE
Assembly **ppAssembly)
{
SString &simpleName = pRequestedAssemblyName->GetSimpleName();
-
BinderTracing::PathSource pathSource = useNativeImages ? BinderTracing::PathSource::AppNativeImagePaths : BinderTracing::PathSource::AppPaths;
// Loop through the binding paths looking for a matching assembly
for (DWORD i = 0; i < pBindingPaths->GetCount(); i++)
@@ -850,6 +973,13 @@ namespace BINDER_SPACE
/*
* BindByTpaList is the entry-point for the custom binding algorithm in CoreCLR.
+ *
+ * The search for assemblies will proceed in the following order:
+ *
+ * If this application is a single-file bundle, the meta-data contained in the bundle
+ * will be probed to find the requested assembly. If the assembly is not found,
+ * The list of platform assemblies (TPAs) are considered next.
+ *
* Platform assemblies are specified as a list of files. This list is the only set of
* assemblies that we will load as platform. They can be specified as IL or NIs.
*
@@ -875,39 +1005,65 @@ namespace BINDER_SPACE
if (!culture.IsEmpty() && !culture.EqualsCaseInsensitive(g_BinderVariables->cultureNeutral))
{
- //
- // Satellite resource probing strategy is to look under each of the Platform Resource Roots
- // followed by App Paths.
- //
+ IF_FAIL_GO(BindSatelliteResource(pApplicationContext, pRequestedAssemblyName, pBindResult));
+ }
+ else
+ {
+ ReleaseHolder pTPAAssembly;
+ SString& simpleName = pRequestedAssemblyName->GetSimpleName();
+
+ // Is assembly in the bundle?
+ // Single-file bundle contents take precedence over TPA.
+ // The list of bundled assemblies is contained in the bundle manifest, and NOT in the TPA.
+ // Therefore the bundle is first probed using the assembly's simple name.
+ // If found, the assembly is loaded from the bundle.
+ if (Bundle::AppIsBundle())
+ {
+ // Search Assembly.ni.dll, then Assembly.dll
+ // The Assembly.ni.dll paths are rare, and intended for supporting managed C++ R2R assemblies.
+ SString candidates[] = { W(".ni.dll"), W(".dll") };
- hr = BindSatelliteResourceByProbingPaths(pApplicationContext->GetPlatformResourceRoots(),
- pRequestedAssemblyName,
- pBindResult,
- [](const WCHAR *path, HRESULT res) { BinderTracing::PathProbed(path, BinderTracing::PathSource::PlatformResourceRoots, res); });
+ // Loop through the binding paths looking for a matching assembly
+ for (int i = 0; i < 2; i++)
+ {
+ SString assemblyFileName(simpleName);
+ assemblyFileName.Append(candidates[i]);
- // We found a platform resource file with matching file name, but whose ref-def didn't match. Fall
- // back to application resource lookup to handle case where a user creates resources with the same
- // names as platform ones.
- if (hr != FUSION_E_CONFIGURATION_ERROR)
- {
- IF_FAIL_GO(hr);
- }
+ SString assemblyFilePath(Bundle::AppBundle->BasePath());
+ assemblyFilePath.Append(assemblyFileName);
- if (!pBindResult->HaveResult())
- {
- IF_FAIL_GO(BindSatelliteResourceByProbingPaths(pApplicationContext->GetAppPaths(),
- pRequestedAssemblyName,
- pBindResult,
- [](const WCHAR *path, HRESULT res) { BinderTracing::PathProbed(path, BinderTracing::PathSource::AppPaths, res); }));
+ BundleFileLocation bundleFileLocation = Bundle::ProbeAppBundle(assemblyFileName, /* pathIsBundleRelative */ true);
+ if (bundleFileLocation.IsValid())
+ {
+ hr = GetAssembly(assemblyFilePath,
+ TRUE, // fIsInGAC
+ FALSE, // fExplicitBindToNativeImage
+ &pTPAAssembly,
+ NULL, // szMDAssemblyPath
+ bundleFileLocation);
+
+ BinderTracing::PathProbed(assemblyFilePath, BinderTracing::PathSource::Bundle, hr);
+
+ if (hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
+ {
+ // Any other error is fatal
+ IF_FAIL_GO(hr);
+
+ if (TestCandidateRefMatchesDef(pRequestedAssemblyName, pTPAAssembly->GetAssemblyName(), true /*tpaListAssembly*/))
+ {
+ // We have found the requested assembly match in the bundle with validation of the full-qualified name.
+ // Bind to it.
+ pBindResult->SetResult(pTPAAssembly);
+ GO_WITH_HRESULT(S_OK);
+ }
+ }
+ }
+ }
}
- }
- else
- {
+
// Is assembly on TPA list?
- SString &simpleName = pRequestedAssemblyName->GetSimpleName();
SimpleNameToFileNameMap * tpaMap = pApplicationContext->GetTpaList();
const SimpleNameToFileNameMapEntry *pTpaEntry = tpaMap->LookupPtr(simpleName.GetUnicode());
- ReleaseHolder pTPAAssembly;
if (pTpaEntry != nullptr)
{
if (pTpaEntry->m_wszNIFileName != nullptr)
@@ -1020,20 +1176,21 @@ namespace BINDER_SPACE
}
/* static */
- HRESULT AssemblyBinder::GetAssembly(SString &assemblyPath,
- BOOL fIsInGAC,
+ HRESULT AssemblyBinder::GetAssembly(SString &assemblyPath,
+ BOOL fIsInGAC,
// When binding to the native image, should we
// assume assemblyPath explicitly specifies that
// NI? (If not, infer the path to the NI
// implicitly.)
- BOOL fExplicitBindToNativeImage,
+ BOOL fExplicitBindToNativeImage,
- Assembly **ppAssembly,
+ Assembly **ppAssembly,
// If assemblyPath refers to a native image without metadata,
// szMDAssemblyPath gives the alternative file to get metadata.
- LPCTSTR szMDAssemblyPath)
+ LPCTSTR szMDAssemblyPath,
+ BundleFileLocation bundleFileLocation)
{
HRESULT hr = S_OK;
@@ -1053,7 +1210,7 @@ namespace BINDER_SPACE
{
LPCTSTR szAssemblyPath = const_cast(assemblyPath.GetUnicode());
- hr = BinderAcquirePEImage(szAssemblyPath, &pPEImage, &pNativePEImage, fExplicitBindToNativeImage);
+ hr = BinderAcquirePEImage(szAssemblyPath, &pPEImage, &pNativePEImage, fExplicitBindToNativeImage, bundleFileLocation);
IF_FAIL_GO(hr);
// If we found a native image, it might be an MSIL assembly masquerading as an native image
@@ -1068,7 +1225,7 @@ namespace BINDER_SPACE
BinderReleasePEImage(pPEImage);
BinderReleasePEImage(pNativePEImage);
- hr = BinderAcquirePEImage(szAssemblyPath, &pPEImage, &pNativePEImage, false);
+ hr = BinderAcquirePEImage(szAssemblyPath, &pPEImage, &pNativePEImage, false, bundleFileLocation);
IF_FAIL_GO(hr);
}
}
@@ -1094,7 +1251,7 @@ namespace BINDER_SPACE
}
else
{
- hr = BinderAcquirePEImage(szMDAssemblyPath, &pPEImage, NULL, FALSE);
+ hr = BinderAcquirePEImage(szMDAssemblyPath, &pPEImage, NULL, FALSE, bundleFileLocation);
IF_FAIL_GO(hr);
hr = BinderAcquireImport(pPEImage, &pIMetaDataAssemblyImport, dwPAFlags, FALSE);
diff --git a/src/coreclr/src/binder/clrprivbinderassemblyloadcontext.cpp b/src/coreclr/src/binder/clrprivbinderassemblyloadcontext.cpp
index 0881af5c599832..8c1ae4060a6154 100644
--- a/src/coreclr/src/binder/clrprivbinderassemblyloadcontext.cpp
+++ b/src/coreclr/src/binder/clrprivbinderassemblyloadcontext.cpp
@@ -250,12 +250,11 @@ void CLRPrivBinderAssemblyLoadContext::PrepareForLoadContextRelease(INT_PTR ptrM
}
CONTRACTL_END;
- // Replace the weak handle with a strong handle so that the managed assembly load context stays alive until the
+ // Add a strong handle so that the managed assembly load context stays alive until the
// CLRPrivBinderAssemblyLoadContext::ReleaseLoadContext is called.
- OBJECTHANDLE handle = reinterpret_cast(m_ptrManagedAssemblyLoadContext);
- OBJECTHANDLE strongHandle = reinterpret_cast(ptrManagedStrongAssemblyLoadContext);
- DestroyLongWeakHandle(handle);
- m_ptrManagedAssemblyLoadContext = reinterpret_cast(strongHandle);
+ // We keep the weak handle as well since this method can be running on one thread (e.g. the finalizer one)
+ // and other thread can be using the weak handle.
+ m_ptrManagedStrongAssemblyLoadContext = ptrManagedStrongAssemblyLoadContext;
_ASSERTE(m_pAssemblyLoaderAllocator != NULL);
_ASSERTE(m_loaderAllocatorHandle != NULL);
@@ -274,15 +273,19 @@ void CLRPrivBinderAssemblyLoadContext::PrepareForLoadContextRelease(INT_PTR ptrM
CLRPrivBinderAssemblyLoadContext::CLRPrivBinderAssemblyLoadContext()
{
m_pTPABinder = NULL;
+ m_ptrManagedStrongAssemblyLoadContext = NULL;
}
void CLRPrivBinderAssemblyLoadContext::ReleaseLoadContext()
{
VERIFY(m_ptrManagedAssemblyLoadContext != NULL);
+ VERIFY(m_ptrManagedStrongAssemblyLoadContext != NULL);
- // This method is called to release the strong handle on the managed AssemblyLoadContext
+ // This method is called to release the weak and strong handles on the managed AssemblyLoadContext
// once the Unloading event has been fired
OBJECTHANDLE handle = reinterpret_cast(m_ptrManagedAssemblyLoadContext);
+ DestroyLongWeakHandle(handle);
+ handle = reinterpret_cast(m_ptrManagedStrongAssemblyLoadContext);
DestroyHandle(handle);
m_ptrManagedAssemblyLoadContext = NULL;
}
diff --git a/src/coreclr/src/binder/coreclrbindercommon.cpp b/src/coreclr/src/binder/coreclrbindercommon.cpp
index afd64cfc4dc582..e415b9067bb34a 100644
--- a/src/coreclr/src/binder/coreclrbindercommon.cpp
+++ b/src/coreclr/src/binder/coreclrbindercommon.cpp
@@ -7,6 +7,7 @@
#include "assemblybinder.hpp"
#include "coreclrbindercommon.h"
#include "clrprivbindercoreclr.h"
+#include "bundle.h"
using namespace BINDER_SPACE;
diff --git a/src/coreclr/src/binder/inc/assembly.hpp b/src/coreclr/src/binder/inc/assembly.hpp
index 0d5500afb82032..f42cee4e622687 100644
--- a/src/coreclr/src/binder/inc/assembly.hpp
+++ b/src/coreclr/src/binder/inc/assembly.hpp
@@ -27,15 +27,18 @@
#include "clrprivbinderassemblyloadcontext.h"
#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
-STDAPI BinderAcquirePEImage(LPCTSTR szAssemblyPath,
- PEImage **ppPEImage,
- PEImage **ppNativeImage,
- BOOL fExplicitBindToNativeImage);
-
-STDAPI BinderAcquireImport(PEImage *pPEImage,
- IMDInternalImport **pIMetaDataAssemblyImport,
- DWORD *pdwPAFlags,
- BOOL bNativeImage);
+#include "bundle.h"
+
+STDAPI BinderAcquirePEImage(LPCTSTR szAssemblyPath,
+ PEImage **ppPEImage,
+ PEImage **ppNativeImage,
+ BOOL fExplicitBindToNativeImage,
+ BundleFileLocation bundleFileLocation);
+
+STDAPI BinderAcquireImport(PEImage *pPEImage,
+ IMDInternalImport **pIMetaDataAssemblyImport,
+ DWORD *pdwPAFlags,
+ BOOL bNativeImage);
STDAPI BinderHasNativeHeader(PEImage *pPEImage,
BOOL *result);
diff --git a/src/coreclr/src/binder/inc/assemblybinder.hpp b/src/coreclr/src/binder/inc/assemblybinder.hpp
index 1332b671edc2dd..5246676b1a47f3 100644
--- a/src/coreclr/src/binder/inc/assemblybinder.hpp
+++ b/src/coreclr/src/binder/inc/assemblybinder.hpp
@@ -18,6 +18,7 @@
#include "bindertypes.hpp"
#include "bindresult.hpp"
#include "coreclrbindercommon.h"
+#include "bundle.h"
class CLRPrivBinderAssemblyLoadContext;
class CLRPrivBinderCoreCLR;
@@ -54,7 +55,8 @@ namespace BINDER_SPACE
/* in */ BOOL fIsInGAC,
/* in */ BOOL fExplicitBindToNativeImage,
/* out */ Assembly **ppAssembly,
- /* in */ LPCTSTR szMDAssemblyPath = NULL);
+ /* in */ LPCTSTR szMDAssemblyPath = NULL,
+ /* in */ BundleFileLocation bundleFileLocation = BundleFileLocation::Invalid());
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
static HRESULT BindUsingHostAssemblyResolver (/* in */ INT_PTR pManagedAssemblyLoadContextToBindWithin,
diff --git a/src/coreclr/src/binder/inc/bindertracing.h b/src/coreclr/src/binder/inc/bindertracing.h
index 472197bf5b4e39..6fb5137349e026 100644
--- a/src/coreclr/src/binder/inc/bindertracing.h
+++ b/src/coreclr/src/binder/inc/bindertracing.h
@@ -180,7 +180,8 @@ namespace BinderTracing
AppNativeImagePaths,
AppPaths,
PlatformResourceRoots,
- SatelliteSubdirectory
+ SatelliteSubdirectory,
+ Bundle
};
void PathProbed(const WCHAR *path, PathSource source, HRESULT hr);
diff --git a/src/coreclr/src/binder/inc/clrprivbinderassemblyloadcontext.h b/src/coreclr/src/binder/inc/clrprivbinderassemblyloadcontext.h
index 09695b09fc0108..546779e3f435d7 100644
--- a/src/coreclr/src/binder/inc/clrprivbinderassemblyloadcontext.h
+++ b/src/coreclr/src/binder/inc/clrprivbinderassemblyloadcontext.h
@@ -78,7 +78,13 @@ class CLRPrivBinderAssemblyLoadContext : public AssemblyLoadContext
CLRPrivBinderCoreCLR *m_pTPABinder;
+ // A long weak GC handle to the managed AssemblyLoadContext
INT_PTR m_ptrManagedAssemblyLoadContext;
+ // A strong GC handle to the managed AssemblyLoadContext. This handle is set when the unload of the AssemblyLoadContext is initiated
+ // to keep the managed AssemblyLoadContext alive until the unload is finished.
+ // We still keep the weak handle pointing to the same managed AssemblyLoadContext so that native code can use the handle above
+ // to refer to it during the whole lifetime of the AssemblyLoadContext.
+ INT_PTR m_ptrManagedStrongAssemblyLoadContext;
LoaderAllocator* m_pAssemblyLoaderAllocator;
void* m_loaderAllocatorHandle;
diff --git a/src/coreclr/src/binder/utils.cpp b/src/coreclr/src/binder/utils.cpp
index 27f1d4c6b3f6d9..953da35d8ffa3f 100644
--- a/src/coreclr/src/binder/utils.cpp
+++ b/src/coreclr/src/binder/utils.cpp
@@ -80,7 +80,7 @@ namespace BINDER_SPACE
SString platformPathSeparator(SString::Literal, GetPlatformPathSeparator());
combinedPath.Set(pathA);
- if (!combinedPath.EndsWith(platformPathSeparator))
+ if (!combinedPath.IsEmpty() && !combinedPath.EndsWith(platformPathSeparator))
{
combinedPath.Append(platformPathSeparator);
}
diff --git a/src/coreclr/src/build.proj b/src/coreclr/src/build.proj
deleted file mode 100644
index ad5ff6e63a70a2..00000000000000
--- a/src/coreclr/src/build.proj
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
- false
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/coreclr/src/classlibnative/bcltype/stringnative.h b/src/coreclr/src/classlibnative/bcltype/stringnative.h
index 6aea696e41af7f..c8e1fcecc9f352 100644
--- a/src/coreclr/src/classlibnative/bcltype/stringnative.h
+++ b/src/coreclr/src/classlibnative/bcltype/stringnative.h
@@ -42,10 +42,8 @@
class COMString {
public:
//
- // Search/Query Methods
+ // Query Methods
//
- static FCDECL6(INT32, CompareOrdinalEx, StringObject* strA, INT32 indexA, INT32 countA, StringObject* strB, INT32 indexB, INT32 countB);
-
static FCDECL2(FC_CHAR_RET, GetCharAt, StringObject* pThisRef, INT32 index);
static FCDECL1(INT32, Length, StringObject* pThisRef);
diff --git a/src/coreclr/src/debug/CMakeLists.txt b/src/coreclr/src/debug/CMakeLists.txt
index 03fcc8cc596065..4fd69d9a82adc3 100644
--- a/src/coreclr/src/debug/CMakeLists.txt
+++ b/src/coreclr/src/debug/CMakeLists.txt
@@ -3,6 +3,9 @@ add_subdirectory(ildbsymlib)
add_subdirectory(ee)
add_subdirectory(di)
add_subdirectory(shim)
+if(CLR_CMAKE_HOST_WIN32)
+ add_subdirectory(createdump)
+endif(CLR_CMAKE_HOST_WIN32)
if(FEATURE_SINGLE_FILE_DIAGNOSTICS)
add_subdirectory(runtimeinfo)
endif(FEATURE_SINGLE_FILE_DIAGNOSTICS)
diff --git a/src/coreclr/src/debug/createdump/CMakeLists.txt b/src/coreclr/src/debug/createdump/CMakeLists.txt
index f642159fb705ba..0915212448e6d8 100644
--- a/src/coreclr/src/debug/createdump/CMakeLists.txt
+++ b/src/coreclr/src/debug/createdump/CMakeLists.txt
@@ -2,53 +2,77 @@ project(createdump)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-include(configure.cmake)
-
-# Set the RPATH of createdump so that it can find dependencies without needing to set LD_LIBRARY_PATH
-# For more information: http://www.cmake.org/Wiki/CMake_RPATH_handling.
-if (CORECLR_SET_RPATH)
- set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
- if(CLR_CMAKE_HOST_OSX)
- set(CMAKE_INSTALL_RPATH "@loader_path")
- else()
- set(CMAKE_INSTALL_RPATH "\$ORIGIN")
- endif(CLR_CMAKE_HOST_OSX)
-endif (CORECLR_SET_RPATH)
+include_directories(BEFORE ${VM_DIR})
remove_definitions(-DUNICODE)
remove_definitions(-D_UNICODE)
-include_directories(BEFORE ${VM_DIR})
+if(CLR_CMAKE_HOST_WIN32)
+
+ set(CREATEDUMP_SOURCES
+ main.cpp
+ createdumpwindows.cpp
+ createdump.rc
+ )
+
+ _add_executable(createdump
+ ${CREATEDUMP_SOURCES}
+ )
+
+ target_link_libraries(createdump
+ kernel32.lib
+ ${STATIC_MT_CRT_LIB}
+ advapi32.lib
+ version.lib
+ dbghelp.lib
+ )
+
+else(CLR_CMAKE_HOST_WIN32)
+
+ include(configure.cmake)
+
+ # Set the RPATH of createdump so that it can find dependencies without needing to set LD_LIBRARY_PATH
+ # For more information: http://www.cmake.org/Wiki/CMake_RPATH_handling.
+ if (CORECLR_SET_RPATH)
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+ if(CLR_CMAKE_HOST_OSX)
+ set(CMAKE_INSTALL_RPATH "@loader_path")
+ else()
+ set(CMAKE_INSTALL_RPATH "\$ORIGIN")
+ endif(CLR_CMAKE_HOST_OSX)
+ endif (CORECLR_SET_RPATH)
+
+ add_definitions(-DPAL_STDCPP_COMPAT)
-add_definitions(-DPAL_STDCPP_COMPAT)
+ set(CREATEDUMP_SOURCES
+ createdump.cpp
+ crashinfo.cpp
+ threadinfo.cpp
+ datatarget.cpp
+ dumpwriter.cpp
+ )
-set(CREATEDUMP_SOURCES
- createdump.cpp
- crashinfo.cpp
- threadinfo.cpp
- datatarget.cpp
- dumpwriter.cpp
-)
+ _add_library(createdump_lib
+ ${CREATEDUMP_SOURCES}
+ )
-_add_library(createdump_lib
- ${CREATEDUMP_SOURCES}
-)
+ _add_executable(createdump
+ main.cpp
+ ${PAL_REDEFINES_FILE}
+ )
-_add_executable(createdump
- main.cpp
- ${PAL_REDEFINES_FILE}
-)
+ add_dependencies(createdump pal_redefines_file)
-add_dependencies(createdump pal_redefines_file)
+ target_link_libraries(createdump
+ createdump_lib
+ corguids
+ dbgutil
+ # share the PAL in the dac module
+ mscordaccore
+ )
-target_link_libraries(createdump
- createdump_lib
- corguids
- dbgutil
- # share the PAL in the dac module
- mscordaccore
-)
+ add_dependencies(createdump mscordaccore)
-add_dependencies(createdump mscordaccore)
+endif(CLR_CMAKE_HOST_WIN32)
install_clr(TARGETS createdump ADDITIONAL_DESTINATION sharedFramework)
diff --git a/src/coreclr/src/debug/createdump/createdump.cpp b/src/coreclr/src/debug/createdump/createdump.cpp
index a4a21f4df3c204..8299054d10b4b0 100644
--- a/src/coreclr/src/debug/createdump/createdump.cpp
+++ b/src/coreclr/src/debug/createdump/createdump.cpp
@@ -7,37 +7,21 @@
bool g_diagnostics = false;
//
-// The common create dump code
+// The Linux create dump code
//
bool
-CreateDumpCommon(const char* dumpPathTemplate, MINIDUMP_TYPE minidumpType, CrashInfo* crashInfo)
+CreateDump(const char* dumpPath, int pid, MINIDUMP_TYPE minidumpType)
{
+ ReleaseHolder dataTarget = new DumpDataTarget(pid);
+ ReleaseHolder crashInfo = new CrashInfo(pid, dataTarget, false);
ReleaseHolder dumpWriter = new DumpWriter(*crashInfo);
bool result = false;
- ArrayHolder dumpPath = new char[PATH_MAX];
- snprintf(dumpPath, PATH_MAX, dumpPathTemplate, crashInfo->Pid());
-
- const char* dumpType = "minidump";
- switch (minidumpType)
+ // The initialize the data target's ReadVirtual support (opens /proc/$pid/mem)
+ if (!dataTarget->Initialize(crashInfo))
{
- case MiniDumpWithPrivateReadWriteMemory:
- dumpType = "minidump with heap";
- break;
-
- case MiniDumpFilterTriage:
- dumpType = "triage minidump";
- break;
-
- case MiniDumpWithFullMemory:
- dumpType = "full dump";
- break;
-
- default:
- break;
+ goto exit;
}
- printf("Writing %s to file %s\n", dumpType, (char*)dumpPath);
-
// Suspend all the threads in the target process and build the list of threads
if (!crashInfo->EnumerateAndSuspendThreads())
{
@@ -61,13 +45,3 @@ CreateDumpCommon(const char* dumpPathTemplate, MINIDUMP_TYPE minidumpType, Crash
crashInfo->ResumeThreads();
return result;
}
-
-//
-// Entry point for SOS createdump command
-//
-bool
-CreateDumpForSOS(const char* programPath, const char* dumpPathTemplate, pid_t pid, MINIDUMP_TYPE minidumpType, ICLRDataTarget* dataTarget)
-{
- ReleaseHolder crashInfo = new CrashInfo(pid, dataTarget, true);
- return CreateDumpCommon(dumpPathTemplate, minidumpType, crashInfo);
-}
diff --git a/src/coreclr/src/debug/createdump/createdump.h b/src/coreclr/src/debug/createdump/createdump.h
index 7627fb6e8611b2..96afcab29199cf 100644
--- a/src/coreclr/src/debug/createdump/createdump.h
+++ b/src/coreclr/src/debug/createdump/createdump.h
@@ -11,16 +11,22 @@
extern bool g_diagnostics;
+#ifdef HOST_UNIX
#define TRACE(args...) \
if (g_diagnostics) { \
printf(args); \
}
+#else
+#define TRACE(args, ...)
+#endif
+#ifdef HOST_UNIX
#include "config.h"
+#endif
+#include
#include
#include
-#include
#include
#include
#include
@@ -34,11 +40,12 @@ extern bool g_diagnostics;
#include
#include
#include
-#include
typedef int T_CONTEXT;
#include
#include
#include
+#ifdef HOST_UNIX
+#include
#include
#include
#include
@@ -56,13 +63,24 @@ typedef int T_CONTEXT;
#include
#define __STDC_FORMAT_MACROS
#include
+#else
+#include
+#endif
#include