Skip to content

chore: support newer c++ versions#724

Merged
bfoss765 merged 1 commit into
masterfrom
fix/build-process
Aug 26, 2025
Merged

chore: support newer c++ versions#724
bfoss765 merged 1 commit into
masterfrom
fix/build-process

Conversation

@HashEngineering
Copy link
Copy Markdown
Contributor

@HashEngineering HashEngineering commented Aug 26, 2025

Issue being fixed or feature implemented

Fix some build process items

What was done?

How Has This Been Tested?

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Bug Fixes
    • Resolved iOS build failures on newer Xcode versions by applying a compatibility patch during dependency installation. This eliminates template-related compiler errors in a third-party library, restoring successful local and CI builds without changing app behavior.
  • Chores
    • Hardened the iOS build process with a post-install step that conditionally applies the fix only when needed, improving reliability across different developer environments and Xcode versions.

@HashEngineering HashEngineering self-assigned this Aug 26, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 26, 2025

Walkthrough

Adds a CocoaPods post_install hook in Podfile to conditionally patch Pods/gRPC-Core/src/core/lib/promise/detail/basic_seq.h by replacing "Traits::template CallSeqFactory" with "Traits::CallSeqFactory" when the file exists, ensuring writability before in-place edit.

Changes

Cohort / File(s) Summary
CocoaPods post-install patch
Podfile
Introduces a post_install script that, if the gRPC-Core basic_seq.h file exists, chmods it writable, reads and replaces the specific template token, and writes the updated contents back. Guarded by file-existence check and runs after target processing.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Dev as Developer
    participant CP as CocoaPods (pod install)
    participant Hook as post_install Hook
    participant FS as File System
    Dev->>CP: Run pod install
    CP->>Hook: Invoke post_install
    alt gRPC-Core basic_seq.h exists
        Hook->>FS: Make file writable
        Hook->>FS: Read file contents
        Hook->>FS: Replace "Traits::template CallSeqFactory" with "Traits::CallSeqFactory"
        Hook->>FS: Write updated contents
        Note right of Hook: Conditional patch applied
    else File missing
        Hook-->>CP: No-op
    end
    CP-->>Dev: Installation complete
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I nibble through Pods with careful cheer,
A tiny patch—now build’s more clear.
Hop, hop, chmod, replace the line,
gRPC behaves, compile’s just fine.
In carrot-orange logs I gleam,
One hop closer to a stable stream. 🥕

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/build-process

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
Podfile (3)

110-118: Make the patch safer, idempotent, and path-robust

Harden the edit to only write when a change is actually made, and resolve the Pods root via the installer to avoid path drift. Also limit removal of the template disambiguator to cases where it isn’t followed by < (so we don’t break legitimate Foo::template Bar<...> uses if they ever appear).

Apply:

-  # Fix gRPC-Core template syntax issue with newer Xcode
-  grpc_file = 'Pods/gRPC-Core/src/core/lib/promise/detail/basic_seq.h'
-  if File.exist?(grpc_file)
-    # Make file writable before modifying
-    File.chmod(0644, grpc_file)
-    text = File.read(grpc_file)
-    new_contents = text.gsub(/Traits::template CallSeqFactory/, 'Traits::CallSeqFactory')
-    File.write(grpc_file, new_contents)
-  end
+  # Fix gRPC-Core template syntax issue with newer Xcode
+  pods_root = installer.sandbox.root.to_s
+  grpc_paths = Dir[File.join(pods_root, 'gRPC-Core/src/core/lib/promise/detail/basic_seq.h')]
+  grpc_paths.each do |grpc_file|
+    next unless File.exist?(grpc_file)
+    text = File.read(grpc_file)
+    # Only strip the disambiguator when it's not followed by '<'
+    patched = text.gsub(/Traits::template\s+(CallSeqFactory)\b(?!\s*</), 'Traits::\1')
+    next if patched == text
+    File.chmod(0644, grpc_file) unless File.writable?(grpc_file)
+    File.write(grpc_file, patched)
+    puts "Patched gRPC-Core template disambiguator in #{grpc_file}"
+  end

110-118: Scope the patch to affected toolchains (optional)

To reduce churn on unaffected setups, you can gate the patch on the local Xcode version (e.g., only apply for Xcode 16.x where the parser tightened this rule). This is optional but keeps noise down for other developer machines and CI images.

Example:

xcode_ver = `xcodebuild -version 2>/dev/null`.to_s[/Xcode\s+(\d+\.\d+)/, 1]
needs_patch = xcode_ver && Gem::Version.new(xcode_ver) >= Gem::Version.new('16.0')
if needs_patch
  # ... run the patch logic ...
else
  puts "Skipping gRPC-Core patch for Xcode #{xcode_ver}"
end

Context: Reports cluster around Xcode 16.x toolchains. (stackoverflow.com, github.com)


110-118: Longer-term: manage this as a formal CocoaPods patch for traceability

If this persists until upstream updates the pod, consider using cocoapods-patches for a reproducible, diff-based patch with a link to the upstream issue. It improves discoverability and makes removal straightforward when the pod is updated.

High level steps:

  • Add the cocoapods-patches plugin and a small patch file targeting basic_seq.h.
  • Annotate with the gRPC issue URL for future cleanup.

References:

  • Upstream tracker for this specific parse error. (github.com)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 92a503a and 746b1d8.

⛔ Files ignored due to path filters (1)
  • Podfile.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • Podfile (1 hunks)
🔇 Additional comments (2)
Podfile (2)

110-118: Stopgap fix is reasonable; matches known Xcode 16 gRPC-Core parsing issue

This in-place patch aligns with community-reported workarounds for Xcode 16’s “A template argument list is expected after a name prefixed by the template keyword” error in gRPC’s basic_seq.h. Replacing Traits::template CallSeqFactory with Traits::CallSeqFactory is consistent with upstream reports.

References:

  • Stack Overflow reports the exact fix in basic_seq.h under Xcode 16.0.x, recommending the same replacement. (stackoverflow.com)
  • gRPC upstream issue tracks this with the identical code context under basic_seq.h. (github.com)

110-118: Consider whether CheckResultAndRunNext needs the same fix

Some copies of basic_seq.h also use Traits::template CheckResultAndRunNext(...) with parentheses (no <...>). If present in the version you’re pulling, Apple Clang in Xcode 16 may flag the same parse error there too. You might want to extend the guarded replacement to include it.

If needed, adjust the regex once to cover both symbols:

-    patched = text.gsub(/Traits::template\s+(CallSeqFactory)\b(?!\s*</), 'Traits::\1')
+    patched = text.gsub(/Traits::template\s+(CallSeqFactory|CheckResultAndRunNext)\b(?!\s*</), 'Traits::\1')

References:

  • Upstream issue shows both CheckResultAndRunNext and CallSeqFactory in the failing region. (github.com)
  • Another public reproduction includes both lines with template before a call expression. (stackoverflow.forums.wiki)

Copy link
Copy Markdown
Contributor

@bfoss765 bfoss765 left a comment

Choose a reason for hiding this comment

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

LGTM

@bfoss765 bfoss765 merged commit 8a6916a into master Aug 26, 2025
3 checks passed
@bfoss765 bfoss765 deleted the fix/build-process branch August 26, 2025 16:04
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