Commit ada88864 authored by Fabio Pelosin's avatar Fabio Pelosin

[WIP][UserProjectIntegrator] Write the workspace only if needed

parent 839286a3
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
- Add support for `prefix_header_contents` in subspecs - Add support for `prefix_header_contents` in subspecs
- Add Rake FileList warning. - Add Rake FileList warning.
- Release: Enable CocoaPods Core-warnings - Release: Enable CocoaPods Core-warnings
- Subspecs now do not inherit the files patterns from the parent spec.
- The workspace is written only if needed greatly reducing the occasions in
which Xcode asks to revert.
###### Specification DSL ###### Specification DSL
......
...@@ -69,21 +69,32 @@ module Pod ...@@ -69,21 +69,32 @@ module Pod
private private
# Creates and saved the workspace containing the Pods project and the # Creates and saved the workspace containing the Pods project and the
# user projects. # user projects, if needed.
#
# @note If the workspace alreayd containts the projects it is not saved
# to avoid Xcode from diplatying the revert dialog: `Do you want to
# keep the Xcode version or revert to the version on disk?`
# #
# @return [void] # @return [void]
# #
def create_workspace def create_workspace
workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path) projpaths = [sandbox.project_path, *user_project_paths].map do |path|
[sandbox.project_path, *user_project_paths].each do |project_path| path.relative_path_from(workspace_path.dirname).to_s
path = project_path.relative_path_from(workspace_path.dirname).to_s end.uniq
workspace << path unless workspace.include?(path)
if workspace_path.exist?
current_workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
if current_workspace.projpaths != projpaths
workspace = Xcodeproj::Workspace.new(*projpaths)
workspace.save_as(workspace_path)
end end
unless workspace_path.exist?
else
UI.notice "From now on use `#{workspace_path.basename}'." UI.notice "From now on use `#{workspace_path.basename}'."
end workspace = Xcodeproj::Workspace.new(*projpaths)
workspace.save_as(workspace_path) workspace.save_as(workspace_path)
end end
end
# Integrates the targets of the user projects with the libraries # Integrates the targets of the user projects with the libraries
# generated from the {Podfile}. # generated from the {Podfile}.
......
...@@ -71,6 +71,10 @@ module Pod ...@@ -71,6 +71,10 @@ module Pod
@integrator.integrate! @integrator.integrate!
UI.warnings.should.include?('The Podfile does not contain any dependency') UI.warnings.should.include?('The Podfile does not contain any dependency')
end end
xit "It writes the workspace only if needed" do
end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment