cocoapods 0.39.0.beta.1 → 0.39.0.beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/lib/cocoapods/gem_version.rb +1 -1
  4. metadata +35 -63
  5. data/lib/cocoapods/command/cache/clean.rb +0 -90
  6. data/lib/cocoapods/command/cache/list.rb +0 -69
  7. data/lib/cocoapods/command/repo/add.rb +0 -53
  8. data/lib/cocoapods/command/repo/lint.rb +0 -77
  9. data/lib/cocoapods/command/repo/list.rb +0 -93
  10. data/lib/cocoapods/command/repo/push.rb +0 -223
  11. data/lib/cocoapods/command/repo/remove.rb +0 -36
  12. data/lib/cocoapods/command/repo/update.rb +0 -27
  13. data/lib/cocoapods/command/spec/cat.rb +0 -51
  14. data/lib/cocoapods/command/spec/create.rb +0 -279
  15. data/lib/cocoapods/command/spec/edit.rb +0 -94
  16. data/lib/cocoapods/command/spec/lint.rb +0 -119
  17. data/lib/cocoapods/command/spec/which.rb +0 -43
  18. data/lib/cocoapods/generator/acknowledgements/markdown.rb +0 -38
  19. data/lib/cocoapods/generator/acknowledgements/plist.rb +0 -80
  20. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +0 -260
  21. data/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb +0 -83
  22. data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +0 -213
  23. data/lib/cocoapods/installer/analyzer/analysis_result.rb +0 -46
  24. data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +0 -79
  25. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +0 -262
  26. data/lib/cocoapods/installer/analyzer/specs_state.rb +0 -76
  27. data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +0 -41
  28. data/lib/cocoapods/installer/analyzer/target_inspector.rb +0 -203
  29. data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +0 -186
  30. data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +0 -297
  31. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +0 -318
  32. data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +0 -173
@@ -1,76 +0,0 @@
1
- module Pod
2
- class Installer
3
- class Analyzer
4
- # This class represents the state of a collection of Pods.
5
- #
6
- # @note The names of the pods stored by this class are always the **root**
7
- # name of the specification.
8
- #
9
- # @note The motivation for this class is to ensure that the names of the
10
- # subspecs are added instead of the name of the Pods.
11
- #
12
- class SpecsState
13
- # Initialize a new instance
14
- #
15
- # @param [Hash{Symbol=>String}] pods_by_state
16
- # The name of the pods grouped by their state
17
- # (`:added`, `:removed`, `:changed` or `:unchanged`).
18
- #
19
- def initialize(pods_by_state = nil)
20
- @added = []
21
- @deleted = []
22
- @changed = []
23
- @unchanged = []
24
-
25
- if pods_by_state
26
- @added = pods_by_state[:added] || []
27
- @deleted = pods_by_state[:removed] || []
28
- @changed = pods_by_state[:changed] || []
29
- @unchanged = pods_by_state[:unchanged] || []
30
- end
31
- end
32
-
33
- # @return [Array<String>] the names of the pods that were added.
34
- #
35
- attr_accessor :added
36
-
37
- # @return [Array<String>] the names of the pods that were changed.
38
- #
39
- attr_accessor :changed
40
-
41
- # @return [Array<String>] the names of the pods that were deleted.
42
- #
43
- attr_accessor :deleted
44
-
45
- # @return [Array<String>] the names of the pods that were unchanged.
46
- #
47
- attr_accessor :unchanged
48
-
49
- # Displays the state of each pod.
50
- #
51
- # @return [void]
52
- #
53
- def print
54
- added .sort.each { |pod| UI.message('A'.green + " #{pod}", '', 2) }
55
- deleted .sort.each { |pod| UI.message('R'.red + " #{pod}", '', 2) }
56
- changed .sort.each { |pod| UI.message('M'.yellow + " #{pod}", '', 2) }
57
- unchanged.sort.each { |pod| UI.message('-' + " #{pod}", '', 2) }
58
- end
59
-
60
- # Adds the name of a Pod to the give state.
61
- #
62
- # @param [String] name
63
- # the name of the Pod.
64
- #
65
- # @param [Symbol] state
66
- # the state of the Pod.
67
- #
68
- # @return [void]
69
- #
70
- def add_name(name, state)
71
- send(state) << name
72
- end
73
- end
74
- end
75
- end
76
- end
@@ -1,41 +0,0 @@
1
- module Pod
2
- class Installer
3
- class Analyzer
4
- class TargetInspectionResult
5
- # @return [TargetDefinition] the target definition, whose project was
6
- # inspected
7
- #
8
- attr_accessor :target_definition
9
-
10
- # @return [Pathname] the path of the user project that the
11
- # #target_definition should integrate
12
- #
13
- attr_accessor :project_path
14
-
15
- # @return [Array<String>] the uuid of the user's targets
16
- #
17
- attr_accessor :project_target_uuids
18
-
19
- # @return [Hash{String=>Symbol}] A hash representing the user build
20
- # configurations where each key corresponds to the name of a
21
- # configuration and its value to its type (`:debug` or
22
- # `:release`).
23
- #
24
- attr_accessor :build_configurations
25
-
26
- # @return [Platform] the platform of the user targets
27
- #
28
- attr_accessor :platform
29
-
30
- # @return [Array<String>] the architectures used by user's targets
31
- #
32
- attr_accessor :archs
33
-
34
- # @return [Bool] whether frameworks are recommended for the integration
35
- # due to the presence of Swift source in the user's targets
36
- #
37
- attr_accessor :recommends_frameworks
38
- end
39
- end
40
- end
41
- end
@@ -1,203 +0,0 @@
1
- module Pod
2
- class Installer
3
- class Analyzer
4
- class TargetInspector
5
- # @return [TargetDefinition] the target definition to inspect
6
- #
7
- attr_accessor :target_definition
8
-
9
- # @return [Pathname] the root of the CocoaPods installation where the
10
- # Podfile is located
11
- attr_accessor :installation_root
12
-
13
- # Initialize a new instance
14
- #
15
- # @param [TargetDefinition] target_definition
16
- # @see #target_definition
17
- #
18
- # @param [Pathname] installation_root
19
- # @see #installation_root
20
- #
21
- def initialize(target_definition, installation_root)
22
- @target_definition = target_definition
23
- @installation_root = installation_root
24
- end
25
-
26
- # Inspect the #target_definition
27
- #
28
- # @return [TargetInspectionResult]
29
- #
30
- def compute_results
31
- project_path = compute_project_path
32
- user_project = Xcodeproj::Project.open(project_path)
33
- targets = compute_targets(user_project)
34
-
35
- result = TargetInspectionResult.new
36
- result.target_definition = target_definition
37
- result.project_path = project_path
38
- result.project_target_uuids = targets.map(&:uuid)
39
- result.build_configurations = compute_build_configurations(targets)
40
- result.platform = compute_platform(targets)
41
- result.archs = compute_archs(targets)
42
- result
43
- end
44
-
45
- #-----------------------------------------------------------------------#
46
-
47
- private
48
-
49
- # Returns the path of the user project that the #target_definition
50
- # should integrate.
51
- #
52
- # @raise If the project is implicit and there are multiple projects.
53
- #
54
- # @raise If the path doesn't exits.
55
- #
56
- # @return [Pathname] the path of the user project.
57
- #
58
- def compute_project_path
59
- if target_definition.user_project_path
60
- path = installation_root + target_definition.user_project_path
61
- path = "#{path}.xcodeproj" unless File.extname(path) == '.xcodeproj'
62
- path = Pathname.new(path)
63
- unless path.exist?
64
- raise Informative, 'Unable to find the Xcode project ' \
65
- "`#{path}` for the target `#{target_definition.label}`."
66
- end
67
- else
68
- xcodeprojs = installation_root.children.select { |e| e.fnmatch('*.xcodeproj') }
69
- if xcodeprojs.size == 1
70
- path = xcodeprojs.first
71
- else
72
- raise Informative, 'Could not automatically select an Xcode project. ' \
73
- "Specify one in your Podfile like so:\n\n" \
74
- " xcodeproj 'path/to/Project.xcodeproj'\n"
75
- end
76
- end
77
- path
78
- end
79
-
80
- # Returns a list of the targets from the project of #target_definition
81
- # that needs to be integrated.
82
- #
83
- # @note The method first looks if there is a target specified with
84
- # the `link_with` option of the {TargetDefinition}. Otherwise
85
- # it looks for the target that has the same name of the target
86
- # definition. Finally if no target was found the first
87
- # encountered target is returned (it is assumed to be the one
88
- # to integrate in simple projects).
89
- #
90
- # @param [Xcodeproj::Project] user_project
91
- # the user project
92
- #
93
- # @return [Array<PBXNativeTarget>]
94
- #
95
- def compute_targets(user_project)
96
- native_targets = user_project.native_targets
97
- if link_with = target_definition.link_with
98
- targets = native_targets.select { |t| link_with.include?(t.name) }
99
- raise Informative, "Unable to find the targets named #{link_with.map { |x| "`#{x}`" }.to_sentence}" \
100
- "to link with target definition `#{target_definition.name}`" if targets.empty?
101
- elsif target_definition.link_with_first_target?
102
- targets = [native_targets.first].compact
103
- raise Informative, 'Unable to find a target' if targets.empty?
104
- else
105
- target = native_targets.find { |t| t.name == target_definition.name.to_s }
106
- targets = [target].compact
107
- raise Informative, "Unable to find a target named `#{target_definition.name}`" if targets.empty?
108
- end
109
- targets
110
- end
111
-
112
- # @param [Array<PBXNativeTarget] the user's targets of the project of
113
- # #target_definition which needs to be integrated
114
- #
115
- # @return [Hash{String=>Symbol}] A hash representing the user build
116
- # configurations where each key corresponds to the name of a
117
- # configuration and its value to its type (`:debug` or `:release`).
118
- #
119
- def compute_build_configurations(user_targets)
120
- if user_targets
121
- user_targets.flat_map { |t| t.build_configurations.map(&:name) }.each_with_object({}) do |name, hash|
122
- hash[name] = name == 'Debug' ? :debug : :release
123
- end.merge(target_definition.build_configurations || {})
124
- else
125
- target_definition.build_configurations || {}
126
- end
127
- end
128
-
129
- # @param [Array<PBXNativeTarget] the user's targets of the project of
130
- # #target_definition which needs to be integrated
131
- #
132
- # @return [Platform] The platform of the user's targets
133
- #
134
- # @note This resolves to the lowest deployment target across the user
135
- # targets.
136
- #
137
- # @todo Is assigning the platform to the target definition the best way
138
- # to go?
139
- #
140
- def compute_platform(user_targets)
141
- return target_definition.platform if target_definition.platform
142
- name = nil
143
- deployment_target = nil
144
-
145
- user_targets.each do |target|
146
- name ||= target.platform_name
147
- raise Informative, 'Targets with different platforms' unless name == target.platform_name
148
- if !deployment_target || deployment_target > Version.new(target.deployment_target)
149
- deployment_target = Version.new(target.deployment_target)
150
- end
151
- end
152
-
153
- target_definition.set_platform(name, deployment_target)
154
- Platform.new(name, deployment_target)
155
- end
156
-
157
- # Computes the architectures relevant for the user's targets.
158
- #
159
- # @param [Array<PBXNativeTarget] the user's targets of the project of
160
- # #target_definition which needs to be integrated
161
- #
162
- # @return [Array<String>]
163
- #
164
- def compute_archs(user_targets)
165
- user_targets.flat_map do |target|
166
- Array(target.common_resolved_build_setting('ARCHS'))
167
- end.compact.uniq.sort
168
- end
169
-
170
- # Checks if any of the targets for the {TargetDefinition} computed before
171
- # by #compute_user_project_targets is recommended to be build as a framework
172
- # due the presence of Swift source code in any of the source build phases.
173
- #
174
- # @param [TargetDefinition] target_definition
175
- # the target definition
176
- #
177
- # @param [Array<PBXNativeTarget>] native_targets
178
- # the targets which are checked for presence of Swift source code
179
- #
180
- # @return [Boolean] Whether the user project targets to integrate into
181
- # uses Swift
182
- #
183
- def compute_recommends_frameworks(target_definition, native_targets)
184
- file_predicate = nil
185
- file_predicate = proc do |file_ref|
186
- if file_ref.respond_to?(:last_known_file_type)
187
- file_ref.last_known_file_type == 'sourcecode.swift'
188
- elsif file_ref.respond_to?(:files)
189
- file_ref.files.any?(&file_predicate)
190
- else
191
- false
192
- end
193
- end
194
- target_definition.platform.supports_dynamic_frameworks? || native_targets.any? do |target|
195
- target.source_build_phase.files.any? do |build_file|
196
- file_predicate.call(build_file.file_ref)
197
- end
198
- end
199
- end
200
- end
201
- end
202
- end
203
- end
@@ -1,186 +0,0 @@
1
- module Pod
2
- class Installer
3
- # Creates the targets which aggregate the Pods libraries in the Pods
4
- # project and the relative support files.
5
- #
6
- class AggregateTargetInstaller < TargetInstaller
7
- # Creates the target in the Pods project and the relative support files.
8
- #
9
- # @return [void]
10
- #
11
- def install!
12
- UI.message "- Installing target `#{target.name}` #{target.platform}" do
13
- add_target
14
- create_support_files_dir
15
- create_support_files_group
16
- create_xcconfig_file
17
- if target.requires_frameworks?
18
- create_info_plist_file
19
- create_module_map
20
- create_umbrella_header
21
- end
22
- create_embed_frameworks_script
23
- create_bridge_support_file
24
- create_copy_resources_script
25
- create_acknowledgements
26
- create_dummy_source
27
- end
28
- end
29
-
30
- #-----------------------------------------------------------------------#
31
-
32
- private
33
-
34
- # @return [TargetDefinition] the target definition of the library.
35
- #
36
- def target_definition
37
- target.target_definition
38
- end
39
-
40
- # Ensure that vendored static frameworks and libraries are not linked
41
- # twice to the aggregate target, which shares the xcconfig of the user
42
- # target.
43
- #
44
- def custom_build_settings
45
- settings = {
46
- 'OTHER_LDFLAGS' => '',
47
- 'OTHER_LIBTOOLFLAGS' => '',
48
- 'PODS_ROOT' => '$(SRCROOT)',
49
- 'SKIP_INSTALL' => 'YES',
50
- }
51
- super.merge(settings)
52
- end
53
-
54
- # Creates the group that holds the references to the support files
55
- # generated by this installer.
56
- #
57
- # @return [void]
58
- #
59
- def create_support_files_group
60
- parent = project.support_files_group
61
- name = target.name
62
- dir = target.support_files_dir
63
- @support_files_group = parent.new_group(name, dir)
64
- end
65
-
66
- # Generates the contents of the xcconfig file and saves it to disk.
67
- #
68
- # @return [void]
69
- #
70
- def create_xcconfig_file
71
- native_target.build_configurations.each do |configuration|
72
- path = target.xcconfig_path(configuration.name)
73
- gen = Generator::XCConfig::AggregateXCConfig.new(target, configuration.name)
74
- gen.save_as(path)
75
- target.xcconfigs[configuration.name] = gen.xcconfig
76
- xcconfig_file_ref = add_file_to_support_group(path)
77
- configuration.base_configuration_reference = xcconfig_file_ref
78
- end
79
- end
80
-
81
- # Generates the bridge support metadata if requested by the {Podfile}.
82
- #
83
- # @note The bridge support metadata is added to the resources of the
84
- # target because it is needed for environments interpreted at
85
- # runtime.
86
- #
87
- # @return [void]
88
- #
89
- def create_bridge_support_file
90
- if target.podfile.generate_bridge_support?
91
- path = target.bridge_support_path
92
- headers = native_target.headers_build_phase.files.map { |bf| sandbox.root + bf.file_ref.path }
93
- generator = Generator::BridgeSupport.new(headers)
94
- generator.save_as(path)
95
- add_file_to_support_group(path)
96
- @bridge_support_file = path.relative_path_from(sandbox.root)
97
- end
98
- end
99
-
100
- # Uniqued Resources grouped by config
101
- #
102
- # @return [Hash{ Symbol => Array<Pathname> }]
103
- #
104
- def resources_by_config
105
- library_targets = target.pod_targets.reject do |pod_target|
106
- pod_target.should_build? && pod_target.requires_frameworks?
107
- end
108
- resources_by_config = {}
109
- target.user_build_configurations.keys.each do |config|
110
- file_accessors = library_targets.select { |t| t.include_in_build_config?(target_definition, config) }.flat_map(&:file_accessors)
111
- resource_paths = file_accessors.flat_map { |accessor| accessor.resources.flat_map { |res| res.relative_path_from(project.path.dirname) } }
112
- resource_bundles = file_accessors.flat_map { |accessor| accessor.resource_bundles.keys.map { |name| "${BUILT_PRODUCTS_DIR}/#{name.shellescape}.bundle" } }
113
- resources_by_config[config] = (resource_paths + resource_bundles).uniq
114
- resources_by_config[config] << bridge_support_file if bridge_support_file
115
- end
116
- resources_by_config
117
- end
118
-
119
- # Creates a script that copies the resources to the bundle of the client
120
- # target.
121
- #
122
- # @note The bridge support file needs to be created before the prefix
123
- # header, otherwise it will not be added to the resources script.
124
- #
125
- # @return [void]
126
- #
127
- def create_copy_resources_script
128
- path = target.copy_resources_script_path
129
- generator = Generator::CopyResourcesScript.new(resources_by_config, target.platform)
130
- generator.save_as(path)
131
- add_file_to_support_group(path)
132
- end
133
-
134
- # Creates a script that embeds the frameworks to the bundle of the client
135
- # target.
136
- #
137
- # @note We can't use Xcode default copy bundle resource phase, because
138
- # we need to ensure that we only copy the resources, which are
139
- # relevant for the current build configuration.
140
- #
141
- # @return [void]
142
- #
143
- def create_embed_frameworks_script
144
- path = target.embed_frameworks_script_path
145
- frameworks_by_config = {}
146
- target.user_build_configurations.keys.each do |config|
147
- relevant_pod_targets = target.pod_targets.select do |pod_target|
148
- pod_target.include_in_build_config?(target_definition, config)
149
- end
150
- frameworks_by_config[config] = relevant_pod_targets.flat_map do |pod_target|
151
- frameworks = pod_target.file_accessors.flat_map(&:vendored_dynamic_artifacts).map { |fw| "${PODS_ROOT}/#{fw.relative_path_from(sandbox.root)}" }
152
- frameworks << "#{target_definition.label}/#{pod_target.product_name}" if pod_target.should_build? && pod_target.requires_frameworks?
153
- frameworks
154
- end
155
- end
156
- generator = Generator::EmbedFrameworksScript.new(frameworks_by_config)
157
- generator.save_as(path)
158
- add_file_to_support_group(path)
159
- end
160
-
161
- # Generates the acknowledgement files (markdown and plist) for the target.
162
- #
163
- # @return [void]
164
- #
165
- def create_acknowledgements
166
- basepath = target.acknowledgements_basepath
167
- Generator::Acknowledgements.generators.each do |generator_class|
168
- path = generator_class.path_from_basepath(basepath)
169
- file_accessors = target.pod_targets.map(&:file_accessors).flatten
170
- generator = generator_class.new(file_accessors)
171
- generator.save_as(path)
172
- add_file_to_support_group(path)
173
- end
174
- end
175
-
176
- # @return [Pathname] the path of the bridge support file relative to the
177
- # sandbox.
178
- #
179
- # @return [Nil] if no bridge support file was generated.
180
- #
181
- attr_reader :bridge_support_file
182
-
183
- #-----------------------------------------------------------------------#
184
- end
185
- end
186
- end