-
Notifications
You must be signed in to change notification settings - Fork 3.9k
ARROW-8459: [Dev][Archery] Use a more recent cmake-format #10571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| "AVX2" | ||
| "AVX512" | ||
| "MAX") | ||
| define_option_string( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can alter this tabulation behavior using https://cmake-format.readthedocs.io/en/latest/configopts.html#min-prefix-chars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you try 32 or something?
I don't expect formatter so much but I want to reduce diff to look history easily later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm going to try formatting with min-prefix-chars=32
dev/archery/archery/utils/lint.py
Outdated
| def __init__(self, cmake_format_bin): | ||
| self.bin = cmake_format_bin | ||
|
|
||
| # TODO(kszucs): check cmake_format version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if you can do it in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, it seems done already below. Perhaps just remove this TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, thanks for spotting that!
| 'go/**/CMakeLists.txt', | ||
| 'java/**/CMakeLists.txt', | ||
| 'matlab/**/CMakeLists.txt', | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have cmake files in python as well, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those haven't been checked earlier either https://github.com/apache/arrow/blob/master/run-cmake-format.py#L29
I think we could simply use a global pattern with an exclusion list rather.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have only python/CMakeLists.txt in python/.
python/cmake_modules/ is a symbolic link to cpp/cmake_modules/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added python/CMakeLists.txt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see.
| 'cpp/cmake_modules/FindPythonLibsNew.cmake', | ||
| 'cpp/cmake_modules/UseCython.cmake', | ||
| 'cpp/src/arrow/util/config.h.cmake', | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know the reasons for these exclusions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ported from the previous script, I assume these files are vendored or generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpp/cmake_modules/*.cmake in the list are imported CMake files: #9045 (comment)
We can't use cmake-format for cpp/src/arrow/util/config.h.cmake because it's not valid CMake file. It has @...@ to replace variables by CMake.
| LLVMAlt | ||
| REQUIRED_VARS # The first variable is used for display. | ||
| LLVM_PACKAGE_VERSION CLANG_EXECUTABLE LLVM_FOUND LLVM_LINK_EXECUTABLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| LLVMAlt | |
| REQUIRED_VARS # The first variable is used for display. | |
| LLVM_PACKAGE_VERSION CLANG_EXECUTABLE LLVM_FOUND LLVM_LINK_EXECUTABLE) | |
| LLVMAlt | |
| # The first variable is used for display. | |
| REQUIRED_VARS LLVM_PACKAGE_VERSION CLANG_EXECUTABLE LLVM_FOUND LLVM_LINK_EXECUTABLE) |
| Arrow | ||
| REQUIRED_VARS # The first required variable is shown | ||
| # in the found message. So this list is | ||
| # not sorted alphabetically. | ||
| ARROW_INCLUDE_DIR ARROW_LIB_DIR ARROW_FULL_SO_VERSION ARROW_SO_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Arrow | |
| REQUIRED_VARS # The first required variable is shown | |
| # in the found message. So this list is | |
| # not sorted alphabetically. | |
| ARROW_INCLUDE_DIR ARROW_LIB_DIR ARROW_FULL_SO_VERSION ARROW_SO_VERSION | |
| Arrow | |
| # The first required variable is shown in the found message. So this list is | |
| # not sorted alphabetically. | |
| REQUIRED_VARS ARROW_INCLUDE_DIR ARROW_LIB_DIR ARROW_FULL_SO_VERSION ARROW_SO_VERSION |
| 'go/**/CMakeLists.txt', | ||
| 'java/**/CMakeLists.txt', | ||
| 'matlab/**/CMakeLists.txt', | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have only python/CMakeLists.txt in python/.
python/cmake_modules/ is a symbolic link to cpp/cmake_modules/.
| 'cpp/cmake_modules/FindPythonLibsNew.cmake', | ||
| 'cpp/cmake_modules/UseCython.cmake', | ||
| 'cpp/src/arrow/util/config.h.cmake', | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpp/cmake_modules/*.cmake in the list are imported CMake files: #9045 (comment)
We can't use cmake-format for cpp/src/arrow/util/config.h.cmake because it's not valid CMake file. It has @...@ to replace variables by CMake.
| "AVX2" | ||
| "AVX512" | ||
| "MAX") | ||
| define_option_string( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you try 32 or something?
I don't expect formatter so much but I want to reduce diff to look history easily later.
|
@kou updated the formatting with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Thanks. It looks good with min-prefix-chars=32.
| 'go/**/CMakeLists.txt', | ||
| 'java/**/CMakeLists.txt', | ||
| 'matlab/**/CMakeLists.txt', | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see.
This is a follow-up of apache#10571 / ARROW-8459 .
This is a follow-up of #10571 / ARROW-8459 . Closes #11112 from kou/github-actions-autotune Authored-by: Sutou Kouhei <kou@clear-code.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
This is a follow-up of apache#10571 / ARROW-8459 . Closes apache#11112 from kou/github-actions-autotune Authored-by: Sutou Kouhei <kou@clear-code.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
- [x] bump cmake-format's version to the latest one - [x] port `run-cmake-format.py` script to archery - [x] support `archery lint --cmake-format` format checks without reformatting the files in-place - [x] support `archery lint --cmake-format --fix` for actually reformat the files - [x] reformat the cmake files I assume we may need tune the options a little bit, so feel free to experiment with the values defined in `cmake-format.py` then re-run `archery-lint --cmake-format --fix`. The `cmakelang` package also provides a `cmake-lint` command which we could experiment with in the future. Closes apache#10571 from kszucs/update-cmake-format Authored-by: Krisztián Szűcs <szucs.krisztian@gmail.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
run-cmake-format.pyscript to archeryarchery lint --cmake-formatformat checks without reformatting the files in-placearchery lint --cmake-format --fixfor actually reformat the filesI assume we may need tune the options a little bit, so feel free to experiment with the values defined in
cmake-format.pythen re-runarchery-lint --cmake-format --fix.The
cmakelangpackage also provides acmake-lintcommand which we could experiment with in the future.