-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameTest.targets
More file actions
67 lines (59 loc) · 3.34 KB
/
GameTest.targets
File metadata and controls
67 lines (59 loc) · 3.34 KB
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
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)GameTest.user" Condition="Exists('$(MSBuildThisFileDirectory)GameTest.user')" />
<PropertyGroup>
<SampleGameRepositoryUrl Condition="'$(SampleGameRepositoryUrl)' == ''">https://github.com/DarkDaskin/Unity-Game-Samples/</SampleGameRepositoryUrl>
<SampleGameRepositoryTag Condition="'$(SampleGameRepositoryTag)' == ''">v2</SampleGameRepositoryTag>
</PropertyGroup>
<ItemGroup Condition="'$(UseDefaultSampleGames)' != 'false'">
<SampleGameType Include="357-net20" />
<SampleGameType Include="357-net20-subset" />
<SampleGameType Include="472-net20" />
<SampleGameType Include="472-net20-subset" />
<SampleGameType Include="567-net20" />
<SampleGameType Include="567-net20-subset" />
<SampleGameType Include="2017-net20" />
<SampleGameType Include="2017-net20-subset" />
<SampleGameType Include="2017-net46" />
<SampleGameType Include="2018-net20" />
<SampleGameType Include="2018-net20-subset" />
<SampleGameType Include="2018-net4-v1.0" />
<SampleGameType Include="2018-net4-v1.1" />
<SampleGameType Include="2018-netstandard20-v2.0" />
<SampleGameType Include="2018-netstandard20-v2.1" />
<SampleGameType Include="2022-net4" />
<SampleGameType Include="2022-netstandard21" />
</ItemGroup>
<Target Name="_ResolveSampleGameDownloadPath">
<PropertyGroup>
<SampleGameDownloadPath Condition="'$(SampleGameDownloadPath)' == ''">$(BaseIntermediateOutputPath)SampleUnityGames\</SampleGameDownloadPath>
<SampleGameDownloadPath>$([MSBuild]::EnsureTrailingSlash($([MSBuild]::NormalizePath('$(SampleGameDownloadPath)'))))</SampleGameDownloadPath>
</PropertyGroup>
</Target>
<Target Name="DownloadSampleGames" DependsOnTargets="_ResolveSampleGameDownloadPath" BeforeTargets="BeforeCompile"
Inputs="$(MSBuildAllProjects)" Outputs="@(SampleGameType->'$(SampleGameDownloadPath)%(Identity)\%(Identity).exe')">
<ItemGroup>
<_SampleGameZipFileName Include="@(SampleGameType->'UnityGame-%(Identity).zip')" />
<_SampleGameZipUrl Include="@(_SampleGameZipFileName->'$(SampleGameRepositoryUrl)releases/download/$(SampleGameRepositoryTag)/%(Identity)')" />
</ItemGroup>
<DownloadFile SourceUrl="%(_SampleGameZipUrl.Identity)" DestinationFolder="$(SampleGameDownloadPath)" />
<Unzip SourceFiles="$(SampleGameDownloadPath)UnityGame-%(SampleGameType.Identity).zip" DestinationFolder="$(SampleGameDownloadPath)%(SampleGameType.Identity)" />
</Target>
<Target Name="GenerateSampleGameInfo" DependsOnTargets="_ResolveSampleGameDownloadPath" BeforeTargets="BeforeCompile">
<PropertyGroup>
<_SampleGameInfoText><![CDATA[
namespace $(RootNamespace)%3B
internal static class SampleGameInfo
{
public const string DownloadPath = @"$(SampleGameDownloadPath)"%3B
}
]]></_SampleGameInfoText>
<_SampleGameInfoFilePath>$(IntermediateOutputPath)SampleGameInfo.cs</_SampleGameInfoFilePath>
</PropertyGroup>
<WriteLinesToFile File="$(_SampleGameInfoFilePath)" Lines="$(_SampleGameInfoText)" WriteOnlyWhenDifferent="true" Overwrite="true" />
<ItemGroup>
<Compile Include="$(_SampleGameInfoFilePath)" />
<FileWrites Include="$(_SampleGameInfoFilePath)" />
</ItemGroup>
</Target>
</Project>