Skip to content

Commit

Permalink
Merge pull request #11 from Fusselwurm/mod
Browse files Browse the repository at this point in the history
pack as mod
  • Loading branch information
Fusselwurm authored Sep 24, 2020
2 parents 5cfd991 + 82f9e1c commit 30d1e6c
Show file tree
Hide file tree
Showing 22 changed files with 2,057 additions and 28 deletions.
34 changes: 29 additions & 5 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Upload build artifact x86
uses: actions/upload-artifact@v2
with:
name: arma3-reflection.so
name: extension
path: reflection.so
windows:
runs-on: windows-latest
Expand All @@ -32,13 +32,37 @@ jobs:
run: msbuild /p:Configuration=Release /p:Platform=Win32
- name: Build solution x64
run: msbuild /p:Configuration=Release /p:Platform=x64
- run: copy D:\a\arma3-reflection\arma3-reflection\Release\arma3-reflection.dll reflection.dll
- name: Upload build artifact Win32
uses: actions/upload-artifact@v2
with:
name: reflection.dll
path: D:\a\arma3-reflection\arma3-reflection\Release\arma3-reflection.dll
name: extension
path: reflection.dll
- run: copy D:\a\arma3-reflection\arma3-reflection\x64\Release\arma3-reflection.dll reflection_x64.dll
- name: Upload build artifact x64
uses: actions/upload-artifact@v2
with:
name: extension
path: reflection_x64.dll
pack_mod:
runs-on: ubuntu-latest
name: build mod
needs: ["windows", "linux"]
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: extension
- name: copy compiled extensions into mod
run: cp *.dll *.so ./mod
- name: pack
id: pack
uses: gruppe-adler/action-release-with-hemtt@cwd
with:
cwd: ./mod
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: reflection_x64.dll
path: D:\a\arma3-reflection\arma3-reflection\x64\Release\arma3-reflection.dll
path: ${{ steps.pack.outputs.zip_path }}
name: mod
62 changes: 39 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
prerelease: false
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
build-win:
name: build & upload Windows binaries
build_win:
name: build Windows binaries
runs-on: windows-latest
needs: ["create_release"]
steps:
Expand All @@ -35,29 +35,23 @@ jobs:
- uses: actions/checkout@v2
- name: Build Win32
run: msbuild /p:Configuration=Release /p:Platform=Win32
- run: copy D:\a\arma3-reflection\arma3-reflection\Release\arma3-reflection.dll reflection.dll
- name: Upload Win32
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/upload-artifact@v2
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: D:\a\arma3-reflection\arma3-reflection\Release\arma3-reflection.dll
asset_name: reflection.dll
asset_content_type: application/octet-stream
name: extension
path: reflection.dll
- name: Build x64
run: msbuild /p:Configuration=Release /p:Platform=x64
- run: copy D:\a\arma3-reflection\arma3-reflection\x64\Release\arma3-reflection.dll reflection_x64.dll
- name: Upload Win64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/upload-artifact@v2
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: D:\a\arma3-reflection\arma3-reflection\x64\Release\arma3-reflection.dll
asset_name: reflection_x64.dll
asset_content_type: application/octet-stream
build-linux:
name: extension
path: reflection_x64.dll
build_linux:
runs-on: ubuntu-latest
name: build & upload Linux binary
name: build Linux binary
needs: ["create_release"]
steps:
- name: update apt index
Expand All @@ -67,12 +61,34 @@ jobs:
- uses: actions/checkout@v2
- name: make
run: make
- name: Upload library
- name: Upload Linux
uses: actions/upload-artifact@v2
with:
name: extension
path: ./reflection.so
pack_and_upload_mod:
runs-on: ubuntu-latest
name: build & upload mod
needs: ["build_win", "build_linux"]
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: extension
- name: copy compiled extensions into mod
run: cp *.dll *.so ./mod
- name: pack
id: pack
uses: gruppe-adler/action-release-with-hemtt@cwd
with:
cwd: ./mod
- name: Upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./reflection.so
asset_name: reflection.so
asset_content_type: application/octet-stream
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: "@arma3_reflection.zip"
asset_name: "@arma3_reflection.zip"
asset_content_type: application/zip
1 change: 1 addition & 0 deletions mod/addons/args/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
z\arma3_reflection\addons\args
7 changes: 7 additions & 0 deletions mod/addons/args/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Extended_PreInit_EventHandlers
{
class ADDON
{
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
2 changes: 2 additions & 0 deletions mod/addons/args/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PREP(getArgument);
PREP(port);
9 changes: 9 additions & 0 deletions mod/addons/args/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "script_component.hpp"

ADDON = false;

PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

ADDON = true;
15 changes: 15 additions & 0 deletions mod/addons/args/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
name = QUOTE(COMPONENT);
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"arma3_reflection_main"};
author = "AUTHOR";
VERSION_CONFIG;
};
};

#include "CfgEventHandlers.hpp"
12 changes: 12 additions & 0 deletions mod/addons/args/functions/fnc_getArgument.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "..\script_component.hpp"

/**
* return [error, value] with error == "" if everything is fine
*/
params [
["_argName", "", [""]]
];

assert(_argName != "");

["arg", [_argName]] call EFUNC(main,call);
10 changes: 10 additions & 0 deletions mod/addons/args/functions/fnc_port.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "..\script_component.hpp"

private _result = ["port"] call FUNC(getArgument);

if ((_result#0) != 0) exitWith {
ERROR_1("could not get game server port from extension. return value '%1'", _result);
0
};

parseNumber (_result#1);
14 changes: 14 additions & 0 deletions mod/addons/args/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#define COMPONENT args
#include "\z\arma3_reflection\addons\main\script_mod.hpp"

// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE

#ifdef DEBUG_ENABLED_MAIN
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_MAIN
#define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN
#endif

#include "\z\arma3_reflection\addons\main\script_macros.hpp"
1 change: 1 addition & 0 deletions mod/addons/main/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
z\arma3_reflection\addons\main
7 changes: 7 additions & 0 deletions mod/addons/main/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Extended_PreInit_EventHandlers
{
class ADDON
{
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
1 change: 1 addition & 0 deletions mod/addons/main/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PREP(call);
9 changes: 9 additions & 0 deletions mod/addons/main/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "script_component.hpp"

ADDON = false;

PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

ADDON = true;
15 changes: 15 additions & 0 deletions mod/addons/main/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
name = QUOTE(COMPONENT);
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"cba_xeh"};
author = "AUTHOR";
VERSION_CONFIG;
};
};

#include "CfgEventHandlers.hpp"
24 changes: 24 additions & 0 deletions mod/addons/main/functions/fnc_call.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "..\script_component.hpp"

/**
* return [error, value] with error == "" if everything is fine
*/
params [
["_method", "", [""]],
["_params", [], [[]]]
];

private _call = format ["%1(%2)", _method, _params joinString ","];

private _rawResponse = ("reflection" callExtension _call);
if (count _rawResponse == 0) exitWith {
ERROR("no answer for reflection.so call :(");
[-1]
};

(call compile _rawResponse) params [
["_responseCode", 0, [0]],
["_returnValue", "", [""]]
];

[_responseCode, _returnValue]
14 changes: 14 additions & 0 deletions mod/addons/main/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#define COMPONENT main
#include "\z\arma3_reflection\addons\main\script_mod.hpp"

// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE

#ifdef DEBUG_ENABLED_MAIN
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_MAIN
#define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN
#endif

#include "\z\arma3_reflection\addons\main\script_macros.hpp"
11 changes: 11 additions & 0 deletions mod/addons/main/script_macros.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "\x\cba\addons\main\script_macros_common.hpp"

#define DFUNC(var1) TRIPLES(ADDON,fnc,var1)

#ifdef DISABLE_COMPILE_CACHE
#undef PREP
#define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QPATHTOF(functions\DOUBLES(fnc,fncName).sqf)
#else
#undef PREP
#define PREP(fncName) [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf), QFUNC(fncName)] call CBA_fnc_compileFunction
#endif
9 changes: 9 additions & 0 deletions mod/addons/main/script_mod.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#define MAINPREFIX z
#define PREFIX arma3_reflection

#include "script_version.hpp"

#define VERSION MAJOR.MINOR.PATCH.BUILD
#define VERSION_AR MAJOR,MINOR,PATCH,BUILD

#define REQUIRED_VERSION 1.96
4 changes: 4 additions & 0 deletions mod/addons/main/script_version.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define MAJOR 1
#define MINOR 0
#define PATCH 0
#define BUILD 0
14 changes: 14 additions & 0 deletions mod/hemtt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name = "arma3_reflection"
prefix = "arma3_reflection"
author = "Fusselwurm"
template = "cba"
mainprefix = "z"
folder_optionals = false
sig_version = 3

files = [
"reflection.so",
"reflection.dll",
"reflection_x64.dll",
"README.md"
]
Loading

0 comments on commit 30d1e6c

Please sign in to comment.