Swift Package's Resource Bundle not present in xcarchive (when framework using said package is archived)

This was really useful @andras . I've added this as a custom build step for my framework target that consumes Swift Packages with resources:

cp -RL "${BUILT_PRODUCTS_DIR}"/*.bundle "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"

This has 2 differences to yours:

  1. I've used the -L flag to cp. When doing an archive of the framework, the .bundles in BUILT_PRODUCTS_DIR are symbolic links instead of the actual bundles. This flag makes sure the destination of the link is copied, instead of the link itself.

  2. I've used UNLOCALIZED_RESOURCES_FOLDER_PATH as the destination path. For iOS (slim) frameworks, this is just the root of the framework. I think for macOS, it would be the Resources directory within the framework.

2 Likes