diff options
author | Sven Boemer <sbomer@gmail.com> | 2020-03-25 21:44:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-25 21:44:04 +0300 |
commit | 8f766ba708a50b789496ce534b7a326a7aae6f0e (patch) | |
tree | 6bb19a77f829216b3740fc14c9e45fe8a83e8e04 /test | |
parent | eb4ae9b9ed0f9de2f1cb97b97d392f78524791d1 (diff) |
Add reference assembly build (#1014)
* Add reference assembly build
This adds a new project that builds a reference assembly for some of
the surface area of the linker. The package is called illink. We
should finalize the name before releasing an official package. This
leaves a number of problems unsolved (described below), but provides
something we can use to start experimenting.
The preliminary included surface area contains public members of
BaseStep and its dependencies, in the FEATURE_ILLINK build flavor -
which notably makes the ref assembly incompatible with the monolinker
surface area. (illink has an AssemblyResolver derived from
Mono.Linker.DirectoryAssemblyResolver, whereas monolinker has one
derived from Mono.Cecil.BaseAssemblyResolver). Therefore the reference
assembly is currently designed for consumption by illink plugins, not
by monolinker plugins.
The reference assembly is built for netstandard2.0, chosen because it
is the lowest common denominator for netcoreapp3.0 and net471, the
TFMs for which we currently build Mono.Linker. The illink flavor
actually doesn't need to be built for net471 (only ILLink.Tasks does),
so we could choose a higher version of netstandard if we disabled that
build flavor.
The ref assembly package is unusual in a few ways, described below. We
may be able to change some of these quirks once we have a better
picture of how linker plugins will be produced and consumed.
- The package *does not* contain any implementation assemblies,
because it is not designed to be consumed by a project targeting a
platform TFM - rather it is only designed to be consumed
from *libraries* that will act as linker plugins. Attempting to
consume it directly from a netcoreapp3.0 project will work during
build, but will fail to locate illink.dll at runtime.
- The package *does not* have a transitive package dependency on
Mono.Cecil (nor does it include Mono.Cecil). This is because the
reference assembly is built against a submodule of the cecil sources,
so we do not have direct control over the package version. This
requires the custom step developer to add a dependency on Mono.Cecil.
To consume this package in a custom step, the custom step project
should:
- Target a netstandard version compatible with the reference
assembly's target framework (currently netstandard2.0).
- Include a dependency on Mono.Cecil compatible with the version
referenced during the linker build (currently 0:11:1:0, which
incidentally ships in the official Mono.Cecil package version
11.1). Attempting to use a higher version (the current latest release
is 11.2) will result in the linker failing to load the custom step.
* Add cecil to the package
This adds a new project which builds reference assemblies for
cecil. It should be kept in sync with the upstream cecil project
file. The cecil reference assembly is included into the illink package
alongside the illink.dll reference assembly.
Also prevent arcade from trying to upload a non-existent PDB for a ref
assembly.
* Set up ApiCompat
* Use .NET Foundation file header
* Pare down ref surface area
- Remove most members of Annotations
- Remove MarkingHelpers and references to it
- Remove protected members of LinkContext
- Remove UninitializedContextFactory and references to it
- Remove AssemblyResolver and references to it
* Fix undefined ExpectedFeedUrl error
The error was occurring because the early import of the Tools targets
was including Microsoft.DotNet.Build.Tasks.Feed.targets, which changed
the DefaultTargets to a publish-related target. Importing the Tools
targets later prevents overriding the DefaultTargets, causing building
to work as expected.
* Add back AnnotationStore ctor
Otherwise the implicitly-defined default ctor exists in the ref but
not the implementation. This was caught by ApiCompat.
* Build against official Mono.Cecil package
This adds an option to build against the submodule for local
development, but the new default is to build against the package.
* Minor project file cleanup
* Remove left-over files
* Further restrict public surface
* Build fix
* UseLocalCecil -> UseCecilPackage
* Use local cecil for monolinker build
* Remove Version from Mono.Linker projects
This will result in the version being taken from VersionPrefix
in Directory.Build.Props, matching the package version.
* Remove left-over reference to cecil ref build
* Copy package dependencies to ILLink.Tasks build output
This preserves the behavior of the ProjectReference dependencies,
which are always copied. The integration tests expect to find the
linker and cecil alongside ILLink.Tasks in the build output.
* Remove AssemblyAction
Co-authored-by: Marek Safar <marek.safar@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/Mono.Linker.Tests/Mono.Linker.Tests.csproj | 9 |
1 files changed, 5 insertions, 4 deletions
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" /> |