-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDissonanceEngine.targets
78 lines (58 loc) · 2.9 KB
/
DissonanceEngine.targets
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<EnginePath>$(MSBuildThisFileDirectory)</EnginePath>
<AssetsPath>$(MSBuildProjectDirectory)</AssetsPath>
<LibrariesDirectory>Libraries</LibrariesDirectory>
<DissonanceBuildToolsAssemblyFile>$(EnginePath)\Tools\Build\netstandard2.0\Dissonance.BuildTools.dll</DissonanceBuildToolsAssemblyFile>
<!-- A default that can be overridden -->
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(EnginePath)\Src\DissonanceEngine.csproj" />
<ProjectReference Include="$(EnginePath)\SourceGenerators\DissonanceSourceGen.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
<ItemGroup>
<Assets Include="$(AssetsPath)\**" />
<Assets Remove="**\bin\**" />
<Assets Remove="**\obj\**" />
<Assets Remove="$(TargetDir)\**" />
<Assets Remove="$(AssetsPath)\.vs\**" />
<Assets Remove="$(AssetsPath)\Properties\launchSettings.json" />
<Assets Remove="**\*.cs" />
<Assets Remove="**\*.csproj" />
</ItemGroup>
<!-- Manage assets -->
<Target Name="CopyAssets" AfterTargets="Build">
<PropertyGroup>
<TargetAssetsPath>$(TargetDir)\Assets</TargetAssetsPath>
</PropertyGroup>
<Message Text="Copying assets from '$(AssetsPath)' to '$(TargetAssetsPath)'" Importance="High"/>
<RemoveDir Directories="$(TargetDir)\Assets" />
<MakeDir Directories="$(TargetDir)\Assets" />
<Copy SourceFiles="@(Assets)" DestinationFolder="$(TargetAssetsPath)\%(RecursiveDir)" SkipUnchangedFiles="False" />
</Target>
<!-- Manage libraries -->
<UsingTask TaskName="MoveProjectDependencies" AssemblyFile="$(DissonanceBuildToolsAssemblyFile)" Condition="$(OutputType) != 'Library'" />
<Target Name="MoveDependencies" AfterTargets="CopyAssets" Condition="$(OutputType) != 'Library'">
<Message Text="Moving dependencies..." Importance="high" />
<MoveProjectDependencies
OutputPath="$(OutputPath)"
AssemblyName="$(AssemblyName)"
LibrariesDir="Libraries"
ProjectDepsFilePath="$(ProjectDepsFilePath)"
ProjectRuntimeConfigFilePath="$(ProjectRuntimeConfigFilePath)"
/>
</Target>
<Target Name="CopyNatives" AfterTargets="MoveDependencies" Condition="$(OutputType) != 'Library'">
<ItemGroup>
<NativeFiles Include="$(EnginePath)\References\Native\**" />
</ItemGroup>
<Message Text="Copying natives from '$(EnginePath)\References\Native' to '$(TargetDir)\Libraries\Native'" Importance="High" />
<Copy SourceFiles="@(NativeFiles)" DestinationFolder="$(TargetDir)\Libraries\Native\%(RecursiveDir)" SkipUnchangedFiles="False" />
</Target>
<!-- Final cleanups -->
<UsingTask TaskName="DeleteEmptyDirectories" AssemblyFile="$(DissonanceBuildToolsAssemblyFile)" />
<Target Name="DeleteEmptyDirectories" AfterTargets="CopyNatives" >
<DeleteEmptyDirectories Path="$(OutputPath)" />
</Target>
</Project>