cocoapods-square-stable 0.19.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +1296 -0
- data/LICENSE +20 -0
- data/README.md +94 -0
- data/bin/pod +16 -0
- data/bin/sandbox-pod +120 -0
- data/lib/cocoapods.rb +77 -0
- data/lib/cocoapods/command.rb +116 -0
- data/lib/cocoapods/command/help.rb +23 -0
- data/lib/cocoapods/command/inter_process_communication.rb +178 -0
- data/lib/cocoapods/command/list.rb +77 -0
- data/lib/cocoapods/command/outdated.rb +56 -0
- data/lib/cocoapods/command/podfile_info.rb +91 -0
- data/lib/cocoapods/command/project.rb +88 -0
- data/lib/cocoapods/command/push.rb +172 -0
- data/lib/cocoapods/command/repo.rb +145 -0
- data/lib/cocoapods/command/search.rb +61 -0
- data/lib/cocoapods/command/setup.rb +134 -0
- data/lib/cocoapods/command/spec.rb +590 -0
- data/lib/cocoapods/config.rb +231 -0
- data/lib/cocoapods/downloader.rb +59 -0
- data/lib/cocoapods/executable.rb +118 -0
- data/lib/cocoapods/external_sources.rb +363 -0
- data/lib/cocoapods/file_list.rb +36 -0
- data/lib/cocoapods/gem_version.rb +7 -0
- data/lib/cocoapods/generator/acknowledgements.rb +107 -0
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +40 -0
- data/lib/cocoapods/generator/acknowledgements/plist.rb +64 -0
- data/lib/cocoapods/generator/bridge_support.rb +22 -0
- data/lib/cocoapods/generator/copy_resources_script.rb +54 -0
- data/lib/cocoapods/generator/dummy_source.rb +22 -0
- data/lib/cocoapods/generator/prefix_header.rb +82 -0
- data/lib/cocoapods/generator/target_environment_header.rb +86 -0
- data/lib/cocoapods/generator/xcconfig.rb +185 -0
- data/lib/cocoapods/hooks/installer_representation.rb +134 -0
- data/lib/cocoapods/hooks/library_representation.rb +94 -0
- data/lib/cocoapods/hooks/pod_representation.rb +74 -0
- data/lib/cocoapods/installer.rb +571 -0
- data/lib/cocoapods/installer/analyzer.rb +559 -0
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +253 -0
- data/lib/cocoapods/installer/file_references_installer.rb +179 -0
- data/lib/cocoapods/installer/pod_source_installer.rb +248 -0
- data/lib/cocoapods/installer/target_installer.rb +379 -0
- data/lib/cocoapods/installer/user_project_integrator.rb +180 -0
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +224 -0
- data/lib/cocoapods/library.rb +202 -0
- data/lib/cocoapods/open_uri.rb +24 -0
- data/lib/cocoapods/project.rb +209 -0
- data/lib/cocoapods/resolver.rb +212 -0
- data/lib/cocoapods/sandbox.rb +343 -0
- data/lib/cocoapods/sandbox/file_accessor.rb +217 -0
- data/lib/cocoapods/sandbox/headers_store.rb +96 -0
- data/lib/cocoapods/sandbox/path_list.rb +208 -0
- data/lib/cocoapods/sources_manager.rb +276 -0
- data/lib/cocoapods/user_interface.rb +304 -0
- data/lib/cocoapods/user_interface/error_report.rb +101 -0
- data/lib/cocoapods/validator.rb +350 -0
- metadata +238 -0
@@ -0,0 +1,185 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
|
4
|
+
# Generates an xcconfig file for each target of the Pods project. The
|
5
|
+
# configuration file should be used by the user target as well.
|
6
|
+
#
|
7
|
+
class XCConfig
|
8
|
+
|
9
|
+
# @return [Sandbox] the sandbox where the Pods project is installed.
|
10
|
+
#
|
11
|
+
attr_reader :sandbox
|
12
|
+
|
13
|
+
# @return [Array<Specification::Consumer>] the consumers for the
|
14
|
+
# specifications of the library which needs the xcconfig.
|
15
|
+
#
|
16
|
+
attr_reader :spec_consumers
|
17
|
+
|
18
|
+
# @return [String] the relative path of the Pods root respect the user
|
19
|
+
# project that should be integrated by this library.
|
20
|
+
#
|
21
|
+
attr_reader :relative_pods_root
|
22
|
+
|
23
|
+
# @param [Sandbox] sandbox @see sandbox
|
24
|
+
# @param [Array<LocalPod>] pods @see pods
|
25
|
+
# @param [String] relative_pods_root @see relative_pods_root
|
26
|
+
#
|
27
|
+
def initialize(sandbox, spec_consumers, relative_pods_root)
|
28
|
+
@sandbox = sandbox
|
29
|
+
@spec_consumers = spec_consumers
|
30
|
+
@relative_pods_root = relative_pods_root
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [Bool] whether the Podfile specifies to add the `-fobjc-arc`
|
34
|
+
# flag for compatibility.
|
35
|
+
#
|
36
|
+
attr_accessor :set_arc_compatibility_flag
|
37
|
+
|
38
|
+
#-----------------------------------------------------------------------#
|
39
|
+
|
40
|
+
# Generates the xcconfig for the library.
|
41
|
+
#
|
42
|
+
# @return [Xcodeproj::Config]
|
43
|
+
#
|
44
|
+
# @note The value `PODS_HEADERS_SEARCH_PATHS` is used to store the headers
|
45
|
+
# so xcconfig can reference the variable.
|
46
|
+
#
|
47
|
+
def generate
|
48
|
+
ld_flags = '-ObjC'
|
49
|
+
if set_arc_compatibility_flag && spec_consumers.any? { |consumer| consumer.requires_arc }
|
50
|
+
ld_flags << ' -fobjc-arc'
|
51
|
+
end
|
52
|
+
|
53
|
+
@xcconfig = Xcodeproj::Config.new({
|
54
|
+
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
|
55
|
+
'OTHER_LDFLAGS' => ld_flags,
|
56
|
+
'HEADER_SEARCH_PATHS' => '${PODS_HEADERS_SEARCH_PATHS}',
|
57
|
+
'PODS_ROOT' => relative_pods_root,
|
58
|
+
'PODS_HEADERS_SEARCH_PATHS' => '${PODS_PUBLIC_HEADERS_SEARCH_PATHS}',
|
59
|
+
'PODS_BUILD_HEADERS_SEARCH_PATHS' => quote(sandbox.build_headers.search_paths),
|
60
|
+
'PODS_PUBLIC_HEADERS_SEARCH_PATHS' => quote(sandbox.public_headers.search_paths),
|
61
|
+
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1'
|
62
|
+
})
|
63
|
+
|
64
|
+
spec_consumers.each do |consumer|
|
65
|
+
add_spec_build_settings_to_xcconfig(consumer, @xcconfig)
|
66
|
+
end
|
67
|
+
|
68
|
+
@xcconfig
|
69
|
+
end
|
70
|
+
|
71
|
+
# @return [Xcodeproj::Config] The generated xcconfig.
|
72
|
+
#
|
73
|
+
attr_reader :xcconfig
|
74
|
+
|
75
|
+
# @return [Hash] The settings of the xcconfig that the Pods project
|
76
|
+
# needs to override.
|
77
|
+
#
|
78
|
+
def self.pods_project_settings
|
79
|
+
{ 'PODS_ROOT' => '${SRCROOT}',
|
80
|
+
'PODS_HEADERS_SEARCH_PATHS' => '${PODS_BUILD_HEADERS_SEARCH_PATHS}' }
|
81
|
+
end
|
82
|
+
|
83
|
+
# Generates and saves the xcconfig to the given path.
|
84
|
+
#
|
85
|
+
# @param [Pathname] path
|
86
|
+
# the path where the prefix header should be stored.
|
87
|
+
#
|
88
|
+
# @return [void]
|
89
|
+
#
|
90
|
+
def save_as(path)
|
91
|
+
path.open('w') { |file| file.write(generate) }
|
92
|
+
end
|
93
|
+
|
94
|
+
#-----------------------------------------------------------------------#
|
95
|
+
|
96
|
+
# @!group Private helpers.
|
97
|
+
|
98
|
+
private
|
99
|
+
|
100
|
+
# @return [String] the default linker flags. `-ObjC` is always included
|
101
|
+
# while `-fobjc-arc` is included only if requested in the
|
102
|
+
# Podfile.
|
103
|
+
#
|
104
|
+
def default_ld_flags
|
105
|
+
flags = %w[ -ObjC ]
|
106
|
+
requires_arc = pods.any? { |pod| pod.requires_arc? }
|
107
|
+
if requires_arc && set_arc_compatibility_flag
|
108
|
+
flags << '-fobjc-arc'
|
109
|
+
end
|
110
|
+
flags.join(" ")
|
111
|
+
end
|
112
|
+
|
113
|
+
# Converts an array of strings to a single string where the each string
|
114
|
+
# is surrounded by double quotes and separated by a space. Used to
|
115
|
+
# represent strings in a xcconfig file.
|
116
|
+
#
|
117
|
+
# @param [Array<String>] strings
|
118
|
+
# a list of strings.
|
119
|
+
#
|
120
|
+
# @return [String] the resulting string.
|
121
|
+
#
|
122
|
+
def quote(strings)
|
123
|
+
strings.sort.map { |s| %W|"#{s}"| }.join(" ")
|
124
|
+
end
|
125
|
+
|
126
|
+
# Configures the given Xcconfig according to the build settings of the
|
127
|
+
# given Specification.
|
128
|
+
#
|
129
|
+
# @param [Specification::Consumer] consumer
|
130
|
+
# The consumer of the specification.
|
131
|
+
#
|
132
|
+
# @param [Xcodeproj::Config] xcconfig
|
133
|
+
# The xcconfig to edit.
|
134
|
+
#
|
135
|
+
# @return [void]
|
136
|
+
#
|
137
|
+
def add_spec_build_settings_to_xcconfig(consumer, xcconfig)
|
138
|
+
xcconfig.merge!(consumer.xcconfig)
|
139
|
+
xcconfig.libraries.merge(consumer.libraries)
|
140
|
+
xcconfig.frameworks.merge(consumer.frameworks)
|
141
|
+
xcconfig.weak_frameworks.merge(consumer.weak_frameworks)
|
142
|
+
add_developers_frameworks_if_needed(consumer, xcconfig)
|
143
|
+
end
|
144
|
+
|
145
|
+
# @return [Array<String>] The search paths for the developer frameworks.
|
146
|
+
#
|
147
|
+
# @todo Inheritance should be properly handled in Xcconfigs.
|
148
|
+
#
|
149
|
+
DEVELOPER_FRAMEWORKS_SEARCH_PATHS = [
|
150
|
+
'$(inherited)',
|
151
|
+
'"$(SDKROOT)/Developer/Library/Frameworks"',
|
152
|
+
'"$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
|
153
|
+
]
|
154
|
+
|
155
|
+
# Adds the search paths of the developer frameworks to the specification
|
156
|
+
# if needed. This is done because the `SenTestingKit` requires them and
|
157
|
+
# adding them to each specification which requires it is repetitive and
|
158
|
+
# error prone.
|
159
|
+
#
|
160
|
+
# @param [Specification::Consumer] consumer
|
161
|
+
# The consumer of the specification.
|
162
|
+
#
|
163
|
+
# @param [Xcodeproj::Config] xcconfig
|
164
|
+
# The xcconfig to edit.
|
165
|
+
#
|
166
|
+
# @return [void]
|
167
|
+
#
|
168
|
+
def add_developers_frameworks_if_needed(consumer, xcconfig)
|
169
|
+
if xcconfig.frameworks.include?('SenTestingKit')
|
170
|
+
search_paths = xcconfig.attributes['FRAMEWORK_SEARCH_PATHS'] ||= ''
|
171
|
+
DEVELOPER_FRAMEWORKS_SEARCH_PATHS.each do |search_path|
|
172
|
+
unless search_paths.include?(search_path)
|
173
|
+
search_paths << ' ' unless search_paths.empty?
|
174
|
+
search_paths << search_path
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
#-----------------------------------------------------------------------#
|
181
|
+
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
@@ -0,0 +1,134 @@
|
|
1
|
+
module Pod
|
2
|
+
|
3
|
+
class Podfile
|
4
|
+
def config
|
5
|
+
UI.warn "Podfile#config is deprecated. The config is accessible from " \
|
6
|
+
"the parameter passed to the hooks"
|
7
|
+
Config.instance
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class Podfile::TargetDefinition
|
12
|
+
def copy_resources_script_name
|
13
|
+
UI.warn "TargetDefinition#copy_resources_script_name is deprecated. " \
|
14
|
+
"The value is accessible directly from the representation of the " \
|
15
|
+
"library using the #copy_resources_script_path method."
|
16
|
+
Config.instance.sandbox.root + "#{label}-resources.sh"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module Hooks
|
21
|
+
|
22
|
+
# The installer representation to pass to the hooks.
|
23
|
+
#
|
24
|
+
class InstallerRepresentation
|
25
|
+
|
26
|
+
public
|
27
|
+
|
28
|
+
# @!group Public Hooks API
|
29
|
+
|
30
|
+
# @return [Pathname] The root of the sandbox.
|
31
|
+
#
|
32
|
+
def sandbox_root
|
33
|
+
installer.sandbox.root
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [Pod::Project] the `Pods/Pods.xcodeproj` project.
|
37
|
+
#
|
38
|
+
# @note This value is not yet set in the pre install callbacks.
|
39
|
+
#
|
40
|
+
def project
|
41
|
+
installer.pods_project
|
42
|
+
end
|
43
|
+
|
44
|
+
# @return [Array<PodRepresentation>] The representation of the Pods.
|
45
|
+
#
|
46
|
+
def pods
|
47
|
+
installer.pod_reps
|
48
|
+
end
|
49
|
+
|
50
|
+
# @return [Array<LibraryRepresentation>] The representation of the
|
51
|
+
# libraries.
|
52
|
+
#
|
53
|
+
def libraries
|
54
|
+
installer.library_reps
|
55
|
+
end
|
56
|
+
|
57
|
+
# @return [Hash{LibraryRepresentation => Array<Specification>}] The
|
58
|
+
# specifications grouped by target definition.
|
59
|
+
#
|
60
|
+
def specs_by_lib
|
61
|
+
result = {}
|
62
|
+
installer.libraries.each do |lib|
|
63
|
+
result[installer.library_rep(lib)] = lib.specs
|
64
|
+
end
|
65
|
+
result
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [Hash{LibraryRepresentation => Array<PodRepresentation>}] The
|
69
|
+
# local pod instances grouped by target.
|
70
|
+
#
|
71
|
+
def pods_by_lib
|
72
|
+
result = {}
|
73
|
+
installer.libraries.each do |lib|
|
74
|
+
pod_names = lib.specs.map { |spec| spec.root.name }.uniq
|
75
|
+
pod_reps = pods.select { |rep| pod_names.include?(rep.name) }
|
76
|
+
result[lib.target_definition] = pod_reps
|
77
|
+
end
|
78
|
+
result
|
79
|
+
end
|
80
|
+
|
81
|
+
#-----------------------------------------------------------------------#
|
82
|
+
public
|
83
|
+
|
84
|
+
# @!group Compatibility
|
85
|
+
#
|
86
|
+
# The following aliases provides compatibility with CP < 0.17
|
87
|
+
|
88
|
+
alias :target_installers :libraries
|
89
|
+
alias :specs_by_target :specs_by_lib
|
90
|
+
alias :local_pods_by_target :pods_by_lib
|
91
|
+
|
92
|
+
#-----------------------------------------------------------------------#
|
93
|
+
|
94
|
+
public
|
95
|
+
|
96
|
+
# @!group Unsafe Hooks API
|
97
|
+
#
|
98
|
+
# The interface of the following objects might change at any time.
|
99
|
+
# If there some information which is needed, please open an issue.
|
100
|
+
|
101
|
+
# @return [Sandbox] sandbox the sandbox where the support files should
|
102
|
+
# be generated.
|
103
|
+
#
|
104
|
+
def sandbox
|
105
|
+
installer.sandbox
|
106
|
+
end
|
107
|
+
|
108
|
+
# @return [Config] The config singleton used for the installation.
|
109
|
+
#
|
110
|
+
def config
|
111
|
+
Config.instance
|
112
|
+
end
|
113
|
+
|
114
|
+
# @return [Installer] The installer described by this instance.
|
115
|
+
#
|
116
|
+
attr_reader :installer
|
117
|
+
|
118
|
+
#-----------------------------------------------------------------------#
|
119
|
+
|
120
|
+
# @!group Private implementation
|
121
|
+
|
122
|
+
# @param [Installer] installer @see installer
|
123
|
+
#
|
124
|
+
def initialize(installer)
|
125
|
+
@installer = installer
|
126
|
+
end
|
127
|
+
|
128
|
+
#-----------------------------------------------------------------------#
|
129
|
+
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
|
@@ -0,0 +1,94 @@
|
|
1
|
+
module Pod
|
2
|
+
module Hooks
|
3
|
+
class LibraryRepresentation
|
4
|
+
|
5
|
+
# Stores the information of the target installer
|
6
|
+
|
7
|
+
#-----------------------------------------------------------------------#
|
8
|
+
|
9
|
+
# @return [String] The name of the Pods library.
|
10
|
+
#
|
11
|
+
def name
|
12
|
+
library.name
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [Array<Dependency>] The dependencies of this library.
|
16
|
+
#
|
17
|
+
def dependencies
|
18
|
+
target_definition.dependencies
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [Pathname] The path of the Pods dir.
|
22
|
+
#
|
23
|
+
def sandbox_dir
|
24
|
+
sandbox.root
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [Pathname] The path of the prefix_header
|
28
|
+
#
|
29
|
+
def prefix_header_path
|
30
|
+
UI.warn "LibraryRepresentation#prefix_header_path is deprecated. " \
|
31
|
+
"Use the specification `prefix_header_contents` attribute."
|
32
|
+
library.prefix_header_path
|
33
|
+
end
|
34
|
+
alias :prefix_header_filename :prefix_header_path
|
35
|
+
|
36
|
+
# @return [Pathname] The path of the script used to copy the resources.
|
37
|
+
#
|
38
|
+
def copy_resources_script_path
|
39
|
+
library.copy_resources_script_path
|
40
|
+
end
|
41
|
+
|
42
|
+
# @return [Project] The Pods project of the sandbox.
|
43
|
+
#
|
44
|
+
def project
|
45
|
+
sandbox.project
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [TargetDefinition] The target definition of the library.
|
49
|
+
#
|
50
|
+
def target_definition
|
51
|
+
library.target_definition
|
52
|
+
end
|
53
|
+
|
54
|
+
#-----------------------------------------------------------------------#
|
55
|
+
|
56
|
+
public
|
57
|
+
|
58
|
+
# @!group Unsafe Hooks API
|
59
|
+
|
60
|
+
# @return [Sandbox] sandbox the sandbox where the support files should
|
61
|
+
# be generated.
|
62
|
+
#
|
63
|
+
attr_reader :sandbox
|
64
|
+
|
65
|
+
# @return [Library] The library whose target needs to be generated.
|
66
|
+
#
|
67
|
+
attr_reader :library
|
68
|
+
|
69
|
+
# @return [PBXNativeTarget] The target generated by the installation
|
70
|
+
# process.
|
71
|
+
#
|
72
|
+
def target
|
73
|
+
library.target
|
74
|
+
end
|
75
|
+
|
76
|
+
#-----------------------------------------------------------------------#
|
77
|
+
|
78
|
+
# @!group Private implementation
|
79
|
+
|
80
|
+
# @param [Sandbox] sandbox @see sandbox
|
81
|
+
# @param [Library] library @see library
|
82
|
+
#
|
83
|
+
def initialize(sandbox, library)
|
84
|
+
@sandbox = sandbox
|
85
|
+
@library = library
|
86
|
+
end
|
87
|
+
|
88
|
+
#-----------------------------------------------------------------------#
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Pod
|
2
|
+
|
3
|
+
class Specification
|
4
|
+
def config
|
5
|
+
UI.warn "[#{name}] Specification#config is deprecated. The config is accessible from " \
|
6
|
+
"the parameter passed to the hooks"
|
7
|
+
Config.instance
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module Hooks
|
12
|
+
|
13
|
+
# Stores the information of the Installer for the hooks
|
14
|
+
#
|
15
|
+
class PodRepresentation
|
16
|
+
|
17
|
+
# @return [String]
|
18
|
+
#
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
# @return [Version]
|
22
|
+
#
|
23
|
+
def version
|
24
|
+
root_spec.version
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [Specification]
|
28
|
+
#
|
29
|
+
def root_spec
|
30
|
+
file_accessors.first.spec.root
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [Array<Specification>]
|
34
|
+
#
|
35
|
+
def specs
|
36
|
+
file_accessors.map(&:spec).uniq
|
37
|
+
end
|
38
|
+
|
39
|
+
# @return [Pathname]
|
40
|
+
#
|
41
|
+
def root
|
42
|
+
file_accessors.first.path_list.root
|
43
|
+
end
|
44
|
+
|
45
|
+
# @return [Array<Pathname>]
|
46
|
+
#
|
47
|
+
def source_files
|
48
|
+
file_accessors.map(&:source_files).flatten.uniq
|
49
|
+
end
|
50
|
+
|
51
|
+
#-----------------------------------------------------------------------#
|
52
|
+
|
53
|
+
# @!group Private implementation
|
54
|
+
|
55
|
+
# @param [Installer] installer @see installer
|
56
|
+
#
|
57
|
+
def initialize(name, file_accessors)
|
58
|
+
@name = name
|
59
|
+
@file_accessors = file_accessors
|
60
|
+
end
|
61
|
+
|
62
|
+
def to_s
|
63
|
+
root_spec.to_s
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
attr_reader :file_accessors
|
69
|
+
|
70
|
+
#-----------------------------------------------------------------------#
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|