Skip to content

Commit a821fec

Browse files
authored
Merge pull request #5 from punker76/smtx
Update paket to solve executing ShowMeTheXAML.MSBuild
2 parents 07c6360 + 14a2229 commit a821fec

File tree

6 files changed

+369
-24
lines changed

6 files changed

+369
-24
lines changed

.paket/Paket.Restore.targets

Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<!-- Prevent dotnet template engine to parse this file -->
3+
<!--/-:cnd:noEmit-->
4+
<PropertyGroup>
5+
<!-- make MSBuild track this file for incremental builds. -->
6+
<!-- ref https://blogs.msdn.microsoft.com/msbuild/2005/09/26/how-to-ensure-changes-to-a-custom-target-file-prompt-a-rebuild/ -->
7+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
8+
<!-- Mark that this target file has been loaded. -->
9+
<IsPaketRestoreTargetsFileLoaded>true</IsPaketRestoreTargetsFileLoaded>
10+
<PaketToolsPath>$(MSBuildThisFileDirectory)</PaketToolsPath>
11+
<PaketRootPath>$(MSBuildThisFileDirectory)..\</PaketRootPath>
12+
<PaketRestoreCacheFile>$(PaketRootPath)paket-files\paket.restore.cached</PaketRestoreCacheFile>
13+
<PaketLockFilePath>$(PaketRootPath)paket.lock</PaketLockFilePath>
14+
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
15+
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>
16+
<!-- Paket command -->
17+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket.exe')">$(PaketRootPath)paket.exe</PaketExePath>
18+
<PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)paket.exe</PaketExePath>
19+
<PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
20+
<PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
21+
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' AND Exists('$(PaketRootPath)paket.bootstrapper.exe')">$(PaketRootPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
22+
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
23+
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
24+
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
25+
26+
<!-- Disable automagic references for F# dotnet sdk -->
27+
<!-- This will not do anything for other project types -->
28+
<!-- see https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1032-fsharp-in-dotnet-sdk.md -->
29+
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
30+
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
31+
</PropertyGroup>
32+
33+
<Target Name="PaketRestore" Condition="'$(PaketRestoreDisabled)' != 'True'" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" >
34+
35+
<!-- Step 1 Check if lockfile is properly restored -->
36+
<PropertyGroup>
37+
<PaketRestoreRequired>true</PaketRestoreRequired>
38+
<NoWarn>$(NoWarn);NU1603</NoWarn>
39+
</PropertyGroup>
40+
41+
<!-- Because ReadAllText is slow on osx/linux, try to find shasum and awk -->
42+
<PropertyGroup>
43+
<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>
44+
<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>
45+
</PropertyGroup>
46+
47+
<!-- If shasum and awk exist get the hashes -->
48+
<Exec Condition=" '$(PaketRestoreCachedHasher)' != '' " Command="$(PaketRestoreCachedHasher)" ConsoleToMSBuild='true'>
49+
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreCachedHash" />
50+
</Exec>
51+
<Exec Condition=" '$(PaketRestoreLockFileHasher)' != '' " Command="$(PaketRestoreLockFileHasher)" ConsoleToMSBuild='true'>
52+
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreLockFileHash" />
53+
</Exec>
54+
55+
<PropertyGroup Condition="Exists('$(PaketRestoreCacheFile)') ">
56+
<!-- if no hash has been done yet fall back to just reading in the files and comparing them -->
57+
<PaketRestoreCachedHash Condition=" '$(PaketRestoreCachedHash)' == '' ">$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash>
58+
<PaketRestoreLockFileHash Condition=" '$(PaketRestoreLockFileHash)' == '' ">$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash>
59+
<PaketRestoreRequired>true</PaketRestoreRequired>
60+
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '$(PaketRestoreCachedHash)' ">false</PaketRestoreRequired>
61+
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '' ">true</PaketRestoreRequired>
62+
</PropertyGroup>
63+
64+
<!-- Do a global restore if required -->
65+
<Exec Command='$(PaketBootStrapperCommand)' Condition="Exists('$(PaketBootStrapperExePath)') AND !(Exists('$(PaketExePath)'))" ContinueOnError="false" />
66+
<Exec Command='$(PaketCommand) restore' Condition=" '$(PaketRestoreRequired)' == 'true' " ContinueOnError="false" />
67+
68+
<!-- Step 2 Detect project specific changes -->
69+
<PropertyGroup>
70+
<PaketReferencesCachedFilePath>$(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).paket.references.cached</PaketReferencesCachedFilePath>
71+
<!-- MyProject.fsproj.paket.references has the highest precedence -->
72+
<PaketOriginalReferencesFilePath>$(MSBuildProjectFullPath).paket.references</PaketOriginalReferencesFilePath>
73+
<!-- MyProject.paket.references -->
74+
<PaketOriginalReferencesFilePath Condition=" !Exists('$(PaketOriginalReferencesFilePath)')">$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references</PaketOriginalReferencesFilePath>
75+
<!-- paket.references -->
76+
<PaketOriginalReferencesFilePath Condition=" !Exists('$(PaketOriginalReferencesFilePath)')">$(MSBuildProjectDirectory)\paket.references</PaketOriginalReferencesFilePath>
77+
<PaketResolvedFilePath>$(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).$(TargetFramework).paket.resolved</PaketResolvedFilePath>
78+
<PaketRestoreRequired>true</PaketRestoreRequired>
79+
<PaketRestoreRequiredReason>references-file-or-cache-not-found</PaketRestoreRequiredReason>
80+
</PropertyGroup>
81+
82+
<!-- Step 2 a Detect changes in references file -->
83+
<PropertyGroup Condition="Exists('$(PaketOriginalReferencesFilePath)') AND Exists('$(PaketReferencesCachedFilePath)') ">
84+
<PaketRestoreCachedHash>$([System.IO.File]::ReadAllText('$(PaketReferencesCachedFilePath)'))</PaketRestoreCachedHash>
85+
<PaketRestoreReferencesFileHash>$([System.IO.File]::ReadAllText('$(PaketOriginalReferencesFilePath)'))</PaketRestoreReferencesFileHash>
86+
<PaketRestoreRequiredReason>references-file</PaketRestoreRequiredReason>
87+
<PaketRestoreRequired Condition=" '$(PaketRestoreReferencesFileHash)' == '$(PaketRestoreCachedHash)' ">false</PaketRestoreRequired>
88+
</PropertyGroup>
89+
90+
<PropertyGroup Condition="!Exists('$(PaketOriginalReferencesFilePath)') AND !Exists('$(PaketReferencesCachedFilePath)') ">
91+
<!-- If both don't exist there is nothing to do. -->
92+
<PaketRestoreRequired>false</PaketRestoreRequired>
93+
</PropertyGroup>
94+
95+
<!-- Step 2 b detect relevant changes in project file (new targetframework) -->
96+
<PropertyGroup Condition=" !Exists('$(PaketResolvedFilePath)') AND '$(TargetFramework)' != '' ">
97+
<PaketRestoreRequired>true</PaketRestoreRequired>
98+
<PaketRestoreRequiredReason>target-framework '$(TargetFramework)'</PaketRestoreRequiredReason>
99+
</PropertyGroup>
100+
101+
<!-- Step 3 Restore project specific stuff if required -->
102+
<Message Condition=" '$(PaketRestoreRequired)' == 'true' " Importance="low" Text="Detected a change ('$(PaketRestoreRequiredReason)') in the project file '$(MSBuildProjectFullPath)', calling paket restore" />
103+
<Exec Command='$(PaketCommand) restore --project "$(MSBuildProjectFullPath)"' Condition=" '$(PaketRestoreRequired)' == 'true' " ContinueOnError="false" />
104+
105+
<!-- This shouldn't actually happen, but just to be sure. -->
106+
<Error Condition=" !Exists('$(PaketResolvedFilePath)') AND '$(TargetFramework)' != '' AND '$(ResolveNuGetPackages)' != 'False' " Text="Paket file '$(PaketResolvedFilePath)' is missing while restoring $(MSBuildProjectFile). Please delete 'paket-files/paket.restore.cached' and call 'paket restore'." />
107+
108+
<!-- Step 4 forward all msbuild properties (PackageReference, DotNetCliToolReference) to msbuild -->
109+
<ReadLinesFromFile Condition="Exists('$(PaketResolvedFilePath)')" File="$(PaketResolvedFilePath)" >
110+
<Output TaskParameter="Lines" ItemName="PaketReferencesFileLines"/>
111+
</ReadLinesFromFile>
112+
113+
<ItemGroup Condition=" Exists('$(PaketResolvedFilePath)') AND '@(PaketReferencesFileLines)' != '' " >
114+
<PaketReferencesFileLinesInfo Include="@(PaketReferencesFileLines)" >
115+
<PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
116+
<PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
117+
<AllPrivateAssets>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4])</AllPrivateAssets>
118+
</PaketReferencesFileLinesInfo>
119+
<PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
120+
<Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
121+
<PrivateAssets Condition="%(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'true'">All</PrivateAssets>
122+
</PackageReference>
123+
</ItemGroup>
124+
125+
<PropertyGroup>
126+
<PaketCliToolFilePath>$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).paket.clitools</PaketCliToolFilePath>
127+
</PropertyGroup>
128+
129+
<ReadLinesFromFile File="$(PaketCliToolFilePath)" >
130+
<Output TaskParameter="Lines" ItemName="PaketCliToolFileLines"/>
131+
</ReadLinesFromFile>
132+
133+
<ItemGroup Condition=" '@(PaketCliToolFileLines)' != '' " >
134+
<PaketCliToolFileLinesInfo Include="@(PaketCliToolFileLines)" >
135+
<PackageName>$([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[0])</PackageName>
136+
<PackageVersion>$([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[1])</PackageVersion>
137+
</PaketCliToolFileLinesInfo>
138+
<DotNetCliToolReference Include="%(PaketCliToolFileLinesInfo.PackageName)">
139+
<Version>%(PaketCliToolFileLinesInfo.PackageVersion)</Version>
140+
</DotNetCliToolReference>
141+
</ItemGroup>
142+
143+
<PropertyGroup>
144+
<RestoreConfigFile>$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).NuGet.Config</RestoreConfigFile>
145+
</PropertyGroup>
146+
147+
</Target>
148+
149+
<Target Name="PaketDisableDirectPack" AfterTargets="_IntermediatePack" BeforeTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
150+
<PropertyGroup>
151+
<ContinuePackingAfterGeneratingNuspec>false</ContinuePackingAfterGeneratingNuspec>
152+
</PropertyGroup>
153+
</Target>
154+
155+
<Target Name="PaketOverrideNuspec" AfterTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
156+
<ItemGroup>
157+
<_NuspecFilesNewLocation Include="$(BaseIntermediateOutputPath)$(Configuration)\*.nuspec"/>
158+
</ItemGroup>
159+
160+
<PropertyGroup>
161+
<PaketProjectFile>$(MSBuildProjectDirectory)/$(MSBuildProjectFile)</PaketProjectFile>
162+
<ContinuePackingAfterGeneratingNuspec>true</ContinuePackingAfterGeneratingNuspec>
163+
<UseNewPack>false</UseNewPack>
164+
<UseNewPack Condition=" '$(NuGetToolVersion)' != '4.0.0' ">true</UseNewPack>
165+
<AdjustedNuspecOutputPath>$(BaseIntermediateOutputPath)$(Configuration)</AdjustedNuspecOutputPath>
166+
<AdjustedNuspecOutputPath Condition="@(_NuspecFilesNewLocation) == ''">$(BaseIntermediateOutputPath)</AdjustedNuspecOutputPath>
167+
</PropertyGroup>
168+
169+
<ItemGroup>
170+
<_NuspecFiles Include="$(AdjustedNuspecOutputPath)\*.nuspec"/>
171+
</ItemGroup>
172+
173+
<Exec Command='$(PaketCommand) fix-nuspecs files "@(_NuspecFiles)" project-file "$(PaketProjectFile)" ' Condition="@(_NuspecFiles) != ''" />
174+
175+
<ConvertToAbsolutePath Condition="@(_NuspecFiles) != ''" Paths="@(_NuspecFiles)">
176+
<Output TaskParameter="AbsolutePaths" PropertyName="NuspecFileAbsolutePath" />
177+
</ConvertToAbsolutePath>
178+
179+
180+
<!-- Call Pack -->
181+
<PackTask Condition="$(UseNewPack)"
182+
PackItem="$(PackProjectInputFile)"
183+
PackageFiles="@(_PackageFiles)"
184+
PackageFilesToExclude="@(_PackageFilesToExclude)"
185+
PackageVersion="$(PackageVersion)"
186+
PackageId="$(PackageId)"
187+
Title="$(Title)"
188+
Authors="$(Authors)"
189+
Description="$(Description)"
190+
Copyright="$(Copyright)"
191+
RequireLicenseAcceptance="$(PackageRequireLicenseAcceptance)"
192+
LicenseUrl="$(PackageLicenseUrl)"
193+
ProjectUrl="$(PackageProjectUrl)"
194+
IconUrl="$(PackageIconUrl)"
195+
ReleaseNotes="$(PackageReleaseNotes)"
196+
Tags="$(PackageTags)"
197+
DevelopmentDependency="$(DevelopmentDependency)"
198+
BuildOutputInPackage="@(_BuildOutputInPackage)"
199+
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
200+
TargetFrameworks="@(_TargetFrameworks)"
201+
AssemblyName="$(AssemblyName)"
202+
PackageOutputPath="$(PackageOutputAbsolutePath)"
203+
IncludeSymbols="$(IncludeSymbols)"
204+
IncludeSource="$(IncludeSource)"
205+
PackageTypes="$(PackageType)"
206+
IsTool="$(IsTool)"
207+
RepositoryUrl="$(RepositoryUrl)"
208+
RepositoryType="$(RepositoryType)"
209+
SourceFiles="@(_SourceFiles->Distinct())"
210+
NoPackageAnalysis="$(NoPackageAnalysis)"
211+
MinClientVersion="$(MinClientVersion)"
212+
Serviceable="$(Serviceable)"
213+
FrameworkAssemblyReferences="@(_FrameworkAssemblyReferences)"
214+
ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)"
215+
NuspecOutputPath="$(AdjustedNuspecOutputPath)"
216+
IncludeBuildOutput="$(IncludeBuildOutput)"
217+
BuildOutputFolder="$(BuildOutputTargetFolder)"
218+
ContentTargetFolders="$(ContentTargetFolders)"
219+
RestoreOutputPath="$(RestoreOutputAbsolutePath)"
220+
NuspecFile="$(NuspecFileAbsolutePath)"
221+
NuspecBasePath="$(NuspecBasePath)"
222+
NuspecProperties="$(NuspecProperties)"/>
223+
224+
<PackTask Condition="! $(UseNewPack)"
225+
PackItem="$(PackProjectInputFile)"
226+
PackageFiles="@(_PackageFiles)"
227+
PackageFilesToExclude="@(_PackageFilesToExclude)"
228+
PackageVersion="$(PackageVersion)"
229+
PackageId="$(PackageId)"
230+
Title="$(Title)"
231+
Authors="$(Authors)"
232+
Description="$(Description)"
233+
Copyright="$(Copyright)"
234+
RequireLicenseAcceptance="$(PackageRequireLicenseAcceptance)"
235+
LicenseUrl="$(PackageLicenseUrl)"
236+
ProjectUrl="$(PackageProjectUrl)"
237+
IconUrl="$(PackageIconUrl)"
238+
ReleaseNotes="$(PackageReleaseNotes)"
239+
Tags="$(PackageTags)"
240+
TargetPathsToAssemblies="@(_TargetPathsToAssemblies->'%(FinalOutputPath)')"
241+
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
242+
TargetFrameworks="@(_TargetFrameworks)"
243+
AssemblyName="$(AssemblyName)"
244+
PackageOutputPath="$(PackageOutputAbsolutePath)"
245+
IncludeSymbols="$(IncludeSymbols)"
246+
IncludeSource="$(IncludeSource)"
247+
PackageTypes="$(PackageType)"
248+
IsTool="$(IsTool)"
249+
RepositoryUrl="$(RepositoryUrl)"
250+
RepositoryType="$(RepositoryType)"
251+
SourceFiles="@(_SourceFiles->Distinct())"
252+
NoPackageAnalysis="$(NoPackageAnalysis)"
253+
MinClientVersion="$(MinClientVersion)"
254+
Serviceable="$(Serviceable)"
255+
AssemblyReferences="@(_References)"
256+
ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)"
257+
NuspecOutputPath="$(AdjustedNuspecOutputPath)"
258+
IncludeBuildOutput="$(IncludeBuildOutput)"
259+
BuildOutputFolder="$(BuildOutputTargetFolder)"
260+
ContentTargetFolders="$(ContentTargetFolders)"
261+
RestoreOutputPath="$(RestoreOutputAbsolutePath)"
262+
NuspecFile="$(NuspecFileAbsolutePath)"
263+
NuspecBasePath="$(NuspecBasePath)"
264+
NuspecProperties="$(NuspecProperties)"/>
265+
</Target>
266+
<!--/+:cnd:noEmit-->
267+
</Project>

.paket/paket.bootstrapper.exe

23.8 KB
Binary file not shown.

.paket/paket.exe

95.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)