Skip to content

Commit

Permalink
test scons emitter for cached builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Vano committed Oct 3, 2024

Unverified

This user has not yet uploaded their public signing key.
1 parent 4df0c27 commit 1c46ab3
Showing 2 changed files with 22 additions and 28 deletions.
25 changes: 11 additions & 14 deletions godot_cppscript.cmake
Original file line number Diff line number Diff line change
@@ -636,9 +636,6 @@ if __name__ != '__main__':
return env.CppScript(sources, cppscript_env, *args, **kwargs)
class CppScriptBuilder():
def __init__(self):
self.builder = Builder(action=generate_header_scons, emitter=generate_header_emitter)
def __call__(self, env, source, call_args, cwd = os.getcwd(), *args, **kwargs):
cppscript_env, *other = call_args
# Convert scons variables to cppscript's env
@@ -673,9 +670,18 @@ if __name__ != '__main__':
with open(godotcpp, 'w') as file:
file.write(cppscript_env['code_format'].CPPSCRIPT_BODY.format(cppscript_env['header_name'].replace(' ', '_').replace('.', '_').upper()))
def generate_header_emitter(target, source, env):
generated = [env.File(filename_to_gen_filename(str(i), env['cppscript_env'])) for i in source]
# To avoid generated sources deletion and re-parsing
env.Precious(generated)
return generated, source
generator = Builder(action=generate, emitter=generate_emitter)(env)
builder = self.builder(env, source=source, *other, *args, **kwargs)
env.Depends(builder, generator)
builder = Builder(action=generate_header_scons, emitter=generate_header_emitter) \\
(env, source=source, *other, *args, **kwargs)
#env.Depends(builder, generator)
return builder
@@ -864,15 +870,6 @@ def cursor_get_field_type(cursor):
# Builder
def generate_header_emitter(target, source, env):
generated = [env.File(filename_to_gen_filename(str(i), env['cppscript_env'])) for i in source]
# To avoid generated sources deletion and re-parsing
env.Precious(generated)
return generated, source
def generate_header_scons(target, source, env):
if \"CPPSCRIPT_DEBUG\" in os.environ.keys():
print(json.dumps(env['cppscript_env'], indent=2, default=lambda x: list(x) if type(x) is set else x))
25 changes: 11 additions & 14 deletions godot_cppscript.py
Original file line number Diff line number Diff line change
@@ -619,9 +619,6 @@ def create_cppscript_target(env, sources, cppscript_env, *args, **kwargs):
return env.CppScript(sources, cppscript_env, *args, **kwargs)

class CppScriptBuilder():
def __init__(self):
self.builder = Builder(action=generate_header_scons, emitter=generate_header_emitter)

def __call__(self, env, source, call_args, cwd = os.getcwd(), *args, **kwargs):
cppscript_env, *other = call_args
# Convert scons variables to cppscript's env
@@ -656,9 +653,18 @@ def generate(target, source, env):
with open(godotcpp, 'w') as file:
file.write(cppscript_env['code_format'].CPPSCRIPT_BODY.format(cppscript_env['header_name'].replace(' ', '_').replace('.', '_').upper()))

def generate_header_emitter(target, source, env):
generated = [env.File(filename_to_gen_filename(str(i), env['cppscript_env'])) for i in source]

# To avoid generated sources deletion and re-parsing
env.Precious(generated)

return generated, source

generator = Builder(action=generate, emitter=generate_emitter)(env)
builder = self.builder(env, source=source, *other, *args, **kwargs)
env.Depends(builder, generator)
builder = Builder(action=generate_header_scons, emitter=generate_header_emitter) \
(env, source=source, *other, *args, **kwargs)
#env.Depends(builder, generator)

return builder

@@ -847,15 +853,6 @@ def cursor_get_field_type(cursor):


# Builder
def generate_header_emitter(target, source, env):
generated = [env.File(filename_to_gen_filename(str(i), env['cppscript_env'])) for i in source]

# To avoid generated sources deletion and re-parsing
env.Precious(generated)

return generated, source


def generate_header_scons(target, source, env):
if "CPPSCRIPT_DEBUG" in os.environ.keys():
print(json.dumps(env['cppscript_env'], indent=2, default=lambda x: list(x) if type(x) is set else x))

0 comments on commit 1c46ab3

Please sign in to comment.