Skip to content
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

add format target to cmake #2671

Merged
merged 35 commits into from
May 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4dd769b
add format target to cmake
strega-nil Apr 26, 2022
507e12b
remove parallelize
strega-nil Apr 26, 2022
dd1ea10
remember to call vsdevcmd; add ERROR_ON_CLANG_FORMAT_NOT_FOUND
strega-nil Apr 26, 2022
bb4fa64
add a format.diff output; should correct errors
strega-nil Apr 26, 2022
6a2a992
errrgh
strega-nil Apr 26, 2022
f552cba
aaaaaugh
strega-nil Apr 26, 2022
abf9330
fix build error, change how format is done
strega-nil Apr 27, 2022
791e5ba
moar fixin'
strega-nil Apr 27, 2022
4212816
forgot cmr :'(
strega-nil Apr 27, 2022
8863e7a
forgot to skip .diff files -.-
strega-nil Apr 27, 2022
1a27369
okay fix builds hopefully
strega-nil Apr 27, 2022
8dc715d
Merge remote-tracking branch 'upstream/main' into strega-nil/add-form…
strega-nil Apr 27, 2022
cf2f367
remove hiddenf iles
strega-nil Apr 27, 2022
de2988d
remove format.diff file
strega-nil Apr 27, 2022
fd5abee
single-quotes -> double-quotes
strega-nil Apr 27, 2022
070076d
(* cries *)
strega-nil Apr 27, 2022
955beb6
(* cries more *)
strega-nil Apr 27, 2022
ae2f1e6
clean UP
strega-nil Apr 27, 2022
ffbff5b
fix people's problems
strega-nil Apr 28, 2022
abe3bd0
[TEST] try clang-format
strega-nil Apr 28, 2022
0f57832
oops, need to fail the pipeline
strega-nil Apr 28, 2022
cce432e
NEAT
strega-nil Apr 28, 2022
bb3222b
vso[error] -> [error]
strega-nil Apr 28, 2022
a2d6aa4
how does that look?
strega-nil Apr 28, 2022
d32cc67
does that result in failures
strega-nil Apr 28, 2022
53e0527
do tests
strega-nil Apr 28, 2022
93d2186
does logissue work?
strega-nil Apr 28, 2022
e9ff5c4
figured it out!
strega-nil Apr 28, 2022
0f539a8
clang-format
strega-nil Apr 28, 2022
2688dce
[TEST] validate (tabs)
strega-nil Apr 28, 2022
19d0f42
validate prettifying
strega-nil Apr 28, 2022
9f899e4
more prettifying
strega-nil Apr 28, 2022
b8566a9
final format
strega-nil Apr 28, 2022
bf41006
Code review feedback, fixing missed path failures.
StephanTLavavej Apr 29, 2022
d4fe38f
add instructions for downloading
strega-nil Apr 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azure-devops/create-prdiff.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ if (0 -ne (Get-Item -LiteralPath $DiffFile).Length) {
''
)
Write-Host ($msg -join "`n")
Write-Host (Get-Content -LiteralPath $DiffFile)
Write-Host [string](Get-Content -LiteralPath $DiffFile)
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
throw
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
}
25 changes: 12 additions & 13 deletions tools/format/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,27 @@ if(CLANG_FORMAT)
message(STATUS "Searching for VS clang-format - found")
endif()

file(GLOB_RECURSE maybe-clang-format-files CONFIGURE_DEPENDS
file(GLOB_RECURSE maybe_clang_format_files CONFIGURE_DEPENDS
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
"../../stl/inc/*"
"../../stl/src/*"
"../../tests/*"
"../../tools/*"
)
set(clang-format-files "")
foreach(maybe-file IN LISTS maybe-clang-format-files)
cmake_path(GET maybe-file EXTENSION LAST_ONLY extension)
if(extension MATCHES [[^(|\.cpp|\.h|\.hpp)$]] AND NOT maybe-file MATCHES [[^\.]])
list(APPEND clang-format-files "${maybe-file}")
set(clang_format_files "")
foreach(maybe_file IN LISTS maybe_clang_format_files)
cmake_path(GET maybe_file FILENAME filename)
cmake_path(GET maybe_file EXTENSION LAST_ONLY extension)
if(extension MATCHES [[^(|\.cpp|\.h|\.hpp)$]] AND NOT filename MATCHES [[^\.]])
list(APPEND clang_format_files "${maybe_file}")
endif()
endforeach()

if(NOT clang-format-files)
if(NOT clang_format_files)
message("${message_level}" "Could not find any files to clang-format!")
endif()

set(clang-format-targets "")
foreach(file IN LISTS clang-format-files)
add_custom_target(clang-format-all ALL)
foreach(file IN LISTS clang_format_files)
cmake_path(RELATIVE_PATH file
BASE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../.."
OUTPUT_VARIABLE relative-file
Expand All @@ -61,12 +62,10 @@ if(CLANG_FORMAT)
COMMAND "${CLANG_FORMAT}" -style=file -i "${file}"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
)
list(APPEND clang-format-targets "${target_name}")
add_dependencies(clang-format-all "${target_name}")
endforeach()

if(clang-format-targets)
add_custom_target(clang-format-all ALL)
add_dependencies(clang-format-all ${clang-format-targets})
if(clang_format_targets)
endif()
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
else()
if(did_search)
Expand Down