cordova-ios icon indicating copy to clipboard operation
cordova-ios copied to clipboard

ios build fails with Pods and CONFIGURATION_BUILD_DIR configured

Open Michael-Shemesh opened this issue 6 years ago • 10 comments

Bug Report

Running a cordova build on ios which uses pods with sub folders fails in PhaseScriptExecution [CP]\ Copy\ Pods\ Resources

Problem

Certain pods have an hierarchy which needs to be dynamically adjusted per pod via the CONFIGURATION_BUILD_DIR argument. If this argument is already set then its value can't be overridden and the pods folder structure will no longer match the expected structure.

The following command is generated by cordova which causes the build to fail: (notice the "CONFIGURATION_BUILD_DIR" argument)

xcodebuild -workspace HelloCordova.xcworkspace -scheme HelloCordova -configuration Release -destination generic/platform=iOS -archivePath HelloCordova.xcarchive archive CONFIGURATION_BUILD_DIR=/Users/michael.shemesh/dev/mobtest/cordova-hello-world/platforms/ios/build/device SHARED_PRECOMPS_DIR=/Users/michael.shemesh/dev/mobtest/cordova-hello-world/platforms/ios/build/sharedpch

Running the same without the "CONFIGURATION_BUILD_DIR" argument will make the build pass:

xcodebuild -workspace HelloCordova.xcworkspace -scheme HelloCordova -configuration Release -destination generic/platform=iOS -archivePath HelloCordova.xcarchive archive SHARED_PRECOMPS_DIR=/Users/michael.shemesh/dev/mobtest/cordova-hello-world/platforms/ios/build/sharedpch

What is expected to happen?

Allow to provide a parameter to disable setting the CONFIGURATION_BUILD_DIR argument. (Setting it to empty also doesn't work since it is still counted by xcode as having a value)

The following is the code section which I wish to disable: cordova/lib/build.js#L351

What does actually happen?

The ios build fails with the following error:

PhaseScriptExecution [CP]\ Copy\ Pods\ Resources /Users/<username>/Library/Developer/Xcode/DerivedData/Thryv-gfricshxsupkdfguznnnhnawnjkb/Build/Intermediates.noindex/ArchiveIntermediates/Thryv/IntermediateBuildFilesPath/Thryv.build/Release-iphoneos/Thryv.build/Script-201964EF33584F706397D9EB.sh
    cd /Users/<username>/dev/mobile-app-generator/build/platforms/ios
    /bin/sh -c /Users/<username>/Library/Developer/Xcode/DerivedData/Thryv-gfricshxsupkdfguznnnhnawnjkb/Build/Intermediates.noindex/ArchiveIntermediates/Thryv/IntermediateBuildFilesPath/Thryv.build/Release-iphoneos/Thryv.build/Script-201964EF33584F706397D9EB.sh
error: Resource "/Users/<username>/Library/Developer/Xcode/DerivedData/Thryv-gfricshxsupkdfguznnnhnawnjkb/Build/Intermediates.noindex/ArchiveIntermediates/Thryv/BuildProductsPath/Release-iphoneos/Braintree/Braintree-UI-Localization.bundle" not found. Run 'pod install' to update the copy resources script.

Information

Create a new cordova project, add the following to the config.xml file:

<plugin name="phonegap-plugin-push" spec="^2.2.3" />

Add the ios platform:

cordova platform add [email protected]

Open the workspace in xcode and add code signing.

Build the project using cordova and see that it works:

cordova build ios --release --device

Add the following to your Podfile:

	pod 'Braintree', '~> 4.23.0'
	pod 'BraintreeDropIn'

Run pod install Now try to build the project again and the error will be shown:

cordova build ios --release --device

Environment, Platform, Device

~/dev/cordova-hello-world » cordova -v 9.0.0 ([email protected])

~/dev/cordova-hello-world » pod env

Stack

   CocoaPods : 1.7.5
        Ruby : ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin18.0]
    RubyGems : 3.0.4
        Host : Mac OS X 10.14.6 (18G87)
       Xcode : 10.3 (10G8)
         Git : git version 2.22.0
Ruby lib dir : /Users/michael.shemesh/.rvm/rubies/ruby-2.1.5/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ a4d0bc49a0346483284c63ecd0b9c31b2453ee14

Installation Source

Executable Path: /Users/michael.shemesh/.rvm/gems/ruby-2.1.5/bin/pod

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.3.1
cocoapods-try         : 1.1.0

Checklist

  • [x] I searched for existing GitHub issues
  • [x] I updated all Cordova tooling to most recent version
  • [x] I included all the necessary information above

Michael-Shemesh avatar Aug 20 '19 14:08 Michael-Shemesh

Same problem with Google Tag Manager Pod. <pod name="GoogleTagManager" spec="~> 7.0" />

ozgeekemen avatar Sep 18 '19 09:09 ozgeekemen

Also experiencing this with https://github.com/chemerisuk/cordova-plugin-firebase-inappmessaging even after forking and updating dependency version numbers. Pod asset is being fetched from the incorrect directory because of the CONFIGURATION_BUILD_DIR location.

This issue appears to be specific to builds on Xcode 10 and up using pods that have artifacts that need to be copied over during build, so the context of the values defining CONFIGURATION_BUILD_DIR are incorrect at the time the artifacts are called upon.

newdaveespionage avatar Sep 21 '19 00:09 newdaveespionage

Would also like to see the ability to disable setting CONFIGURATION_BUILD_DIR. I ended up forking cordova-ios and commenting out that line. Seems to work and not cause pod issues.

jsheetzati avatar Oct 18 '19 15:10 jsheetzati

@jsheetzati can you please post your env that worked after forking the repo and commenting out the line? I tried doing that but still couldn't get it to build. Here is my env:

My env: Cordova cli: 8.1.2 Cordova ios: 5.1.1 Branch: 4.0.0 Pod: 1.8.4

CodeWithOz avatar Dec 17 '19 15:12 CodeWithOz

I just added the help wanted label. It would be ideal if we can find a way to resolve this issue without breaking anything else. I would highly recommend people follow up with us on Slack or on the mailing list, follow links in the footer of cordova.io or cordova.apache.org.

brody4hire avatar Feb 17 '20 15:02 brody4hire

Same here with me https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking-attribution/issues/633 😭😭😭

bobrosoft avatar Feb 25 '20 11:02 bobrosoft

any plans on this?

EinfachHans avatar Jan 25 '21 10:01 EinfachHans

Hi,

I'm also experiencing this issue. Anyone found a solution?

seamlink-aalves avatar May 18 '21 14:05 seamlink-aalves

@seamlink-aalves in result I forked the repo, committed a fix for it and using my fork in packages.json as

"branch-cordova-sdk": "git://github.com/bobrosoft/cordova-ionic-phonegap-branch-deep-linking-attribution.git",

bobrosoft avatar May 18 '21 15:05 bobrosoft

Any chance of having the #671 merged for the next big update? This is currently blocking us from building our apps throught command line interface and enabling build automation?

seamlink-aalves avatar Nov 24 '21 16:11 seamlink-aalves