0

For illustration purposes two Xcode project created and dependency managed by Cocoapods. First one is the iOS Apps project and another one is the dependency Framework. Both project build and run properly in absent of GoogleMaps. In presence of GoogleMaps as an indirect dependency for the first project causes error, Here is the dependency tree:

AcademiaMainAPP/
├─ TARGETS/AcademiaMainAPP       [Error: Multiple commands produce for Assets.car]
└─ PODS/
   └─ AcademiaMainGUI/
      ├─ TARGETS/AcademiaMainDMO [No error, build & run successfully]
      └─ PODS/
         ├─ GoogleMaps
         └─ AcademiaCoreLIB

Build Cases for GoogleMaps as an Indirect Dependency:

iOS Apps project build error for the default target

Error:

Multiple commands produce '/Users/Academia/Library/Developer/Xcode/DerivedData/AcademiaMainAPP-dchavmxvfznhbifvdocjhrxhitug/Build/Products/Debug-iphonesimulator/Academia.app/Assets.car':
1) Target 'AcademiaMainAPP' (project 'AcademiaMainAPP') has compile command with input '/opt/dev/ios_workspace/academia-main-iosapp/AcademiaMainAPP/Preview Content/Preview Assets.xcassets'
2) That command depends on command in Target 'AcademiaMainAPP' (project 'AcademiaMainAPP'): script phase "[CP] Copy Pods Resources"

Warning:

duplicate output file '/Users/Academia/Library/Developer/Xcode/DerivedData/AcademiaMainAPP-dchavmxvfznhbifvdocjhrxhitug/Build/Products/Debug-iphonesimulator/Academia.app/Assets.car'
on task: PhaseScriptExecution [CP] Copy Pods Resources /Users/Academia/Library/Developer/Xcode/DerivedData/AcademiaMainAPP-dchavmxvfznhbifvdocjhrxhitug/Build/Intermediates.noindex/AcademiaMainAPP.build/Debug-iphonesimulator/AcademiaMainAPP.build/Script-3D735383E09B1F357AA7768E.sh

Query?

Right now we are using Xcode 11.4.1. Actually no such Assets.car used by us. s.static_framework = true added in Podspec for GoogleMaps. For details please find our Podfile and Podspec as blew. Indeed we need to know that if there is any mistake or lacking of configuration in the Podfile or Podspec. Our only query to the expertise those who already resolved such issues please guide us to solve this.


1. AcademiaMainAPP/Podfile:

platform :ios, '13.0'

target 'AcademiaMainAPP' do
  use_frameworks!

  # Pods for AcademiaMainAPP
  pod 'AcademiaMainGUI', :git => 'git.chorke.org:academia/academia-main-iosgui.git'
  pod 'AcademiaCoreLIB', :git => 'git.chorke.org:academia/academia-core-ioslib.git'

  target 'AcademiaMainAPPTests' do
    # Pods for testing
  end
end

2.a AcademiaMainGUI/Podfile:

platform :ios, '13.0'

target 'AcademiaMainGUI' do
  use_frameworks!

  # Pods for AcademiaMainGUI
  pod 'AcademiaCoreLIB', :git => 'git.chorke.org:academia/academia-core-ioslib.git'
  pod 'GoogleMaps', '~> 3.8.0'

  target 'AcademiaMainGUITests' do
    # Pods for testing
  end

  target 'AcademiaMainDMO' do
    target 'AcademiaMainDMOTests' do
      # Pods for testing
    end
    target 'AcademiaMainDMOUITests' do
      # Pods for testing
    end
  end
end

2.b AcademiaMainGUI.podspec:

Pod::Spec.new do |s|
  s.name        = 'AcademiaMainGUI'
  s.module_name = 'AcademiaMainGUI'
  s.version     = '1.0.0'
  s.source      = { :git => 'git.chorke.org:academia/academia-main-iosgui.git', :tag => "v#{s.version}" }

  s.homepage          = 'https://cdn.chorke.org/docs/academia/swift/main/academia-main-iosgui'
  s.documentation_url = 'https://cdn.chorke.org/docs/academia/swift/main/academia-main-iosgui'
  s.source_files      = 'AcademiaMainGUI', 'AcademiaMainGUI/**/*.{h,m,swift}'
  s.authors           = {'Chorke Academia' => 'academia@chorke.org'}
  s.resources         = ['AcademiaMainGUI/Resource/*.xcassets']
  s.license           = { :type => 'MIT', :file => 'LICENSE' }
  s.social_media_url  = "https://twitter.com/chorkeinc"
  s.swift_versions    = ['5.0', '5.1']

  s.requires_arc              = true
  s.static_framework          = true
  s.ios.deployment_target     = '13.0'
  s.osx.deployment_target     = '10.12'
  s.tvos.deployment_target    = '10.0'
  s.watchos.deployment_target = '3.0'

  s.summary       = 'Swift Classess, Structures and Utilities for SwiftUI & UIKit'
  s.description   = <<-DESC
  AcademiaMainGUI is the dependnecy for the AcademiaMainAPP by the Academian for the Academian.
  SwiftUI and UIKit related reusable protocols, extensions, classess, strutures, utilites,
  functions and constants developed for encapsulation, security and agile software
  development for Swift. Minimizing the learning curve and the development costing of
  an Academian. Academia developed such library targeting Multi-Lingual Academian.
                  DESC

  s.dependency    'AcademiaCoreLIB'
  s.dependency    'GoogleMaps'
end
Śhāhēēd
  • 1,812
  • 6
  • 23
  • 44
  • `use_frameworks! :linkage => :static` might help – Paul Beusterien Apr 26 '20 at 19:01
  • Thanks for your suggestion. We already tried where there is the same error and warning remain! So far we could realized that `use_frameworks! :linkage => :static` is the alternative of the dependency framework **Podspec** `s.static_framework = true` property. If `s.static_framework = true` property missed in the **Podspec** of any dependency framework which contains **static framework** then we could use `use_frameworks! :linkage => :static` in the dependent **Podfile** to handle such static framework. – Śhāhēēd Apr 27 '20 at 05:38
  • For **Xcode 11.4** please select the menu item `File » Workspace Settings` then select `Shared Workspace Settings » Build System » Legacy Build System`. After that to clear the project from **Derived Data** press hotkey `⌘ + Option + Shift + K` then `⌘ + Shift + R` to build and `⌘ + R` to run. The Xcode build properly without any error. But keep in mind It's the temporary solution for the legacy system built pod dependency framework. For details [Xcode Error: Multiple commands produce](https://stackoverflow.com/questions/50718018) – Śhāhēēd Apr 27 '20 at 06:53

0 Answers0