Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Fix dotnetcore #2252

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="..\..\packages\MultiTarget\build\MultiTarget.props" Condition="Exists('..\..\packages\MultiTarget\build\MultiTarget.props')" Label="Paket" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure about this change.
What is the difference between a "global" and a "frameworkSpecific" msbuild file?
Paket seems to add global ones on top, but these tests seem to test the reverse?
Are those tests broken? What are the criteria for "global" msbuild?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my try to fix #2227.
Nuget always adds props to the top. The distinction of "global" is specific to that, there is no such thing in nuget.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0x53A thanks. so global is everything directly in the build folder, correct?
Is the current output acceptable? I have no Idea what I did that the ordering with the existing item changed... If not can you spot the relevant change (it's ok if not but than I know I have to take a deeper look)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matthid I had tried to be smart. Global was everything either directly in the build folder, or for a list of frameworks that exactly matches the framework restriction. I think my use case still works (Fsharp.Compiler.Tools), I don't know if there are other problematic packages that Must be imported at the top.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0x53A perfect, if you can live with this new behavior life is good

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For why it moved: previously it was (incorrectly) tagged as framework-specific, not global:
image

With your simplified Partition(List.partition (fun lib -> "" = lib.Path.Name )), this is now correctly detected as global.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for confirming this!

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="..\..\packages\MultiTarget\build\MultiTarget.props" Condition="Exists('..\..\packages\MultiTarget\build\MultiTarget.props')" Label="Paket" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="..\..\packages\MultiTarget\build\MultiTarget.props" Condition="Exists('..\..\packages\MultiTarget\build\MultiTarget.props')" Label="Paket" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

<Choose>
<When Condition="'$(Configuration)|$(Platform)'=='Debug|arm'">
<ItemGroup>
Expand All @@ -125,19 +124,28 @@
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Release|arm'">
<When Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ItemGroup>
<NativeReference Include="cpprest120_app_2_7">
<HintPath>..\packages\cpprestsdk.v120.winapp.msvcstl.dyn.rt-dyn\lib\native\v120\winapp\msvcstl\dyn\rt-dyn\arm\Release\cpprest120_app_2_7.dll</HintPath>
<NativeReference Include="cpprest120d_app_2_7">
<HintPath>..\packages\cpprestsdk.v120.winapp.msvcstl.dyn.rt-dyn\lib\native\v120\winapp\msvcstl\dyn\rt-dyn\x64\Debug\cpprest120d_app_2_7.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<When Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ItemGroup>
<NativeReference Include="cpprest120d_app_2_7">
<HintPath>..\packages\cpprestsdk.v120.winapp.msvcstl.dyn.rt-dyn\lib\native\v120\winapp\msvcstl\dyn\rt-dyn\x64\Debug\cpprest120d_app_2_7.dll</HintPath>
<HintPath>..\packages\cpprestsdk.v120.winapp.msvcstl.dyn.rt-dyn\lib\native\v120\winapp\msvcstl\dyn\rt-dyn\x86\Debug\cpprest120d_app_2_7.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Release|arm'">
<ItemGroup>
<NativeReference Include="cpprest120_app_2_7">
<HintPath>..\packages\cpprestsdk.v120.winapp.msvcstl.dyn.rt-dyn\lib\native\v120\winapp\msvcstl\dyn\rt-dyn\arm\Release\cpprest120_app_2_7.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</NativeReference>
Expand Down Expand Up @@ -172,6 +180,15 @@
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ItemGroup>
<NativeReference Include="cpprest120d_2_7">
<HintPath>..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn\lib\native\v120\windesktop\msvcstl\dyn\rt-dyn\x86\Debug\cpprest120d_2_7.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ItemGroup>
<NativeReference Include="cpprest120_2_7">
Expand Down Expand Up @@ -201,6 +218,15 @@
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ItemGroup>
<NativeReference Include="cpprest120d_wp81_2_7">
<HintPath>..\packages\cpprestsdk.v120.winphone.msvcstl.dyn.rt-dyn\lib\native\v120\winphone\msvcstl\dyn\rt-dyn\x86\Debug\cpprest120d_wp81_2_7.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Release|arm'">
<ItemGroup>
<NativeReference Include="cpprest120_wp81_2_7">
Expand Down Expand Up @@ -230,6 +256,15 @@
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ItemGroup>
<NativeReference Include="cpprest120d_wps81_2_7">
<HintPath>..\packages\cpprestsdk.v120.winphonesl.msvcstl.dyn.rt-dyn\lib\native\v120\winphonesl\msvcstl\dyn\rt-dyn\x86\Debug\cpprest120d_wps81_2_7.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Release|arm'">
<ItemGroup>
<NativeReference Include="cpprest120_wps81_2_7">
Expand Down Expand Up @@ -259,6 +294,15 @@
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ItemGroup>
<NativeReference Include="cpprest120d_xp_2_7">
<HintPath>..\packages\cpprestsdk.v120.winxp.msvcstl.dyn.rt-dyn\lib\native\v120\winxp\msvcstl\dyn\rt-dyn\x86\Debug\cpprest120d_xp_2_7.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ItemGroup>
<NativeReference Include="cpprest120_xp_2_7">
Expand Down Expand Up @@ -288,19 +332,28 @@
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Release|arm'">
<When Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ItemGroup>
<NativeReference Include="cpprest140_uwp_2_7">
<HintPath>..\packages\cpprestsdk.v140.winapp.msvcstl.dyn.rt-dyn\lib\native\v140\winapp\msvcstl\dyn\rt-dyn\arm\Release\cpprest140_uwp_2_7.dll</HintPath>
<NativeReference Include="cpprest140d_uwp_2_7">
<HintPath>..\packages\cpprestsdk.v140.winapp.msvcstl.dyn.rt-dyn\lib\native\v140\winapp\msvcstl\dyn\rt-dyn\x64\Debug\cpprest140d_uwp_2_7.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<When Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ItemGroup>
<NativeReference Include="cpprest140d_uwp_2_7">
<HintPath>..\packages\cpprestsdk.v140.winapp.msvcstl.dyn.rt-dyn\lib\native\v140\winapp\msvcstl\dyn\rt-dyn\x64\Debug\cpprest140d_uwp_2_7.dll</HintPath>
<HintPath>..\packages\cpprestsdk.v140.winapp.msvcstl.dyn.rt-dyn\lib\native\v140\winapp\msvcstl\dyn\rt-dyn\x86\Debug\cpprest140d_uwp_2_7.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Release|arm'">
<ItemGroup>
<NativeReference Include="cpprest140_uwp_2_7">
<HintPath>..\packages\cpprestsdk.v140.winapp.msvcstl.dyn.rt-dyn\lib\native\v140\winapp\msvcstl\dyn\rt-dyn\arm\Release\cpprest140_uwp_2_7.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</NativeReference>
Expand Down Expand Up @@ -335,6 +388,15 @@
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ItemGroup>
<NativeReference Include="cpprest140d_2_7">
<HintPath>..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn\lib\native\v140\windesktop\msvcstl\dyn\rt-dyn\x86\Debug\cpprest140d_2_7.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</NativeReference>
</ItemGroup>
</When>
<When Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ItemGroup>
<NativeReference Include="cpprest140_2_7">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="..\..\packages\MultiTarget\build\MultiTarget.props" Condition="Exists('..\..\packages\MultiTarget\build\MultiTarget.props')" Label="Paket" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down
27 changes: 17 additions & 10 deletions src/Paket.Core/Files/ProjectFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -744,12 +744,20 @@ module ProjectFile =
model.GetReferenceFolders()
|> List.map (fun lib -> lib.Targets)

// Just in case anyone wants to compile FOR netcore in the old format...
// I don't think there is anyone actually using this part, but it's there for backwards compat.
let netCoreRestricted =
model.ApplyFrameworkRestrictions
[ FrameworkRestriction.AtLeast (FrameworkIdentifier.DotNetStandard DotNetStandardVersion.V1_0);
FrameworkRestriction.AtLeast (FrameworkIdentifier.DotNetCore DotNetCoreVersion.V1_0) ]

// handle legacy conditions
let conditions =
model.GetReferenceFolders()
|> List.sortBy (fun libFolder -> libFolder.Name)
|> List.collect (fun libFolder ->
(model.GetReferenceFolders() @ netCoreRestricted.CompileRefFolders)
|> List.sortBy (fun libFolder -> libFolder.Path)
|> List.collect (fun libFolder ->
match libFolder with
| x when (match x.Targets with | [SinglePlatform(Runtimes(_))] -> true | _ -> false) -> [] // TODO: Add reference to custom task instead
//| x when (match x.Targets with | [SinglePlatform(Runtimes(_))] -> true | _ -> false) -> [] // TODO: Add reference to custom task instead
| _ ->
match PlatformMatching.getCondition referenceCondition allTargets libFolder.Targets with
| "" -> []
Expand Down Expand Up @@ -788,16 +796,15 @@ module ProjectFile =
[lowerCondition,createItemGroup !assemblyTargets frameworkAssemblies,true
condition,createItemGroup libFolder.Targets rest,false]
)

// global targets are targets, that are either directly in the /build folder,
// or, if there is a framework-restriction, specific to the framework(s).

// global targets are targets, that are either directly in the /build folder.
// (ref https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package#including-msbuild-props-and-targets-in-a-package).
let globalTargets, frameworkSpecificTargets =
if not importTargets then List.empty, List.empty else
let sortedTargets = model.TargetsFileFolders |> List.sortBy (fun lib -> lib.Name)
let sortedTargets = model.TargetsFileFolders |> List.sortBy (fun lib -> lib.Path)
sortedTargets
|> List.partition (fun lib -> allTargetProfiles = set lib.Targets )
|> List.partition (fun lib -> "" = lib.Path.Name)

let frameworkSpecificTargetsFileConditions =
frameworkSpecificTargets
|> List.map (fun lib -> PlatformMatching.getCondition referenceCondition allTargets lib.Targets,createPropertyGroup lib.Files.References)
Expand Down