|
1 | 1 | <Project> |
| 2 | + <PropertyGroup> |
| 3 | + <BeforePack>_PackToolset</BeforePack> |
| 4 | + </PropertyGroup> |
| 5 | + |
| 6 | + <PropertyGroup> |
| 7 | + <_ArchiveBase>zig-$(ZigArchiveName)-$(Version)</_ArchiveBase> |
| 8 | + <_ArchiveName>$(_ArchiveBase).$(ZigArchiveType)</_ArchiveName> |
| 9 | + <_ArchivePath>$(OutputPath)$(_ArchiveName)</_ArchivePath> |
| 10 | + <_ArchiveDestination>$(OutputPath)$(_ArchiveBase)/</_ArchiveDestination> |
| 11 | + </PropertyGroup> |
| 12 | + |
2 | 13 | <ItemGroup> |
3 | | - <None Include="build/**/*" |
4 | | - Pack="true" |
5 | | - PackagePath="%(RelativeDir)" /> |
6 | | - <None Include="bin/$(Configuration)/zig-$(ZigArchiveName)-$(Version)/**/*" |
| 14 | + <None Include="build/**" |
7 | 15 | Pack="true" |
8 | | - PackagePath="tools/%(RecursiveDir)" /> |
| 16 | + PackagePath="%(Identity)" /> |
9 | 17 | </ItemGroup> |
10 | 18 |
|
| 19 | + <ItemGroup> |
| 20 | + <Zig Include="$(_ArchiveDestination)**" /> |
| 21 | + </ItemGroup> |
| 22 | + |
| 23 | + <!-- |
| 24 | + TODO: We currently assume that the tar program can extract XZ archives. This |
| 25 | + is not the case for the tar that ships with Windows. So, this target only |
| 26 | + really works on Unix systems or in environments that have a proper tar (e.g. |
| 27 | + Git Bash). |
| 28 | + --> |
11 | 29 | <Target Name="_RestoreArchive" |
12 | 30 | AfterTargets="_GenerateRestoreProjectPathWalk"> |
13 | | - <PropertyGroup> |
14 | | - <_ArchiveBase>zig-$(ZigArchiveName)-$(Version)</_ArchiveBase> |
15 | | - <_ArchiveName>$(_ArchiveBase).$(ZigArchiveType)</_ArchiveName> |
16 | | - <_ArchivePath>$(OutputPath)$(_ArchiveName)</_ArchivePath> |
17 | | - <_ArchiveDestination>$(OutputPath)$(_ArchiveBase)/</_ArchiveDestination> |
18 | | - </PropertyGroup> |
19 | | - |
20 | 31 | <DownloadFile SourceUrl="https://ziglang.org/download/$(Version)/$(_ArchiveName)" |
21 | 32 | DestinationFolder="$(OutputPath)" |
22 | 33 | Condition="!Exists('$(_ArchivePath)')" /> |
|
32 | 43 | Condition="'$(ZigArchiveType)' == 'tar.xz' and !Exists('$(_ArchiveDestination)zig')" /> |
33 | 44 | </Target> |
34 | 45 |
|
| 46 | + <!-- |
| 47 | + We need to work around some NuGet weirdness where files without an extension |
| 48 | + do not get packed properly when using RecursiveDir on its own. |
| 49 | + --> |
| 50 | + <Target Name="_PackToolset"> |
| 51 | + <ItemGroup> |
| 52 | + <None Include="@(Zig)" |
| 53 | + Pack="true" |
| 54 | + PackagePath="tools/%(RecursiveDir)%(Filename)%(Extension)" |
| 55 | + Condition="'%(Extension)' != ''" /> |
| 56 | + <None Include="@(Zig)" |
| 57 | + Pack="true" |
| 58 | + PackagePath="tools/%(RecursiveDir)" |
| 59 | + Condition="'%(Extension)' == ''" /> |
| 60 | + </ItemGroup> |
| 61 | + </Target> |
| 62 | + |
35 | 63 | <Import Project="$([MSBuild]::GetPathOfFileAbove('$(MSBuildThisFile)', '$(MSBuildThisFileDirectory)..'))" /> |
36 | 64 | </Project> |
0 commit comments