-
Notifications
You must be signed in to change notification settings - Fork 4
/
Game.targets
77 lines (77 loc) · 6.23 KB
/
Game.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
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CopyLocalLockFileAssemblies>True</CopyLocalLockFileAssemblies>
<TargetPlatform Condition="!$(GamePlatform.Contains(';'))">$(GamePlatform)</TargetPlatform>
<TargetPlatform Condition="$(GamePlatform.Contains(';'))">$(GamePlatform.Split(';')[0])</TargetPlatform>
<AssemblySearchPaths>$(AssemblySearchPaths);Dependencies;Dependencies\$(TargetPlatform)\$(ManagedDir)</AssemblySearchPaths>
</PropertyGroup>
<Target Name="BeforeBuild">
<PropertyGroup>
<SteamCommand>pwsh "..\Steam.ps1"</SteamCommand>
<PlatformArg Condition="'$(GamePlatform)' != ''">-platform $(GamePlatform.Split(';')[0])</PlatformArg>
<DeobfArg Condition="'$(Deobfuscator)' != ''">-deobfuscator $(Deobfuscator)</DeobfArg>
<AppIdArg Condition="'$(SteamAppId)' != ''">-steam_appid $(SteamAppId)</AppIdArg>
<BranchArg Condition="'$(SteamBranch)' != ''">-steam_branch $(SteamBranch)</BranchArg>
<DepotArg Condition="'$(SteamDepot)' != ''">-steam_depot $(SteamDepot)</DepotArg>
<LoginArg Condition="'$(SteamLogin)' != ''">-steam_access $(SteamLogin)</LoginArg>
</PropertyGroup>
<Message Text="Setting up environment for $(TargetPlatform)..." Importance="High" />
<Exec Command="$(SteamCommand) -game_name $(GameName) -dotnet $(TargetFramework) -target_dir $(TargetDir) -managed_dir $(ManagedDir) $(PlatformArg) $(DeobfArg) $(AppIdArg) $(BranchArg) $(DepotArg) $(LoginArg)" />
</Target>
<Target Name="ChangeAliasesOfStrongNameAssemblies" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences">
<ItemGroup>
<ReferencePath Condition="'%(FileName)' == 'Oxide.References'">
<Aliases>References</Aliases>
</ReferencePath>
</ItemGroup>
</Target>
<Target Name="AfterBuild">
<ItemGroup>
<CoreFiles Include="$(TargetDir)\Oxide*.dll" />
<ContentFiles Include="$(NuGetPackageRoot)\oxide.references\**\lib\any\$(TargetFramework)\*.*" />
<ContentFiles Include="$(NuGetPackageRoot)\oxide.core\**\lib\$(TargetFramework)\*.*" />
<ContentFiles Include="$(NuGetPackageRoot)\oxide.csharp\**\lib\any\*.*; $(NuGetPackageRoot)\oxide.csharp\**\lib\$(TargetFramework)\*.*" />
<ContentFiles Include="$(NuGetPackageRoot)\oxide.mysql\**\lib\any\MySql.*.dll; $(NuGetPackageRoot)\oxide.mysql\**\lib\any\System.*.dll" />
<ContentFiles Include="$(NuGetPackageRoot)\oxide.mysql\**\lib\$(TargetFramework)\*.*" />
<ContentFiles Include="$(NuGetPackageRoot)\oxide.sqlite\**\lib\any\*.*; $(NuGetPackageRoot)\oxide.sqlite\**\lib\$(TargetFramework)\*.*" />
<ContentFiles Include="$(ProjectDir)\Dependencies\Base\*.dll" />
<ContentX64Files Include="$(NuGetPackageRoot)\oxide.references\**\lib\any\x64\*.*; $(NuGetPackageRoot)\oxide.sqlite\**\lib\any\x64\*.*" />
<ContentX86Files Include="$(NuGetPackageRoot)\oxide.references\**\lib\any\x86\*.*; $(NuGetPackageRoot)\oxide.sqlite\**\lib\any\x86\*.*" />
</ItemGroup>
<Message Condition="'@(CoreFiles)' != ''" Text="Bundling core files: @(CoreFiles->'%(Filename)%(Extension)', ', ')" Importance="High" />
<Copy SourceFiles="@(CoreFiles)" DestinationFiles="@(CoreFiles->'$(ProjectDir)\bin\Bundle\$(PackageId)\$(ManagedDir)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Message Condition="'@(PatchedFiles)' != ''" Text="Bundling patched files: @(PatchedFiles->'%(Filename)%(Extension)', ', ')" Importance="High" />
<Copy SourceFiles="@(PatchedFiles)" DestinationFiles="@(PatchedFiles->'$(ProjectDir)\bin\Bundle\$(PackageId)\$(ManagedDir)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Message Condition="'@(ContentFiles)' != ''" Text="Bundling reference files: @(ContentFiles->'%(Filename)%(Extension)', ', ')" Importance="High" />
<Copy SourceFiles="@(ContentFiles)" DestinationFiles="@(ContentFiles->'$(ProjectDir)\bin\Bundle\$(PackageId)\$(ManagedDir)\%(Filename)%(Extension)')" />
<Message Condition="'@(ContentX64Files)' != ''" Text="Bundling reference files: @(ContentX64Files->'%(Filename)%(Extension)', ', ')" Importance="High" />
<Copy SourceFiles="@(ContentX64Files)" DestinationFiles="@(ContentX64Files->'$(ProjectDir)\bin\Bundle\$(PackageId)\$(ManagedDir)\x64\%(Filename)%(Extension)')" />
<Message Condition="'@(ContentX86Files)' != ''" Text="Bundling reference files: @(ContentX86Files->'%(Filename)%(Extension)', ', ')" Importance="High" />
<Copy SourceFiles="@(ContentX86Files)" DestinationFiles="@(ContentX86Files->'$(ProjectDir)\bin\Bundle\$(PackageId)\$(ManagedDir)\x86\%(Filename)%(Extension)')" />
<!--<Exec Command="pdb2mdb %(PatchedFiles.Identity)" IgnoreExitCode="true" Condition="'$(Configuration)' == 'Debug' AND '$(OS)' == 'Windows_NT'" />-->
</Target>
<Target Name="LocalDeploy" AfterTargets="AfterBuild" Condition="Exists('..\.deploy') AND $(GamePlatform.Contains('windows'))">
<ItemGroup>
<GameExes Include="$(GameExe)" />
</ItemGroup>
<Message Text="Checking for and ending %(GameExes.Identity) process..." Importance="High" />
<Exec Command="start /b /wait taskkill /f /im %(GameExes.Identity) /fi "memusage gt 2"" Condition="'$(OS)' == 'Windows_NT'" />
<ReadLinesFromFile File="..\.deploy">
<Output PropertyName="DeployPath" TaskParameter="Lines" />
</ReadLinesFromFile>
<PropertyGroup Condition="'$(DeployPath)' != '' AND !$(SteamBranch.Contains('public'))">
<DeployPath>$(DeployPath)-$(SteamBranch)</DeployPath>
</PropertyGroup>
<ItemGroup>
<DeployFiles Include="$(ProjectDir)\bin\Bundle\$(PackageId)\**\*.*" />
</ItemGroup>
<Message Text="Deploying to $(DeployPath): @(DeployFiles ->'%(Filename)%(Extension)', ', ')..." Importance="High" Condition="'@(DeployFiles)' != ''" />
<Copy SourceFiles="@(DeployFiles)" DestinationFiles="@(DeployFiles->'$(DeployPath)\%(RecursiveDir)%(Filename)%(Extension)')" Condition="'$(DeployPath)' != ''" />
</Target>
<Target Name="BuildPlatform" AfterTargets="AfterBuild" Condition="$(GamePlatform.Contains(';'))">
<PropertyGroup>
<GamePlatform>$(GamePlatform.Split(';')[1])</GamePlatform>
</PropertyGroup>
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="Clean;Build" Properties="PackageId=$(AssemblyName)-$(GamePlatform);GamePlatform=$(GamePlatform)" />
</Target>
</Project>