From 876b9b2f6afa7f609d58955333078531a33f9836 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 28 Apr 2021 01:22:04 -0500 Subject: [PATCH 1/4] sqfc --- .gitignore | 3 ++ addons/accessory/CfgEventHandlers.hpp | 4 +-- addons/characters/CfgEventHandlers.hpp | 2 +- addons/common/CfgEventHandlers.hpp | 8 ++--- addons/diagnostic/CfgEventHandlers.hpp | 4 +-- addons/disposable/CfgEventHandlers.hpp | 4 +-- addons/events/CfgEventHandlers.hpp | 6 ++-- addons/help/CfgEventhandlers.hpp | 6 ++-- addons/keybinding/CfgEventHandlers.hpp | 4 +-- addons/main/script_macros_common.hpp | 2 ++ addons/network/CfgEventHandlers.hpp | 2 +- addons/optics/CfgEventHandlers.hpp | 4 +-- addons/settings/CfgEventHandlers.hpp | 6 ++-- addons/statemachine/CfgEventHandlers.hpp | 4 +-- addons/ui/CfgEventHandlers.hpp | 4 +-- addons/vectors/CfgEventHandlers.hpp | 2 +- addons/versioning/CfgEventHandlers.hpp | 10 +++--- hemtt.toml | 18 +++++++++++ sqfc.json | 17 ++++++++++ tools/compile_sqf.py | 40 ++++++++++++++++++++++++ tools/make.py | 3 ++ 21 files changed, 118 insertions(+), 35 deletions(-) create mode 100644 sqfc.json create mode 100644 tools/compile_sqf.py diff --git a/.gitignore b/.gitignore index cd092168c6..a7e7f79078 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ Thumbs.db *# tools/ndocs-project/Data/* + +ArmaScriptCompiler.exe +*.sqfc diff --git a/addons/accessory/CfgEventHandlers.hpp b/addons/accessory/CfgEventHandlers.hpp index 93e3311cf2..865276cfba 100644 --- a/addons/accessory/CfgEventHandlers.hpp +++ b/addons/accessory/CfgEventHandlers.hpp @@ -1,11 +1,11 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; diff --git a/addons/characters/CfgEventHandlers.hpp b/addons/characters/CfgEventHandlers.hpp index b928bc2de6..9b160c1600 100755 --- a/addons/characters/CfgEventHandlers.hpp +++ b/addons/characters/CfgEventHandlers.hpp @@ -1,5 +1,5 @@ class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; diff --git a/addons/common/CfgEventHandlers.hpp b/addons/common/CfgEventHandlers.hpp index e53a38deb3..250e76b3d6 100644 --- a/addons/common/CfgEventHandlers.hpp +++ b/addons/common/CfgEventHandlers.hpp @@ -1,19 +1,19 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); - clientInit = QUOTE(call COMPILE_FILE(XEH_preClientInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + clientInit = QUOTE(call COMPILE_SCRIPT(XEH_preClientInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_postInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); }; }; diff --git a/addons/diagnostic/CfgEventHandlers.hpp b/addons/diagnostic/CfgEventHandlers.hpp index a95951422a..d139b36ebe 100644 --- a/addons/diagnostic/CfgEventHandlers.hpp +++ b/addons/diagnostic/CfgEventHandlers.hpp @@ -1,12 +1,12 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; diff --git a/addons/disposable/CfgEventHandlers.hpp b/addons/disposable/CfgEventHandlers.hpp index 065090d479..1987dc39f6 100644 --- a/addons/disposable/CfgEventHandlers.hpp +++ b/addons/disposable/CfgEventHandlers.hpp @@ -1,12 +1,12 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; diff --git a/addons/events/CfgEventHandlers.hpp b/addons/events/CfgEventHandlers.hpp index b447552987..5082ce318d 100644 --- a/addons/events/CfgEventHandlers.hpp +++ b/addons/events/CfgEventHandlers.hpp @@ -1,18 +1,18 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_postInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); }; }; diff --git a/addons/help/CfgEventhandlers.hpp b/addons/help/CfgEventhandlers.hpp index 0d3301d6e0..f6503c2479 100644 --- a/addons/help/CfgEventhandlers.hpp +++ b/addons/help/CfgEventhandlers.hpp @@ -1,17 +1,17 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_postInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); }; }; diff --git a/addons/keybinding/CfgEventHandlers.hpp b/addons/keybinding/CfgEventHandlers.hpp index df3b0949f4..5cc4b2f6a9 100644 --- a/addons/keybinding/CfgEventHandlers.hpp +++ b/addons/keybinding/CfgEventHandlers.hpp @@ -1,12 +1,12 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; diff --git a/addons/main/script_macros_common.hpp b/addons/main/script_macros_common.hpp index d50a27f53d..be13021c04 100644 --- a/addons/main/script_macros_common.hpp +++ b/addons/main/script_macros_common.hpp @@ -854,6 +854,8 @@ Macro: ISNILS() #define COMPILE_FILE2(var1) COMPILE_FILE2_SYS('var1') #define COMPILE_FILE2_CFG(var1) COMPILE_FILE2_CFG_SYS('var1') +#define COMPILE_SCRIPT(var1) compileScript ['PATHTO_SYS(PREFIX,COMPONENT_F,var1)'] + #define VERSIONING_SYS(var1) class CfgSettings \ { \ diff --git a/addons/network/CfgEventHandlers.hpp b/addons/network/CfgEventHandlers.hpp index b928bc2de6..9b160c1600 100644 --- a/addons/network/CfgEventHandlers.hpp +++ b/addons/network/CfgEventHandlers.hpp @@ -1,5 +1,5 @@ class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; diff --git a/addons/optics/CfgEventHandlers.hpp b/addons/optics/CfgEventHandlers.hpp index 00f32c9f68..4a699f04ab 100644 --- a/addons/optics/CfgEventHandlers.hpp +++ b/addons/optics/CfgEventHandlers.hpp @@ -1,12 +1,12 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; diff --git a/addons/settings/CfgEventHandlers.hpp b/addons/settings/CfgEventHandlers.hpp index 3ad1f7cf32..4b9879db6c 100644 --- a/addons/settings/CfgEventHandlers.hpp +++ b/addons/settings/CfgEventHandlers.hpp @@ -1,18 +1,18 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_postInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); }; }; diff --git a/addons/statemachine/CfgEventHandlers.hpp b/addons/statemachine/CfgEventHandlers.hpp index 93e3311cf2..865276cfba 100644 --- a/addons/statemachine/CfgEventHandlers.hpp +++ b/addons/statemachine/CfgEventHandlers.hpp @@ -1,11 +1,11 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; diff --git a/addons/ui/CfgEventHandlers.hpp b/addons/ui/CfgEventHandlers.hpp index 978375be9e..c6403f260d 100644 --- a/addons/ui/CfgEventHandlers.hpp +++ b/addons/ui/CfgEventHandlers.hpp @@ -1,12 +1,12 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; diff --git a/addons/vectors/CfgEventHandlers.hpp b/addons/vectors/CfgEventHandlers.hpp index b928bc2de6..9b160c1600 100644 --- a/addons/vectors/CfgEventHandlers.hpp +++ b/addons/vectors/CfgEventHandlers.hpp @@ -1,5 +1,5 @@ class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; diff --git a/addons/versioning/CfgEventHandlers.hpp b/addons/versioning/CfgEventHandlers.hpp index e639e9848f..ea4bbd0ec6 100644 --- a/addons/versioning/CfgEventHandlers.hpp +++ b/addons/versioning/CfgEventHandlers.hpp @@ -1,19 +1,19 @@ class Extended_PreStart_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); }; }; class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_postInit)); - serverInit = QUOTE(call COMPILE_FILE(XEH_postInitServer)); - clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient)); + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + serverInit = QUOTE(call COMPILE_SCRIPT(XEH_postInitServer)); + clientInit = QUOTE(call COMPILE_SCRIPT(XEH_postInitClient)); }; }; diff --git a/hemtt.toml b/hemtt.toml index bc561927ef..40efd4274a 100644 --- a/hemtt.toml +++ b/hemtt.toml @@ -21,9 +21,11 @@ authority = "{{prefix}}_{{version}}-{{git \"id 8\"}}" check = [ "!version_set" ] +prebuild = ["!compile_sqf"] releasebuild = [ "@zip CBA_A3_v{{semver.major}}.{{semver.minor}}.{{semver.patch}}", "!version_unset" + ,"!compile_sqf_cleanup" ] [header_exts] @@ -58,3 +60,19 @@ steps_windows = [ ] only_release = true show_output = true + +[scripts.compile_sqf] +steps_windows = [ + "echo 'compile_sqf'", + "py tools/compile_sqf.py cleanup build" +] +only_release = true +show_output = true + +[scripts.compile_sqf_cleanup] +steps_windows = [ + "echo 'compile_sqf_cleanup'", + "py tools/compile_sqf.py cleanup" +] +only_release = true +show_output = true diff --git a/sqfc.json b/sqfc.json new file mode 100644 index 0000000000..45efb16582 --- /dev/null +++ b/sqfc.json @@ -0,0 +1,17 @@ +{ + "inputDirs": [ + "P:/x/cba/addons/" + ], + "includePaths": [ + "P:/" + ], + "excludeList": [ + "\\initsettings.sqf", + "\\initkeybinds.sqf", + "\\xeh_prep.sqf", + "\\backwards_comp.sqf", + "settings\\gui_createCategory.sqf" + ], + "outputDir": "P:/", + "workerThreads": 12 +} diff --git a/tools/compile_sqf.py b/tools/compile_sqf.py new file mode 100644 index 0000000000..29aaa5e52d --- /dev/null +++ b/tools/compile_sqf.py @@ -0,0 +1,40 @@ +import os +import sys +import subprocess + +# Handle script being called from either base or /tools folder (e.g. hemmt will run from base) +addon_base_path = os.getcwd() +if os.path.basename(addon_base_path) == "tools": + addon_base_path = os.path.dirname(addon_base_path) + + +def cleanup(): + count = 0 + for root, _dirs, files in os.walk(os.path.join(addon_base_path, "addons")): + for file in files: + if file.endswith(".sqfc"): + os.remove(os.path.join(root, file)) + count += 1 + print("cleaned [{} sqfc files]".format(count)) + + +def build(verbose): + compiler_exe = os.path.join(addon_base_path, "ArmaScriptCompiler.exe") + if not os.path.isfile(compiler_exe): + print("Warning: ArmaScriptCompiler.exe not found in base folder - skipping compiling") + return + # raise FileNotFoundError("ArmaScriptCompiler not found") + ret = subprocess.call([compiler_exe], cwd=addon_base_path, stdout=verbose) + print("compiled [ret {}]".format(ret)) + + +def main(argv): + # print("compile_sqf.py [Base: {}]".format(addon_base_path)) + if ("cleanup" in argv) or (len(argv) < 2): + cleanup() + if ("build" in argv) or (len(argv) < 2): + build("verbose" in argv) + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) diff --git a/tools/make.py b/tools/make.py index 91020364d1..c57f1634bf 100644 --- a/tools/make.py +++ b/tools/make.py @@ -392,6 +392,9 @@ def copy_optionals_for_building(mod,pbos): try: for dir_name in src_directories: + # Ignore PBOs from HEMMT + if (os.path.isfile(os.path.join(optionals_root,dir_name))): + continue mod.append(dir_name) #userconfig requires special handling since it is not a PBO source folder. #CfgConvert fails to build server.pbo if userconfig is not found in P:\ From 420fe1e40c641e7704734c6447f4c3bbb1fa496e Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 23 May 2021 17:10:32 -0500 Subject: [PATCH 2/4] Update make.py --- tools/make.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/make.py b/tools/make.py index c57f1634bf..91020364d1 100644 --- a/tools/make.py +++ b/tools/make.py @@ -392,9 +392,6 @@ def copy_optionals_for_building(mod,pbos): try: for dir_name in src_directories: - # Ignore PBOs from HEMMT - if (os.path.isfile(os.path.join(optionals_root,dir_name))): - continue mod.append(dir_name) #userconfig requires special handling since it is not a PBO source folder. #CfgConvert fails to build server.pbo if userconfig is not found in P:\ From 2994aa9ba18079df3c9583f24ae9396edb70ba30 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 23 May 2021 17:15:41 -0500 Subject: [PATCH 3/4] Update sqfc.json --- sqfc.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sqfc.json b/sqfc.json index 45efb16582..cff92c9f93 100644 --- a/sqfc.json +++ b/sqfc.json @@ -10,7 +10,11 @@ "\\initkeybinds.sqf", "\\xeh_prep.sqf", "\\backwards_comp.sqf", - "settings\\gui_createCategory.sqf" + "settings\\gui_createCategory.sqf", + "diagnostic\\fnc_initExtendedDebugConsole.sqf", + "xeh\\fnc_initDisplay.sqf", + "xeh\\fnc_startLoadingScreen.sqf", + "xeh\\fnc_endLoadingScreen.sqf" ], "outputDir": "P:/", "workerThreads": 12 From 893f5f2a947625fe05951fc96010e1c847dd4c3e Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 23 May 2021 17:19:32 -0500 Subject: [PATCH 4/4] toLower --- sqfc.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sqfc.json b/sqfc.json index cff92c9f93..f56495919c 100644 --- a/sqfc.json +++ b/sqfc.json @@ -10,11 +10,11 @@ "\\initkeybinds.sqf", "\\xeh_prep.sqf", "\\backwards_comp.sqf", - "settings\\gui_createCategory.sqf", - "diagnostic\\fnc_initExtendedDebugConsole.sqf", - "xeh\\fnc_initDisplay.sqf", - "xeh\\fnc_startLoadingScreen.sqf", - "xeh\\fnc_endLoadingScreen.sqf" + "settings\\gui_createcategory.sqf", + "diagnostic\\fnc_initextendeddebugconsole.sqf", + "xeh\\fnc_initdisplay.sqf", + "xeh\\fnc_startloadingscreen.sqf", + "xeh\\fnc_endloadingscreen.sqf" ], "outputDir": "P:/", "workerThreads": 12