Cocoapods: Embed Pods Frameworks build phase not reliably executed with Xcode 10 / New Build System

Created on 2 Oct 2018  Â·  4Comments  Â·  Source: CocoaPods/CocoaPods

Report

What did you do?

  1. Create a new pod (with example project) using pod lib create
  2. Open example project in Xcode 10
  3. Add some code to the pod project
  4. Build & run
  5. Make some changes to the pod project code
  6. Build & run

What did you expect to happen?

Expect changes made in step 5 to take effect in the example project

What happened instead?

The example app continues to use the initially built version of the pod.

CocoaPods Environment

Stack

   CocoaPods : 1.5.3
        Ruby : ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
    RubyGems : 2.5.2.3
        Host : Mac OS X 10.14 (18A391)
       Xcode : 10.0 (10A255)
         Git : git version 2.17.1 (Apple Git-112)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ a30768897a075978084398f2dee09206c2cced5c

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.2
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.1
cocoapods-try         : 1.1.0
slather               : 2.4.5

Podfile

use_frameworks!

target 'Foobar_Example' do
  pod 'Foobar', :path => '../'

  target 'Foobar_Tests' do
    inherit! :search_paths

    pod 'FBSnapshotTestCase' , '~> 2.1.4'
  end
end

Project that demonstrates the issue

This can be reproduced with any cocoapods library, but here is a simple example that demonstrates the issue - Foobar.zip

Further discussion

This problem only happens when using Xcode's "New Build System" which is the default as of Xcode 10. Reverting to the Legacy Build System is a workaround.

Removing the Input Files and Output Files from the [CP] Embed Pods Frameworks build phase works around the issue when using the New Build System.

screenshot 2018-10-02 at 09 44 25

The [CP] Embed Pods Frameworks build phase is not executed by Xcode's New Build System after making a change to a (development) pod:

screenshot 2018-10-02 at 10 04 28

Most helpful comment

I documented the issue here:
https://www.ralfebert.de/ios/blog/cocoapods-clean-input-output-files/

I wondered, has it been considered to disable the input/output folders in the build phase by default until the Xcode bug is fixed?

All 4 comments

Another workaround I found, which doesn't require using the old build system or deleting those input/output source files after each pod install is to add an additional Script Build Phase just before the "[CP] Embed Pod Frameworks" one which just touches the shell script:

# Hopeful workaround for: https://github.com/CocoaPods/CocoaPods/issues/8151
touch "$SRCROOT/Pods/Target Support Files/Pods-TARGETNAME/Pods-TARGETNAME-frameworks.sh"

This a known issue with the new build system. Apple is aware of it and it has been tracked here https://github.com/CocoaPods/CocoaPods/issues/8073 with a PR that allows you to disable input/output paths here https://github.com/CocoaPods/CocoaPods/pull/8105 which is not yet released but you can use Bundler to point to a SHA for CocoaPods.

Going to close as the other issue since there are now 2 workarounds (use legacy build system or use the flag from #8105).

A small workaround bash script that will remove from modified by cocoapods project.pbxproj file wrong output file line (example based on Instabug framework):

PROJECT_NAME=MyAppProject

sed -i '' 's#"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Instabug.framework",##' ${PROJECT_NAME}.xcodeproj/project.pbxproj

execute this script after pod install build step

I documented the issue here:
https://www.ralfebert.de/ios/blog/cocoapods-clean-input-output-files/

I wondered, has it been considered to disable the input/output folders in the build phase by default until the Xcode bug is fixed?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pronebird picture pronebird  Â·  3Comments

pallaviMN picture pallaviMN  Â·  3Comments

dawnnnnn picture dawnnnnn  Â·  3Comments

intelliot picture intelliot  Â·  3Comments

marzapower picture marzapower  Â·  3Comments