Skip to content

Multiple targets with same framework output name causes Xcode to build the wrong target #342

Open
@c0diq

Description

@c0diq

Describe the bug
Because of a bug with xcodebuild reported here and here, when RxBluetoothKit project is integrated directly as a source dependency inside another project (not via Carthage), Xcodebuild will incorrectly choose the wrong target (macOS, watchOS) when determining dependencies implicitly.

To Reproduce
Steps to reproduce the behavior:

  1. Create a simple project with just iOS as platform/sdk
  2. Make sure Implicit Dependency is checked in the scheme
  3. Add RxBluetoothKit.xcodeproj to project
  4. Drag the RxBluetoothKit.framework for iOS from RxBluetoothKit.xcodeproj Products folder to the Link Phase of the main project.
  5. Make sure it's NOT explicitly specified in Target Dependency (xcodebuild will complain about multiple commands build the same output otherwise)
  6. On the command line execute:
    set -euo pipefail && xcodebuild -derivedDataPath 'build' -sdk 'iphonesimulator' -enableCodeCoverage YES -scheme 'App' -configuration 'Debug' build

Notice that it will randomly pick ios, watchos or macos.

Expected behavior
It should pick iOS.

Solution
The way to solve it is to follow what other frameworks do like RxSwift, etc.. and have a single target RxBluetoothKit that supports all platforms.

Environment:

  • Macbook Pro 2018
  • OS: macOS 10.14.4
  • Library version: 5.2.1
  • Swift version: 5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions