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

Using a docker container for clang-cl #580

Merged
merged 9 commits into from
Feb 2, 2024
Merged

Using a docker container for clang-cl #580

merged 9 commits into from
Feb 2, 2024

Conversation

lemire
Copy link
Member

@lemire lemire commented Jan 30, 2024

To fix the clang-format version, use a Docker container.

See #577 (comment)

tools/run-clangclcheckdocker.sh Outdated Show resolved Hide resolved
tools/remove-clangcldocker.sh Outdated Show resolved Hide resolved
tools/run-clangclcheckdocker.sh Outdated Show resolved Hide resolved
@lemire lemire requested a review from SLieve January 30, 2024 20:52
Copy link
Member

@Dr-Emann Dr-Emann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to consider trying to use a local clang-format if available (and the right version)?

Something like

if clang-format-17 --version | grep -qF 'version 17.'; then
  clang_format=( clang-format-17 )
elif clang-format --version | grep -qF 'version 17.'; then
  clang_format=( clang-format )
else
  if [ -t 0 ]; then DOCKER_ARGS=-it; fi
  clang_format=( docker run --rm $DOCKER_ARGS -v "$MAINSOURCE:/app:Z" -w "/app" -u "$(id -u $USER):$(id -g $USER)" kszonek/clang-format-17 )
fi

"${clang_format[@]}" "$@"

Then we can use that script as if it were clang-format itself, passing e.g. tools/clang-format.sh --style=file --verbose -i -- $ALL_CROARING_FILES in a wrapper

tools/run-clangcldocker.sh Outdated Show resolved Hide resolved
tools/run-clangcldocker.sh Outdated Show resolved Hide resolved
tools/run-clangcldocker.sh Outdated Show resolved Hide resolved
@lemire lemire requested a review from Dr-Emann January 31, 2024 22:39
@lemire
Copy link
Member Author

lemire commented Jan 31, 2024

@Dr-Emann Please re-review.

tools/run-clangcldocker.sh Outdated Show resolved Hide resolved
tools/run-clangcldocker.sh Outdated Show resolved Hide resolved
tools/run-clangcldocker.sh Outdated Show resolved Hide resolved
@lemire lemire requested a review from Dr-Emann February 2, 2024 20:08
@lemire
Copy link
Member Author

lemire commented Feb 2, 2024

@Dr-Emann I have updated the script.

Copy link
Member

@Dr-Emann Dr-Emann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a comment, but don't want to hold things up for it

tools/run-clangcldocker.sh Show resolved Hide resolved
@lemire
Copy link
Member Author

lemire commented Feb 2, 2024

Merging.

@lemire lemire merged commit 676c863 into master Feb 2, 2024
35 checks passed
SLieve pushed a commit to SLieve/CRoaring that referenced this pull request Feb 3, 2024
* Using a docker container for clang-cl


---------

Co-authored-by: Daniel Lemire <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants