Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Directory.Build.props23
-rw-r--r--Directory.Build.targets57
-rw-r--r--eng/Tools.props8
-rw-r--r--eng/Version.Details.xml4
-rw-r--r--eng/Versions.props3
-rw-r--r--illink.sln48
-rw-r--r--src/ILLink.Tasks/ILLink.Tasks.csproj60
-rw-r--r--src/analyzer/analyzer.csproj13
-rw-r--r--src/linker/Linker/DirectoryAssemblyResolver.cs4
-rw-r--r--src/linker/Mono.Linker.csproj21
-rw-r--r--src/linker/ref/Linker.Steps/BaseStep.cs18
-rw-r--r--src/linker/ref/Linker.Steps/IStep.cs10
-rw-r--r--src/linker/ref/Linker/Annotations.cs18
-rw-r--r--src/linker/ref/Linker/LinkContext.cs20
-rw-r--r--src/linker/ref/Mono.Linker.csproj23
-rw-r--r--test/Mono.Linker.Tests/Mono.Linker.Tests.csproj9
16 files changed, 236 insertions, 103 deletions
diff --git a/Directory.Build.props b/Directory.Build.props
index acf6e308c..f85d60a6c 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -2,8 +2,29 @@
<PropertyGroup>
<MonoBuild Condition="'$(MonoBuild)' == '' and '$(SolutionName)' == 'monolinker'">true</MonoBuild>
</PropertyGroup>
+
+ <PropertyGroup>
+ <IsReferenceAssembly Condition="'$(IsReferenceAssembly)' == '' and '$([System.IO.Path]::GetFileName($(MSBuildProjectDirectory)))' == 'ref'">true</IsReferenceAssembly>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(IsReferenceAssembly)' == 'true' ">
+ <ProduceOnlyReferenceAssembly>true</ProduceOnlyReferenceAssembly>
+ <!-- used by Arcade to compute OutputPath, IntermediateOutputPath, etc. early in the import chain. -->
+ <OutDirName>$(MSBuildProjectName)/ref</OutDirName>
+ <!-- don't try to publish PDBs for ref assemblies that have none. -->
+ <PublishWindowsPdb>false</PublishWindowsPdb>
+ <RunApiCompat>false</RunApiCompat>
+ </PropertyGroup>
+
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition="'$(MonoBuild)' == ''" />
+ <!-- Still use global versions even if not using arcade. -->
+ <Import Project="eng/Versions.props" Condition="'$(MonoBuild)' != ''" />
<PropertyGroup>
<IsPackable>false</IsPackable>
+ <PackageLicenseExpression>MIT</PackageLicenseExpression>
+ <_ToolsProjectTargets>$(ArtifactsToolsetDir)Common\Tools.proj.nuget.g.targets</_ToolsProjectTargets>
+ <!-- Set this to false to build against the submodule. Convenient for experimenting locally. -->
+ <UseCecilPackage Condition="'$(MonoBuild)' != '' And '$(UseCecilPackage)' == ''">false</UseCecilPackage>
+ <UseCecilPackage Condition="'$(UseCecilPackage)' == ''">true</UseCecilPackage>
</PropertyGroup>
-</Project> \ No newline at end of file
+
+</Project>
diff --git a/Directory.Build.targets b/Directory.Build.targets
index e149bf138..fd3affb32 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -1,8 +1,65 @@
<Project>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition="'$(MonoBuild)' == ''" />
+ <Import Project="$(_ToolsProjectTargets)" Condition="Exists('$(_ToolsProjectTargets)')" />
+
<Target Name="VSTestIfTestProject">
<CallTarget Targets="VSTest" Condition="'$(IsTestProject)' == 'true'" />
</Target>
+ <!-- set up ApiCompat with ref assemblies -->
+ <PropertyGroup Condition=" '$(RunApiCompat)' == 'true' ">
+ <ContractProject Condition="'$(ContractProject)' == ''">$(MSBuildProjectDirectory)\ref\$(MSBuildProjectName).csproj</ContractProject>
+ <HasMatchingContract Condition="Exists('$(ContractProject)')">true</HasMatchingContract>
+ <RunApiCompat Condition="'$(HasMatchingContract)' != 'true'">false</RunApiCompat>
+ </PropertyGroup>
+ <ItemGroup Condition="'$(HasMatchingContract)' == 'true' ">
+ <ProjectReference Include="$(ContractProject)">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ <OutputItemType>ResolvedMatchingContract</OutputItemType>
+ </ProjectReference>
+ </ItemGroup>
+
+ <!-- Shared logic to publish multiple projects in the same
+ package. Pack doesn't support including project references
+ (https://github.com/NuGet/Home/issues/3891), so we work around
+ this by explicitly including the publish output in the
+ package. -->
+ <PropertyGroup>
+ <IncludePublishOutput Condition="'$(IncludePublishOutput)' == ''">false</IncludePublishOutput>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(IncludePublishOutput)' == 'true'">
+ <!-- Don't include the build output. Instead, we want to include the TargetFramework-specific publish output. -->
+ <IncludeBuildOutput>false</IncludeBuildOutput>
+ <!-- Suppress NuGet warning for package which sets IncludeBuildOutput=false, see https://github.com/NuGet/Home/issues/8583 -->
+ <NoWarn>$(NoWarn);NU5128</NoWarn>
+ <!-- Option to include Json files in the package. Default is to just include dlls. -->
+ <IncludeJsonFilesInPackage Condition="'$(IncludeJsonFilesInPackage)' == ''">false</IncludeJsonFilesInPackage>
+ <!-- Use a NuGet extension point to publish and set up the package files. -->
+ <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_AddPublishOutputToPackage</TargetsForTfmSpecificContentInPackage>
+ </PropertyGroup>
+
+ <Target Name="_AddPublishOutputToPackage" Condition="'$(IncludePublishOutput)' == 'true'">
+ <PropertyGroup>
+ <PublishDir>$(BaseOutputPath)$(TargetFramework)</PublishDir>
+ </PropertyGroup>
+ <ItemGroup>
+ <ProjectsToPublish Include="$(MSBuildProjectFile)">
+ <AdditionalProperties>TargetFramework=$(TargetFramework);PublishDir=$(PublishDir)</AdditionalProperties>
+ </ProjectsToPublish>
+ </ItemGroup>
+ <!-- Clean the publish directory in case there are any left-over artifacts (publish does not work incrementally). -->
+ <ItemGroup>
+ <_FilesToDelete Remove="@(_FilesToDelete)" />
+ <_FilesToDelete Include="$(PublishDir)/*.dll" />
+ <_FilesToDelete Include="$(PublishDir)/*.json" />
+ </ItemGroup>
+ <Delete Files="@(_FilesToDelete)" />
+ <MSBuild Projects="@(ProjectsToPublish)" Targets="Publish" />
+ <ItemGroup>
+ <TfmSpecificPackageFile Include="$(PublishDir)/*.dll" PackagePath="$(BuildOutputTargetFolder)\$(TargetFramework)" />
+ <TfmSpecificPackageFile Include="$(PublishDir)/*.json" PackagePath="$(BuildOutputTargetFolder)\$(TargetFramework)" Condition="'$(IncludeJsonFilesInPackage)' == 'true'" />
+ </ItemGroup>
+ </Target>
+
</Project>
diff --git a/eng/Tools.props b/eng/Tools.props
new file mode 100644
index 000000000..494d20897
--- /dev/null
+++ b/eng/Tools.props
@@ -0,0 +1,8 @@
+<Project>
+
+ <!-- This file is an Arcade extension point that specifies additional tools to restore. -->
+ <ItemGroup>
+ <PackageReference Include="Microsoft.DotNet.ApiCompat" Version="$(MicrosoftDotNetApiCompatVersion)" />
+ </ItemGroup>
+
+</Project> \ No newline at end of file
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index cd189bfae..62c8c2f11 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -7,5 +7,9 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>7dbc907fa03eacf4c57f827cb4235d77b7ed4fcd</Sha>
</Dependency>
+ <Dependency Name="Microsoft.DotNet.ApiCompat" Version="5.0.0-beta.20162.4">
+ <Uri>https://github.com/dotnet/arcade</Uri>
+ <Sha />
+ </Dependency>
</ToolsetDependencies>
</Dependencies>
diff --git a/eng/Versions.props b/eng/Versions.props
index 419ba90a2..1453ba247 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -12,5 +12,8 @@
<SystemReflectionMetadataVersion>1.5.0</SystemReflectionMetadataVersion>
<MicrosoftBuildFrameworkVersion>15.4.8</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildUtilitiesCoreVersion>15.4.8</MicrosoftBuildUtilitiesCoreVersion>
+ <MicrosoftDotNetApiCompatVersion>5.0.0-beta.20162.4</MicrosoftDotNetApiCompatVersion>
+ <!-- We depend on (and redistribute) the official Mono.Cecil NuGet package built from https://github.com/jbevain/cecil -->
+ <MonoCecilVersion>0.11.2</MonoCecilVersion>
</PropertyGroup>
</Project>
diff --git a/illink.sln b/illink.sln
index 3a0216dd4..a15aa2b35 100644
--- a/illink.sln
+++ b/illink.sln
@@ -3,10 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.Cecil.Pdb", "external\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj", "{63E6915C-7EA4-4D76-AB28-0D7191EEA626}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.Cecil", "external\cecil\Mono.Cecil.csproj", "{D68133BD-1E63-496E-9EDE-4FBDBF77B486}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mono.Linker", "src\linker\Mono.Linker.csproj", "{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILLink.Tasks", "src\ILLink.Tasks\ILLink.Tasks.csproj", "{A7A026C4-DEB4-4EF6-963E-17E7B98A6527}"
@@ -25,6 +21,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "analyzer", "analyzer", "{AA
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "analyzer", "src\analyzer\analyzer.csproj", "{96182221-C5C4-436D-9BE0-EC499F9BAF17}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{AC840E16-5507-436F-B9B1-46DB20FD395D}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "linker", "linker", "{80AE2045-E62C-4CD6-93E6-8ED34011B457}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Linker", "src\linker\ref\Mono.Linker.csproj", "{C7338775-E3F2-413D-82FD-C5B5B1455B19}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -35,30 +37,6 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Debug|x64.ActiveCfg = Debug|Any CPU
- {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Debug|x64.Build.0 = Debug|Any CPU
- {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Debug|x86.ActiveCfg = Debug|Any CPU
- {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Debug|x86.Build.0 = Debug|Any CPU
- {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|Any CPU.Build.0 = Release|Any CPU
- {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|x64.ActiveCfg = Release|Any CPU
- {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|x64.Build.0 = Release|Any CPU
- {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|x86.ActiveCfg = Release|Any CPU
- {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|x86.Build.0 = Release|Any CPU
- {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x64.ActiveCfg = Debug|Any CPU
- {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x64.Build.0 = Debug|Any CPU
- {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x86.ActiveCfg = Debug|Any CPU
- {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x86.Build.0 = Debug|Any CPU
- {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.Build.0 = Release|Any CPU
- {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x64.ActiveCfg = Release|Any CPU
- {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x64.Build.0 = Release|Any CPU
- {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.ActiveCfg = Release|Any CPU
- {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.Build.0 = Release|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -143,6 +121,18 @@ Global
{96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|x64.Build.0 = Release|Any CPU
{96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|x86.ActiveCfg = Release|Any CPU
{96182221-C5C4-436D-9BE0-EC499F9BAF17}.Release|x86.Build.0 = Release|Any CPU
+ {C7338775-E3F2-413D-82FD-C5B5B1455B19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C7338775-E3F2-413D-82FD-C5B5B1455B19}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C7338775-E3F2-413D-82FD-C5B5B1455B19}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {C7338775-E3F2-413D-82FD-C5B5B1455B19}.Debug|x64.Build.0 = Debug|Any CPU
+ {C7338775-E3F2-413D-82FD-C5B5B1455B19}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {C7338775-E3F2-413D-82FD-C5B5B1455B19}.Debug|x86.Build.0 = Debug|Any CPU
+ {C7338775-E3F2-413D-82FD-C5B5B1455B19}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C7338775-E3F2-413D-82FD-C5B5B1455B19}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C7338775-E3F2-413D-82FD-C5B5B1455B19}.Release|x64.ActiveCfg = Release|Any CPU
+ {C7338775-E3F2-413D-82FD-C5B5B1455B19}.Release|x64.Build.0 = Release|Any CPU
+ {C7338775-E3F2-413D-82FD-C5B5B1455B19}.Release|x86.ActiveCfg = Release|Any CPU
+ {C7338775-E3F2-413D-82FD-C5B5B1455B19}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -153,6 +143,8 @@ Global
{2C26601F-3E2F-45B9-A02F-58EE9296E19E} = {A879F5FC-D6C9-4ED4-BEAE-03B5CCE3C136}
{10249F19-1B72-4087-AF7F-C95B7672B204} = {A879F5FC-D6C9-4ED4-BEAE-03B5CCE3C136}
{96182221-C5C4-436D-9BE0-EC499F9BAF17} = {AA0569FB-73E9-4B42-9A19-714BB1229DAE}
+ {80AE2045-E62C-4CD6-93E6-8ED34011B457} = {AC840E16-5507-436F-B9B1-46DB20FD395D}
+ {C7338775-E3F2-413D-82FD-C5B5B1455B19} = {80AE2045-E62C-4CD6-93E6-8ED34011B457}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E43A3901-42B0-48CA-BB36-5CD40A99A6EE}
diff --git a/src/ILLink.Tasks/ILLink.Tasks.csproj b/src/ILLink.Tasks/ILLink.Tasks.csproj
index 80969b0c6..99af162cc 100644
--- a/src/ILLink.Tasks/ILLink.Tasks.csproj
+++ b/src/ILLink.Tasks/ILLink.Tasks.csproj
@@ -1,25 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
+ <!-- Keep these in sync with _ILLinkTasksTFM in Sdk.props. -->
<TargetFrameworks>netcoreapp3.0;net472</TargetFrameworks>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
- <IsPackable>true</IsPackable>
- <PackageLicenseExpression>MIT</PackageLicenseExpression>
<Description>MSBuild tasks for running the IL Linker</Description>
- <!-- Don't include the build output. Instead, we want to include
- the TargetFramework-specific publish output. -->
- <IncludeBuildOutput>false</IncludeBuildOutput>
- <!-- Suppress NuGet warning for package which sets IncludeBuildOutput=false, see https://github.com/NuGet/Home/issues/8583 -->
- <NoWarn>$(NoWarn);NU5128</NoWarn>
+ <LangVersion>latest</LangVersion>
+ <IsPackable>true</IsPackable>
<!-- We want to package the tasks package together with its
transitive dependencies and the linker, without marking them
- as dependencies in the tasks package.
-
- Pack doesn't support including project references
- (https://github.com/NuGet/Home/issues/3891), so we work
- around this by explicitly including the publish output in the
- package. -->
- <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_LayoutPackage</TargetsForTfmSpecificContentInPackage>
- <LangVersion>latest</LangVersion>
+ as dependencies in the tasks package. -->
+ <IncludePublishOutput>true</IncludePublishOutput>
+ <!-- Include deps.json and runtimeconfig.json since we run illink.dll as a separate process. -->
+ <IncludeJsonFilesInPackage>true</IncludeJsonFilesInPackage>
+ <BuildOutputTargetFolder>tools</BuildOutputTargetFolder>
+ <!-- Recommended by arcade for tools projects. generates an assembly version that includes patch number derived from date and build revision -->
+ <AutoGenerateAssemblyVersion>true</AutoGenerateAssemblyVersion>
+ <!-- Place linker and cecil alongside ILLink.Tasks in the output, for integration tests. -->
+ <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
@@ -43,42 +40,13 @@
</Content>
</ItemGroup>
- <Target Name="_LayoutPackage">
-
- <PropertyGroup>
- <PublishDir>$(BaseOutputPath)$(TargetFramework)</PublishDir>
- </PropertyGroup>
-
- <ItemGroup>
- <ProjectsToPublish Include="$(MSBuildProjectFile)">
- <AdditionalProperties>TargetFramework=$(TargetFramework);PublishDir=$(PublishDir)</AdditionalProperties>
- </ProjectsToPublish>
- </ItemGroup>
-
- <!-- Clean the publish directory in case there are any left-over
- artifacts (publish does not work incrementally). -->
- <ItemGroup>
- <_FilesToDelete Remove="@(_FilesToDelete)" />
- <_FilesToDelete Include="$(PublishDir)/*.dll" />
- <_FilesToDelete Include="$(PublishDir)/*.json" />
- </ItemGroup>
- <Delete Files="@(_FilesToDelete)" />
-
- <MSBuild Projects="@(ProjectsToPublish)" Targets="Publish" />
- <ItemGroup>
- <TfmSpecificPackageFile Include="$(PublishDir)/*.dll" PackagePath="tools\$(TargetFramework)" />
- <TfmSpecificPackageFile Include="$(PublishDir)/*.json" PackagePath="tools\$(TargetFramework)" />
- </ItemGroup>
-
- </Target>
-
<ItemGroup>
<ProjectReference Include="../linker/Mono.Linker.csproj" PrivateAssets="All" />
- <ProjectReference Include="../../external/cecil/Mono.Cecil.csproj" PrivateAssets="All" />
+ <PackageReference Condition="'$(UseCecilPackage)' == 'true'" Include="Mono.Cecil" Version="$(MonoCecilVersion)" PrivateAssets="All" />
+ <ProjectReference Condition="'$(UseCecilPackage)' != 'true'" Include="../../external/cecil/Mono.Cecil.csproj" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
-
<!-- We use private assets for the Microsoft.Build packages to
prevent them from being published with the tasks dll, because
these are already a part of the SDK. -->
diff --git a/src/analyzer/analyzer.csproj b/src/analyzer/analyzer.csproj
index 2e56fb5ff..d5fa0d344 100644
--- a/src/analyzer/analyzer.csproj
+++ b/src/analyzer/analyzer.csproj
@@ -17,18 +17,9 @@
<TargetFrameworks>net471</TargetFrameworks>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
- <DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
- <Optimize Condition="'$(Optimize)' == ''">false</Optimize>
- </PropertyGroup>
-
- <PropertyGroup Condition="'$(Configuration)' == 'Release'">
- <Optimize Condition="'$(Optimize)' == ''">true</Optimize>
- </PropertyGroup>
-
<ItemGroup>
- <ProjectReference Include="../../external/cecil/Mono.Cecil.csproj">
- </ProjectReference>
+ <PackageReference Condition="'$(UseCecilPackage)' == 'true'" Include="Mono.Cecil" Version="$(MonoCecilVersion)" />
+ <ProjectReference Condition="'$(UseCecilPackage)' != 'true'" Include="../../external/cecil/Mono.Cecil.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(MonoBuild)' == ''">
diff --git a/src/linker/Linker/DirectoryAssemblyResolver.cs b/src/linker/Linker/DirectoryAssemblyResolver.cs
index e3aa534a4..beae353eb 100644
--- a/src/linker/Linker/DirectoryAssemblyResolver.cs
+++ b/src/linker/Linker/DirectoryAssemblyResolver.cs
@@ -1,3 +1,7 @@
+// 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.
+
using System;
using System.Reflection;
using System.Collections.Generic;
diff --git a/src/linker/Mono.Linker.csproj b/src/linker/Mono.Linker.csproj
index 1ca9a4023..197989ea2 100644
--- a/src/linker/Mono.Linker.csproj
+++ b/src/linker/Mono.Linker.csproj
@@ -3,7 +3,6 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<RootNamespace>Mono</RootNamespace>
- <Version>0.2.0.0</Version>
<Configurations>Debug;Release</Configurations>
<LangVersion>latest</LangVersion>
</PropertyGroup>
@@ -12,6 +11,7 @@
<AssemblyName>illink</AssemblyName>
<Description>IL Linker</Description>
<DefineConstants>$(DefineConstants);FEATURE_ILLINK</DefineConstants>
+ <!-- Ensure that this netcore TFM matches that in LinkTask.cs's ILLinkPath. -->
<TargetFrameworks>netcoreapp3.0;net471</TargetFrameworks>
</PropertyGroup>
@@ -23,15 +23,9 @@
<TargetFrameworks>net471</TargetFrameworks>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
- <DefineConstants>$(DefineConstants);DEBUG</DefineConstants>
- <DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
- <Optimize Condition="'$(Optimize)' == ''">false</Optimize>
- </PropertyGroup>
-
- <PropertyGroup Condition="'$(Configuration)' == 'Release'">
- <Optimize Condition="'$(Optimize)' == ''">true</Optimize>
- </PropertyGroup>
+ <ItemGroup>
+ <Compile Remove="ref\**\*.cs" />
+ </ItemGroup>
<ItemGroup Condition="'$(MonoBuild)' == ''">
<Compile Remove="Linker\I18nAssemblies.cs" />
@@ -42,8 +36,9 @@
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\..\external\cecil\Mono.Cecil.csproj" />
- <ProjectReference Include="..\..\external\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj" />
+ <PackageReference Condition="'$(UseCecilPackage)' == 'true'" Include="Mono.Cecil" Version="$(MonoCecilVersion)" />
+ <ProjectReference Condition="'$(UseCecilPackage)' != 'true'" Include="..\..\external\cecil\Mono.Cecil.csproj" />
+ <ProjectReference Condition="'$(UseCecilPackage)' != 'true'" Include="..\..\external\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(MonoBuild)' == ''">
@@ -51,7 +46,7 @@
</ItemGroup>
<ItemGroup Condition="'$(MonoBuild)' != ''">
- <ProjectReference Include="..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb.csproj" />
+ <ProjectReference Condition="'$(UseCecilPackage)' != 'true'" Include="..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb.csproj" />
</ItemGroup>
<!-- When publishing illink as a dependency of ILLink.Tasks, we want
diff --git a/src/linker/ref/Linker.Steps/BaseStep.cs b/src/linker/ref/Linker.Steps/BaseStep.cs
new file mode 100644
index 000000000..9e0fb53e1
--- /dev/null
+++ b/src/linker/ref/Linker.Steps/BaseStep.cs
@@ -0,0 +1,18 @@
+// 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.
+
+using Mono.Cecil;
+
+namespace Mono.Linker.Steps {
+
+ public abstract class BaseStep : IStep {
+ public LinkContext Context { get { throw null; } }
+ public AnnotationStore Annotations { get { throw null; } }
+ public void Process (LinkContext context) { throw null; }
+ protected virtual bool ConditionToProcess () { throw null; }
+ protected virtual void Process () { throw null; }
+ protected virtual void EndProcess () { throw null; }
+ protected virtual void ProcessAssembly (AssemblyDefinition assembly) { throw null; }
+ }
+}
diff --git a/src/linker/ref/Linker.Steps/IStep.cs b/src/linker/ref/Linker.Steps/IStep.cs
new file mode 100644
index 000000000..53a3cd007
--- /dev/null
+++ b/src/linker/ref/Linker.Steps/IStep.cs
@@ -0,0 +1,10 @@
+// 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 Mono.Linker.Steps {
+
+ public interface IStep {
+ void Process (LinkContext context);
+ }
+}
diff --git a/src/linker/ref/Linker/Annotations.cs b/src/linker/ref/Linker/Annotations.cs
new file mode 100644
index 000000000..12fb2d6dc
--- /dev/null
+++ b/src/linker/ref/Linker/Annotations.cs
@@ -0,0 +1,18 @@
+// 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.
+
+using System;
+using System.Collections.Generic;
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+
+namespace Mono.Linker {
+
+ public partial class AnnotationStore
+ {
+ internal AnnotationStore() {}
+ public void Mark (IMetadataTokenProvider provider) { throw null; }
+ public void Mark (CustomAttribute attribute) { throw null; }
+ }
+}
diff --git a/src/linker/ref/Linker/LinkContext.cs b/src/linker/ref/Linker/LinkContext.cs
new file mode 100644
index 000000000..0b9605467
--- /dev/null
+++ b/src/linker/ref/Linker/LinkContext.cs
@@ -0,0 +1,20 @@
+// 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.
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+
+namespace Mono.Linker {
+
+ public class LinkContext
+ {
+ internal LinkContext () { }
+ public AnnotationStore Annotations { get { throw null; } }
+ public TypeDefinition GetType (string fullName) { throw null; }
+ }
+}
diff --git a/src/linker/ref/Mono.Linker.csproj b/src/linker/ref/Mono.Linker.csproj
new file mode 100644
index 000000000..e456bbd7b
--- /dev/null
+++ b/src/linker/ref/Mono.Linker.csproj
@@ -0,0 +1,23 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <RootNamespace>Mono</RootNamespace>
+ <LangVersion>latest</LangVersion>
+ <AssemblyName>illink</AssemblyName>
+ <Description>IL Linker</Description>
+ <TargetFramework>netstandard2.0</TargetFramework>
+ <IsPackable>true</IsPackable>
+ <!-- Nuget issues a warning about missing <reference> items in the generated nuspec,
+ used for packages.config which we do not support. -->
+ <NoWarn>$(NoWarn);NU5131</NoWarn>
+ <!-- We need to create a package that includes the build output of the cecil projectreference below. -->
+ <IncludeBuildOutput>true</IncludeBuildOutput>
+ <BuildOutputTargetFolder>ref</BuildOutputTargetFolder>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Condition="'$(UseCecilPackage)' == 'true'" Include="Mono.Cecil" Version="$(MonoCecilVersion)" />
+ <ProjectReference Condition="'$(UseCecilPackage)' != 'true'" Include="..\..\..\external\cecil\Mono.Cecil.csproj" />
+ </ItemGroup>
+
+</Project>
diff --git a/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj b/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj
index 2e93533ee..64455b6ae 100644
--- a/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj
+++ b/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj
@@ -1,4 +1,4 @@
-<Project>
+<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
@@ -24,8 +24,9 @@
<Folder Include="Extensions\" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\..\external\cecil\Mono.Cecil.csproj" />
- <ProjectReference Include="..\..\external\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj" />
+ <PackageReference Condition="'$(UseCecilPackage)' == 'true'" Include="Mono.Cecil" Version="$(MonoCecilVersion)" />
+ <ProjectReference Condition="'$(UseCecilPackage)' != 'true'" Include="..\..\external\cecil\Mono.Cecil.csproj" />
+ <ProjectReference Condition="'$(UseCecilPackage)' != 'true'" Include="..\..\external\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj" />
<ProjectReference Include="..\..\src\linker\Mono.Linker.csproj" />
<ProjectReference Include="..\Mono.Linker.Tests.Cases\Mono.Linker.Tests.Cases.csproj" />
<ProjectReference Include="..\Mono.Linker.Tests.Cases.Expectations\Mono.Linker.Tests.Cases.Expectations.csproj" />
@@ -58,7 +59,7 @@
</Target>
<ItemGroup Condition="'$(MonoBuild)' != ''">
- <ProjectReference Include="..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb.csproj" />
+ <ProjectReference Condition="'$(UseCecilPackage)' != 'true'" Include="..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb.csproj" />
<PackageReference Include="NUnit" Version="3.10.0" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.10.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />