Unverified Commit 212a5d3c authored by Dimitris Koutsogiorgas's avatar Dimitris Koutsogiorgas Committed by GitHub

Merge pull request #7490 from dnkoutso/immutability_wins_2

Make more classes immutable
parents e0bac737 a2fb7a0a
......@@ -777,8 +777,7 @@ module Pod
resolver_specs_by_target = nil
UI.section "Resolving dependencies of #{UI.path(podfile.defined_in_file) || 'Podfile'}" do
resolver = Resolver.new(sandbox, podfile, locked_dependencies, sources)
resolver.specs_updated = specs_updated?
resolver = Resolver.new(sandbox, podfile, locked_dependencies, sources, specs_updated?)
resolver_specs_by_target = resolver.resolve
resolver_specs_by_target.values.flatten(1).map(&:spec).each(&:validate_cocoapods_version)
end
......@@ -919,8 +918,7 @@ module Pod
project = Xcodeproj::Project.open(project_path)
target_inspectors.each do |inspector|
target_definition = inspector.target_definition
inspector.user_project = project
results = inspector.compute_results
results = inspector.compute_results(project)
inspection_result[target_definition] = results
UI.message('Using `ARCHS` setting to build architectures of ' \
"target `#{target_definition.label}`: (`#{results.archs.join('`, `')}`)")
......
......@@ -12,6 +12,22 @@ module Pod
# subspecs are added instead of the name of the Pods.
#
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
#
# @param [Hash{Symbol=>String}] pods_by_state
......@@ -38,22 +54,6 @@ module Pod
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.
#
# @return [void]
......
......@@ -8,11 +8,12 @@ module Pod
# @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
# Podfile is located
attr_accessor :installation_root
#
attr_reader :installation_root
# Initialize a new instance
#
......@@ -33,7 +34,7 @@ module Pod
#
# @return [TargetInspectionResult]
#
def compute_results
def compute_results(user_project)
raise ArgumentError, 'Cannot compute results without a user project set' unless user_project
targets = compute_targets(user_project)
......@@ -81,11 +82,6 @@ module Pod
path
end
# @return [Xcodeproj::Project] the user's Xcode project, used for target
# inspection
#
attr_accessor :user_project
#-----------------------------------------------------------------------#
private
......@@ -115,7 +111,7 @@ module Pod
[target]
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
#
# @return [Hash{String=>Symbol}] A hash representing the user build
......@@ -132,7 +128,7 @@ module Pod
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
#
# @return [Platform] The platform of the user's targets
......@@ -171,7 +167,7 @@ module Pod
# 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
#
# @return [Array<String>]
......
......@@ -71,11 +71,11 @@ module Pod
# @return [Array<Source>] The list of the sources which will be used for
# the resolution.
#
attr_accessor :sources
attr_reader :sources
# @return [Bool] Whether the resolver has sources repositories up-to-date.
#
attr_accessor :specs_updated
attr_reader :specs_updated
alias specs_updated? specs_updated
# Init a new Resolver
......@@ -84,14 +84,18 @@ module Pod
# @param [Podfile] podfile @see podfile
# @param [Array<Dependency>] locked_dependencies @see locked_dependencies
# @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))
@sandbox = sandbox
@podfile = podfile
@podfile_dependency_cache = podfile_dependency_cache
@locked_dependencies = locked_dependencies
@sources = Array(sources)
@specs_updated = specs_updated
@podfile_dependency_cache = podfile_dependency_cache
@platforms_by_dependency = Hash.new { |h, k| h[k] = [] }
@cached_sets = {}
end
......@@ -344,7 +348,7 @@ module Pod
# one Pod installation, so different version of the same Pods for
# 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