RxBluetoothKit icon indicating copy to clipboard operation
RxBluetoothKit copied to clipboard

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

Open c0diq opened this issue 6 years ago • 2 comments

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

c0diq avatar Jun 01 '19 05:06 c0diq

same problem

m-ricca avatar Nov 11 '21 15:11 m-ricca

same problem

Mase9527 avatar Jan 21 '22 03:01 Mase9527