Skip to content

AlwaysBuild not honored when using ninja execution engine #4870

Description

@pmova7173630

Describe the bug
The AlwaysBuild command for a target is not honored when using the experimental ninja execution engine.

Required information

  • Link to SCons Users thread discussing your issue.
    https://discord.com/channels/571796279483564041/1521525108106330122/1521525112195780709

  • Version of SCons
    Version 4.10.2, HEAD of master. However I know this goes back to the original ninja release.

  • Version of Python
    Python 3.14.5, although I know it also fails on 3.6 and 3.10

  • Which python distribution if applicable (python.org, cygwin, anaconda, macports, brew,etc)
    python.org

  • How you installed SCons
    This happens both on using “scons-local” as well as from the source tree.

  • What Platform are you on? (Linux/Windows and which version)
    Linux - Ubuntu 20.04, Ubuntu 24.04, Alpine 3.24.1

  • How to reproduce your issue? Please include a small self contained reproducer. Likely a SConstruct should do for most issues.

Here is a simple sconstruct using test2.cpp from test/ninja/ninja-fixture

SetOption('experimental','ninja')
DefaultEnvironment(tools=[])
env = Environment()
env.Tool('ninja')

# Compile source to object
obj = env.Object('test2.cpp')
# Force rebuild of object file every time
env.AlwaysBuild(obj)

# Link object to executable
env.Program(target='always_build', source=obj)
  • How you invoke scons (The command line you're using "scons --flags some_arguments”)

When using python3 <path_to_worktree>/scripts/scons.py it will build the app and then on subsequent calls will rebuild the .o file per the AlwaysBuild on the target.

When using python3 <path_to_worktree>/scripts/scons.py --experimental=ninja it will build the app and then on subsequent calls there is no work to do (which is wrong).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions