summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-04-04 14:31:24 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-04-04 14:31:24 +0200
commit7fa97f37fba8aebbf11f646596b218c59d5ed561 (patch)
treec10739f689580ce1f27bfe3980e53c923e0074bd /editor
parenta28be933eea39b9969b201d90c19e1f4ab822ab5 (diff)
parent55558fb17574ddcbf0dcbba3f90a1aa880907f28 (diff)
downloadredot-engine-7fa97f37fba8aebbf11f646596b218c59d5ed561.tar.gz
Merge pull request #89452 from Riteo/name-a-better-duo
SCons: Enable the experimental Ninja backend and minimize timestamp changes to generated code
Diffstat (limited to 'editor')
-rw-r--r--editor/SCsub28
1 files changed, 15 insertions, 13 deletions
diff --git a/editor/SCsub b/editor/SCsub
index f4d30b68b1..e3b17b83f8 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -7,19 +7,24 @@ env.editor_sources = []
import os
import glob
import editor_builders
+import methods
def _make_doc_data_class_path(to_path):
- # NOTE: It is safe to generate this file here, since this is still executed serially
- with open(os.path.join(to_path, "doc_data_class_path.gen.h"), "w", encoding="utf-8", newline="\n") as g:
- g.write("static const int _doc_data_class_path_count = " + str(len(env.doc_class_path)) + ";\n")
- g.write("struct _DocDataClassPath { const char* name; const char* path; };\n")
+ file_path = os.path.join(to_path, "doc_data_class_path.gen.h")
- g.write("static const _DocDataClassPath _doc_data_class_paths[" + str(len(env.doc_class_path) + 1) + "] = {\n")
- for c in sorted(env.doc_class_path):
- g.write('\t{"' + c + '", "' + env.doc_class_path[c] + '"},\n')
- g.write("\t{nullptr, nullptr}\n")
- g.write("};\n")
+ class_path_data = ""
+ class_path_data += "static const int _doc_data_class_path_count = " + str(len(env.doc_class_path)) + ";\n"
+ class_path_data += "struct _DocDataClassPath { const char* name; const char* path; };\n"
+ class_path_data += (
+ "static const _DocDataClassPath _doc_data_class_paths[" + str(len(env.doc_class_path) + 1) + "] = {\n"
+ )
+ for c in sorted(env.doc_class_path):
+ class_path_data += '\t{"' + c + '", "' + env.doc_class_path[c] + '"},\n'
+ class_path_data += "\t{nullptr, nullptr}\n"
+ class_path_data += "};\n"
+
+ methods.write_file_if_needed(file_path, class_path_data)
if env.editor_build:
@@ -38,10 +43,7 @@ if env.editor_build:
reg_exporters += "\tregister_" + e + "_exporter_types();\n"
reg_exporters += "}\n"
- # NOTE: It is safe to generate this file here, since this is still executed serially
- with open("register_exporters.gen.cpp", "w", encoding="utf-8", newline="\n") as f:
- f.write(reg_exporters_inc)
- f.write(reg_exporters)
+ methods.write_file_if_needed("register_exporters.gen.cpp", reg_exporters_inc + reg_exporters)
# Core API documentation.
docs = []