This is an archive of the discontinued LLVM Phabricator instance.

[gn build] Add a script to check if source lists in BUILD.gn files and CMakeLists.txt files match.
ClosedPublic

Authored by thakis on Nov 26 2018, 10:21 PM.

Details

Summary

Also fix a missing file in lib/Support/BUILD.gn found by the script.

The script is very stupid and assumes that CMakeLists.txt follow the standard LLVM CMakeLists.txt formatting with one cpp source file per line. Despite its simplicity, it works well in practice.

It would be nice if it also checked deps and maybe automatically applied its suggestions.

Diff Detail

Event Timeline

thakis created this revision.Nov 26 2018, 10:21 PM
phosek added inline comments.Nov 28 2018, 11:46 PM
llvm/utils/gn/build/sync_source_lists_from_cmake.py
45

Move this inside the if statement below.

48

You could do just:

added = cmake_cpp - gn_cpp
if added:
  print('added:\n%s' % ',\n'.join(added))
52

ditto

thakis updated this revision to Diff 175872.Nov 29 2018, 7:57 AM
thakis marked 4 inline comments as done.

address comments

llvm/utils/gn/build/sync_source_lists_from_cmake.py
48

Done.

To explain a bit why I did what I had: I'm indenting the "add
lines to have the right amount of space in front and with quoting for copying the file right into a gn file, and with your approach I need to duplicated the indent string. But that's better than duplicating the set difference, and your approach is better without drawbacks in the remove case.

phosek accepted this revision.Nov 29 2018, 2:04 PM

LGTM

This revision is now accepted and ready to land.Nov 29 2018, 2:04 PM
This revision was automatically updated to reflect the committed changes.