Skip to content

Commit

Permalink
Merge pull request #1450 from CBATeam/sqfc
Browse files Browse the repository at this point in the history
Add sqfc support
  • Loading branch information
PabstMirror committed Jun 3, 2021
2 parents 0ca8baf + 893f5f2 commit 9191ad5
Show file tree
Hide file tree
Showing 20 changed files with 119 additions and 35 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ Thumbs.db
*#

tools/ndocs-project/Data/*

ArmaScriptCompiler.exe
*.sqfc
4 changes: 2 additions & 2 deletions addons/accessory/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};
2 changes: 1 addition & 1 deletion addons/characters/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
};
};
8 changes: 4 additions & 4 deletions addons/common/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};
4 changes: 2 additions & 2 deletions addons/diagnostic/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};

Expand Down
4 changes: 2 additions & 2 deletions addons/disposable/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};

Expand Down
6 changes: 3 additions & 3 deletions addons/events/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};

Expand Down
6 changes: 3 additions & 3 deletions addons/help/CfgEventhandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};
4 changes: 2 additions & 2 deletions addons/keybinding/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};

Expand Down
2 changes: 2 additions & 0 deletions addons/main/script_macros_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
{ \
Expand Down
2 changes: 1 addition & 1 deletion addons/network/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
};
};
4 changes: 2 additions & 2 deletions addons/optics/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};

Expand Down
6 changes: 3 additions & 3 deletions addons/settings/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};

Expand Down
4 changes: 2 additions & 2 deletions addons/statemachine/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};
4 changes: 2 additions & 2 deletions addons/ui/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};

Expand Down
2 changes: 1 addition & 1 deletion addons/vectors/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
};
};
10 changes: 5 additions & 5 deletions addons/versioning/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};
18 changes: 18 additions & 0 deletions hemtt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
21 changes: 21 additions & 0 deletions sqfc.json
Original file line number Diff line number Diff line change
@@ -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
}
40 changes: 40 additions & 0 deletions tools/compile_sqf.py
Original file line number Diff line number Diff line change
@@ -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))

0 comments on commit 9191ad5

Please sign in to comment.