Make more classes immutable

parent e57559d7
...@@ -777,8 +777,7 @@ module Pod ...@@ -777,8 +777,7 @@ module Pod
resolver_specs_by_target = nil resolver_specs_by_target = nil
UI.section "Resolving dependencies of #{UI.path(podfile.defined_in_file) || 'Podfile'}" do UI.section "Resolving dependencies of #{UI.path(podfile.defined_in_file) || 'Podfile'}" do
resolver = Resolver.new(sandbox, podfile, locked_dependencies, sources) resolver = Resolver.new(sandbox, podfile, locked_dependencies, sources, specs_updated?)
resolver.specs_updated = specs_updated?
resolver_specs_by_target = resolver.resolve resolver_specs_by_target = resolver.resolve
resolver_specs_by_target.values.flatten(1).map(&:spec).each(&:validate_cocoapods_version) resolver_specs_by_target.values.flatten(1).map(&:spec).each(&:validate_cocoapods_version)
end end
...@@ -919,8 +918,7 @@ module Pod ...@@ -919,8 +918,7 @@ module Pod
project = Xcodeproj::Project.open(project_path) project = Xcodeproj::Project.open(project_path)
target_inspectors.each do |inspector| target_inspectors.each do |inspector|
target_definition = inspector.target_definition target_definition = inspector.target_definition
inspector.user_project = project results = inspector.compute_results(project)
results = inspector.compute_results
inspection_result[target_definition] = results inspection_result[target_definition] = results
UI.message('Using `ARCHS` setting to build architectures of ' \ UI.message('Using `ARCHS` setting to build architectures of ' \
"target `#{target_definition.label}`: (`#{results.archs.join('`, `')}`)") "target `#{target_definition.label}`: (`#{results.archs.join('`, `')}`)")
......
...@@ -12,6 +12,22 @@ module Pod ...@@ -12,6 +12,22 @@ module Pod
# subspecs are added instead of the name of the Pods. # subspecs are added instead of the name of the Pods.
# #
class SpecsState class SpecsState
# @return [Set<String>] the names of the pods that were added.
#
attr_reader :added
# @return [Set<String>] the names of the pods that were changed.
#
attr_reader :changed
# @return [Set<String>] the names of the pods that were deleted.
#
attr_reader :deleted
# @return [Set<String>] the names of the pods that were unchanged.
#
attr_reader :unchanged
# Initialize a new instance # Initialize a new instance
# #
# @param [Hash{Symbol=>String}] pods_by_state # @param [Hash{Symbol=>String}] pods_by_state
...@@ -38,22 +54,6 @@ module Pod ...@@ -38,22 +54,6 @@ module Pod
end end
end end
# @return [Set<String>] the names of the pods that were added.
#
attr_accessor :added
# @return [Set<String>] the names of the pods that were changed.
#
attr_accessor :changed
# @return [Set<String>] the names of the pods that were deleted.
#
attr_accessor :deleted
# @return [Set<String>] the names of the pods that were unchanged.
#
attr_accessor :unchanged
# Displays the state of each pod. # Displays the state of each pod.
# #
# @return [void] # @return [void]
......
...@@ -8,11 +8,12 @@ module Pod ...@@ -8,11 +8,12 @@ module Pod
# @return [TargetDefinition] the target definition to inspect # @return [TargetDefinition] the target definition to inspect
# #
attr_accessor :target_definition attr_reader :target_definition
# @return [Pathname] the root of the CocoaPods installation where the # @return [Pathname] the root of the CocoaPods installation where the
# Podfile is located # Podfile is located
attr_accessor :installation_root #
attr_reader :installation_root
# Initialize a new instance # Initialize a new instance
# #
...@@ -33,7 +34,7 @@ module Pod ...@@ -33,7 +34,7 @@ module Pod
# #
# @return [TargetInspectionResult] # @return [TargetInspectionResult]
# #
def compute_results def compute_results(user_project)
raise ArgumentError, 'Cannot compute results without a user project set' unless user_project raise ArgumentError, 'Cannot compute results without a user project set' unless user_project
targets = compute_targets(user_project) targets = compute_targets(user_project)
...@@ -81,11 +82,6 @@ module Pod ...@@ -81,11 +82,6 @@ module Pod
path path
end end
# @return [Xcodeproj::Project] the user's Xcode project, used for target
# inspection
#
attr_accessor :user_project
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
private private
...@@ -115,7 +111,7 @@ module Pod ...@@ -115,7 +111,7 @@ module Pod
[target] [target]
end end
# @param [Array<PBXNativeTarget] the user's targets of the project of # @param [Array<PBXNativeTarget] user_targets the user's targets of the project of
# #target_definition which needs to be integrated # #target_definition which needs to be integrated
# #
# @return [Hash{String=>Symbol}] A hash representing the user build # @return [Hash{String=>Symbol}] A hash representing the user build
...@@ -132,7 +128,7 @@ module Pod ...@@ -132,7 +128,7 @@ module Pod
end end
end end
# @param [Array<PBXNativeTarget] the user's targets of the project of # @param [Array<PBXNativeTarget] user_targets the user's targets of the project of
# #target_definition which needs to be integrated # #target_definition which needs to be integrated
# #
# @return [Platform] The platform of the user's targets # @return [Platform] The platform of the user's targets
...@@ -171,7 +167,7 @@ module Pod ...@@ -171,7 +167,7 @@ module Pod
# Computes the architectures relevant for the user's targets. # Computes the architectures relevant for the user's targets.
# #
# @param [Array<PBXNativeTarget] the user's targets of the project of # @param [Array<PBXNativeTarget] user_targets the user's targets of the project of
# #target_definition which needs to be integrated # #target_definition which needs to be integrated
# #
# @return [Array<String>] # @return [Array<String>]
......
...@@ -71,11 +71,11 @@ module Pod ...@@ -71,11 +71,11 @@ module Pod
# @return [Array<Source>] The list of the sources which will be used for # @return [Array<Source>] The list of the sources which will be used for
# the resolution. # the resolution.
# #
attr_accessor :sources attr_reader :sources
# @return [Bool] Whether the resolver has sources repositories up-to-date. # @return [Bool] Whether the resolver has sources repositories up-to-date.
# #
attr_accessor :specs_updated attr_reader :specs_updated
alias specs_updated? specs_updated alias specs_updated? specs_updated
# Init a new Resolver # Init a new Resolver
...@@ -84,14 +84,18 @@ module Pod ...@@ -84,14 +84,18 @@ module Pod
# @param [Podfile] podfile @see podfile # @param [Podfile] podfile @see podfile
# @param [Array<Dependency>] locked_dependencies @see locked_dependencies # @param [Array<Dependency>] locked_dependencies @see locked_dependencies
# @param [Array<Source>, Source] sources @see sources # @param [Array<Source>, Source] sources @see sources
# @param [Boolean] specs_updated @see specs_updated
# @param [PodfileDependencyCache] podfile_dependency_cache the podfile dependency cache to use
# within this Resolver.
# #
def initialize(sandbox, podfile, locked_dependencies, sources, def initialize(sandbox, podfile, locked_dependencies, sources, specs_updated,
podfile_dependency_cache: Installer::Analyzer::PodfileDependencyCache.from_podfile(podfile)) podfile_dependency_cache: Installer::Analyzer::PodfileDependencyCache.from_podfile(podfile))
@sandbox = sandbox @sandbox = sandbox
@podfile = podfile @podfile = podfile
@podfile_dependency_cache = podfile_dependency_cache
@locked_dependencies = locked_dependencies @locked_dependencies = locked_dependencies
@sources = Array(sources) @sources = Array(sources)
@specs_updated = specs_updated
@podfile_dependency_cache = podfile_dependency_cache
@platforms_by_dependency = Hash.new { |h, k| h[k] = [] } @platforms_by_dependency = Hash.new { |h, k| h[k] = [] }
@cached_sets = {} @cached_sets = {}
end end
...@@ -344,7 +348,7 @@ module Pod ...@@ -344,7 +348,7 @@ module Pod
# one Pod installation, so different version of the same Pods for # one Pod installation, so different version of the same Pods for
# target definitions are not allowed. # target definitions are not allowed.
# #
attr_accessor :cached_sets attr_reader :cached_sets
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
......
This diff is collapsed.
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