yonaskolb / yonaskolb/XcodeGen

Generated scheme contains additional (unspecified) targets in Test Action

Open
#1,009 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

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

Screen Shot 2021-01-18 at 12 10 32@2x

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.