Remaining feedback from ILLink merge (#79677)
authorTlakaelel Axayakatl Ceja <tlakaelel.ceja@microsoft.com>
Thu, 22 Dec 2022 01:24:07 +0000 (17:24 -0800)
committerGitHub <noreply@github.com>
Thu, 22 Dec 2022 01:24:07 +0000 (17:24 -0800)
* 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

eng/Versions.props
src/tools/illink/PATENTS.TXT [deleted file]
src/tools/illink/README.md
src/tools/illink/ilasm.ilproj [deleted file]
src/tools/illink/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj
src/tools/illink/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj
src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILCompiler.cs

index 0c5a741..634fe53 100644 (file)
     <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>
     <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 -->
     <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>
     <!-- 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 -->
diff --git a/src/tools/illink/PATENTS.TXT b/src/tools/illink/PATENTS.TXT
deleted file mode 100644 (file)
index a868428..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-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.
index e4a0d37..66eacd9 100644 (file)
@@ -1,6 +1,6 @@
 # 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`.
diff --git a/src/tools/illink/ilasm.ilproj b/src/tools/illink/ilasm.ilproj
deleted file mode 100644 (file)
index b13fc40..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<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
index 7d1c6de..ad7814b 100644 (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>
index 1ac6ba3..e30470d 100644 (file)
@@ -2,7 +2,6 @@
 
   <PropertyGroup>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-    <DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);DEBUG</DefineConstants>
   </PropertyGroup>
 
   <ItemGroup>
     <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>
index 02bb2ed..7b5835d 100644 (file)
@@ -65,9 +65,9 @@ namespace Mono.Linker.Tests.TestCasesRunner
 #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;