8000 Creates a stage sandbox and sandbox dir cleaner step. by sebastianv1 · Pull Request #8339 · CocoaPods/CocoaPods · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Creates a stage sandbox and sandbox dir cleaner step. #8339

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

Merged
merged 1 commit into from
Dec 18, 2018

Conversation

sebastianv1
Copy link
Collaborator
@sebastianv1 sebastianv1 commented Dec 7, 2018

Inside stage sandbox we now add all the respective header search paths to the sandbox HeaderStore and each pod target's HeaderStore. This sets up the work for incremental pod installation because we would like to analyze each pod target's build settings to determine if it has changed; however, we previously only added the header search paths during installation which is too late in the pipline.

Instead of removing the entire Headers and Target Support Files directory in the Sandbox for every installation, we now only remove the headers and target support files that are stale.

integration specs: CocoaPods/cocoapods-integration-specs#197

@CocoaPodsBarista
Copy link
1 Warning
⚠️ Please include a CHANGELOG entry to credit yourself!
You can find it at CHANGELOG.md.

Here's an example of your CHANGELOG entry:

* Creates a stage sandbox and sandbox dir cleaner step.  
  [sebastianv1](https://github.com/sebastianv1)
  [#issue_number](https://github.com/CocoaPods/CocoaPods/issues/issue_number)

note: There are two invisible spaces after the entry's text.

Generated by 🚫 Danger

#
def stage_sandbox(sandbox, pod_targets, aggregate_targets)
SandboxHeaderPathsInstaller.new(sandbox, pod_targets).install!
clean_sandbox(pod_targets, aggregate_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.

I'm thinking this should go somewhere else since it will change with the incremental installation since it will go after cache analysis.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And SandboxHeaderPathsInstaller needs to go before analysis such that all the header search paths are set up correctly for the build settings

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ended up redoing the generate_pods_project function. Let me know what y'all think

10000
@sebastianv1 sebastianv1 force-pushed the sebastianv1/fixup-sandbox branch 2 times, most recently from 1e33279 to 7b77c7d Compare December 7, 2018 18:09
@sebastianv1 sebastianv1 force-pushed the sebastianv1/fixup-sandbox branch 2 times, most recently from a69d7cb to 2f3e199 Compare December 7, 2018 18:35
@sebastianv1 sebastianv1 force-pushed the sebastianv1/fixup-sandbox branch from 2f3e199 to f2fa5ec Compare December 10, 2018 20:44
mappings[sub_dir] << header
end
mappings
end
Copy link
Member

Choose a reason for hiding this comment

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

not that this is an issue, but note that this will now be part of the public API of PodTarget - does it need to be? it feels like something the sandbox should handle

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a good point. I'm open to hearing what others think about moving it into the sandbox. I don't really have a strong preference about where it lives, I just moved it here since everywhere we needed the header mappings we were already iterating over the pod targets, so it made sense in my head at the time to just put it in here.

Copy link
Contributor

Choose a reason for hiding this comment

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

This might explode a bit but passing file_accessor does not make sense as the pod_target is already a holder and owner of file_accessors.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So header_mappings won't actually be a part of the public API of PodTarget since it's under private. It takes in a file_accessor since it's more of a helper used by the public functions public_header_mappings_by_file_accessor and header_mappings_by_file_accessor

@sebastianv1 sebastianv1 8000 force-pushed the sebastianv1/fixup-sandbox branch from f2fa5ec to 0a5ccd5 Compare December 11, 2018 18:16
@sebastianv1 sebastianv1 force-pushed the sebastianv1/fixup-sandbox branch from 0a5ccd5 to f939393 Compare December 12, 2018 04:02
@dnkoutso dnkoutso added this to the 1.7.0 milestone Dec 12, 2018
attr_reader :sandbox

# @return [Array<PodTarget>]
# The list of all pod targets that will be installed into the Sandbox.
Copy link
Contributor

Choose a reason for hiding this comment

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

is this correct or copy pasta?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct in that I wrote it :) The list of pod targets that will be installed are used to compute which folders need to be deleted.

end

aggregate_targets.each do |aggregate_target|
target_support_dirs.delete(aggregate_target.support_files_dir)
FileUtils.rm_rf(aggregate_target.support_files_dir)
Copy link
Member

Choose a reason for hiding this comment

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

this is actually a pretty big change in functionality here -- before, we'd only rm_rf the support_files_dirs for pods that aren't being installed, and now you always remove them. I don't think we want that

Copy link
Collaborator Author
@sebastianv1 sebastianv1 Dec 14, 2018

Choose a reason for hiding this comment

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

Can remove. Any reason why we don't want that if the files are regenerated anyways? This has the possibility of leaving behind stale files. Say we change a Pod to use modular_headers and then revert back. We'd then leave behind a stale modulemap file.

Copy link
Member

Choose a reason for hiding this comment

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

Because it means we have to rewrite the files. Right now, we only actually write to disk if there's a change

@@ -318,22 +339,17 @@ def validate_build_configurations
# regenerated from scratch and any file which might not be
# overwritten.
#
# @todo [#247] Clean the headers of only the pods to install.
#
def clean_sandbox
Copy link
Member

Choose a reason for hiding this comment

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

all the old functionality now seems to be replicated in SandboxDirCleaner#clean!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

F3AB

Sets up incremental since clean_sandbox will only take in a subset of all pod targets to clean.

@sebastianv1 sebastianv1 force-pushed the sebastianv1/fixup-sandbox branch from f939393 to 6830327 Compare December 14, 2018 19:50
The `stage_sandbox` step during installation adds all the respective header search paths to sandbox `HeaderStore` and each pod target's `HeaderStore`. These were previously only added during the `link_headers` step during project generation, and moving them out into an earlier step before generation helps set up the work for incremental pod installation because we would like to analyze each pod target's build settings (and header search paths) before project generation.

The `SandboxDirCleaner` object also sets up incremental pod installation because we don't want to delete the entire `Pods/Headers` and `Pods/Target Support Files` directories for every installation.
@sebastianv1 sebastianv1 force-pushed the sebastianv1/fixup-sandbox branch from 6830327 to 3eaff05 Compare December 18, 2018 00:37
@sebastianv1 sebastianv1 merged commit 632a8ca into CocoaPods:master Dec 18, 2018
@dnkoutso dnkoutso deleted the sebastianv1/fixup-sandbox branch December 18, 2018 01:31
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.

5 participants
0