Merge pull request #89452 from Riteo/name-a-better-duo

SCons: Enable the experimental Ninja backend and minimize timestamp changes to generated code
This commit is contained in:
Rémi Verschelde
2024-04-04 14:31:24 +02:00
8 changed files with 120 additions and 72 deletions

View File

@@ -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 = []