mirror of
https://github.com/rmroc451/TweaksAndThings.git
synced 2025-12-16 09:19:37 -06:00
72 lines
3.3 KiB
XML
72 lines
3.3 KiB
XML
<Project>
|
|
<PropertyGroup>
|
|
<!-- Try to find the directory on our own -->
|
|
<GameManagedDir Condition="'$(GameManagedDir)' == ''">$([System.IO.Directory]::GetDirectories(`$(GameDir)`, `*_Data`)[0])\Managed</GameManagedDir>
|
|
|
|
<!-- Copy the mod to the game directory -->
|
|
<GameModDir Condition="'$(GameModDir)' == ''">$(GameDir)/Mods/$(AssemblyName)</GameModDir>
|
|
<OutDir Condition="'$(Configuration)' == 'Debug'">$(GameModDir)/</OutDir>
|
|
<VersionTimestamp>$([System.DateTime]::UtcNow.ToString(`o`))</VersionTimestamp>
|
|
</PropertyGroup>
|
|
|
|
<!-- Replace the default version if something was set for it -->
|
|
<PropertyGroup Condition="'$(AssemblyVersion)' == '' OR '$(MajorVersion)' != '' OR '$(MinorVersion)' != ''">
|
|
<MajorVersion Condition="'$(MajorVersion)' == ''">1</MajorVersion>
|
|
<MinorVersion Condition="'$(MinorVersion)' == ''">1</MinorVersion>
|
|
<PatchVersion Condition="'$(PatchVersion)' == ''">1</PatchVersion>
|
|
<AssemblyVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion)</AssemblyVersion>
|
|
<FileVersion>$(AssemblyVersion)</FileVersion>
|
|
<ProductVersion>$(AssemblyVersion)</ProductVersion>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<!-- Reference the .dll/.exes specified with GameAssembly elements-->
|
|
<Reference Include="@(GameAssembly)">
|
|
<HintPath Condition="Exists('$(GameManagedDir)\%(Identity).dll')">$(GameManagedDir)\%(Identity).dll</HintPath>
|
|
<HintPath Condition="Exists('$(GameManagedDir)\%(Identity).exe')">$(GameManagedDir)\%(Identity).exe</HintPath>
|
|
<Private>false</Private>
|
|
</Reference>
|
|
</ItemGroup>
|
|
|
|
<!-- Publish the mod as a neat zip file -->
|
|
<Target Name="PrepareForPublishing" AfterTargets="AfterBuild" Condition="'$(Configuration)' == 'Release'">
|
|
<!-- Replace $(AssemblyVersion) with the actual version -->
|
|
<Exec Command="powershell -Command "(Get-Content '$(OutputPath)Definition.json') -replace '\$\(AssemblyVersion\)', '$(AssemblyVersion)_$(VersionTimestamp)' | Set-Content '$(OutputPath)Definition.json'"" />
|
|
|
|
<PropertyGroup>
|
|
<ModsDirectory>$(OutputPath)/Mods</ModsDirectory>
|
|
<ModDirectory>$(ModsDirectory)/$(AssemblyName)</ModDirectory>
|
|
|
|
<!-- Folder we'll put the published zips into -->
|
|
<PublishPath>../bin</PublishPath>
|
|
<ZipName>$(PublishPath)/$(AssemblyName)_$(AssemblyVersion)_Experimental.zip</ZipName>
|
|
</PropertyGroup>
|
|
|
|
<!-- Assure the output path exists -->
|
|
<MakeDir Directories="$(PublishPath)" />
|
|
|
|
<!-- Remove the old Mods directory, and Zips file if any is lying around -->
|
|
<ItemGroup>
|
|
<OldZips Include="$(PublishPath)/$(AssemblyName)_*.zip" />
|
|
</ItemGroup>
|
|
|
|
<RemoveDir Directories="$(ModsDirectory)" ContinueOnError="true" />
|
|
<Delete Files="@(OldZips)" />
|
|
|
|
<!-- Create the Mods directory again -->
|
|
<MakeDir Directories="$(ModDirectory)" />
|
|
|
|
<!-- Move all files to the right folder -->
|
|
<ItemGroup>
|
|
<OutputFiles Include="$(OutputPath)/**/*" />
|
|
</ItemGroup>
|
|
|
|
<Copy SourceFiles="@(OutputFiles)" DestinationFolder="$(ModDirectory)" />
|
|
|
|
<!-- Zip it up -->
|
|
<Exec Command="powershell -Command "Compress-Archive -Path '$(ModsDirectory)' -Destination '$(ZipName)'"" />
|
|
|
|
<!-- Move them to the game directory -->
|
|
<Copy SourceFiles="@(OutputFiles)" DestinationFolder="$(GameModDir)" />
|
|
</Target>
|
|
</Project> |