Skip to content

Commit cba4dd8

Browse files
committed
Update version
Add new package script
1 parent 54a8900 commit cba4dd8

File tree

5 files changed

+69
-4
lines changed

5 files changed

+69
-4
lines changed

DrakiaXYZ-Waypoints.csproj

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@
3030
<ErrorReport>prompt</ErrorReport>
3131
<WarningLevel>4</WarningLevel>
3232
</PropertyGroup>
33+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Package|AnyCPU'">
34+
<OutputPath>bin\Package\</OutputPath>
35+
<DefineConstants>TRACE</DefineConstants>
36+
<Optimize>true</Optimize>
37+
<DebugType>pdbonly</DebugType>
38+
<PlatformTarget>AnyCPU</PlatformTarget>
39+
<LangVersion>7.3</LangVersion>
40+
<ErrorReport>prompt</ErrorReport>
41+
</PropertyGroup>
3342
<ItemGroup>
3443
<Reference Include="0Harmony, Version=2.9.0.0, Culture=neutral, processorArchitecture=MSIL">
3544
<SpecificVersion>False</SpecificVersion>
@@ -149,6 +158,9 @@
149158
<PreBuildEvent>powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File $(ProjectDir)\VersionChecker\setbuild.ps1</PreBuildEvent>
150159
</PropertyGroup>
151160
<PropertyGroup>
152-
<PostBuildEvent>copy "$(TargetPath)" "$(ProjectDir)\..\..\BepInEx\plugins\$(ProjectName)\$(TargetFileName)"</PostBuildEvent>
161+
<PostBuildEvent>copy "$(TargetPath)" "$(ProjectDir)\..\..\BepInEx\plugins\$(ProjectName)\$(TargetFileName)"
162+
if $(ConfigurationName) == Package (
163+
powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File $(ProjectDir)\package.ps1
164+
)</PostBuildEvent>
153165
</PropertyGroup>
154166
</Project>

DrakiaXYZ-Waypoints.sln

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1010
Debug|Any CPU = Debug|Any CPU
11+
Package|Any CPU = Package|Any CPU
1112
Release|Any CPU = Release|Any CPU
1213
EndGlobalSection
1314
GlobalSection(ProjectConfigurationPlatforms) = postSolution
1415
{DB6C9ACA-DEC4-4D61-AF7B-5F5DAB6CCE70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1516
{DB6C9ACA-DEC4-4D61-AF7B-5F5DAB6CCE70}.Debug|Any CPU.Build.0 = Debug|Any CPU
17+
{DB6C9ACA-DEC4-4D61-AF7B-5F5DAB6CCE70}.Package|Any CPU.ActiveCfg = Package|Any CPU
18+
{DB6C9ACA-DEC4-4D61-AF7B-5F5DAB6CCE70}.Package|Any CPU.Build.0 = Package|Any CPU
1619
{DB6C9ACA-DEC4-4D61-AF7B-5F5DAB6CCE70}.Release|Any CPU.ActiveCfg = Release|Any CPU
1720
{DB6C9ACA-DEC4-4D61-AF7B-5F5DAB6CCE70}.Release|Any CPU.Build.0 = Release|Any CPU
1821
EndGlobalSection

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
// You can specify all the values or you can default the Build and Revision Numbers
3434
// by using the '*' as shown below:
3535
// [assembly: AssemblyVersion("1.0.*")]
36-
[assembly: AssemblyVersion("1.5.0.0")]
37-
[assembly: AssemblyFileVersion("1.5.0.0")]
36+
[assembly: AssemblyVersion("1.5.1.0")]
37+
[assembly: AssemblyFileVersion("1.5.1.0")]
3838
[assembly: TarkovVersion(30626)]

WaypointsPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
namespace DrakiaXYZ.Waypoints
1616
{
17-
[BepInPlugin("xyz.drakia.waypoints", "DrakiaXYZ-Waypoints", "1.5.0")]
17+
[BepInPlugin("xyz.drakia.waypoints", "DrakiaXYZ-Waypoints", "1.5.1")]
1818
[BepInDependency("com.SPT.core", "3.9.0")]
1919
public class WaypointsPlugin : BaseUnityPlugin
2020
{

package.ps1

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Configuration
2+
$packageDir = '.\Package'
3+
$artifactDir = '.\bin\Package'
4+
5+
# Make sure our CWD is where the script lives
6+
Set-Location $PSScriptRoot
7+
8+
# Fetch the plugin info
9+
$assemblyInfoPath = 'Properties\AssemblyInfo.cs'
10+
$versionPattern = '^\[assembly: AssemblyVersion\("(.*)"\)\]'
11+
$namePattern = '<AssemblyName>(.*)</AssemblyName>'
12+
(Get-Content $assemblyInfoPath) | ForEach-Object {
13+
if ($_ -match $versionPattern) {
14+
$assemblyVersion = [version]$matches[1]
15+
}
16+
}
17+
$csprojPath = Get-ChildItem '.' -filter '*.csproj'
18+
(Get-Content $csprojPath) | ForEach-Object {
19+
if ($_ -match $namePattern) {
20+
$modName = $matches[1]
21+
}
22+
}
23+
24+
# Format the version number for our archive
25+
$modVersion = '{0}.{1}.{2}' -f $assemblyVersion.Major, $assemblyVersion.Minor, $assemblyVersion.Build
26+
if ($assemblyVersion.Revision -ne 0)
27+
{
28+
$modVersion = '{0}.{1}' -f $modVersion, $assemblyVersion.Revision
29+
}
30+
31+
Write-Host ('Packaging {0} v{1}' -f $modName, $modVersion)
32+
33+
# Create the package structure
34+
$bepInExDir = '{0}\BepInEx' -f $packageDir
35+
$pluginsDir = '{0}\plugins\{1}' -f $bepInExDir, $modName
36+
$null = mkdir $pluginsDir -ea 0
37+
38+
# Copy required files to the package structure
39+
$artifactPath = ('{0}\{1}.dll' -f $artifactDir, $modName)
40+
Copy-Item $artifactPath -Destination $pluginsDir
41+
42+
# Create the archive
43+
$archivePath = '{0}\{1}-{2}.7z' -f $packageDir, $modName, $modVersion
44+
if (Test-Path $archivePath)
45+
{
46+
Remove-Item $archivePath
47+
}
48+
7z a $archivePath $bepInExDir
49+
50+
Write-Host ('Mod packaging complete')

0 commit comments

Comments
 (0)