-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommonTargets.csproj
53 lines (53 loc) · 2.86 KB
/
CommonTargets.csproj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Directory for calling yak, this is different for Rhino 7 and 8,
because Rhino 8 supports multi-targeted packages.
-->
<PropertyGroup Condition="$(Configuration.EndsWith('R7'))">
<YakBuildPath>$(OutputPath)/net48</YakBuildPath>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.EndsWith('R8'))">
<YakBuildPath>$(OutputPath)</YakBuildPath>
</PropertyGroup>
<PropertyGroup>
<YakYamlFile>$(YakBuildPath)/manifest.yml</YakYamlFile>
</PropertyGroup>
<!--
Target for wiping the build directory
-->
<Target Name="PrepareBuildYakPackage">
<RemoveDir Directories="$(YakBuildPath)" />
</Target>
<!--
Target for building the yak package
-->
<Target Name="BuildYakPackage">
<!-- create the manifest yaml file -->
<Copy SourceFiles="$(MSBuildThisFileDirectory)/yak/manifest.yml" DestinationFiles="$(YakYamlFile)" />
<ReplaceFileText InputFilename="$(YakYamlFile)" OutputFilename="$(YakYamlFile)" MatchExpression="\$name\$" ReplacementText="$(YakName)" />
<ReplaceFileText InputFilename="$(YakYamlFile)" OutputFilename="$(YakYamlFile)" MatchExpression="\$version\$" ReplacementText="$(Version)" />
<ReplaceFileText InputFilename="$(YakYamlFile)" OutputFilename="$(YakYamlFile)" MatchExpression="\$authors\$" ReplacementText="$(YakAuthors)" />
<ReplaceFileText InputFilename="$(YakYamlFile)" OutputFilename="$(YakYamlFile)" MatchExpression="\$description\$" ReplacementText="$(YakDescription)" />
<ReplaceFileText InputFilename="$(YakYamlFile)" OutputFilename="$(YakYamlFile)" MatchExpression="\$url\$" ReplacementText="$(YakUrl)" />
<ReplaceFileText InputFilename="$(YakYamlFile)" OutputFilename="$(YakYamlFile)" MatchExpression="\$icon_url\$" ReplacementText="$(YakIconUrl)" />
<ReplaceFileText InputFilename="$(YakYamlFile)" OutputFilename="$(YakYamlFile)" MatchExpression="\$keywords\$" ReplacementText="$(YakKeywords)" />
<!-- remove pdb files etc -->
<!-- see example here: https://learn.microsoft.com/en-us/visualstudio/msbuild/delete-task?view=vs-2022 -->
<ItemGroup>
<FilesToDelete Include="$(YakBuildPath)*\*.yak;$(YakBuildPath)*\*.pdb;$(YakBuildPath)*\*.xml" />
</ItemGroup>
<Message Text="Deleting Files @(FilesToDelete)" />
<Delete Files="@(FilesToDelete)">
<Output TaskParameter="DeletedFiles" ItemName="FilesDeleted" />
</Delete>
<Message Text="Files deleted: @(FilesDeleted)" />
<!-- call yak -->
<Exec Command=""$(YakExecutable)" build" WorkingDirectory="$(YakBuildPath)" />
<!-- move resulting yak package -->
<ItemGroup>
<BuiltYakPackages Include="$(YakBuildPath)\*.yak" />
</ItemGroup>
<Copy SourceFiles="@(BuiltYakPackages)" DestinationFolder="$(MSBuildThisFileDirectory)/bin/packages" />
</Target>
</Project>