Skip to content

Share build file lists between CMake, Bazel and Buck builds #35456

@dzhulgakov

Description

@dzhulgakov

🚀 Feature

It'd be great for developer productivity if file lists were shared among build systems.

Motivation

We're maintaining 3 different build systems right now (CMake, two FB-internal flavors of Buck) and Bazel support is on the way - #35316 . Parts of buck build are exposed as https://github.com/pytorch/pytorch/blob/master/tools/build_variables.bzl . Today they duplicate lists of files manually (including upcoming #35220). It's bad for developer productivity as it's easy to forget to add new file.

Pitch

We could put the lists of files in a very simple format - just a text file with file names would do, or a very simple python program. All major build systems support importing external file lists. For buck/bazel it can be done by writing .bzl function and importing results.

For CMake simple proof of concept is https://gist.github.com/dzhulgakov/8f6cc0a7fd710b8f29689ba5e5858f7d

Alternatives

Alternative is to use globs aggressively. It's not a full solution as we currently mix different targets in the same directory (e.g. python and no-python sources). And globs can be tricky with triggering incremental rebuilds correctly.

cc @kostmo @malfet

Metadata

Metadata

Assignees

Labels

enhancementNot as big of a feature, but technically not a bug. Should be easy to fixmodule: buildBuild system issuestriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions