Skip to content

Ninja Generation Tool #3929

Open
Open
@bdbaddog

Description

@bdbaddog

Summary
This tool attempts to generically take a SCons build and generate a ninja file which is representative of the build and can be built by Ninja.

Ninja is a very fast build system, which is meant to have its build files generated by other systems. Ninja is especially good at iterative rebuilds and quick traversing a build graph to determine what needs to be rebuilt.

This PR is to introduce the ninja tool based off the ninja tool from mongodb's site tools.

This PR scope is BETA functionality of the ninja tool. It will not work well with all other tools and is primarily aimed at cross platform (win32/linux/osx) C/C++ builds. The goal of this PR is to get the tool to a point that it can be integrated in beta form.

Feature/Test List

Test Name Test Description Implemented
generate_and_build.py Generate and build simple C program X
generate_and_build_cxx.py Generate and build simple CPP program and check header deps X
generate_source.py Generate source with built C program and build C program from generated source X
multi_env.py Build two C programs with two seperate envs with one ninja file X
shell_commands.py Simple shell command to take in sources and build targets X
copy_function_command.py SCons "Copy" function action converted to command line for ninja X
build_libraries.py Build and linking C shared and static libraries X
iterative_speedup.py Make sure Ninja is faster than SCons in single file change rebuild (Would love to see this fail one day) X
output_orders.py Make sure outputs are ordered correctly in ninja file
existing_targets.py Make sure response files generate correctly even if existing targets are already built
unhandled_actions.py Unhandled actions will reinvoke scons without ninja to build just those targets
ninja_rule.py Create and register a custom ninja rule
command_line_targets.py Specify Alias and targets from command to build
non_ninja_nodes.py Make sure Scons is reinvoked on nodes which are not FS or Alias

Known Issues

Known Issue Description Github Issue
SCons doesn't have representive job pools to translate to ninja #3667
Ninja tool is global, affects all environments regardless of what environment its invoked in
Compilation Databases interactions between SCons and Ninja
Response files are always used even when not necessary
Targets and -j are not propagated to ninja correctly
TEMPLATE aggregation destroys order (need interactive mode)

Associated PRs

PR # Description
#3642 Initial experimental tool implemenation

Other Implementations
NCAR/eol_scons's ninja implementation

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the basic use.
  • I have created a new test or updated the unit tests to cover ninja specific Methods.
  • I have updated src/CHANGES.txt (and read the README.txt in that directory)
  • I have updated the appropriate documentation

Metadata

Metadata

Assignees

Labels

NinjaToolsIssues related to tools subsystem

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions