Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CocoaPodsPlugin] Support first-party caching for incremental install #19

Merged
merged 3 commits into from Dec 2, 2021

Conversation

polac24
Copy link
Collaborator

@polac24 polac24 commented Nov 21, 2021

When Podfile has enabled incremental_installation, e.g.

install! 'cocoapods',
         :generate_multiple_pod_projects => true
         :incremental_installation => true

CocoaPods plugin was failing as pods_project is nil (see here). To fix that, this PR optimistically integrates XCRemoteCache to all targets in the Pods project (adding pre/postbuild scripts,CC, SWIFT_EXEC etc) on a first Pods project generation as the plugin will not have a chance to integrate/deintegrate it in consecutive invocations (cocoapods intentionally leaves Pods project intact to not generate it without need).
There will be just a tiny performance penalty if no artifacts are ready and XCRemoteCache is disabled - xcprebuild will quit early when a global .rc/arc.rc doesn't exist and fallback to the local compilation.

By the way, I revealed that generate_multiple_pod_projects mode is not fully supported (for now). Such setup changes a way the Pods project is configured and each pod has a separate .xcodeproj.
To support it, manually modifying each .xcodeproj to integrate XCRemoteCache (build steps build settings etc.), would be required, but so far CocoaPods Plugins interface does not provide a nice API for that (link).

Standard

Screenshot 2021-11-21 at 19 18 52

generate_multiple_pod_projects

Screenshot 2021-11-21 at 19 17 39

Fixes #18

# Pods projects can be generated only once (if incremental_installation is abled)
# Always integrate XCRemoteCache to all Pods, in case it will be needed later
unless installer_context.pods_project.nil?
# Attach XCRemoteCache to Pods targets
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is just moved from the "RC enabled" flow.

@polac24 polac24 force-pushed the 20211121-incremental-installation branch from f8f244f to 64bccae Compare December 2, 2021 07:56
@polac24 polac24 merged commit cbed913 into spotify:master Dec 2, 2021
@polac24 polac24 deleted the 20211121-incremental-installation branch December 2, 2021 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pod install fails when using generate_multiple_pod_projects and incremental_installation
2 participants