fermoya/cocoapods-catalyst-support

Issue copying bundles

Closed this issue · 8 comments

I've run into an issue where copying bundles to iOS for a pod excluded from catalyst isn't working. As far as I can tell test -f just fails for bundles. Could be something else I'm missing though.

Failing copying code for debug scheme:

failing test command

I implemented a workaround to have the resource copying code for Debug match the other schemes and just check if the $SDKRoot is not the macOS root. and that seems to work (at least for this project).

Workaround diff:

Screen Shot 2020-10-17 at 11 24 33 AM

Workaround result:

workaround result

I'm sure there is context for why that test is there that I'm missing so don't know that this workaround is a general fix, but figured I'd post it here since it might be helpful.

Hi @PeterBuerer , thanks for opening this issue, I’ll take a look at it. What’s the pod that’s giving you problems? Could you please share your podfile?

The test -f is just checking that that path exists and is a file in order to install it. This was done because I couldn’t get some of the bundle names if they were contained in binaries.

If you let me know the pod that gives you the issue, I can debug it and fix it. What you’re doing will uninstall all resources from all pods, including those resources that should be installed for macOS

Intercom is the pod I'm having issues with https://cocoapods.org/pods/Intercom.
Podfile:

source 'git@github.com:CocoaPods/specs.git'
inhibit_all_warnings!
platform :ios, '11.0'

load 'remove_ios_only_frameworks.rb'

target 'App' do
  use_frameworks!

  # Provides customer support chat in the app
  pod 'Intercom'

  target 'AppTests' do
    inherit! :search_paths
  end

end

def catalyst_unsupported_pods
  [
    'Intercom',
  ]
end

post_install do |installer|
  installer.configure_support_catalyst
end

I appreciate the help!

hey @PeterBuerer , I'm using your Podfile with the version of the script in this repository and I can Build and Archive for both Any iOS and Any macOS.

What's the error you get and for which device (iOS, iOS simulator, macOS)?

This snippet:

if [ test -f "\$${PODS_ROOT}/Intercom/Intercom/Intercom.framework/Versions/A/Resources/Intercom.bundle" ]; then 
  install_resource "${PODS_ROOT}/Intercom/Intercom/Intercom.framework/Versions/A/Resources/Intercom.bundle"
fi

checks that a file in the path ${PODS_ROOT}/Intercom/Intercom/Intercom.framework/Versions/A/Resources/Intercom.bundle exists and if so, it installs it. If it fails, then it means it doesn't exists and there's another issue behind it.

The version of Intercom is 8.0.0

@PeterBuerer , I think this might help you:
https://github.com/fermoya/CatalystPodSupport#select-build-configurations-to-process-for-store-upload
Which build configuration are you using? Check out what the value is for DEBUG macro in that configuration

I'm running the Debug configuration with DEBUG=1 in the preprocessor macros
DEBUG setup

The build log of the pods resources script in the Report Navigator has these errors that the test commands produce:
test command failing

I get the errors building for iOS, iOS simulator, and macOS.
Building completes successfully, but the bundles don't get copied

Hey @PeterBuerer , I just pushed some changes and it should be fine now, could you please check for me?

Apologies, as it built successfully I didn't notice that error. The condition was wrong, you can either do if test -f FILE or if [-f FILE]. I've used -d because bundles are directories after all.

Just to explain, you will probably not see this condition any more in your script. When Xcode 12 beta was released, I modified the script to skip installing frameworks and resources using SDKROOT and not ARCHS, so there are no issues with simulators now. That's the only reason I distinguished between debug configurations and release configurations, but this isn't needed any more.

The part where I test a resource before installing it will remain in remove_ios_only_frameworks.rb. This is necessary because some frameworks can depend on binaries that have bundles inside. I can't access this information directly from the Podspec to get their names and skip their installation the same way I'd do with other pods. This is why this needs to stay.

All in all, if you have any other pod that installs resources and this pod isn't excluded, you'll see this condition applied, which basically tests that this bundle exists and is available (it wasn't skipped in *-frameworsk.sh) before installing it. For this sample you shared, you shouldn't see it.

Thanks a million for opening this issue

That works! This is what that section of the resources script looks like for me now:
Screen Shot 2020-10-18 at 4 05 24 PM

Thanks for the explanation and for building out this tool, @fermoya!