Skip to content

fix: provision C++ clang-format for spotless - #918

Open
ColinLeeo wants to merge 1 commit into
apache:developfrom
ColinLeeo:fix/cpp-clang-format-provisioning
Open

fix: provision C++ clang-format for spotless#918
ColinLeeo wants to merge 1 commit into
apache:developfrom
ColinLeeo:fix/cpp-clang-format-provisioning

Conversation

@ColinLeeo

@ColinLeeo ColinLeeo commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix the root formatting docs to use the Java/C++ Maven profiles explicitly.
  • Add a repo-local cpp/tools/clang-format wrapper for clang-format 17.0.6.
  • Configure C++ Spotless to use the wrapper on Linux/macOS, with PATH fallback on unsupported hosts.

Validation

  • ./cpp/tools/clang-format --version
  • ./mvnw spotless:apply -P with-cpp
  • ./mvnw spotless:check -P with-cpp
  • ./mvnw spotless:check -P with-java,with-cpp
  • xmllint --noout cpp/pom.xml

@ColinLeeo
ColinLeeo requested a lite review from Copilot August 24, 2026 06:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request improves C++ formatting reproducibility in the Maven/Spotless workflow by introducing a repo-local clang-format wrapper (pinned to 17.0.6) and updating documentation to use the correct Maven profiles for formatting across Java/C++/Python modules.

Changes:

  • Update root and Python formatting documentation to use explicit Maven profiles/phases for formatting.
  • Add cpp/tools/clang-format wrapper that downloads and runs a pinned clang-format (with PATH fallback on unsupported hosts).
  • Configure C++ Spotless to call the wrapper on Linux/macOS via OS-activated Maven profiles.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
CLAUDE.md Updates root formatting commands and explains how formatting is provisioned across profiles.
python/CLAUDE.md Updates Python formatting command to use the with-python profile (and initialize) explicitly.
cpp/tools/clang-format New wrapper script that provisions and enforces a pinned clang-format version.
cpp/pom.xml Routes Spotless C++ formatting through a configurable executable, defaulting to wrapper on Linux/macOS.
cpp/CLAUDE.md Documents Spotless/clang-format provisioning behavior for C++.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cpp/tools/clang-format
Comment on lines +41 to +50
download() {
url="$1"
output="$2"
if command -v curl >/dev/null 2>&1; then
curl -fL "${url}" -o "${output}"
elif command -v wget >/dev/null 2>&1; then
wget -O "${output}" "${url}"
else
echo "Neither curl nor wget is available to download clang-format ${VERSION}." >&2
exit 1
Comment thread CLAUDE.md
./mvnw spotless:apply -P with-java,with-cpp # Format Java and C++
./mvnw spotless:check -P with-java,with-cpp # Check Java and C++ formatting
./mvnw initialize spotless:apply -P with-java,with-python # Format Java, C++, and Python
./mvnw process-sources -P with-java,with-python # Check Java, C++, and Python formatting
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.

2 participants