未验证 提交 d3560881 编写于 作者: T Tlakaelel Axayakatl Ceja 提交者: GitHub

Remaining feedback from ILLink merge (#79677)

* Remaining feedback from ILLink merge
Move ILLink MSBuild dependencies into Versions.props MSBuild section, and use a consistent MSBuild version
Update the readme from linker to state is a project and not a repository
Uses a live build of ilasm instead of relying on prebuilt bits from Microsoft.NET.Sdk.IL
Remove a unnecesary DefineConstant that is imported via SDK
Avoid having hardcoded package versions
Removes the illink PATENTS.txt, runtime's PATENTS.txt already takes into account Mono given that it has a mono partition
上级 8d663721
......@@ -135,9 +135,11 @@
<SystemSecurityCryptographyCngVersion>5.0.0</SystemSecurityCryptographyCngVersion>
<SystemSecurityCryptographyOpenSslVersion>5.0.0</SystemSecurityCryptographyOpenSslVersion>
<SystemSecurityPrincipalWindowsVersion>5.0.0</SystemSecurityPrincipalWindowsVersion>
<SystemSecurityPermissionsVersion>7.0.0</SystemSecurityPermissionsVersion>
<SystemServiceModelPrimitivesVersion>4.9.0</SystemServiceModelPrimitivesVersion>
<SystemTextJsonVersion>8.0.0-alpha.1.22611.2</SystemTextJsonVersion>
<SystemRuntimeCompilerServicesUnsafeVersion>6.0.0</SystemRuntimeCompilerServicesUnsafeVersion>
<SystemThreadingAccessControlVersion>7.0.0</SystemThreadingAccessControlVersion>
<SystemThreadingTasksExtensionsVersion>4.5.4</SystemThreadingTasksExtensionsVersion>
<SystemValueTupleVersion>4.5.0</SystemValueTupleVersion>
<runtimenativeSystemIOPortsVersion>8.0.0-alpha.1.22611.2</runtimenativeSystemIOPortsVersion>
......@@ -172,6 +174,8 @@
<DNNEVersion>1.0.27</DNNEVersion>
<MicrosoftBuildVersion>17.3.2</MicrosoftBuildVersion>
<MicrosoftBuildTasksCoreVersion>$(MicrosoftBuildVersion)</MicrosoftBuildTasksCoreVersion>
<MicrosoftBuildFrameworkVersion>$(MicrosoftBuildVersion)</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildUtilitiesCoreVersion>$(MicrosoftBuildVersion)</MicrosoftBuildUtilitiesCoreVersion>
<NugetProjectModelVersion>6.2.2</NugetProjectModelVersion>
<NugetPackagingVersion>6.2.2</NugetPackagingVersion>
<!-- Testing -->
......@@ -184,6 +188,8 @@
<XUnitVersion>2.4.2</XUnitVersion>
<XUnitAnalyzersVersion>1.0.0</XUnitAnalyzersVersion>
<XUnitRunnerVisualStudioVersion>2.4.5</XUnitRunnerVisualStudioVersion>
<NUnitVersion>3.12.0</NUnitVersion>
<NUnitTestAdapterVersion>4.1.0</NUnitTestAdapterVersion>
<CoverletCollectorVersion>3.1.2</CoverletCollectorVersion>
<NewtonsoftJsonVersion>13.0.1</NewtonsoftJsonVersion>
<NewtonsoftJsonBsonVersion>1.0.2</NewtonsoftJsonBsonVersion>
......@@ -210,9 +216,6 @@
<!-- Mono Cecil -->
<MicrosoftDotNetCecilVersion>0.11.4-alpha.22619.1</MicrosoftDotNetCecilVersion>
<MicrosoftDotNetCecilPdbVersion>0.11.4-alpha.22619.1</MicrosoftDotNetCecilPdbVersion>
<!-- ILLink dependencies -->
<MicrosoftBuildFrameworkVersion>17.0.0-preview-21267-01</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildUtilitiesCoreVersion>17.0.0-preview-21267-01</MicrosoftBuildUtilitiesCoreVersion>
<!-- ICU -->
<MicrosoftNETCoreRuntimeICUTransportVersion>8.0.0-alpha.1.22612.1</MicrosoftNETCoreRuntimeICUTransportVersion>
<!-- MsQuic -->
......
Microsoft Patent Promise for Mono
Microsoft Corporation and its affiliates (“Microsoft”) promise not to
assert any Applicable Patents against you for making, using, selling,
offering for sale, importing, or distributing Mono.
If you file, maintain, or voluntarily participate in any claim in a
lawsuit alleging direct or contributory patent infringement by Mono,
or inducement of patent infringement by Mono, then your rights under
this promise will automatically terminate.
This promise is not an assurance that (i) any Applicable Patents are
valid or enforceable or (ii) Mono does not infringe patents or other
intellectual property rights of any third party. No rights except
those expressly stated in this promise are granted, waived or received
by Microsoft, whether by implication, exhaustion, estoppel or
otherwise. This is a personal promise directly from Microsoft to you,
and you agree as a condition of benefitting from it that no Microsoft
rights are received from suppliers, distributors, or otherwise in
connection with this promise.
Definitions:
“Mono” means those portions of the software development technology, as
originally distributed by Xamarin, Inc. or the .NET Foundation under
the name “Mono,” that implement .NET Framework Functionality, provided
that such portions at a minimum implement all of the required parts of
the mandatory provisions of Standard ECMA-335 – Common Language
Infrastructure (CLI).
“.NET Framework Functionality” means any functionality in Microsoft’s
.NET Framework as described in Microsoft’s API documentation on
Microsoft’s MSDN website, including the functionality in
Windowsbase.dll, but excluding all other functionality in the Windows
Presentation Foundation component of .NET Framework.
“Applicable Patents” are those patent claims, currently owned by
Microsoft and acquired in the future, that are necessarily infringed
by Mono. For clarity, Applicable Patents do not include any patent
claims that are infringed (x) by any underlying or enabling technology
that may be used, combined, or distributed in connection with Mono
(such as hardware, operating systems, or applications that run on
Mono), (y) only as a consequence of modification of Mono, or (z) only
by the combination of Mono with third party code.
# Trimming Tools
This repository hosts various tools and msbuild tasks which are used when trimming managed applications with .NET 5 and newer.
This project hosts various tools and msbuild tasks which are used when trimming managed applications with modern .NET.
## IL Trimmer
......@@ -22,26 +22,4 @@ The [tlens](src/tlens/README.md) is another tool for developers which can be use
Another tool available for developers is implemented as [Roslyn Analyzer](src/ILLink.RoslynAnalyzer) which runs on source code and warns developers about code patterns and APIs which are problematic when building code which could be used with trimmed apps.
# Contributing
We welcome contributions! Many developers have helped make this project better by reporting [issues](https://github.com/dotnet/linker/issues) or contributing [pull requests](https://github.com/dotnet/linker/pulls).
## How to build all projects
There is a shell script available in the root folder which can build the whole project and much more (build.cmd on Windows).
```sh
./build.sh
```
## Running tests from CLI
The same script can be used to run all tests from the terminal. We also have integration into Visual Studio and individual tests or whole test suites can be run within IDE as well.
```sh
./build.sh -test
```
## CI Build & Test Status
[![Build Status](https://dev.azure.com/dnceng-public/public/_apis/build/status/dotnet/linker-ci?definitionId=105&branchName=main)](https://dev.azure.com/dnceng-public/public/_build/latest?definitionId=105&branchName=main)
We welcome contributions! Many developers have helped make this project better by reporting [issues](https://github.com/dotnet/runtime/issues) or contributing [pull requests](https://github.com/dotnet/runtime/pulls) and tagging with the label `area-Tools-ILLink`.
<Project Sdk="Microsoft.NET.Sdk.IL">
<!-- This project exists solely to restore ilasm for use in the test
project. -->
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<Target Name="CopyILAsmTool" DependsOnTargets="ResolveIlasmToolPaths" Condition="'$(MonoBuild)' == ''">
<PropertyGroup>
<IlasmFileName Condition=" '$(OS)' != 'Windows_NT' ">ilasm</IlasmFileName>
<IlasmFileName Condition=" '$(OS)' == 'Windows_NT' ">ilasm.exe</IlasmFileName>
</PropertyGroup>
<Copy SourceFiles="$(_IlasmDir)\$(IlasmFileName)" DestinationFolder="$(ArtifactsDir)tools\ilasm" />
</Target>
</Project>
\ No newline at end of file
......@@ -68,7 +68,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Security.Permissions" Version="5.0.0" />
<PackageReference Include="System.Security.Permissions" Version="$(SystemSecurityPermissionsVersion)" />
</ItemGroup>
</Project>
......@@ -2,7 +2,6 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);DEBUG</DefineConstants>
</PropertyGroup>
<ItemGroup>
......@@ -18,30 +17,25 @@
<PackageReference Include="Microsoft.DotNet.Cecil.Pdb" Version="$(MicrosoftDotNetCecilPdbVersion)" PrivateAssets="All" Publish="True" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisVersion)" />
<ProjectReference Include="$(RepoRoot)\src\coreclr\tools\ILVerification\ILVerification.csproj" />
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
<PackageReference Include="nunit" Version="$(NUnitVersion)" />
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnitTestAdapterVersion)" />
<!-- This reference is purely so that the linker can resolve this
dependency of mscorlib. It is not actually required to build
the tests. -->
<PackageReference Include="System.Threading.AccessControl" Version="5.0.0" />
<PackageReference Include="System.Threading.AccessControl" Version="$(SystemThreadingAccessControlVersion)" />
<ProjectReference Include="..\..\src\linker\Mono.Linker.csproj" SkipUseReferenceAssembly="true" />
<ProjectReference Include="..\Mono.Linker.Tests.Cases\Mono.Linker.Tests.Cases.csproj" />
<ProjectReference Include="..\Mono.Linker.Tests.Cases.Expectations\Mono.Linker.Tests.Cases.Expectations.csproj" />
</ItemGroup>
<Target Name="PrepareTools" BeforeTargets="Build">
<!-- Restore ilasm using ilasm.ilproj. Restore must be done
separately from copy with a different set of input
properties, to force MSBuild to re-evaluate using new props
and targets from the restored package. -->
<PropertyGroup>
<IlasmProject>$(MSBuildThisFileDirectory)../../ilasm.ilproj</IlasmProject>
</PropertyGroup>
<MSBuild Projects="$(IlasmProject)" Targets="Restore" />
<MSBuild Projects="$(IlasmProject)" Targets="CopyILAsmTool" />
</Target>
<!-- Tests require ilasm so we make sure that it is live built before executing the tests. -->
<ItemGroup>
<ProjectReference Include="$(CoreClrProjectRoot)runtime.proj"
AdditionalProperties="ClrILToolsSubset=true;Configuration=$(CoreCLRConfiguration)"
ReferenceOutputAssembly="false"
SkipGetTargetFrameworkProperties="true" />
</ItemGroup>
<ItemGroup>
<None Update="TestCases\Dependencies\PInvokesExpectations.json">
......@@ -57,6 +51,9 @@
<RuntimeHostConfigurationOption Include="Mono.Linker.Tests.ArtifactsDir">
<Value>$(ArtifactsDir)</Value>
</RuntimeHostConfigurationOption>
<RuntimeHostConfigurationOption Include="Mono.Linker.Tests.ILToolsDir">
<Value>$(CoreCLRArtifactsPath)</Value>
</RuntimeHostConfigurationOption>
<RuntimeHostConfigurationOption Include="Mono.Linker.Tests.ArtifactsBinDir">
<Value>$(ArtifactsBinDir)</Value>
</RuntimeHostConfigurationOption>
......
......@@ -65,9 +65,9 @@ protected virtual NPath LocateIlasm ()
#if NETCOREAPP
var extension = RuntimeInformation.IsOSPlatform (OSPlatform.Windows) ? ".exe" : "";
var toolsDir = Path.Combine((string)AppContext.GetData("Mono.Linker.Tests.ArtifactsDir")!, "tools");
var toolsDir = (string)AppContext.GetData("Mono.Linker.Tests.ILToolsDir")!;
var ilasmPath = Path.GetFullPath (Path.Combine (toolsDir, "ilasm", $"ilasm{extension}")).ToNPath ();
var ilasmPath = Path.GetFullPath (Path.Combine (toolsDir, $"ilasm{extension}")).ToNPath ();
if (ilasmPath.FileExists ())
return ilasmPath;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册