|
18 | 18 | <PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)paket.exe</PaketExePath>
|
19 | 19 | <PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
|
20 | 20 | <PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
|
| 21 | + |
| 22 | + <!-- .net core fdd --> |
| 23 | + <_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)"))</_PaketExeExtension> |
| 24 | + <PaketCommand Condition=" '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</PaketCommand> |
| 25 | + |
| 26 | + <!-- no extension is a shell script --> |
| 27 | + <PaketCommand Condition=" '$(_PaketExeExtension)' == '' ">"$(PaketExePath)"</PaketCommand> |
| 28 | + |
21 | 29 | <PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' AND Exists('$(PaketRootPath)paket.bootstrapper.exe')">$(PaketRootPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
|
22 | 30 | <PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
|
23 | 31 | <PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
|
|
30 | 38 | <DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
|
31 | 39 | </PropertyGroup>
|
32 | 40 |
|
33 |
| - <Target Name="PaketRestore" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" > |
| 41 | + <Target Name="PaketRestore" Condition="'$(PaketRestoreDisabled)' != 'True'" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" > |
34 | 42 |
|
35 | 43 | <!-- Step 1 Check if lockfile is properly restored -->
|
36 | 44 | <PropertyGroup>
|
37 | 45 | <PaketRestoreRequired>true</PaketRestoreRequired>
|
38 |
| - <NoWarn>$(NoWarn);NU1603</NoWarn> |
| 46 | + <NoWarn>$(NoWarn);NU1603;NU1604;NU1605;NU1608</NoWarn> |
39 | 47 | </PropertyGroup>
|
40 | 48 |
|
| 49 | + <!-- Because ReadAllText is slow on osx/linux, try to find shasum and awk --> |
| 50 | + <PropertyGroup> |
| 51 | + <PaketRestoreCachedHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreCachedHasher)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum "$(PaketRestoreCacheFile)" | /usr/bin/awk '{ print $1 }'</PaketRestoreCachedHasher> |
| 52 | + <PaketRestoreLockFileHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreLockFileHash)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum "$(PaketLockFilePath)" | /usr/bin/awk '{ print $1 }'</PaketRestoreLockFileHasher> |
| 53 | + </PropertyGroup> |
| 54 | + |
| 55 | + <!-- If shasum and awk exist get the hashes --> |
| 56 | + <Exec StandardOutputImportance="Low" Condition=" '$(PaketRestoreCachedHasher)' != '' " Command="$(PaketRestoreCachedHasher)" ConsoleToMSBuild='true'> |
| 57 | + <Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreCachedHash" /> |
| 58 | + </Exec> |
| 59 | + <Exec StandardOutputImportance="Low" Condition=" '$(PaketRestoreLockFileHasher)' != '' " Command="$(PaketRestoreLockFileHasher)" ConsoleToMSBuild='true'> |
| 60 | + <Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreLockFileHash" /> |
| 61 | + </Exec> |
| 62 | + |
| 63 | + <!-- Debug whats going on --> |
| 64 | + <Message Importance="low" Text="calling paket restore with targetframework=$(TargetFramework) targetframeworks=$(TargetFrameworks)" /> |
| 65 | + |
41 | 66 | <PropertyGroup Condition="Exists('$(PaketRestoreCacheFile)') ">
|
42 |
| - <PaketRestoreCachedHash>$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash> |
43 |
| - <PaketRestoreLockFileHash>$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash> |
| 67 | + <!-- if no hash has been done yet fall back to just reading in the files and comparing them --> |
| 68 | + <PaketRestoreCachedHash Condition=" '$(PaketRestoreCachedHash)' == '' ">$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash> |
| 69 | + <PaketRestoreLockFileHash Condition=" '$(PaketRestoreLockFileHash)' == '' ">$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash> |
44 | 70 | <PaketRestoreRequired>true</PaketRestoreRequired>
|
45 | 71 | <PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '$(PaketRestoreCachedHash)' ">false</PaketRestoreRequired>
|
46 | 72 | <PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '' ">true</PaketRestoreRequired>
|
47 | 73 | </PropertyGroup>
|
48 | 74 |
|
| 75 | + |
49 | 76 | <!-- Do a global restore if required -->
|
50 | 77 | <Exec Command='$(PaketBootStrapperCommand)' Condition="Exists('$(PaketBootStrapperExePath)') AND !(Exists('$(PaketExePath)'))" ContinueOnError="false" />
|
51 | 78 | <Exec Command='$(PaketCommand) restore' Condition=" '$(PaketRestoreRequired)' == 'true' " ContinueOnError="false" />
|
52 | 79 |
|
53 | 80 | <!-- Step 2 Detect project specific changes -->
|
| 81 | + <ItemGroup> |
| 82 | + <MyTargetFrameworks Condition="'$(TargetFramework)' != '' " Include="$(TargetFramework)"></MyTargetFrameworks> |
| 83 | + <!-- Don't include all frameworks when msbuild explicitly asks for a single one --> |
| 84 | + <MyTargetFrameworks Condition="'$(TargetFrameworks)' != '' AND '$(TargetFramework)' == '' " Include="$(TargetFrameworks)"></MyTargetFrameworks> |
| 85 | + <PaketResolvedFilePaths Include="@(MyTargetFrameworks -> '$(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).%(Identity).paket.resolved')"></PaketResolvedFilePaths> |
| 86 | + </ItemGroup> |
| 87 | + <Message Importance="low" Text="MyTargetFrameworks=@(MyTargetFrameworks) PaketResolvedFilePaths=@(PaketResolvedFilePaths)" /> |
54 | 88 | <PropertyGroup>
|
55 | 89 | <PaketReferencesCachedFilePath>$(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).paket.references.cached</PaketReferencesCachedFilePath>
|
56 | 90 | <!-- MyProject.fsproj.paket.references has the highest precedence -->
|
|
59 | 93 | <PaketOriginalReferencesFilePath Condition=" !Exists('$(PaketOriginalReferencesFilePath)')">$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references</PaketOriginalReferencesFilePath>
|
60 | 94 | <!-- paket.references -->
|
61 | 95 | <PaketOriginalReferencesFilePath Condition=" !Exists('$(PaketOriginalReferencesFilePath)')">$(MSBuildProjectDirectory)\paket.references</PaketOriginalReferencesFilePath>
|
62 |
| - <PaketResolvedFilePath>$(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).$(TargetFramework).paket.resolved</PaketResolvedFilePath> |
| 96 | + |
| 97 | + <DoAllResolvedFilesExist>false</DoAllResolvedFilesExist> |
| 98 | + <DoAllResolvedFilesExist Condition="Exists(%(PaketResolvedFilePaths.Identity))">true</DoAllResolvedFilesExist> |
63 | 99 | <PaketRestoreRequired>true</PaketRestoreRequired>
|
64 | 100 | <PaketRestoreRequiredReason>references-file-or-cache-not-found</PaketRestoreRequiredReason>
|
65 | 101 | </PropertyGroup>
|
|
78 | 114 | </PropertyGroup>
|
79 | 115 |
|
80 | 116 | <!-- Step 2 b detect relevant changes in project file (new targetframework) -->
|
81 |
| - <PropertyGroup Condition=" !Exists('$(PaketResolvedFilePath)') AND '$(TargetFramework)' != '' "> |
| 117 | + <PropertyGroup Condition=" '$(DoAllResolvedFilesExist)' != 'true' "> |
82 | 118 | <PaketRestoreRequired>true</PaketRestoreRequired>
|
83 |
| - <PaketRestoreRequiredReason>target-framework '$(TargetFramework)'</PaketRestoreRequiredReason> |
| 119 | + <PaketRestoreRequiredReason>target-framework '$(TargetFramework)' or '$(TargetFrameworks)' files @(PaketResolvedFilePaths)</PaketRestoreRequiredReason> |
84 | 120 | </PropertyGroup>
|
85 | 121 |
|
86 | 122 | <!-- Step 3 Restore project specific stuff if required -->
|
87 | 123 | <Message Condition=" '$(PaketRestoreRequired)' == 'true' " Importance="low" Text="Detected a change ('$(PaketRestoreRequiredReason)') in the project file '$(MSBuildProjectFullPath)', calling paket restore" />
|
88 |
| - <Exec Command='$(PaketCommand) restore --project "$(MSBuildProjectFullPath)"' Condition=" '$(PaketRestoreRequired)' == 'true' " ContinueOnError="false" /> |
| 124 | + <Exec Command='$(PaketCommand) restore --project "$(MSBuildProjectFullPath)" --target-framework "$(TargetFrameworks)"' Condition=" '$(PaketRestoreRequired)' == 'true' AND '$(TargetFramework)' == '' " ContinueOnError="false" /> |
| 125 | + <Exec Command='$(PaketCommand) restore --project "$(MSBuildProjectFullPath)" --target-framework "$(TargetFramework)"' Condition=" '$(PaketRestoreRequired)' == 'true' AND '$(TargetFramework)' != '' " ContinueOnError="false" /> |
89 | 126 |
|
90 | 127 | <!-- This shouldn't actually happen, but just to be sure. -->
|
91 |
| - <Error Condition=" !Exists('$(PaketResolvedFilePath)') AND '$(TargetFramework)' != '' " Text="A paket file for the framework '$(TargetFramework)' is missing. Please delete 'paket-files/paket.restore.cached' and call 'paket restore'." /> |
| 128 | + <PropertyGroup> |
| 129 | + <DoAllResolvedFilesExist>false</DoAllResolvedFilesExist> |
| 130 | + <DoAllResolvedFilesExist Condition="Exists(%(PaketResolvedFilePaths.Identity))">true</DoAllResolvedFilesExist> |
| 131 | + </PropertyGroup> |
| 132 | + <Error Condition=" '$(DoAllResolvedFilesExist)' != 'true' AND '$(ResolveNuGetPackages)' != 'False' " Text="One Paket file '@(PaketResolvedFilePaths)' is missing while restoring $(MSBuildProjectFile). Please delete 'paket-files/paket.restore.cached' and call 'paket restore'." /> |
92 | 133 |
|
93 | 134 | <!-- Step 4 forward all msbuild properties (PackageReference, DotNetCliToolReference) to msbuild -->
|
94 |
| - <ReadLinesFromFile Condition="Exists('$(PaketResolvedFilePath)')" File="$(PaketResolvedFilePath)" > |
| 135 | + <ReadLinesFromFile Condition="'@(PaketResolvedFilePaths)' != ''" File="%(PaketResolvedFilePaths.Identity)" ><!--Condition="Exists('%(PaketResolvedFilePaths.Identity)')"--> |
95 | 136 | <Output TaskParameter="Lines" ItemName="PaketReferencesFileLines"/>
|
96 | 137 | </ReadLinesFromFile>
|
97 | 138 |
|
98 |
| - <ItemGroup Condition=" Exists('$(PaketResolvedFilePath)') AND '@(PaketReferencesFileLines)' != '' " > |
| 139 | + <ItemGroup Condition=" '@(PaketReferencesFileLines)' != '' " > |
99 | 140 | <PaketReferencesFileLinesInfo Include="@(PaketReferencesFileLines)" >
|
100 | 141 | <PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
|
101 | 142 | <PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
|
| 143 | + <AllPrivateAssets>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4])</AllPrivateAssets> |
102 | 144 | </PaketReferencesFileLinesInfo>
|
103 | 145 | <PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
|
104 | 146 | <Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
|
| 147 | + <PrivateAssets Condition=" ('%(PaketReferencesFileLinesInfo.AllPrivateAssets)' == 'true') Or ('$(PackAsTool)' == 'true') ">All</PrivateAssets> |
| 148 | + <ExcludeAssets Condition="%(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'exclude'">runtime</ExcludeAssets> |
| 149 | + <Publish Condition=" '$(PackAsTool)' == 'true' ">true</Publish> |
105 | 150 | </PackageReference>
|
106 | 151 | </ItemGroup>
|
107 | 152 |
|
|
123 | 168 | </DotNetCliToolReference>
|
124 | 169 | </ItemGroup>
|
125 | 170 |
|
| 171 | + <!-- Disabled for now until we know what to do with runtime deps - https://github.com/fsprojects/Paket/issues/2964 |
126 | 172 | <PropertyGroup>
|
127 | 173 | <RestoreConfigFile>$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).NuGet.Config</RestoreConfigFile>
|
128 |
| - </PropertyGroup> |
| 174 | + </PropertyGroup> --> |
129 | 175 |
|
130 | 176 | </Target>
|
131 | 177 |
|
|
136 | 182 | </Target>
|
137 | 183 |
|
138 | 184 | <Target Name="PaketOverrideNuspec" AfterTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
|
| 185 | + <ItemGroup> |
| 186 | + <_NuspecFilesNewLocation Include="$(BaseIntermediateOutputPath)$(Configuration)\*.nuspec"/> |
| 187 | + </ItemGroup> |
| 188 | + |
139 | 189 | <PropertyGroup>
|
140 | 190 | <PaketProjectFile>$(MSBuildProjectDirectory)/$(MSBuildProjectFile)</PaketProjectFile>
|
141 | 191 | <ContinuePackingAfterGeneratingNuspec>true</ContinuePackingAfterGeneratingNuspec>
|
142 | 192 | <UseNewPack>false</UseNewPack>
|
143 | 193 | <UseNewPack Condition=" '$(NuGetToolVersion)' != '4.0.0' ">true</UseNewPack>
|
| 194 | + <AdjustedNuspecOutputPath>$(BaseIntermediateOutputPath)$(Configuration)</AdjustedNuspecOutputPath> |
| 195 | + <AdjustedNuspecOutputPath Condition="@(_NuspecFilesNewLocation) == ''">$(BaseIntermediateOutputPath)</AdjustedNuspecOutputPath> |
144 | 196 | </PropertyGroup>
|
145 | 197 |
|
146 | 198 | <ItemGroup>
|
147 |
| - <_NuspecFiles Include="$(BaseIntermediateOutputPath)*.nuspec"/> |
| 199 | + <_NuspecFiles Include="$(AdjustedNuspecOutputPath)\*.nuspec"/> |
148 | 200 | </ItemGroup>
|
149 | 201 |
|
150 | 202 | <Exec Command='$(PaketCommand) fix-nuspecs files "@(_NuspecFiles)" project-file "$(PaketProjectFile)" ' Condition="@(_NuspecFiles) != ''" />
|
|
153 | 205 | <Output TaskParameter="AbsolutePaths" PropertyName="NuspecFileAbsolutePath" />
|
154 | 206 | </ConvertToAbsolutePath>
|
155 | 207 |
|
| 208 | + |
156 | 209 | <!-- Call Pack -->
|
157 | 210 | <PackTask Condition="$(UseNewPack)"
|
158 | 211 | PackItem="$(PackProjectInputFile)"
|
|
188 | 241 | Serviceable="$(Serviceable)"
|
189 | 242 | FrameworkAssemblyReferences="@(_FrameworkAssemblyReferences)"
|
190 | 243 | ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)"
|
191 |
| - NuspecOutputPath="$(BaseIntermediateOutputPath)" |
| 244 | + NuspecOutputPath="$(AdjustedNuspecOutputPath)" |
192 | 245 | IncludeBuildOutput="$(IncludeBuildOutput)"
|
193 | 246 | BuildOutputFolder="$(BuildOutputTargetFolder)"
|
194 | 247 | ContentTargetFolders="$(ContentTargetFolders)"
|
|
230 | 283 | Serviceable="$(Serviceable)"
|
231 | 284 | AssemblyReferences="@(_References)"
|
232 | 285 | ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)"
|
233 |
| - NuspecOutputPath="$(BaseIntermediateOutputPath)" |
| 286 | + NuspecOutputPath="$(AdjustedNuspecOutputPath)" |
234 | 287 | IncludeBuildOutput="$(IncludeBuildOutput)"
|
235 | 288 | BuildOutputFolder="$(BuildOutputTargetFolder)"
|
236 | 289 | ContentTargetFolders="$(ContentTargetFolders)"
|
|
0 commit comments