RxSwiftCommunity / RxDataSources

UITableView and UICollectionView Data Sources for RxSwift (sections, animated updates, editing ...)
MIT License
3.07k stars 487 forks source link

Cycle in dependencies between targets 'RxDataSources' and 'RxCocoa'; building could produce unreliable results. #284

Open alouanemed opened 5 years ago

alouanemed commented 5 years ago

I am trying to integrate Circle Ci and fastlane with my iOS app.

I get this error on :x: error: Cycle in dependencies between targets 'RxDataSources' and 'RxCocoa'; building could produce unreliable results.

Although I can run the app on simulator easily without that error. I had that error several times in the past but I would clean the project and it will disappear.

The error occurs when running the cmd both on my machine and on circle ci :

bundle exec fastlane test

pod file šŸ‘


platform :ios, '11.0'
use_modular_headers!
use_frameworks!

abstract_target 'projectApp' do
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
    inhibit_all_warnings!

    # Networking
    pod 'Moya/RxSwift', '~> 11.0'  # https://github.com/Moya/Moya
    pod 'ReachabilitySwift', '~> 4.3.0' # https://github.com/ashleymills/Reachability.swift

    # Rx Extensions
    pod 'RxDataSources', '~> 3.0'  # https://github.com/RxSwiftCommunity/RxDataSources
    pod 'RxSwiftExt' # https://github.com/RxSwiftCommunity/RxSwiftExt
    pod 'NSObject+Rx' # https://github.com/RxSwiftCommunity/NSObject-Rx
    pod 'RxViewController' # https://github.com/devxoul/RxViewController
    pod 'RxGesture'  # https://github.com/RxSwiftCommunity/RxGesture
    pod 'RxOptional'  # https://github.com/RxSwiftCommunity/RxOptional
    pod 'RxTheme'  # https://github.com/RxSwiftCommunity/RxTheme

    # JSON Mapping
    #pod 'ObjectMapper', :git => 'https://github.com/kajensen/ObjectMapper.git'  # https://github.com/Hearst-DD/ObjectMapper
    pod 'Moya-ObjectMapper/RxSwift'  # https://github.com/ivanbruel/Moya-ObjectMapper

    # Image
    pod 'Kingfisher', '~> 4.0'  # https://github.com/onevcat/Kingfisher

    # Date
    pod 'SwiftDate', '~> 5.0'  # https://github.com/malcommac/SwiftDate

    # Tools
    pod 'R.swift', '~> 5.0.0' # https://github.com/mac-cain13/R.swift
    pod 'SwiftLint' # https://github.com/realm/SwiftLint

    # Keychain
    pod 'KeychainAccess'  # https://github.com/kishikawakatsumi/KeychainAccess

    # Fabric
    pod 'Fabric'
    pod 'Crashlytics'

    # UI
    pod 'NVActivityIndicatorView' # https://github.com/ninjaprox/NVActivityIndicatorView
    pod 'PMAlertController' # https://github.com/pmusolino/PMAlertController
    pod 'ImageSlideshow', '~> 1.6'  # https://github.com/zvonicek/ImageSlideshow
    pod 'ImageSlideshow/Kingfisher'
    pod 'DZNEmptyDataSet'  # https://github.com/dzenbot/DZNEmptyDataSet
    pod 'Hero' # https://github.com/lkzhao/Hero
    pod 'Localize-Swift', '~> 2.0'  # https://github.com/marmelroy/Localize-Swift
    pod 'RAMAnimatedTabBarController' # https://github.com/Ramotion/animated-tab-bar
    pod 'AcknowList' # https://github.com/vtourraine/AcknowList
    pod 'KafkaRefresh'  # https://github.com/OpenFeyn/KafkaRefresh
    pod 'JVFloatLabeledTextField'  # https://github.com/jverdi/JVFloatLabeledTextField

    # Keyboard
    pod 'IQKeyboardManagerSwift'  # https://github.com/hackiftekhar/IQKeyboardManager

    # Auto Layout
    pod 'SnapKit', '~> 4.0'  # https://github.com/SnapKit/SnapKit

    # Code Quality
    pod 'FLEX', '~> 2.0'  # https://github.com/Flipboard/FLEX
    pod 'SwifterSwift', '~> 4.6.0' # https://github.com/SwifterSwift/SwifterSwift
    pod 'AttributedLib', :git => 'https://github.com/Nirma/Attributed.git'  # https://github.com/Nirma/Attributed

    # Logging
    pod 'CocoaLumberjack/Swift'  # https://github.com/CocoaLumberjack/CocoaLumberjack

  target 'productA'
  target 'productB'

end

# CocoaPods optimization, always clean project after pod updating
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 8.0
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
      end
    end
  end

    Dir.glob(installer.sandbox.target_support_files_root + "Pods-*/*.sh").each do |script|
        flag_name = File.basename(script, ".sh") + "-Installation-Flag"
        folder = "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
        file = File.join(folder, flag_name)
        content = File.read(script)
        content.gsub!(/set -e/, "set -e\nKG_FILE=\"#{file}\"\nif [ -f \"$KG_FILE\" ]; then exit 0; fi\nmkdir -p \"#{folder}\"\ntouch \"$KG_FILE\"")
        File.write(script, content)
    end 
tigran-stdev commented 5 years ago

Hi @alouanemed, I have faced the same issue in my end.

I am assuming the problem is coming due to enabled parallelized build option in the scheme.

The whole error message is the following:

error: Cycle in dependencies between targets 'RxDataSources' and 'RxCocoa'; building could produce unreliable results.
Cycle path: RxDataSources ā†’ RxCocoa ā†’ RxDataSources
Cycle details:
ā†’ Target 'RxDataSources' has target dependency on Target 'RxCocoa'
ā†’ Target 'RxCocoa' has a command with output '/Users/.../Build/Products/DebugDev-iphonesimulator/RxCocoa/RxCocoa.framework.dSYM'
ā—‹ Target 'RxCocoa' has a command with output '/Users/.../Build/Products/DebugDev-iphonesimulator/RxCocoa/RxCocoa.framework/RxCocoa'
ā—‹ Target 'RxCocoa' has link command with output '/Users/.../Build/Intermediates.noindex/Pods.build/DebugDev-iphonesimulator/RxCocoa.build/Objects-normal/x86_64/RxCocoa'

I can't understand how RxCocoa target depends from RxDataSource.

brunomunizaf commented 5 years ago

As the warning says: 'RxDataSources' has target dependency on Target 'RxCocoa' which means that wherever you're importing RxDataSources you don't have to import RxCocoa.