yonaskolb / yonaskolb/XcodeGen
Generated scheme contains additional (unspecified) targets in Test Action
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 8.8k
- Forks
- 908
- Avg merge
- 17d 14h
- Merged PRs (30d)
- 2
Description
Recently, we are often running into the following build errors (excerpt of hundreds of this kind):
error: Multiple commands produce '[...]/DerivedData/[...]/Build/Products/Debug-iphonesimulator/SomeApp.app
duplicate output file '[...]/DerivedData/[...]/Build/Products/Debug-iphonesimulator/SomeApp.app/_CodeSignature' on task: CodeSign [...]/DerivedData/[...]/Build/Products/Debug-iphonesimulator/SomeApp.app (in target 'SomeAppWithExtension' from project 'SomeApp')
We have a similar setup as described in #589, so we specify an AllTests scheme, in which we specify all of our individual test targets in the test action. The build and run actions contain a reference to our main application target, which is also used as the host application for this scheme.
During our investigations, we discovered that the errors always occur, when the AllTests scheme contains an additional application target in the list of targets in the Test Action of the scheme (see screenshot). When running xcodegen generate multiple times in a row (10+ times), this additional target is present in the AllTests scheme for approximately half of the cases.
We already tried debugging the SchemeGenerator, but we could not find the location in which the additional application target is added to the scheme. The testables, which are added to the XCScheme.TestAction only contain the test targets that we explicilty specify in the project.yml. So how are the bottom two entries ending up in the scheme? When opening the generated xcscheme file, it doesn't even contain a reference to those bottom two entries.
Do you have any idea, how the additional target could end up in the scheme?
project.yml
schemes:
AllTests:
build:
targets:
SomeApp: test
run:
executable: "SomeApp"
test:
gatherCoverageData: true
language: en
region: US
targets:
- name: TestTarget1
randomExecutionOrder: true
parallelizable: true
- name: TestTarget2
randomExecutionOrder: true
parallelizable: true
- name: TestTarget3
randomExecutionOrder: true
parallelizable: true
- ...
Screenshot

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SchemeGenerator and the scheme definition in project.yml, then reproduce the issue by running xcodegen generate repeatedly and inspecting the generated xcscheme file. Compare the explicit testables with the additional application targets shown in Xcode, and determine where those entries are introduced or resolved. Done means identifying and fixing the source of the unexpected targets and confirming that repeated generation produces the intended Test Action.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- build-system, cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100