Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sqfc support #1450

Merged
merged 4 commits into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
17 changes: 17 additions & 0 deletions sqfc.json
Original file line number Diff line number Diff line change
@@ -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
}
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))
3 changes: 3 additions & 0 deletions tools/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:\
Expand Down