yandex / yandex/implicits

Xcode project integration support

Open
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Swift
Stars
43
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Problem

ImplicitsAnalysisPlugin currently only works with SPM packages. Native Xcode projects (.xcodeproj) are not supported because:

  1. The plugin only implements BuildToolPlugin, not XcodeBuildToolPlugin
  2. XcodePluginContext has fundamentally different API — no Package, no dependency graph traversal
  3. No way to automatically discover which targets depend on Implicits or locate their .implicitinterface files

Possible Approaches

Option A: XcodeBuildToolPlugin

Implement the XcodeBuildToolPlugin protocol.

Challenges:

  • No dependency graph — need alternative way to discover dependencies
  • Could require a config file (e.g., implicits.json) listing dependent modules
  • Need to figure out where Xcode places plugin outputs to calculate interface paths
Option B: External CLI Tool

Standalone tool that:

  1. Parses .xcodeproj using XcodeProj library or similar
  2. Discovers targets and their dependencies
  3. Adds build phases or generates scripts for each target
  4. Manages .implicitinterface file locations

Pros: Full control over xcodeproj structure, can automate setup
Cons: Complex setup, requires xcodeproj parsing, user must run tool after project changes

Option C: Build Rules + Run Script

Use Xcode's built-in mechanisms:

  1. Add Run Script build phase that invokes implicits-tool
  2. User manually configures input/output paths
  3. Cross-target dependencies handled via explicit configuration

Pros: No plugin needed, works with any Xcode version
Cons: Manual setup per target, error-prone

Option D: SWIFTC Wrapper

Intercept the Swift compiler via SWIFT_EXEC build setting:

  1. Set SWIFT_EXEC to point to a wrapper script/binary
  2. Wrapper receives all source files for the module (Swift compiles whole modules)
  3. Wrapper runs implicits-tool analysis
  4. Wrapper calls the real swiftc with original arguments

Pros:

  • Automatic once configured — no per-target build phases needed
  • Gets complete module compilation context
  • Minimal project modification (one build setting)

Cons:

  • Need to correctly pass through all swiftc flags
  • Need to locate .implicitinterface files from dependencies
  • May break with Xcode/toolchain updates if argument format changes
  • Debugging compilation issues becomes harder (extra indirection layer)

Research Needed

  • Explore XcodePluginContext API limitations in detail
  • How do similar tools (SwiftLint, Sourcery) handle Xcode integration?
  • Can Build Rules provide enough info for cross-target analysis?
  • Evaluate xcodeproj parsing libraries (XcodeProj, etc.)
  • Test SWIFT_EXEC approach — what arguments does swiftc receive in Xcode builds?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation file or test is named. Start by exploring the XcodePluginContext API and testing the SWIFT_EXEC approach, then compare XcodeBuildToolPlugin, an external CLI, build rules, and the wrapper approach. Done requires selecting a viable Xcode integration path and resolving its dependency discovery and .implicitinterface handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.