Merge pull request #838 from PapyChacal/scons-caching

Add options to use scons caching for faster iteration.
pull/853/head
Fabio Alessandrelli 2022-09-19 14:51:40 +02:00 committed by GitHub
commit 0b87aaa74c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

3
.gitignore vendored
View File

@ -12,6 +12,9 @@ src/gen
logs/* logs/*
*.log *.log
# The default cache directory
cache/
# Binaries # Binaries
*.o *.o
*.os *.os

View File

@ -168,12 +168,19 @@ else:
json_api_file = os.path.join(os.getcwd(), env["headers_dir"], "extension_api.json") json_api_file = os.path.join(os.getcwd(), env["headers_dir"], "extension_api.json")
bindings = env.GenerateBindings( bindings = env.GenerateBindings(
env.Dir("."), [json_api_file, os.path.join(env["headers_dir"], "godot", "gdnative_interface.h")] env.Dir("."),
[json_api_file, os.path.join(env["headers_dir"], "godot", "gdnative_interface.h"), "binding_generator.py"],
) )
scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path is not None:
CacheDir(scons_cache_path)
Decider("MD5")
# Forces bindings regeneration. # Forces bindings regeneration.
if env["generate_bindings"]: if env["generate_bindings"]:
AlwaysBuild(bindings) AlwaysBuild(bindings)
NoCache(bindings)
# Includes # Includes
env.Append(CPPPATH=[[env.Dir(d) for d in [env["headers_dir"], "include", os.path.join("gen", "include")]]]) env.Append(CPPPATH=[[env.Dir(d) for d in [env["headers_dir"], "include", os.path.join("gen", "include")]]])

View File

@ -217,6 +217,11 @@ def generate_builtin_bindings(api, output_dir, build_config):
if type_name in used_classes: if type_name in used_classes:
used_classes.remove(type_name) used_classes.remove(type_name)
used_classes = list(used_classes)
used_classes.sort()
fully_used_classes = list(fully_used_classes)
fully_used_classes.sort()
with header_filename.open("w+") as header_file: with header_filename.open("w+") as header_file:
header_file.write(generate_builtin_class_header(builtin_api, size, used_classes, fully_used_classes)) header_file.write(generate_builtin_class_header(builtin_api, size, used_classes, fully_used_classes))
@ -901,6 +906,11 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node):
if type_name in used_classes: if type_name in used_classes:
used_classes.remove(type_name) used_classes.remove(type_name)
used_classes = list(used_classes)
used_classes.sort()
fully_used_classes = list(fully_used_classes)
fully_used_classes.sort()
with header_filename.open("w+") as header_file: with header_filename.open("w+") as header_file:
header_file.write( header_file.write(
generate_engine_class_header(class_api, used_classes, fully_used_classes, use_template_get_node) generate_engine_class_header(class_api, used_classes, fully_used_classes, use_template_get_node)