yonaskolb / yonaskolb/XcodeGen

destinationFilters are silently ignored for syncedFolder sources (no platformFiltersByRelativePath emitted)

Open
#1,646 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
8.8k
Forks
908
Avg merge
17d 14h
Merged PRs (30d)
2

Description

Summary

destinationFilters on a TargetSource work for regular (group) sources: each file gets platformFilters on its PBXBuildFile. For type: syncedFolder the same key is silently ignored, so every file in the folder compiles for all destinations of the target.

Xcode itself supports per-file platform filters inside synced folders via platformFiltersByRelativePath on PBXFileSystemSynchronizedBuildFileExceptionSet, and the bundled XcodeProj already models that field (tuist/XcodeProj#1065, in XcodeProj 9.8.0+).

Reproduction

name: Demo
targets:
  App:
    type: application
    supportedDestinations: [iOS, visionOS]
    sources:
      - path: Sources
        type: syncedFolder
        excludes:
          - VisionOSMain.swift
        destinationFilters: [iOS]
      - path: Sources
        type: syncedFolder
        includes:
          - VisionOSMain.swift
        destinationFilters: [visionOS]

Sources/AppDelegate.swift uses UIScreen, Sources/VisionOSMain.swift is a visionOS @main.

Expected

The generated exception set carries the filters, the way Xcode writes them when you uncheck "Any Supported Platform" in the file inspector:

platformFiltersByRelativePath = {
    AppDelegate.swift = (ios, );
    VisionOSMain.swift = (xros, );
};

and the visionOS build does not compile AppDelegate.swift.

Actual

membershipExceptions are emitted from excludes/includes, but there is no platformFiltersByRelativePath at all.
Building for visionOS compiles AppDelegate.swift and fails with 'UIScreen' is unavailable in visionOS. No warning that the key is ignored.

I verified that Xcode honors a hand-written platformFiltersByRelativePath in the generated project (Xcode 26.5): the filtered files are skipped on the other platform for both iOS and visionOS builds.
Folder keys are not honored by Xcode, only file paths, so the generator would need to enumerate matching files the same way syncedFolderExceptions already does for excludes.

Environment

  • XcodeGen 2.45.4 (same on 2.46.0 / master)
  • Xcode 26.5
  • macOS 26

Related, but different: #1589 / #1587 (excludes), #1602 / #1604 (includes), #1607 (directory-level exceptions).

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

Start at the existing syncedFolderExceptions entry point and trace how matching files are enumerated for excludes and includes. Check the bundled XcodeProj model's platformFiltersByRelativePath field and use the reproduction to verify that generated exception sets contain per-file filters and that both iOS and visionOS builds skip the wrong-platform files.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.