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..f56495919c --- /dev/null +++ b/sqfc.json @@ -0,0 +1,21 @@ +{ + "inputDirs": [ + "P:/x/cba/addons/" + ], + "includePaths": [ + "P:/" + ], + "excludeList": [ + "\\initsettings.sqf", + "\\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" + ], + "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))