cocoapods 0.38.2 → 0.39.0.beta.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +175 -90
- data/lib/cocoapods.rb +0 -6
- data/lib/cocoapods/command/lib.rb +15 -10
- data/lib/cocoapods/command/repo/lint.rb +3 -1
- data/lib/cocoapods/command/repo/push.rb +13 -4
- data/lib/cocoapods/command/spec/create.rb +5 -6
- data/lib/cocoapods/command/spec/lint.rb +15 -10
- data/lib/cocoapods/executable.rb +36 -6
- data/lib/cocoapods/gem_version.rb +1 -1
- data/lib/cocoapods/generator/copy_resources_script.rb +1 -1
- data/lib/cocoapods/generator/embed_frameworks_script.rb +40 -10
- data/lib/cocoapods/generator/xcconfig.rb +1 -2
- data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +9 -8
- data/lib/cocoapods/generator/xcconfig/{private_pod_xcconfig.rb → pod_xcconfig.rb} +14 -63
- data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +1 -2
- data/lib/cocoapods/installer.rb +60 -32
- data/lib/cocoapods/installer/analyzer.rb +2 -0
- data/lib/cocoapods/installer/file_references_installer.rb +3 -3
- data/lib/cocoapods/installer/pod_source_installer.rb +24 -5
- data/lib/cocoapods/installer/source_provider_hooks_context.rb +32 -0
- data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +6 -4
- data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +2 -7
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +59 -25
- data/lib/cocoapods/resolver.rb +10 -2
- data/lib/cocoapods/sandbox/file_accessor.rb +57 -0
- data/lib/cocoapods/sandbox/headers_store.rb +5 -6
- data/lib/cocoapods/target.rb +0 -12
- data/lib/cocoapods/target/pod_target.rb +7 -0
- data/lib/cocoapods/validator.rb +34 -23
- metadata +16 -16
- data/lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb +0 -53
data/lib/cocoapods.rb
CHANGED
@@ -67,10 +67,4 @@ module Pod
|
|
67
67
|
autoload :UmbrellaHeader, 'cocoapods/generator/umbrella_header'
|
68
68
|
autoload :XCConfig, 'cocoapods/generator/xcconfig'
|
69
69
|
end
|
70
|
-
|
71
|
-
module Hooks
|
72
|
-
autoload :InstallerRepresentation, 'cocoapods/hooks/installer_representation'
|
73
|
-
autoload :LibraryRepresentation, 'cocoapods/hooks/library_representation'
|
74
|
-
autoload :PodRepresentation, 'cocoapods/hooks/pod_representation'
|
75
|
-
end
|
76
70
|
end
|
@@ -115,16 +115,19 @@ module Pod
|
|
115
115
|
DESC
|
116
116
|
|
117
117
|
def self.options
|
118
|
-
[
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
'
|
127
|
-
|
118
|
+
[
|
119
|
+
['--quick', 'Lint skips checks that would require to download and build the spec'],
|
120
|
+
['--allow-warnings', 'Lint validates even if warnings are present'],
|
121
|
+
['--subspec=NAME', 'Lint validates only the given subspec'],
|
122
|
+
['--no-subspecs', 'Lint skips validation of subspecs'],
|
123
|
+
['--no-clean', 'Lint leaves the build directory intact for inspection'],
|
124
|
+
['--fail-fast', 'Lint stops on the first failing platform or subspec'],
|
125
|
+
['--use-libraries', 'Lint uses static libraries to install the spec'],
|
126
|
+
['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependent pods ' \
|
127
|
+
'(defaults to https://github.com/CocoaPods/Specs.git). ' \
|
128
|
+
'Multiple sources must be comma-delimited.'],
|
129
|
+
['--private', 'Lint skips checks that apply only to public specs'],
|
130
|
+
].concat(super)
|
128
131
|
end
|
129
132
|
|
130
133
|
def initialize(argv)
|
@@ -136,6 +139,7 @@ module Pod
|
|
136
139
|
@only_subspec = argv.option('subspec')
|
137
140
|
@use_frameworks = !argv.flag?('use-libraries')
|
138
141
|
@source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
|
142
|
+
@private = argv.flag?('private', false)
|
139
143
|
@podspecs_paths = argv.arguments!
|
140
144
|
super
|
141
145
|
end
|
@@ -156,6 +160,7 @@ module Pod
|
|
156
160
|
validator.no_subspecs = !@subspecs || @only_subspec
|
157
161
|
validator.only_subspec = @only_subspec
|
158
162
|
validator.use_frameworks = @use_frameworks
|
163
|
+
validator.ignore_public_only_results = @private
|
159
164
|
validator.validate
|
160
165
|
|
161
166
|
unless @clean
|
@@ -20,17 +20,25 @@ module Pod
|
|
20
20
|
]
|
21
21
|
|
22
22
|
def self.options
|
23
|
-
[
|
24
|
-
|
25
|
-
|
23
|
+
[
|
24
|
+
['--allow-warnings', 'Allows pushing even if there are warnings'],
|
25
|
+
['--use-libraries', 'Linter uses static libraries to install the spec'],
|
26
|
+
['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependent pods ' \
|
27
|
+
'(defaults to all available repos). ' \
|
28
|
+
'Multiple sources must be comma-delimited.'],
|
29
|
+
['--local-only', 'Does not perform the step of pushing REPO to its remote'],
|
30
|
+
['--no-private', 'Lint includes checks that apply only to public repos'],
|
31
|
+
].concat(super)
|
26
32
|
end
|
27
33
|
|
28
34
|
def initialize(argv)
|
29
35
|
@allow_warnings = argv.flag?('allow-warnings')
|
30
36
|
@local_only = argv.flag?('local-only')
|
31
37
|
@repo = argv.shift_argument
|
38
|
+
@source_urls = argv.option('sources', SourcesManager.all.map(&:url).join(',')).split(',')
|
32
39
|
@podspec = argv.shift_argument
|
33
40
|
@use_frameworks = !argv.flag?('use-libraries')
|
41
|
+
@private = argv.flag?('private', true)
|
34
42
|
super
|
35
43
|
end
|
36
44
|
|
@@ -84,9 +92,10 @@ module Pod
|
|
84
92
|
def validate_podspec_files
|
85
93
|
UI.puts "\nValidating #{'spec'.pluralize(count)}".yellow
|
86
94
|
podspec_files.each do |podspec|
|
87
|
-
validator = Validator.new(podspec,
|
95
|
+
validator = Validator.new(podspec, @source_urls)
|
88
96
|
validator.allow_warnings = @allow_warnings
|
89
97
|
validator.use_frameworks = @use_frameworks
|
98
|
+
validator.ignore_public_only_results = @private
|
90
99
|
begin
|
91
100
|
validator.validate
|
92
101
|
rescue => e
|
@@ -126,13 +126,12 @@ Pod::Spec.new do |s|
|
|
126
126
|
s.version = "#{data[:version]}"
|
127
127
|
s.summary = "#{data[:summary]}"
|
128
128
|
|
129
|
+
# This description is used to generate tags and improve search results.
|
130
|
+
# * Think: What does it do? Why did you write it? What is the focus?
|
131
|
+
# * Try to keep it short, snappy and to the point.
|
132
|
+
# * Write the description between the DESC delimiters below.
|
133
|
+
# * Finally, don't worry about the indent, CocoaPods strips it!
|
129
134
|
s.description = <<-DESC
|
130
|
-
A longer description of #{data[:name]} in Markdown format.
|
131
|
-
|
132
|
-
* Think: Why did you write this? What is the focus? What does it do?
|
133
|
-
* CocoaPods will be using this to generate tags, and improve search results.
|
134
|
-
* Try to keep it short, snappy and to the point.
|
135
|
-
* Finally, don't worry about the indent, CocoaPods strips it!
|
136
135
|
DESC
|
137
136
|
|
138
137
|
s.homepage = "#{data[:homepage]}"
|
@@ -15,16 +15,19 @@ module Pod
|
|
15
15
|
]
|
16
16
|
|
17
17
|
def self.options
|
18
|
-
[
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
'
|
27
|
-
|
18
|
+
[
|
19
|
+
['--quick', 'Lint skips checks that would require to download and build the spec'],
|
20
|
+
['--allow-warnings', 'Lint validates even if warnings are present'],
|
21
|
+
['--subspec=NAME', 'Lint validates only the given subspec'],
|
22
|
+
['--no-subspecs', 'Lint skips validation of subspecs'],
|
23
|
+
['--no-clean', 'Lint leaves the build directory intact for inspection'],
|
24
|
+
['--fail-fast', 'Lint stops on the first failing platform or subspec'],
|
25
|
+
['--use-libraries', 'Lint uses static libraries to install the spec'],
|
26
|
+
['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependent pods ' \
|
27
|
+
'(defaults to https://github.com/CocoaPods/Specs.git). ' \
|
28
|
+
'Multiple sources must be comma-delimited.'],
|
29
|
+
['--private', 'Lint skips checks that apply only to public specs'],
|
30
|
+
].concat(super)
|
28
31
|
end
|
29
32
|
|
30
33
|
def initialize(argv)
|
@@ -36,6 +39,7 @@ module Pod
|
|
36
39
|
@only_subspec = argv.option('subspec')
|
37
40
|
@use_frameworks = !argv.flag?('use-libraries')
|
38
41
|
@source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
|
42
|
+
@private = argv.flag?('private', false)
|
39
43
|
@podspecs_paths = argv.arguments!
|
40
44
|
super
|
41
45
|
end
|
@@ -52,6 +56,7 @@ module Pod
|
|
52
56
|
validator.no_subspecs = !@subspecs || @only_subspec
|
53
57
|
validator.only_subspec = @only_subspec
|
54
58
|
validator.use_frameworks = @use_frameworks
|
59
|
+
validator.ignore_public_only_results = @private
|
55
60
|
validator.validate
|
56
61
|
failure_reasons << validator.failure_reason
|
57
62
|
|
data/lib/cocoapods/executable.rb
CHANGED
@@ -45,14 +45,10 @@ module Pod
|
|
45
45
|
#
|
46
46
|
# @return [String] the output of the command (STDOUT and STDERR).
|
47
47
|
#
|
48
|
-
|
49
|
-
#
|
50
|
-
def self.execute_command(executable, command, raise_on_failure)
|
48
|
+
def self.execute_command(executable, command, raise_on_failure = true)
|
51
49
|
bin = which(executable)
|
52
50
|
raise Informative, "Unable to locate the executable `#{executable}`" unless bin
|
53
51
|
|
54
|
-
require 'shellwords'
|
55
|
-
|
56
52
|
command = command.map(&:to_s)
|
57
53
|
full_command = "#{bin} #{command.join(' ')}"
|
58
54
|
|
@@ -64,7 +60,8 @@ module Pod
|
|
64
60
|
end
|
65
61
|
|
66
62
|
status = popen3(bin, command, stdout, stderr)
|
67
|
-
|
63
|
+
stdout, stderr = stdout.join, stderr.join
|
64
|
+
output = stdout + stderr
|
68
65
|
unless status.success?
|
69
66
|
if raise_on_failure
|
70
67
|
raise Informative, "#{full_command}\n\n#{output}"
|
@@ -72,6 +69,7 @@ module Pod
|
|
72
69
|
UI.message("[!] Failed: #{full_command}".red)
|
73
70
|
end
|
74
71
|
end
|
72
|
+
|
75
73
|
output
|
76
74
|
end
|
77
75
|
|
@@ -95,6 +93,38 @@ module Pod
|
|
95
93
|
nil
|
96
94
|
end
|
97
95
|
|
96
|
+
# Runs the given command, capturing the desired output.
|
97
|
+
#
|
98
|
+
# @param [String] bin
|
99
|
+
# The binary to use.
|
100
|
+
#
|
101
|
+
# @param [Array<#to_s>] command
|
102
|
+
# The command to send to the binary.
|
103
|
+
#
|
104
|
+
# @param [Symbol] capture
|
105
|
+
# Whether it should raise if the command fails.
|
106
|
+
#
|
107
|
+
# @raise If the executable could not be located.
|
108
|
+
#
|
109
|
+
# @return [(String, Process::Status)]
|
110
|
+
# The desired captured output from the command, and the status from
|
111
|
+
# running the command.
|
112
|
+
#
|
113
|
+
def self.capture_command(executable, command, capture: :merge)
|
114
|
+
bin = which(executable)
|
115
|
+
raise Informative, "Unable to locate the executable `#{executable}`" unless bin
|
116
|
+
|
117
|
+
require 'open3'
|
118
|
+
command = command.map(&:to_s)
|
119
|
+
case capture
|
120
|
+
when :merge then Open3.capture2e(bin, *command)
|
121
|
+
when :both then Open3.capture3(bin, *command)
|
122
|
+
when :out then Open3.capture2(bin, *command)
|
123
|
+
when :err then Open3.capture3(bin, *command).drop(1)
|
124
|
+
when :none then Open3.capture2(bin, *command).last
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
98
128
|
private
|
99
129
|
|
100
130
|
def self.popen3(bin, command, stdout, stderr)
|
@@ -160,7 +160,7 @@ EOS
|
|
160
160
|
|
161
161
|
mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
162
162
|
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
163
|
-
if [[ "${ACTION}" == "install" ]]; then
|
163
|
+
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
|
164
164
|
mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
165
165
|
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
166
166
|
fi
|
@@ -34,7 +34,7 @@ module Pod
|
|
34
34
|
# @return [String] The contents of the embed frameworks script.
|
35
35
|
#
|
36
36
|
def script
|
37
|
-
script = <<-
|
37
|
+
script = <<-SH.strip_heredoc
|
38
38
|
#!/bin/sh
|
39
39
|
set -e
|
40
40
|
|
@@ -47,8 +47,10 @@ module Pod
|
|
47
47
|
{
|
48
48
|
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
|
49
49
|
local source="${BUILT_PRODUCTS_DIR}/$1"
|
50
|
-
|
50
|
+
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
|
51
51
|
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
|
52
|
+
elif [ -r "$1" ]; then
|
53
|
+
local source="$1"
|
52
54
|
fi
|
53
55
|
|
54
56
|
local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
@@ -62,14 +64,24 @@ module Pod
|
|
62
64
|
echo "rsync -av --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${destination}\\""
|
63
65
|
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
|
64
66
|
|
67
|
+
local basename
|
68
|
+
basename="$(basename -s .framework "$1")"
|
69
|
+
binary="${destination}/${basename}.framework/${basename}"
|
70
|
+
if ! [ -r "$binary" ]; then
|
71
|
+
binary="${destination}/${basename}"
|
72
|
+
fi
|
73
|
+
|
74
|
+
# Strip invalid architectures so "fat" simulator / device frameworks work on device
|
75
|
+
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
|
76
|
+
strip_invalid_archs "$binary"
|
77
|
+
fi
|
78
|
+
|
65
79
|
# Resign the code if required by the build settings to avoid unstable apps
|
66
80
|
code_sign_if_enabled "${destination}/$(basename "$1")"
|
67
81
|
|
68
82
|
# Embed linked Swift runtime libraries
|
69
|
-
local basename
|
70
|
-
basename="$(basename "$1" | sed -E s/\\\\..+// && exit ${PIPESTATUS[0]})"
|
71
83
|
local swift_runtime_libs
|
72
|
-
swift_runtime_libs=$(xcrun otool -LX "$
|
84
|
+
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\\\/\\(.+dylib\\).*/\\\\1/g | uniq -u && exit ${PIPESTATUS[0]})
|
73
85
|
for lib in $swift_runtime_libs; do
|
74
86
|
echo "rsync -auv \\"${SWIFT_STDLIB_PATH}/${lib}\\" \\"${destination}\\""
|
75
87
|
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
|
@@ -87,15 +99,33 @@ module Pod
|
|
87
99
|
fi
|
88
100
|
}
|
89
101
|
|
90
|
-
|
91
|
-
|
102
|
+
# Strip invalid architectures
|
103
|
+
strip_invalid_archs() {
|
104
|
+
binary="$1"
|
105
|
+
# Get architectures for current file
|
106
|
+
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
|
107
|
+
stripped=""
|
108
|
+
for arch in $archs; do
|
109
|
+
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
|
110
|
+
# Strip non-valid architectures in-place
|
111
|
+
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
|
112
|
+
stripped="$stripped $arch"
|
113
|
+
fi
|
114
|
+
done
|
115
|
+
if [[ "$stripped" ]]; then
|
116
|
+
echo "Stripped $binary of architectures:$stripped"
|
117
|
+
fi
|
118
|
+
}
|
119
|
+
|
120
|
+
SH
|
121
|
+
script << "\n" unless frameworks_by_config.values.all?(&:empty?)
|
92
122
|
frameworks_by_config.each do |config, frameworks|
|
93
123
|
unless frameworks.empty?
|
94
|
-
script
|
124
|
+
script << %(if [[ "$CONFIGURATION" == "#{config}" ]]; then\n)
|
95
125
|
frameworks.each do |framework|
|
96
|
-
script
|
126
|
+
script << %( install_framework "#{framework}"\n)
|
97
127
|
end
|
98
|
-
script
|
128
|
+
script << "fi\n"
|
99
129
|
end
|
100
130
|
end
|
101
131
|
script
|
@@ -6,8 +6,7 @@ module Pod
|
|
6
6
|
#
|
7
7
|
module XCConfig
|
8
8
|
autoload :AggregateXCConfig, 'cocoapods/generator/xcconfig/aggregate_xcconfig'
|
9
|
-
autoload :
|
10
|
-
autoload :PrivatePodXCConfig, 'cocoapods/generator/xcconfig/private_pod_xcconfig'
|
9
|
+
autoload :PodXCConfig, 'cocoapods/generator/xcconfig/pod_xcconfig'
|
11
10
|
autoload :XCConfigHelper, 'cocoapods/generator/xcconfig/xcconfig_helper'
|
12
11
|
end
|
13
12
|
end
|
@@ -53,11 +53,12 @@ module Pod
|
|
53
53
|
#
|
54
54
|
def generate
|
55
55
|
includes_static_libs = !target.requires_frameworks?
|
56
|
-
includes_static_libs ||= pod_targets.flat_map(&:file_accessors).any? { |fa| !fa.
|
56
|
+
includes_static_libs ||= pod_targets.flat_map(&:file_accessors).any? { |fa| !fa.vendored_static_artifacts.empty? }
|
57
57
|
config = {
|
58
58
|
'OTHER_LDFLAGS' => '$(inherited) ' + XCConfigHelper.default_ld_flags(target, includes_static_libs),
|
59
59
|
'PODS_ROOT' => target.relative_pods_root,
|
60
60
|
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
|
61
|
+
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) ',
|
61
62
|
}
|
62
63
|
@xcconfig = Xcodeproj::Config.new(config)
|
63
64
|
|
@@ -106,13 +107,13 @@ module Pod
|
|
106
107
|
'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(framework_header_search_paths, '-iquote'),
|
107
108
|
}
|
108
109
|
if pod_targets.any? { |t| !t.should_build? }
|
109
|
-
# Make library headers
|
110
|
+
# Make library headers discoverable by `#import "…"`
|
110
111
|
library_header_search_paths = target.sandbox.public_headers.search_paths(target.platform)
|
111
|
-
build_settings['HEADER_SEARCH_PATHS'] = XCConfigHelper.quote(library_header_search_paths)
|
112
|
+
build_settings['HEADER_SEARCH_PATHS'] = '$(inherited) ' + XCConfigHelper.quote(library_header_search_paths)
|
112
113
|
build_settings['OTHER_CFLAGS'] += ' ' + XCConfigHelper.quote(library_header_search_paths, '-isystem')
|
113
114
|
end
|
114
115
|
if pod_targets.any? { |t| t.should_build? && t.scoped? }
|
115
|
-
build_settings['FRAMEWORK_SEARCH_PATHS'] = '
|
116
|
+
build_settings['FRAMEWORK_SEARCH_PATHS'] = '"$PODS_FRAMEWORK_BUILD_PATH"'
|
116
117
|
end
|
117
118
|
@xcconfig.merge!(build_settings)
|
118
119
|
else
|
@@ -224,14 +225,14 @@ module Pod
|
|
224
225
|
#
|
225
226
|
def merged_user_target_xcconfigs
|
226
227
|
settings = user_target_xcconfig_values_by_consumer_by_key
|
227
|
-
settings.each_with_object({}) do |(key,
|
228
|
-
uniq_values =
|
228
|
+
settings.each_with_object({}) do |(key, values_by_consumer), xcconfig|
|
229
|
+
uniq_values = values_by_consumer.values.uniq
|
229
230
|
values_are_bools = uniq_values.all? { |v| v =~ /(yes|no)/i }
|
230
231
|
if values_are_bools
|
231
232
|
# Boolean build settings
|
232
233
|
if uniq_values.count > 1
|
233
234
|
UI.warn 'Can\'t merge user_target_xcconfig for pod targets: ' \
|
234
|
-
"#{
|
235
|
+
"#{values_by_consumer.keys.map(&:name)}. Boolean build "\
|
235
236
|
"setting #{key} has different values."
|
236
237
|
else
|
237
238
|
xcconfig[key] = uniq_values.first
|
@@ -243,7 +244,7 @@ module Pod
|
|
243
244
|
# Singular build settings
|
244
245
|
if uniq_values.count > 1
|
245
246
|
UI.warn 'Can\'t merge user_target_xcconfig for pod targets: ' \
|
246
|
-
"#{
|
247
|
+
"#{values_by_consumer.keys.map(&:name)}. Singular build "\
|
247
248
|
"setting #{key} has different values."
|
248
249
|
else
|
249
250
|
xcconfig[key] = uniq_values.first
|
@@ -3,28 +3,21 @@ module Pod
|
|
3
3
|
module XCConfig
|
4
4
|
# Generates the private xcconfigs for the pod targets.
|
5
5
|
#
|
6
|
-
# The
|
7
|
-
# values
|
8
|
-
#
|
6
|
+
# The xcconfig file for a Pod target merges the pod target
|
7
|
+
# configuration values with the default configuration values
|
8
|
+
# required by CocoaPods.
|
9
9
|
#
|
10
|
-
class
|
10
|
+
class PodXCConfig
|
11
11
|
# @return [Target] the target represented by this xcconfig.
|
12
12
|
#
|
13
13
|
attr_reader :target
|
14
14
|
|
15
|
-
# @return [Xcodeproj::Config] The public xcconfig which this one will
|
16
|
-
# use.
|
17
|
-
#
|
18
|
-
attr_reader :public_xcconfig
|
19
|
-
|
20
15
|
# Initialize a new instance
|
21
16
|
#
|
22
17
|
# @param [Target] target @see target
|
23
|
-
# @param [Xcodeproj::Config] public_xcconfig @see public_xcconfig
|
24
18
|
#
|
25
|
-
def initialize(target
|
19
|
+
def initialize(target)
|
26
20
|
@target = target
|
27
|
-
@public_xcconfig = public_xcconfig
|
28
21
|
end
|
29
22
|
|
30
23
|
# @return [Xcodeproj::Config] The generated xcconfig.
|
@@ -50,6 +43,7 @@ module Pod
|
|
50
43
|
target_search_paths = target.build_headers.search_paths(target.platform)
|
51
44
|
sandbox_search_paths = target.sandbox.public_headers.search_paths(target.platform)
|
52
45
|
search_paths = target_search_paths.concat(sandbox_search_paths).uniq
|
46
|
+
framework_search_paths = target.dependent_targets.flat_map(&:file_accessors).flat_map(&:vendored_frameworks).map { |fw| '${PODS_ROOT}/' << fw.dirname.relative_path_from(target.sandbox.root).to_s }
|
53
47
|
|
54
48
|
config = {
|
55
49
|
'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
|
@@ -57,9 +51,12 @@ module Pod
|
|
57
51
|
'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(search_paths),
|
58
52
|
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
|
59
53
|
'SKIP_INSTALL' => 'YES',
|
54
|
+
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) ' << XCConfigHelper.quote(framework_search_paths)
|
60
55
|
# 'USE_HEADERMAP' => 'NO'
|
61
56
|
}
|
62
57
|
|
58
|
+
@xcconfig = Xcodeproj::Config.new(config)
|
59
|
+
|
63
60
|
if target.requires_frameworks? && target.scoped?
|
64
61
|
# Only quote the FRAMEWORK_SEARCH_PATHS entry, because it’s a setting that takes multiple values.
|
65
62
|
# In addition, quoting CONFIGURATION_BUILD_DIR would make it be interpreted as a relative path.
|
@@ -68,63 +65,17 @@ module Pod
|
|
68
65
|
'FRAMEWORK_SEARCH_PATHS' => '"$PODS_FRAMEWORK_BUILD_PATH"',
|
69
66
|
'CONFIGURATION_BUILD_DIR' => '$PODS_FRAMEWORK_BUILD_PATH',
|
70
67
|
}
|
71
|
-
|
68
|
+
@xcconfig.merge!(build_settings)
|
72
69
|
end
|
73
70
|
|
74
|
-
|
75
|
-
|
71
|
+
XCConfigHelper.add_settings_for_file_accessors_of_target(target, @xcconfig)
|
72
|
+
target.file_accessors.each do |file_accessor|
|
73
|
+
@xcconfig.merge!(file_accessor.spec_consumer.pod_target_xcconfig)
|
74
|
+
end
|
76
75
|
XCConfigHelper.add_target_specific_settings(target, @xcconfig)
|
77
|
-
@xcconfig.includes = [target.name]
|
78
76
|
@xcconfig
|
79
77
|
end
|
80
78
|
|
81
|
-
private
|
82
|
-
|
83
|
-
#-----------------------------------------------------------------------#
|
84
|
-
|
85
|
-
# !@group Private Helpers
|
86
|
-
|
87
|
-
# Returns the hash representation of an xcconfig which inherit from the
|
88
|
-
# namespaced keys of a given one.
|
89
|
-
#
|
90
|
-
# @param [Hash] source_config
|
91
|
-
# The xcconfig whose keys need to be inherited.
|
92
|
-
#
|
93
|
-
# @param [Hash] destination_config
|
94
|
-
# The config which should inherit the source config keys.
|
95
|
-
#
|
96
|
-
# @return [Hash] The inheriting xcconfig.
|
97
|
-
#
|
98
|
-
def add_xcconfig_namespaced_keys(source_config, destination_config, prefix)
|
99
|
-
result = destination_config.dup
|
100
|
-
source_config.each do |key, _value|
|
101
|
-
prefixed_key = prefix + conditional_less_key(key)
|
102
|
-
current_value = destination_config[key]
|
103
|
-
if current_value
|
104
|
-
result[key] = "#{current_value} ${#{prefixed_key}}"
|
105
|
-
else
|
106
|
-
result[key] = "${#{prefixed_key}}"
|
107
|
-
end
|
108
|
-
end
|
109
|
-
result
|
110
|
-
end
|
111
|
-
|
112
|
-
# Strips the [*]-syntax from the given xcconfig key.
|
113
|
-
#
|
114
|
-
# @param [String] key
|
115
|
-
# The key to strip.
|
116
|
-
#
|
117
|
-
# @return [String] The stripped key.
|
118
|
-
#
|
119
|
-
def conditional_less_key(key)
|
120
|
-
brackets_index = key.index('[')
|
121
|
-
if brackets_index
|
122
|
-
key[0...brackets_index]
|
123
|
-
else
|
124
|
-
key
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
79
|
#-----------------------------------------------------------------------#
|
129
80
|
end
|
130
81
|
end
|