Use TARGET_BUILD_DIR for actool output #11762
Open
+5
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🌈
This PR changes the copy-resource script to use
$TARGET_BUILD_DIR
for the output location instead of$BUILT_PRODUCTS_DIR
for actool. This aligns with the way other tools such asibtool
andmomc
operate.Background
I am using a unique setup with CocoaPods for my app where I call
xcodebuild
directly on CocoaPods-generatedPods.xcodeproj
to prebuild Pods, by overriding some build settings such asSYMROOT
. The prebuilt pods are then integrated by adding build phases manually to the app target to runPods-<target>-frameworks.sh
and...-resources.sh
, with an overridden$BUILT_PRODUCTS_DIR
that points to the directory containing prebuilt pods.This setup has been working well with any pod, including ones containing XCFrameworks or resource bundles. However, I encountered a problem when I tried to add a pod that contains
xcassets
. The copy-frameworks script tries to runactool
to write the assets into the app binary, but it fails because${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
points to the prebuild directory instead of the app's build directory in my custom setup.Other tools in the copy-resources script use
${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
for their output (some excerpted below), and in the script it'smkdir -p
-ing only${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
. Based on these observations, I believe it is safe to changeactool
to match with other tools. Also, with the standard setup,$TARGET_BUILD_DIR
basically points the same path as$BUILT_PRODUCTS_DIR
AFAIK.Please let me know if any of my assumptions are incorrect. Thank you!
CocoaPods/lib/cocoapods/generator/copy_resources_script.rb
Lines 153 to 156 in 2a50177
CocoaPods/lib/cocoapods/generator/copy_resources_script.rb
Lines 167 to 170 in 2a50177
Edited: Tested locally by running
bundle exec rake spec:integration
with the updated spec CocoaPods/cocoapods-integration-specs#339.