Skip to content

Commit

Permalink
Update to target .NET5 framework
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-safar committed Sep 4, 2020
1 parent a14edcc commit 83878bb
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 19 deletions.
2 changes: 2 additions & 0 deletions Directory.Build.props
Expand Up @@ -7,6 +7,8 @@
<IsReferenceAssembly Condition="'$(IsReferenceAssembly)' == '' and '$([System.IO.Path]::GetFileName($(MSBuildProjectDirectory)))' == 'ref'">true</IsReferenceAssembly>
</PropertyGroup>
<PropertyGroup Condition=" '$(IsReferenceAssembly)' == 'true' ">
<!-- Since .NET file reference assemblies are always produced -->
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<ProduceOnlyReferenceAssembly>true</ProduceOnlyReferenceAssembly>
<!-- Used by Arcade to compute OutputPath, IntermediateOutputPath, etc. early in the import chain. -->
<OutDirName>$(MSBuildProjectName)/ref</OutDirName>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Expand Up @@ -17,7 +17,7 @@
<!-- see https://github.com/dotnet/runtime/issues/1338 -->
<MicrosoftNETCoreILAsmVersion>$(MicrosoftNETSdkILPackageVersion)</MicrosoftNETCoreILAsmVersion>
<!-- These should match the SDK version at https://github.com/dotnet/sdk/blob/master/eng/Versions.props -->
<SystemReflectionMetadataVersion>1.5.0</SystemReflectionMetadataVersion>
<SystemReflectionMetadataVersion>1.8.0</SystemReflectionMetadataVersion>
<MicrosoftBuildFrameworkVersion>15.4.8</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildUtilitiesCoreVersion>15.4.8</MicrosoftBuildUtilitiesCoreVersion>
<MicrosoftDotNetApiCompatVersion>5.0.0-beta.20427.5</MicrosoftDotNetApiCompatVersion>
Expand Down
2 changes: 1 addition & 1 deletion eng/ilasm.ilproj
Expand Up @@ -4,7 +4,7 @@
project. -->

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<Target Name="CopyILAsmTool" DependsOnTargets="ResolveIlasmToolPaths" Condition="'$(MonoBuild)' == ''">
Expand Down
4 changes: 2 additions & 2 deletions global.json
@@ -1,9 +1,9 @@
{
"tools": {
"dotnet": "5.0.100-preview.6.20310.4",
"dotnet": "5.0.100-rc.1.20453.7",
"runtimes": {
"dotnet": [
"3.0.0"
"6.0.0-alpha.1.20452.19"
]
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/ILLink.Tasks/ILLink.Tasks.csproj
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<!-- Keep these in sync with _ILLinkTasksTFM in Sdk.props. -->
<!-- Keep the netcoreapp TFM in sync with the Mono.Linker.csproj condition below. -->
<TargetFrameworks>netcoreapp3.0;net472</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<Description>MSBuild tasks for running the IL Linker</Description>
<LangVersion>latest</LangVersion>
Expand Down Expand Up @@ -36,7 +36,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../linker/Mono.Linker.csproj" PrivateAssets="All" Condition=" '$(TargetFramework)' == 'netcoreapp3.0' " />
<ProjectReference Include="../linker/Mono.Linker.csproj" PrivateAssets="All" Condition=" '$(TargetFramework)' == 'net5.0' " />
<PackageReference Condition="'$(UseCecilPackage)' == 'true'" Include="Mono.Cecil" Version="$(MonoCecilVersion)" PrivateAssets="All" Publish="True" />
<ProjectReference Condition="'$(UseCecilPackage)' != 'true'" Include="../../external/cecil/Mono.Cecil.csproj" PrivateAssets="All" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ILLink.Tasks/LinkTask.cs
Expand Up @@ -235,7 +235,7 @@ public class ILLink : ToolTask

var taskDirectory = Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location);
// The linker always runs on .NET Core, even when using desktop MSBuild to host ILLink.Tasks.
_illinkPath = Path.Combine (Path.GetDirectoryName (taskDirectory), "netcoreapp3.0", "illink.dll");
_illinkPath = Path.Combine (Path.GetDirectoryName (taskDirectory), "net5.0", "illink.dll");
return _illinkPath;
}
set => _illinkPath = value;
Expand Down
2 changes: 1 addition & 1 deletion src/analyzer/analyzer.csproj
Expand Up @@ -9,7 +9,7 @@

<PropertyGroup Condition="'$(MonoBuild)' == ''">
<DefineConstants>$(DefineConstants);FEATURE_ILLINK</DefineConstants>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(MonoBuild)' != ''">
Expand Down
2 changes: 1 addition & 1 deletion src/analyzer/common/Mono.Options/Options.cs
Expand Up @@ -748,7 +748,7 @@ protected OptionException (SerializationInfo info, StreamingContext context)
get {return this.option;}
}

#if !PCL
#if !PCL && !NETCOREAPP
#pragma warning disable 618 // SecurityPermissionAttribute is obsolete
[SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
#pragma warning restore 618
Expand Down
2 changes: 2 additions & 0 deletions src/linker/Mono.Linker.csproj
Expand Up @@ -5,6 +5,7 @@
</PropertyGroup>

<PropertyGroup Condition="'$(MonoBuild)' == ''">
<TargetFramework>net5.0</TargetFramework>
<DefineConstants>$(DefineConstants);FEATURE_ILLINK</DefineConstants>
<IsPackable>true</IsPackable>
<!-- Nuget issues a warning about missing <reference> items in the generated nuspec,
Expand All @@ -31,6 +32,7 @@
<Compile Remove="Linker.Steps\PreserveCalendarsStep.cs" />
<Compile Remove="Linker.Steps\RemoveFeaturesStep.cs" />
<Compile Remove="Linker.Steps\ResolveFromXApiStep.cs" />
<Compile Remove="System.Diagnostics.CodeAnalysis\*.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/linker/ref/Mono.Linker.csproj
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<BuildOutputTargetFolder>ref</BuildOutputTargetFolder>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Expand Up @@ -5,10 +5,14 @@
</PropertyGroup>

<PropertyGroup Condition="'$(MonoBuild)' == ''">
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(MonoBuild)' != ''">
<TargetFramework>net471</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="System.Diagnostics.CodeAnalysis\*.cs" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj
Expand Up @@ -5,11 +5,11 @@
<WarningLevel>0</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<LangVersion>8.0</LangVersion>
<LangVersion>Latest</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(MonoBuild)' == ''">
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<DefineConstants>$(DefineConstants);ILLINK</DefineConstants>
</PropertyGroup>

Expand Down
4 changes: 1 addition & 3 deletions test/Mono.Linker.Tests/Mono.Linker.Tests.csproj
Expand Up @@ -7,11 +7,9 @@
</PropertyGroup>

<PropertyGroup Condition="'$(MonoBuild)' == ''">
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<DefineConstants>$(DefineConstants);ILLINK</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);DEBUG</DefineConstants>
<!-- Simulate https://github.com/dotnet/sdk/pull/2073 until it ships. -->
<DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.0'">$(DefineConstants);NETCOREAPP</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(MonoBuild)' != ''">
Expand Down
6 changes: 4 additions & 2 deletions test/Mono.Linker.Tests/TestCases/TestDatabase.cs
Expand Up @@ -251,12 +251,14 @@ static void GetDirectoryPaths (out string rootSourceDirectory, out string testCa
var configDirectoryName = "Release";
#endif

#if NETCOREAPP3_0
#if NET5_0
var tfm = "net5.0";
#elif NETCOREAPP3_0
var tfm = "netcoreapp3.0";
#elif NET471
var tfm = "net471";
#else
var tfm = "";
#error "Unknown TFM"
#endif

#if ILLINK
Expand Down
2 changes: 1 addition & 1 deletion test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs
Expand Up @@ -127,7 +127,7 @@ public virtual void Populate (TestCaseMetadaProvider metadataProvider)

private static NPath GetExpectationsAssemblyPath ()
{
return new Uri (typeof (KeptAttribute).Assembly.CodeBase).LocalPath.ToNPath ();
return new Uri (typeof (KeptAttribute).Assembly.Location).LocalPath.ToNPath ();
}

protected void CopyToInputAndExpectations (NPath source)
Expand Down

0 comments on commit 83878bb

Please sign in to comment.