add build script

This commit is contained in:
Li 2022-05-08 12:21:33 +12:00
parent 063c267755
commit bf4d5f5005
14 changed files with 8903 additions and 9004 deletions

View file

@ -38,11 +38,6 @@ Global
MacOS|ARM64 = MacOS|ARM64
MacOS|x64 = MacOS|x64
MacOS|x86 = MacOS|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
Windows|Any CPU = Windows|Any CPU
Windows|ARM = Windows|ARM
Windows|ARM64 = Windows|ARM64
@ -98,16 +93,6 @@ Global
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.MacOS|x64.Build.0 = MacOS|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.MacOS|x86.ActiveCfg = MacOS|x86
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.MacOS|x86.Build.0 = MacOS|x86
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|Any CPU.ActiveCfg = Windows|Any CPU
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|Any CPU.Build.0 = Windows|Any CPU
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|ARM.ActiveCfg = Windows|ARM
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|ARM.Build.0 = Windows|ARM
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|ARM64.ActiveCfg = Windows|ARM64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|ARM64.Build.0 = Windows|ARM64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|x64.ActiveCfg = Windows|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|x64.Build.0 = Windows|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|x86.ActiveCfg = Debug|x86
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|x86.Build.0 = Debug|x86
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|Any CPU.ActiveCfg = Windows|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|Any CPU.Build.0 = Windows|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|ARM.ActiveCfg = Windows|ARM
@ -166,16 +151,6 @@ Global
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.MacOS|x64.Build.0 = MacOS|x64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.MacOS|x86.ActiveCfg = MacOS|x86
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.MacOS|x86.Build.0 = MacOS|x86
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|Any CPU.ActiveCfg = Linux|Any CPU
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|Any CPU.Build.0 = Linux|Any CPU
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|ARM.ActiveCfg = Debug|ARM
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|ARM.Build.0 = Debug|ARM
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|ARM64.ActiveCfg = Debug|ARM64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|ARM64.Build.0 = Debug|ARM64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|x64.ActiveCfg = Windows|x64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|x64.Build.0 = Windows|x64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|x86.ActiveCfg = Debug|x86
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|x86.Build.0 = Debug|x86
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Windows|Any CPU.ActiveCfg = Debug|x64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Windows|Any CPU.Build.0 = Debug|x64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Windows|ARM.ActiveCfg = Windows|Any CPU
@ -216,16 +191,6 @@ Global
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.MacOS|ARM64.ActiveCfg = Debug|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.MacOS|x64.ActiveCfg = Debug|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.MacOS|x86.ActiveCfg = Debug|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|Any CPU.ActiveCfg = Windows|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|Any CPU.Build.0 = Windows|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|ARM.ActiveCfg = Windows|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|ARM.Build.0 = Windows|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|ARM64.ActiveCfg = Windows|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|ARM64.Build.0 = Windows|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|x64.ActiveCfg = Debug|x64
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|x64.Build.0 = Debug|x64
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|x86.ActiveCfg = Debug|x86
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|x86.Build.0 = Debug|x86
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|Any CPU.ActiveCfg = Debug|x64
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|Any CPU.Build.0 = Debug|x64
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|ARM.ActiveCfg = Windows|Any CPU
@ -234,7 +199,7 @@ Global
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|x64.Build.0 = Windows|x64
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|x86.ActiveCfg = Windows|x86
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|x86.Build.0 = Windows|x86
{D330A197-67D4-42B0-8906-54264AF95EC1}.Android|Any CPU.ActiveCfg = Debug
{D330A197-67D4-42B0-8906-54264AF95EC1}.Android|Any CPU.ActiveCfg = Windows
{D330A197-67D4-42B0-8906-54264AF95EC1}.Android|ARM.ActiveCfg = Windows
{D330A197-67D4-42B0-8906-54264AF95EC1}.Android|ARM64.ActiveCfg = Windows
{D330A197-67D4-42B0-8906-54264AF95EC1}.Android|x64.ActiveCfg = Windows
@ -259,17 +224,7 @@ Global
{D330A197-67D4-42B0-8906-54264AF95EC1}.MacOS|ARM64.ActiveCfg = Debug
{D330A197-67D4-42B0-8906-54264AF95EC1}.MacOS|x64.ActiveCfg = Debug
{D330A197-67D4-42B0-8906-54264AF95EC1}.MacOS|x86.ActiveCfg = Debug
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|Any CPU.ActiveCfg = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|Any CPU.Build.0 = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|ARM.ActiveCfg = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|ARM.Build.0 = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|ARM64.ActiveCfg = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|ARM64.Build.0 = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|x64.ActiveCfg = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|x64.Build.0 = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|x86.ActiveCfg = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|x86.Build.0 = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Windows|Any CPU.ActiveCfg = Debug
{D330A197-67D4-42B0-8906-54264AF95EC1}.Windows|Any CPU.ActiveCfg = Windows
{D330A197-67D4-42B0-8906-54264AF95EC1}.Windows|ARM.ActiveCfg = Windows
{D330A197-67D4-42B0-8906-54264AF95EC1}.Windows|ARM64.ActiveCfg = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Windows|x64.ActiveCfg = Windows

View file

@ -1,7 +1,7 @@
Package: hisp
Version: 1.6.2
Depends: coreutils,systemd,mariadb-server,libsqlite3-dev
Version: $VERSION
Depends: coreutils,systemd,mariadb-server,libsqlite3-dev,zlib1g-dev,libicu-dev,libkrb5-dev
Maintainer: Li
Homepage: https://islehorse.com
Architecture: amd64
Description: Open Source Implementation of the flash game "Horse Isle" server.
Description: Open Source Implementation of the server for flash game "Horse Isle".

View file

@ -4,7 +4,6 @@ using HISP.Game.Items;
using HISP.Game.Events;
using HISP.Game.Horse;
using HISP.Game.Inventory;
using HISP.Modding;
using System.Linq;
using System;
@ -70,7 +69,6 @@ namespace HISP.Game.Chat
if (!user.Administrator)
return false;
ModLoader.ReloadModsFromFilesystem();
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket);

View file

@ -218,6 +218,6 @@
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="mkdir $(ProjectDir)Resources\Versioning&#xD;&#xA;&#xD;&#xA;git rev-parse --verify HEAD&gt;&quot;$(ProjectDir)Resources\Versioning\GitCommit&quot; &#xD;&#xA;&#xD;&#xA;git describe --abbrev=0 --tags&gt;&quot;$(ProjectDir)Resources\Versioning\GitTag&quot; &#xD;&#xA;&#xD;&#xA;git branch --show-current&gt;&quot;$(ProjectDir)Resources\Versioning\GitBranch&quot; &#xD;&#xA;&#xD;&#xA;date /t&gt;&quot;$(ProjectDir)Resources\Versioning\BuildDate&quot; &#xD;&#xA;&#xD;&#xA;time /t&gt;&quot;$(ProjectDir)Resources\Versioning\BuildTime&quot; " />
<Exec Command="mkdir $(ProjectDir)Resources\Versioning&#xD;&#xA;git rev-parse --verify HEAD&gt;&quot;$(ProjectDir)Resources\Versioning\GitCommit&quot; &#xD;&#xA;git describe --abbrev=0 --tags&gt;&quot;$(ProjectDir)Resources\Versioning\GitTag&quot; &#xD;&#xA;git branch --show-current&gt;&quot;$(ProjectDir)Resources\Versioning\GitBranch&quot; &#xD;&#xA;date /t&gt;&quot;$(ProjectDir)Resources\Versioning\BuildDate&quot; &#xD;&#xA;time /t&gt;&quot;$(ProjectDir)Resources\Versioning\BuildTime&quot; " />
</Target>
</Project>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>C:\Users\User\Documents\git\HISP\HorseIsleServer\LibHISP\Properties\PublishProfiles\iOSARM.pubxml</_LastSelectedProfileId>
<_LastSelectedProfileId>C:\Users\User\Documents\git\HISP\HorseIsleServer\LibHISP\Properties\PublishProfiles\Linux64.pubxml</_LastSelectedProfileId>
</PropertyGroup>
</Project>

View file

@ -1,20 +0,0 @@
namespace HISP.Modding
{
public interface IMod
{
public void OnModLoad();
public void OnModUnload();
public string ModName
{
get;
}
public string ModVersion
{
get;
}
public string ModId
{
get;
}
}
}

View file

@ -1,77 +0,0 @@
using HISP.Server;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
namespace HISP.Modding
{
public class ModLoader
{
private static List<IMod> modList = new List<IMod>();
public static IMod[] ModList
{
get
{
return modList.ToArray();
}
}
public static void LoadMod(IMod mod)
{
mod.OnModLoad(); // Call OnModLoad();
modList.Add(mod); // add to the list of mods
Logger.InfoPrint("Loaded mod: "+mod.ModName + " v" + mod.ModVersion + " SUCCESS.");
}
public static void UnloadMod(IMod mod)
{
mod.OnModUnload();
modList.Remove(mod);
Logger.InfoPrint("Unloading mod: " + mod.ModName);
}
public static void UnloadAllMods()
{
foreach (IMod loadedMod in ModList)
{
UnloadMod(loadedMod);
}
}
public static void LoadModFromFilesystem(string dllfile)
{
try
{
Assembly assembly = Assembly.LoadFile(dllfile);
Type[] types = assembly.GetTypes();
// Search for classes that implement IMod
foreach (Type type in types)
{
if (type.GetInterfaces().Contains(typeof(IMod)))
{
IMod mod = (IMod)Activator.CreateInstance(type); // Crate an instance of the class
LoadMod(mod); // Load it into memory
}
}
}
catch (Exception e)
{
Logger.ErrorPrint("Failed to load mod: " + dllfile + " - [EXCEPTION]" + e.Message + " " + e.InnerException + "\n" + e.StackTrace);
}
}
public static void OnShutdown()
{
UnloadAllMods();
}
public static void ReloadModsFromFilesystem()
{
UnloadAllMods();
if (Directory.Exists(ConfigReader.ModsFolder))
{
string[] filelist = Directory.GetFiles(ConfigReader.ModsFolder, "*.dll", SearchOption.TopDirectoryOnly);
foreach (string file in filelist)
{
LoadModFromFilesystem(file);
}
}
}
}
}

View file

@ -7,7 +7,6 @@ using HISP.Game.Chat;
using HISP.Security;
using System;
using System.Diagnostics;
using HISP.Modding;
namespace HISP.Server
{
@ -33,7 +32,6 @@ namespace HISP.Server
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
#endif
ModLoader.ReloadModsFromFilesystem();
Console.Title = ServerVersion.GetBuildString();
ConfigReader.OpenConfig();

View file

@ -18,7 +18,6 @@ using HISP.Game.SwfModules;
using HISP.Game.Horse;
using HISP.Game.Events;
using HISP.Game.Items;
using HISP.Modding;
namespace HISP.Server
{
@ -8259,7 +8258,6 @@ namespace HISP.Server
}
public static void ShutdownServer()
{
ModLoader.OnShutdown();
GameClient.OnShutdown();
GameServer.OnShutdown();
Database.OnShutdown();

View file

@ -1,4 +1,6 @@
using HISP.Properties;
using System;
using System.Globalization;
using HISP.Properties;
namespace HISP.Server
{
@ -44,27 +46,33 @@ namespace HISP.Server
}
public static string GetVersionString()
{
return Resources.GitTag.Replace("\r", "").Replace("\n", "");
return Resources.GitTag.Replace("\r", "").Replace("\n", "").ToString().Trim() + "."+ GetCommitHashVersion();
}
public static string GetBranch()
{
return Resources.GitBranch.Replace("\r", "").Replace("\n", "");
return Resources.GitBranch.Replace("\r", "").Replace("\n", "").ToString().Trim();
}
public static string GetBuildDate()
{
return Resources.BuildDate.Replace("\r", "").Replace("\n", "");
return Resources.BuildDate.Replace("\r", "").Replace("\n", "").ToString().Trim();
}
public static string GetBuildTime()
{
return Resources.BuildTime.Replace("\r", "").Replace("\n", "");
return Resources.BuildTime.Replace("\r", "").Replace("\n", "").ToString().Trim();
}
public static string GetCommitHashVersion()
{
return UInt16.Parse(Resources.GitCommit.Substring(0, 4), NumberStyles.HexNumber).ToString();
}
public static string GetCommitHash(int TotalBytes)
{
return Resources.GitCommit.Substring(0, TotalBytes).Replace("\r", "").Replace("\n", "");
return Resources.GitCommit.Substring(0, TotalBytes).Replace("\r", "").Replace("\n", "").ToString().Trim();
}
public static string GetBuildString()
{
return PRODUCT + " " + GetVersionString() + " `" + GetBranch() + "@" + GetCommitHash(7) + "`; (" + GetArchitecture() + "; " + GetPlatform() + "); Built on " + GetBuildDate() + " at " + GetBuildTime();
return PRODUCT + " " + GetVersionString() + " " + GetBranch() + " (" + GetArchitecture() + "; " + GetPlatform() + "); Built @ " + GetBuildDate() + " " + GetBuildTime();
}
}
}

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>C:\Users\User\Documents\git\HISP\HorseIsleServer\N00BS\Properties\PublishProfiles\Win32.pubxml</_LastSelectedProfileId>
<_LastSelectedProfileId>C:\Users\User\Documents\git\HISP\HorseIsleServer\N00BS\Properties\PublishProfiles\Win64.pubxml</_LastSelectedProfileId>
</PropertyGroup>
<ItemGroup>
<Compile Update="LoadingForm.cs">

View file

@ -7,7 +7,6 @@ using HISP.Game.Horse;
using HISP.Game.Items;
using HISP.Game.Services;
using HISP.Game.SwfModules;
using HISP.Modding;
using HISP.Security;
using HISP.Server;
using HTTP;
@ -75,7 +74,6 @@ namespace HISP.Noobs
BaseDir = Path.Combine(Environment.GetEnvironmentVariable("APPDATA"), "HISP", "N00BS");
Directory.CreateDirectory(BaseDir);
ModLoader.ReloadModsFromFilesystem();
// Start Web Server
try

41
HorseIsleServer/build.py Normal file
View file

@ -0,0 +1,41 @@
#!/bin/python3
import os
import subprocess
import date
import datetime
import struct
import binascii
global commit_hash
global commit_tag
global commit_branch
def derive_version():
commit_tag + "." + struct.unpack("h", binascii.unhexlify())
versioning_folder = os.path.join("LibHISP", "Resources", "Versioning")
if not os.path.exists(versioning_folder):
os.mkdir(versioning_folder)
commit_hash = "0"*40
commit_tag = "v0.0.0"
commit_branch = "master"
try:
commit_hash = subprocess.run(['git', 'rev-parse', '--verify', 'HEAD'], stdout=subprocess.PIPE).stdout.replace(b"\r", b"").replace(b"\n", b"").decode("UTF-8")
commit_tag = subprocess.run(['git', 'describe', '--abbrev=0', '--tags'], stdout=subprocess.PIPE).stdout.replace(b"\r", b"").replace(b"\n", b"").decode("UTF-8")
commit_branch = subprocess.run(['git', 'branch', '--show-current'], stdout=subprocess.PIPE).stdout.replace(b"\r", b"").replace(b"\n", b"").decode("UTF-8")
except FileNotFoundError:
print("Git not installed")
commit_date = datetime.datetime.now().strftime("%d/%m/%Y")
commit_time = datetime.datetime.now().strftime("%H:%M:%S")
open(os.path.join(versioning_folder, "GitCommit"), "w").write(commit_hash)
open(os.path.join(versioning_folder, "GitTag" ), "w").write(commit_tag)
open(os.path.join(versioning_folder, "GitBranch"), "w").write(commit_branch)
open(os.path.join(versioning_folder, "BuildDate"), "w").write(commit_date)
open(os.path.join(versioning_folder, "BuildTime"), "w").write(commit_time)