chore: use new template

This commit is contained in:
Tsubasa6848
2024-03-23 19:54:55 +08:00
Unverified
parent 35fc8a7a4f
commit 0034f21b98
9 changed files with 81 additions and 57 deletions
+7 -1
View File
@@ -29,4 +29,10 @@ jobs:
with: with:
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }} name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
path: | path: |
bin/ bin/DLL/
- uses: actions/upload-artifact@v3
with:
name: PDB
path: |
bin/PDB/
+28 -11
View File
@@ -11,7 +11,7 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: recursive submodules: recursive
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: xmake-io/github-action-setup-xmake@v1 - uses: xmake-io/github-action-setup-xmake@v1
@@ -29,7 +29,13 @@ jobs:
with: with:
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }} name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
path: | path: |
bin/ bin/DLL/
- uses: actions/upload-artifact@v3
with:
name: PDB
path: |
bin/PDB/
upload-to-release: upload-to-release:
needs: needs:
@@ -38,24 +44,35 @@ jobs:
contents: write contents: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - name: Checkout code
uses: actions/checkout@v4
- uses: actions/download-artifact@v3 - name: Download Plugin
uses: actions/download-artifact@v3
with: with:
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }} name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
path: release/ path: release/Plugin/
- run: | - name: Download PDB
cp LICENSE README.md release/ uses: actions/download-artifact@v3
with:
name: PDB
path: release/PDB/
- name: Copy additional files
run: |
cp LICENSE README.md release/Plugin/
- name: Archive release - name: Archive release
run: | run: |
cd release cd release/Plugin
zip -r ../${{ github.event.repository.name }}-windows-x64.zip * zip -r ../${{ github.event.repository.name }}-windows-x64.zip *
cd .. cd ..
- uses: softprops/action-gh-release@v1 - name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with: with:
append_body: true
files: | files: |
${{ github.event.repository.name }}-windows-x64.zip release/${{ github.event.repository.name }}-windows-x64.zip
release/PDB/${{ github.event.repository.name }}.pdb
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "${pluginName}", "name": "${pluginName}",
"entry": "${pluginFile}", "entry": "${pluginFile}",
"version": "0.9.3", "version": "0.9.4",
"type": "native", "type": "native",
"dependencies": [ "dependencies": [
{ {
+3 -2
View File
@@ -88,10 +88,11 @@ function pack_plugin(target,plugin_define)
local manifest_path = find_file("manifest.json", os.projectdir()) local manifest_path = find_file("manifest.json", os.projectdir())
if manifest_path then if manifest_path then
local manifest = io.readfile(manifest_path) local manifest = io.readfile(manifest_path)
local bindir = path.join(os.projectdir(), "bin") local bindir = path.join(os.projectdir(), "bin/DLL")
local pdbdir = path.join(os.projectdir(), "bin/PDB")
local outputdir = path.join(bindir, plugin_define.pluginName) local outputdir = path.join(bindir, plugin_define.pluginName)
local targetfile = path.join(outputdir, plugin_define.pluginFile) local targetfile = path.join(outputdir, plugin_define.pluginFile)
local pdbfile = path.join(outputdir, path.basename(plugin_define.pluginFile) .. ".pdb") local pdbfile = path.join(pdbdir, path.basename(plugin_define.pluginFile) .. ".pdb")
local libfile = path.join(os.projectdir(), "lib") local libfile = path.join(os.projectdir(), "lib")
local manifestfile = path.join(outputdir, "manifest.json") local manifestfile = path.join(outputdir, "manifest.json")
local oritargetfile = target:targetfile() local oritargetfile = target:targetfile()
+8 -34
View File
@@ -5,17 +5,12 @@ ll::Logger logger(PLUGIN_NAME);
namespace GMLIB_LegacyRemoteCallApi { namespace GMLIB_LegacyRemoteCallApi {
namespace { std::unique_ptr<LRCA>& LRCA::getInstance() {
static std::unique_ptr<LRCA> instance;
return instance;
}
std::unique_ptr<std::reference_wrapper<ll::plugin::NativePlugin>> bool LRCA::load() {
selfPluginInstance; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
auto disable(ll::plugin::NativePlugin& /*self*/) -> bool { return true; }
auto enable(ll::plugin::NativePlugin& /*self*/) -> bool { return true; }
auto load(ll::plugin::NativePlugin& self) -> bool {
selfPluginInstance = std::make_unique<std::reference_wrapper<ll::plugin::NativePlugin>>(self);
Export_Legacy_GMLib_ModAPI(); Export_Legacy_GMLib_ModAPI();
Export_Legacy_GMLib_ServerAPI(); Export_Legacy_GMLib_ServerAPI();
Export_Compatibility_API(); Export_Compatibility_API();
@@ -28,31 +23,10 @@ auto load(ll::plugin::NativePlugin& self) -> bool {
return true; return true;
} }
auto unload(ll::plugin::NativePlugin& self) -> bool { return false; } bool LRCA::enable() { return true; }
} // namespace bool LRCA::disable() { return true; }
auto getSelfPluginInstance() -> ll::plugin::NativePlugin& {
if (!selfPluginInstance) {
throw std::runtime_error("selfPluginInstance is null");
}
return *selfPluginInstance;
}
} // namespace GMLIB_LegacyRemoteCallApi } // namespace GMLIB_LegacyRemoteCallApi
extern "C" { LL_REGISTER_PLUGIN(GMLIB_LegacyRemoteCallApi::LRCA, GMLIB_LegacyRemoteCallApi::LRCA::getInstance());
_declspec(dllexport) auto ll_plugin_disable(ll::plugin::NativePlugin& self) -> bool {
return GMLIB_LegacyRemoteCallApi::disable(self);
}
_declspec(dllexport) auto ll_plugin_enable(ll::plugin::NativePlugin& self) -> bool {
return GMLIB_LegacyRemoteCallApi::enable(self);
}
_declspec(dllexport) auto ll_plugin_load(ll::plugin::NativePlugin& self) -> bool {
return GMLIB_LegacyRemoteCallApi::load(self);
}
_declspec(dllexport) auto ll_plugin_unload(ll::plugin::NativePlugin& self) -> bool {
return GMLIB_LegacyRemoteCallApi::unload(self);
}
}
+26 -2
View File
@@ -1,9 +1,33 @@
#pragma once #pragma once
#include <ll/api/plugin/NativePlugin.h> #include <ll/api/plugin/NativePlugin.h>
#include <ll/api/plugin/RegisterHelper.h>
namespace GMLIB_LegacyRemoteCallApi { namespace GMLIB_LegacyRemoteCallApi {
[[nodiscard]] auto getSelfPluginInstance() -> ll::plugin::NativePlugin&; class LRCA {
public:
static std::unique_ptr<LRCA>& getInstance();
LRCA(ll::plugin::NativePlugin& self) : mSelf(self) {}
[[nodiscard]] ll::plugin::NativePlugin& getSelf() const { return mSelf; }
/// @return True if the plugin is loaded successfully.
bool load();
/// @return True if the plugin is enabled successfully.
bool enable();
/// @return True if the plugin is disabled successfully.
bool disable();
// TODO: Implement this method if you need to unload the plugin.
// /// @return True if the plugin is unloaded successfully.
// bool unload();
private:
ll::plugin::NativePlugin& mSelf;
};
} // namespace GMLIB_LegacyRemoteCallApi } // namespace GMLIB_LegacyRemoteCallApi
+1 -1
View File
@@ -4,7 +4,7 @@
#include <RemoteCallAPI.h> #include <RemoteCallAPI.h>
#define PLUGIN_NAME "GMLIB-LRCA" #define PLUGIN_NAME "GMLIB-LRCA"
#define LIB_VERSION SemVersion(0, 9, 1, "", "") #define LIB_VERSION SemVersion(0, 9, 4, "", "")
extern ll::Logger logger; extern ll::Logger logger;
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"format_version": 2, "format_version": 2,
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi", "tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
"version": "0.9.3", "version": "0.9.4",
"info": { "info": {
"name": "GMLIB-LegacyRemoteCallApi", "name": "GMLIB-LegacyRemoteCallApi",
"description": "Legacy RemoteCall API for GMLIB", "description": "Legacy RemoteCall API for GMLIB",
@@ -14,7 +14,7 @@
"library" "library"
] ]
}, },
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.9.3/GMLIB-LegacyRemoteCallApi-windows-x64.zip", "asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.9.4/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
"dependencies": { "dependencies": {
"github.com/GroupMountain/GMLIB": ">=0.9.6" "github.com/GroupMountain/GMLIB": ">=0.9.6"
}, },
+5 -3
View File
@@ -1,4 +1,4 @@
add_rules("mode.debug", "mode.release", "mode.releasedbg") add_rules("mode.debug", "mode.release")
add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git") add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git")
@@ -47,7 +47,8 @@ target("GMLIB-LegacyRemoteCallApi") -- Change this to your plugin name.
"/utf-8" "/utf-8"
) )
add_defines( add_defines(
"_HAS_CXX23=1" -- To enable C++23 features "NOMINMAX",
"UNICODE"
) )
add_files( add_files(
"src/**.cpp" "src/**.cpp"
@@ -68,7 +69,8 @@ target("GMLIB-LegacyRemoteCallApi") -- Change this to your plugin name.
) )
set_exceptions("none") -- To avoid conflicts with /EHa set_exceptions("none") -- To avoid conflicts with /EHa
set_kind("shared") set_kind("shared")
set_languages("cxx23") set_languages("c++23")
set_symbols("debug")
after_build(function (target) after_build(function (target)
local plugin_packer = import("scripts.after_build") local plugin_packer = import("scripts.after_build")