Skip to content

Commit

Permalink
Tools: HEMTT ignore has_include (#9613)
Browse files Browse the repository at this point in the history
* Tools: HEMTT ignore has_include

* Fix make.py and sqfvmChecker.py for changes

---------

Co-authored-by: PabstMirror <[email protected]>
  • Loading branch information
BrettMayson and PabstMirror authored Nov 3, 2023
1 parent 20676a2 commit 95e0625
Show file tree
Hide file tree
Showing 28 changed files with 58 additions and 37 deletions.
5 changes: 3 additions & 2 deletions addons/fire/addon.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[rapify]
enabled = false
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true
1 change: 1 addition & 0 deletions addons/fire/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
Expand Down
5 changes: 3 additions & 2 deletions addons/medical/addon.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[rapify]
enabled = false
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true
1 change: 1 addition & 0 deletions addons/medical/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
Expand Down
5 changes: 3 additions & 2 deletions addons/medical_ai/addon.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[rapify]
enabled = false
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true
1 change: 1 addition & 0 deletions addons/medical_ai/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
Expand Down
5 changes: 3 additions & 2 deletions addons/medical_blood/addon.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[rapify]
enabled = false
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true
1 change: 1 addition & 0 deletions addons/medical_blood/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
Expand Down
5 changes: 3 additions & 2 deletions addons/medical_damage/addon.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[rapify]
enabled = false
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true
1 change: 1 addition & 0 deletions addons/medical_damage/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
Expand Down
5 changes: 3 additions & 2 deletions addons/medical_engine/addon.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[rapify]
enabled = false
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true
1 change: 1 addition & 0 deletions addons/medical_engine/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
Expand Down
5 changes: 3 additions & 2 deletions addons/medical_feedback/addon.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[rapify]
enabled = false
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true
1 change: 1 addition & 0 deletions addons/medical_feedback/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
Expand Down
5 changes: 3 additions & 2 deletions addons/medical_gui/addon.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[rapify]
enabled = false
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true
1 change: 1 addition & 0 deletions addons/medical_gui/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
Expand Down
5 changes: 3 additions & 2 deletions addons/medical_statemachine/addon.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[rapify]
enabled = false
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true
1 change: 1 addition & 0 deletions addons/medical_statemachine/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
Expand Down
5 changes: 3 additions & 2 deletions addons/medical_status/addon.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[rapify]
enabled = false
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true
1 change: 1 addition & 0 deletions addons/medical_status/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
Expand Down
5 changes: 3 additions & 2 deletions addons/medical_treatment/addon.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[rapify]
enabled = false
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true
1 change: 1 addition & 0 deletions addons/medical_treatment/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
Expand Down
5 changes: 3 additions & 2 deletions addons/medical_vitals/addon.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[rapify]
enabled = false
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true
1 change: 1 addition & 0 deletions addons/medical_vitals/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
Expand Down
5 changes: 3 additions & 2 deletions addons/realisticnames/addon.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[rapify]
enabled = false
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true
1 change: 1 addition & 0 deletions addons/realisticnames/config.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\norealisticnames\script_component.hpp")
#define PATCH_SKIP "No Realistic Names"
#endif
Expand Down
7 changes: 2 additions & 5 deletions tools/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -1345,16 +1345,13 @@ def main(argv):
if os.path.isfile(addonTomlPath):
with open(addonTomlPath, "r") as f:
tomlFile = f.read()
if "preprocess = false" in tomlFile:
print_error("'preprocess = false' not supported")
raise
skipPreprocessing = "[preprocess]\nenabled = false" in tomlFile or "[rapify]\nenabled = false" in tomlFile
skipPreprocessing = "pboProject_noBinConfig = true".lower() in tomlFile.lower()

if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")):
print_green("$NOBIN$ Found. Proceeding with non-binarizing!")
cmd = [makepboTool, "-P","-A","-X=*.backup", os.path.join(work_drive, prefix, module),os.path.join(module_root, release_dir, project,"addons")]
elif skipPreprocessing:
print_green("addon.toml set [preprocess.enabled = false]. Proceeding with non-binerized config build!")
print_green("addon.toml set [pboProject_noBinConfig = true]. Proceeding with non-binerized config build!")
cmd = [pboproject, "-B", "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S", "+Noisy", "+Clean", "-Warnings", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"]
else:
cmd = [pboproject, "+B", "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S", "+Noisy", "+Clean", "-Warnings", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"]
Expand Down
10 changes: 4 additions & 6 deletions tools/sqfvmChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_files_to_process(basePath):
with open(addonTomlPath, "rb") as f:
tomlFile = tomllib.load(f)
try:
skipPreprocessing = not tomlFile.get('rapify')['enabled']
skipPreprocessing = tomlFile.get('tools')['sqfvm_skipConfigChecks']
except:
pass
if file == "config.cpp" and skipPreprocessing:
Expand All @@ -42,7 +42,7 @@ def get_files_to_process(basePath):
return arma_files


def process_file(filePath, skipA3Warnings=True):
def process_file(filePath, skipA3Warnings=True, skipPragmaHemtt=True):
with open(filePath, "r", encoding="utf-8", errors="ignore") as file:
content = file.read()
if content.startswith("//pragma SKIP_COMPILE"):
Expand Down Expand Up @@ -71,10 +71,8 @@ def process_file(filePath, skipA3Warnings=True):
if line.startswith("[ERR]"):
fileHasError = True
if not (
skipA3Warnings
and line.startswith("[WRN]")
and ("a3/" in line)
and (("Unexpected IFDEF" in line) or ("defined twice" in line))
(skipA3Warnings and line.startswith("[WRN]") and ("a3/" in line) and (("Unexpected IFDEF" in line) or ("defined twice" in line)))
or (skipPragmaHemtt and line.startswith("[WRN]") and ("Unknown pragma instruction 'hemtt'" in line))
):
print(" {}".format(line))
return fileHasError
Expand Down

0 comments on commit 95e0625

Please sign in to comment.