Skip to content

'AlwaysBuild' is not defined when using generate_bindings=yes #1236

@DmitriySalnikov

Description

@DmitriySalnikov

Godot version

N/A

godot-cpp version

63755b2

System information

Windows 10

Issue description

After moving the main logic from the SConstruct file to godotcpp.py (63755b2) the argument generate_bindings=yes is broken.

$ scons generate_bindings=yes
scons: Reading SConscript files ...
Auto-detected 8 CPU cores available for build parallelism. Using 7 cores by default. You can override it with the -j argument.
Building for architecture x86_64 on platform windows
NameError: name 'AlwaysBuild' is not defined:
  File "C:\My\Projects\GE\Addons\godot_debug_draw_3d\godot-cpp\SConstruct", line 51:
    library = env.GodotCPP()
  File "c:\my\python39\lib\site-packages\SCons\Util\envs.py", line 242:
    return self.method(*nargs, **kwargs)
  File "tools\godotcpp.py", line 287:
    AlwaysBuild(bindings)

The previous commit in the 4.1 branch (ce5dd37) works with this argument without problems.

Using this patch the error disappeared:

diff --git a/tools/godotcpp.py b/tools/godotcpp.py
index 60cd34b..676b626 100644
--- a/tools/godotcpp.py
+++ b/tools/godotcpp.py
@@ -284,8 +284,8 @@ def _godot_cpp(env):
     )
     # Forces bindings regeneration.
     if env["generate_bindings"]:
-        AlwaysBuild(bindings)
-        NoCache(bindings)
+        env.AlwaysBuild(bindings)
+        env.NoCache(bindings)
 
     # Sources to compile
     sources = []

But I'm not sure if it works as planned, so you can create a PR yourself.

Steps to reproduce

Try to build with scons generate_bindings=yes

Minimal reproduction project

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions