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:
authorSven Boemer <sbomer@gmail.com>2017-06-09 19:44:36 +0300
committerMarek Safar <marek.safar@gmail.com>2017-06-09 19:44:36 +0300
commit92eb1e00dda1244d6621f334d491cfdd98a26008 (patch)
tree1b7d0d3a925830414d2f7b485a39a7037f92622e
parent8609d3a5e4fa5ce3c5e7fc7f20d35986349bfa80 (diff)
Set up task package to build for multiple tfms (#129)
-rw-r--r--corebuild/integration/ILLink.Tasks/ILLink.Tasks.csproj63
-rw-r--r--corebuild/integration/ILLink.Tasks/ILLink.Tasks.nuspec3
-rw-r--r--corebuild/integration/ILLink.Tasks/ILLink.Tasks.targets6
-rw-r--r--corebuild/linker.sln24
-rw-r--r--linker/ILLink.props (renamed from linker/NetCore.props)7
-rw-r--r--linker/Mono.Linker.csproj22
-rw-r--r--linker/Mono.Linker/AssemblyResolver.cs2
-rw-r--r--linker/Mono.Linker/DirectoryAssemblyResolver.cs2
-rw-r--r--linker/Mono.Linker/Driver.cs4
9 files changed, 82 insertions, 51 deletions
diff --git a/corebuild/integration/ILLink.Tasks/ILLink.Tasks.csproj b/corebuild/integration/ILLink.Tasks/ILLink.Tasks.csproj
index d52906cd3..725f20bd1 100644
--- a/corebuild/integration/ILLink.Tasks/ILLink.Tasks.csproj
+++ b/corebuild/integration/ILLink.Tasks/ILLink.Tasks.csproj
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
- <PropertyGroup>
+ <PropertyGroup>
<VersionPrefix>0.1.4-preview</VersionPrefix>
- <TargetFramework>netcoreapp2.0</TargetFramework>
+ <TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
+ <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<RuntimeFrameworkVersion>2.0.0-beta-001509-00</RuntimeFrameworkVersion>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<PackageOutputPath>../nupkgs</PackageOutputPath>
@@ -17,7 +18,7 @@
<!-- We want to package the tasks package together with its
package dependencies, the linker, and the linker's
- dependencies, in order to prevent projects that contsume the
+ dependencies, in order to prevent projects that consume the
tasks package from pulling in the linker. To do this, we need
to include project references and package references in the
package, and prevent any of these references from being
@@ -41,8 +42,8 @@
references from being marked as dependencies. -->
<!-- TODO: Remove the custom .nuspec once the P2P PrivateAssets
issue is fixed. -->
- <NuspecFile>ILLink.Tasks.nuspec</NuspecFile>
- <NuspecProperties>id=$(AssemblyName);authors=$(AssemblyName);description=linker tasks;tfm=$(TargetFramework);</NuspecProperties>
+ <NuspecFile>ILLink.Tasks.nuspec</NuspecFile>
+ <NuspecProperties>id=$(AssemblyName);authors=$(AssemblyName);description=linker tasks;</NuspecProperties>
</PropertyGroup>
<!-- TODO: Remove this workaround once we're able to avoid using a
@@ -64,14 +65,25 @@
Instead, we use GenerateNuspecDependsOn. We could probably also
use BeforeTargets="GenerateNuspec". -->
<PropertyGroup>
- <GenerateNuspecDependsOn>Publish;SetDynamicNuspecProperties;$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn>
+ <GenerateNuspecDependsOn>SetDynamicNuspecProperties;$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn>
</PropertyGroup>
- <Target Name="SetDynamicNuspecProperties">
+ <Target Name="SetDynamicNuspecProperties"
+ DependsOnTargets="LayoutPackage">
<PropertyGroup>
- <NuspecProperties>$(NuspecProperties)output=$(PublishDir);version=$(Version);</NuspecProperties>
+ <NuspecProperties>$(NuspecProperties)version=$(Version);</NuspecProperties>
</PropertyGroup>
</Target>
+ <Target Name="LayoutPackage">
+ <ItemGroup>
+ <TFMsToPublish Include="$(TargetFrameworks)" />
+ <ProjectsToPublish Include="$(MSBuildProjectFile)">
+ <AdditionalProperties>TargetFramework=%(TFMsToPublish.Identity);PublishDir=%(TFMsToPublish.Identity)</AdditionalProperties>
+ </ProjectsToPublish>
+ </ItemGroup>
+ <MSBuild Projects="@(ProjectsToPublish)" Targets="Publish" />
+ </Target>
+
<ItemGroup>
<Compile Include="LinkTask.cs" />
<Compile Include="DepsJsonLinker.cs" />
@@ -125,18 +137,17 @@
</ItemGroup>
-->
-
<ItemGroup>
<!-- TODO: Once https://github.com/dotnet/sdk/issues/952 is fixed,
use PrivateAssets="All" to prevent this project reference
from being marked as a dependency of the tasks package (while
still including it in the publish output). -->
- <ProjectReference Include="../../../linker/Mono.Linker.csproj" />
+ <ProjectReference Include="../../../linker/Mono.Linker.csproj">
<!-- SetConfiguration isn't required when the configuration is
- already set in the solution. However, it should be possible
- to set it here to allow packing the tasks csproj on its
- own. This would let us avoid some of the strange behavior
- that shows up when trying to build from a .sln file.
+ already set in the solution. Setting it here allows packing
+ the tasks csproj on its own. This lets us avoid some of the
+ strange behavior that shows up when trying to build from a
+ .sln file.
There is a nuget bug that prevents this from working
properly during restore
@@ -152,11 +163,20 @@
(because some target gets its reference information from
the lock file, which doesn't have configuration info).
-->
- <!--
- <SetConfiguration>Configuration=netcore_$(Configuration)</SetConfiguration>
- -->
+ <SetConfiguration>Configuration=illink_$(Configuration)</SetConfiguration>
+ </ProjectReference>
</ItemGroup>
+ <!-- Workaround for the SetConfiguration issue described above. -->
+ <Target Name="SetCecilConfiguration"
+ AfterTargets="AssignProjectConfiguration">
+ <ItemGroup>
+ <ProjectReferenceWithConfiguration Condition=" '%(Filename)%(Extension)' == 'Mono.Cecil.csproj' Or '%(Filename)%(Extension)' == 'Mono.Cecil.Pdb.csproj' ">
+ <SetConfiguration>Configuration=netstandard_$(Configuration)</SetConfiguration>
+ </ProjectReferenceWithConfiguration>
+ </ItemGroup>
+ </Target>
+
<ItemGroup>
<!-- TODO: Once we can avoid using a custom .nuspec, we should be
@@ -164,8 +184,13 @@
them from becoming package dependencies, and use an msbuild
itemgroup to include their assets in the package instead of
passing the publish path to the .nuspec. -->
- <PackageReference Include="Microsoft.Build.Framework" Version="0.1.0-preview-00028-160627" />
- <PackageReference Include="Microsoft.Build.Utilities.Core" Version="0.1.0-preview-00028-160627" />
+ <!-- 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. -->
+ <PackageReference Include="Microsoft.Build.Framework" Version="15.1.1012"
+ PrivateAssets="All" />
+ <PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.1.1012"
+ PrivateAssets="All" />
<PackageReference Include="NuGet.ProjectModel" Version="4.3.0-preview1-2500" />
</ItemGroup>
</Project>
diff --git a/corebuild/integration/ILLink.Tasks/ILLink.Tasks.nuspec b/corebuild/integration/ILLink.Tasks/ILLink.Tasks.nuspec
index 89112242e..2ed76e140 100644
--- a/corebuild/integration/ILLink.Tasks/ILLink.Tasks.nuspec
+++ b/corebuild/integration/ILLink.Tasks/ILLink.Tasks.nuspec
@@ -8,6 +8,7 @@
</metadata>
<files>
<file src="ILLink.Tasks.targets" target="build" />
- <file src="$output$*.dll" target="tools/$tfm$" />
+ <file src="netcoreapp2.0/**/*.dll" target="tools" />
+ <file src="net46/**/*.dll" target="tools" />
</files>
</package>
diff --git a/corebuild/integration/ILLink.Tasks/ILLink.Tasks.targets b/corebuild/integration/ILLink.Tasks/ILLink.Tasks.targets
index db63d820e..6d5b03967 100644
--- a/corebuild/integration/ILLink.Tasks/ILLink.Tasks.targets
+++ b/corebuild/integration/ILLink.Tasks/ILLink.Tasks.targets
@@ -1,7 +1,11 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
- <LinkTaskDllPath Condition=" '$(LinkTaskDllPath)' == '' ">$(MSBuildThisFileDirectory)../tools/$(TargetFramework)/ILLink.Tasks.dll</LinkTaskDllPath>
+ <_LinkTaskDirectoryRoot>$(MSBuildThisFileDirectory)../tools/</_LinkTaskDirectoryRoot>
+ <_LinkTaskTFM Condition=" '$(MSBuildRuntimeType)' == 'Core' ">netcoreapp2.0</_LinkTaskTFM>
+ <_LinkTaskTFM Condition=" '$(_LinkTaskTFM)' == '' ">net46</_LinkTaskTFM>
+ <_LinkTaskDirectory>$(_LinkTaskDirectoryRoot)$(_LinkTaskTFM)/</_LinkTaskDirectory>
+ <LinkTaskDllPath Condition=" '$(LinkTaskDllPath)' == '' ">$(_LinkTaskDirectory)ILLink.Tasks.dll</LinkTaskDllPath>
</PropertyGroup>
<PropertyGroup>
diff --git a/corebuild/linker.sln b/corebuild/linker.sln
index 11ad040f6..c93587578 100644
--- a/corebuild/linker.sln
+++ b/corebuild/linker.sln
@@ -22,18 +22,18 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.ActiveCfg = netcore_Debug|Any CPU
- {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.Build.0 = netcore_Debug|Any CPU
- {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.ActiveCfg = netcore_Debug|x64
- {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.Build.0 = netcore_Debug|x64
- {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.ActiveCfg = netcore_Debug|x86
- {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.Build.0 = netcore_Debug|x86
- {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.ActiveCfg = netcore_Release|Any CPU
- {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.Build.0 = netcore_Release|Any CPU
- {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.ActiveCfg = netcore_Release|x64
- {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.Build.0 = netcore_Release|x64
- {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.ActiveCfg = netcore_Release|x86
- {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.Build.0 = netcore_Release|x86
+ {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.ActiveCfg = illink_Debug|Any CPU
+ {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.Build.0 = illink_Debug|Any CPU
+ {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.ActiveCfg = illink_Debug|x64
+ {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.Build.0 = illink_Debug|x64
+ {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.ActiveCfg = illink_Debug|x86
+ {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.Build.0 = illink_Debug|x86
+ {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.ActiveCfg = illink_Release|Any CPU
+ {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.Build.0 = illink_Release|Any CPU
+ {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.ActiveCfg = illink_Release|x64
+ {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.Build.0 = illink_Release|x64
+ {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.ActiveCfg = illink_Release|x86
+ {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.Build.0 = illink_Release|x86
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.Build.0 = netstandard_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x64.ActiveCfg = netstandard_Debug|x64
diff --git a/linker/NetCore.props b/linker/ILLink.props
index 3a8c30dba..db2a8a8f4 100644
--- a/linker/NetCore.props
+++ b/linker/ILLink.props
@@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netcoreapp2.0</TargetFramework>
+ <TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
+ <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<RuntimeFrameworkVersion>2.0.0-beta-001509-00</RuntimeFrameworkVersion>
- <DefineConstants>$(DefineConstants);NET_CORE</DefineConstants>
+ <DefineConstants>$(DefineConstants);FEATURE_ILLINK</DefineConstants>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>illink</AssemblyName>
- <OutputType>exe</OutputType>
+ <OutputType>Library</OutputType>
</PropertyGroup>
</Project>
diff --git a/linker/Mono.Linker.csproj b/linker/Mono.Linker.csproj
index 8da37d7d2..ff826f3a3 100644
--- a/linker/Mono.Linker.csproj
+++ b/linker/Mono.Linker.csproj
@@ -10,11 +10,11 @@
targets.
-->
<PropertyGroup>
- <NetCoreBuild Condition=" $(Configuration.StartsWith('netcore')) Or '$(NuGetRestoreTargets)' != '' ">true</NetCoreBuild>
- <NetCoreBuild Condition=" '$(NetCoreBuild)' == '' ">false</NetCoreBuild>
+ <ILLinkBuild Condition=" $(Configuration.StartsWith('illink')) Or '$(NuGetRestoreTargets)' != '' ">true</ILLinkBuild>
+ <ILLinkBuild Condition=" '$(ILLinkBuild)' == '' ">false</ILLinkBuild>
<TargetFrameworkProfile />
</PropertyGroup>
- <Import Project="NetCore.props" Condition=" $(NetCoreBuild) " />
+ <Import Project="ILLink.props" Condition=" $(ILLinkBuild) " />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -24,8 +24,8 @@
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Mono.Linker</RootNamespace>
- <AssemblyName Condition=" ! $(NetCoreBuild) ">monolinker</AssemblyName>
- <AssemblyName Condition=" $(NetCoreBuild) ">illink</AssemblyName>
+ <AssemblyName Condition=" ! $(ILLinkBuild) ">monolinker</AssemblyName>
+ <AssemblyName Condition=" $(ILLinkBuild) ">illink</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -45,7 +45,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" Condition=" ! $(NetCoreBuild) " />
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" Condition=" ! $(ILLinkBuild) " />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@@ -53,7 +53,7 @@
<Target Name="AfterBuild">
</Target>
-->
- <ItemGroup Condition=" ! $(NetCoreBuild) ">
+ <ItemGroup Condition=" ! $(ILLinkBuild) ">
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
@@ -98,14 +98,14 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\cecil\Mono.Cecil.csproj">
- <SetConfiguration Condition=" '$(Configuration)' == 'netcore_Debug' ">Configuration=netstandard_Debug</SetConfiguration>
- <SetConfiguration Condition=" '$(Configuration)' == 'netcore_Release' ">Configuration=netstandard_Release</SetConfiguration>
+ <SetConfiguration Condition=" '$(Configuration)' == 'illink_Debug' ">Configuration=netstandard_Debug</SetConfiguration>
+ <SetConfiguration Condition=" '$(Configuration)' == 'illink_Release' ">Configuration=netstandard_Release</SetConfiguration>
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
<Name>Mono.Cecil</Name>
</ProjectReference>
<ProjectReference Include="..\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj">
- <SetConfiguration Condition=" '$(Configuration)' == 'netcore_Debug' ">Configuration=netstandard_Debug</SetConfiguration>
- <SetConfiguration Condition=" '$(Configuration)' == 'netcore_Release' ">Configuration=netstandard_Release</SetConfiguration>
+ <SetConfiguration Condition=" '$(Configuration)' == 'illink_Debug' ">Configuration=netstandard_Debug</SetConfiguration>
+ <SetConfiguration Condition=" '$(Configuration)' == 'illink_Release' ">Configuration=netstandard_Release</SetConfiguration>
<Project>{63E6915C-7EA4-4D76-AB28-0D7191EEA626}</Project>
<Name>Mono.Cecil.Pdb</Name>
</ProjectReference>
diff --git a/linker/Mono.Linker/AssemblyResolver.cs b/linker/Mono.Linker/AssemblyResolver.cs
index c8351f76f..b10bb5374 100644
--- a/linker/Mono.Linker/AssemblyResolver.cs
+++ b/linker/Mono.Linker/AssemblyResolver.cs
@@ -33,7 +33,7 @@ using Mono.Cecil;
namespace Mono.Linker {
-#if NET_CORE
+#if FEATURE_ILLINK
public class AssemblyResolver : DirectoryAssemblyResolver {
#else
public class AssemblyResolver : BaseAssemblyResolver {
diff --git a/linker/Mono.Linker/DirectoryAssemblyResolver.cs b/linker/Mono.Linker/DirectoryAssemblyResolver.cs
index 8ff0b50c2..416dab71b 100644
--- a/linker/Mono.Linker/DirectoryAssemblyResolver.cs
+++ b/linker/Mono.Linker/DirectoryAssemblyResolver.cs
@@ -5,7 +5,7 @@ using System.IO;
using Mono.Collections.Generic;
using Mono.Cecil;
-#if NET_CORE
+#if FEATURE_ILLINK
namespace Mono.Linker {
public abstract class DirectoryAssemblyResolver : IAssemblyResolver {
diff --git a/linker/Mono.Linker/Driver.cs b/linker/Mono.Linker/Driver.cs
index e71436abb..16616b437 100644
--- a/linker/Mono.Linker/Driver.cs
+++ b/linker/Mono.Linker/Driver.cs
@@ -37,7 +37,7 @@ namespace Mono.Linker {
public class Driver {
-#if NET_CORE
+#if FEATURE_ILLINK
static readonly string _linker = "IL Linker";
#else
static readonly string _linker = "Mono CIL Linker";
@@ -284,7 +284,7 @@ namespace Mono.Linker {
Console.WriteLine (_linker);
if (msg != null)
Console.WriteLine ("Error: " + msg);
-#if NET_CORE
+#if FEATURE_ILLINK
Console.WriteLine ("illink [options] -x|-a|-i file");
#else
Console.WriteLine ("monolinker [options] -x|-a|-i file");