cocoapods 0.39.0 → 1.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +261 -12
- data/lib/cocoapods.rb +1 -0
- data/lib/cocoapods/command.rb +1 -0
- data/lib/cocoapods/command/env.rb +66 -0
- data/lib/cocoapods/command/init.rb +1 -1
- data/lib/cocoapods/command/lib.rb +1 -1
- data/lib/cocoapods/command/project.rb +0 -4
- data/lib/cocoapods/command/repo/lint.rb +7 -6
- data/lib/cocoapods/command/repo/push.rb +22 -1
- data/lib/cocoapods/command/setup.rb +0 -24
- data/lib/cocoapods/command/spec/create.rb +3 -1
- data/lib/cocoapods/command/spec/edit.rb +14 -21
- data/lib/cocoapods/command/spec/env_spec.rb +53 -0
- data/lib/cocoapods/command/spec/lint.rb +1 -1
- data/lib/cocoapods/config.rb +1 -34
- data/lib/cocoapods/downloader.rb +9 -4
- data/lib/cocoapods/external_sources.rb +0 -4
- data/lib/cocoapods/external_sources/abstract_external_source.rb +38 -11
- data/lib/cocoapods/external_sources/path_source.rb +2 -2
- data/lib/cocoapods/gem_version.rb +2 -2
- data/lib/cocoapods/generator/acknowledgements.rb +1 -1
- data/lib/cocoapods/generator/acknowledgements/plist.rb +1 -1
- data/lib/cocoapods/generator/copy_resources_script.rb +28 -21
- data/lib/cocoapods/generator/info_plist_file.rb +34 -8
- data/lib/cocoapods/generator/module_map.rb +3 -18
- data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +22 -10
- data/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb +2 -1
- data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +2 -1
- data/lib/cocoapods/hooks_manager.rb +3 -11
- data/lib/cocoapods/installer.rb +45 -25
- data/lib/cocoapods/installer/analyzer.rb +53 -25
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +2 -13
- data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +4 -0
- data/lib/cocoapods/installer/analyzer/target_inspector.rb +22 -19
- data/lib/cocoapods/installer/file_references_installer.rb +53 -6
- data/lib/cocoapods/installer/installation_options.rb +156 -0
- data/lib/cocoapods/installer/migrator.rb +1 -56
- data/lib/cocoapods/installer/pod_source_installer.rb +10 -8
- data/lib/cocoapods/installer/podfile_validator.rb +42 -1
- data/lib/cocoapods/installer/post_install_hooks_context.rb +19 -2
- data/lib/cocoapods/installer/target_installer.rb +6 -2
- data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +6 -5
- data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +82 -14
- data/lib/cocoapods/installer/user_project_integrator.rb +37 -16
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +14 -136
- data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +15 -22
- data/lib/cocoapods/project.rb +109 -19
- data/lib/cocoapods/resolver.rb +17 -15
- data/lib/cocoapods/resolver/lazy_specification.rb +4 -0
- data/lib/cocoapods/sandbox.rb +0 -32
- data/lib/cocoapods/sandbox/headers_store.rb +2 -2
- data/lib/cocoapods/sandbox/podspec_finder.rb +1 -1
- data/lib/cocoapods/sources_manager.rb +181 -50
- data/lib/cocoapods/target/aggregate_target.rb +17 -11
- data/lib/cocoapods/target/pod_target.rb +31 -4
- data/lib/cocoapods/user_interface.rb +32 -3
- data/lib/cocoapods/user_interface/error_report.rb +46 -36
- data/lib/cocoapods/validator.rb +132 -43
- metadata +164 -79
@@ -24,7 +24,7 @@ module Pod
|
|
24
24
|
# @see AbstractExternalSource#description
|
25
25
|
#
|
26
26
|
def description
|
27
|
-
"from `#{
|
27
|
+
"from `#{declared_path}`"
|
28
28
|
end
|
29
29
|
|
30
30
|
private
|
@@ -34,7 +34,7 @@ module Pod
|
|
34
34
|
# @return [String] The path as declared by the user.
|
35
35
|
#
|
36
36
|
def declared_path
|
37
|
-
result = params[:path]
|
37
|
+
result = params[:path]
|
38
38
|
result.to_s if result
|
39
39
|
end
|
40
40
|
|
@@ -45,7 +45,7 @@ module Pod
|
|
45
45
|
# @return [String] the foot notes.
|
46
46
|
#
|
47
47
|
def footnote_text
|
48
|
-
'Generated by CocoaPods -
|
48
|
+
'Generated by CocoaPods - https://cocoapods.org'
|
49
49
|
end
|
50
50
|
|
51
51
|
#-----------------------------------------------------------------------#
|
@@ -114,44 +114,51 @@ realpath() {
|
|
114
114
|
|
115
115
|
install_resource()
|
116
116
|
{
|
117
|
-
|
117
|
+
if [[ "$1" = /* ]] ; then
|
118
|
+
RESOURCE_PATH="$1"
|
119
|
+
else
|
120
|
+
RESOURCE_PATH="${PODS_ROOT}/$1"
|
121
|
+
fi
|
122
|
+
if [[ ! -e "$RESOURCE_PATH" ]] ; then
|
123
|
+
cat << EOM
|
124
|
+
error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
|
125
|
+
EOM
|
126
|
+
exit 1
|
127
|
+
fi
|
128
|
+
case $RESOURCE_PATH in
|
118
129
|
*\.storyboard)
|
119
|
-
echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$
|
120
|
-
ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$
|
130
|
+
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$RESOURCE_PATH\\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT}"
|
131
|
+
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$RESOURCE_PATH\\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}"
|
121
132
|
;;
|
122
133
|
*\.xib)
|
123
|
-
echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$
|
124
|
-
ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$
|
134
|
+
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$RESOURCE_PATH\\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT}"
|
135
|
+
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$RESOURCE_PATH\\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}"
|
125
136
|
;;
|
126
137
|
*.framework)
|
127
138
|
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
128
139
|
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
129
|
-
echo "rsync -av $
|
130
|
-
rsync -av "$
|
140
|
+
echo "rsync -av $RESOURCE_PATH ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
141
|
+
rsync -av "$RESOURCE_PATH" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
131
142
|
;;
|
132
143
|
*.xcdatamodel)
|
133
|
-
echo "xcrun momc \\"$
|
134
|
-
xcrun momc "$
|
144
|
+
echo "xcrun momc \\"$RESOURCE_PATH\\" \\"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\\""
|
145
|
+
xcrun momc "$RESOURCE_PATH" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
|
135
146
|
;;
|
136
147
|
*.xcdatamodeld)
|
137
|
-
echo "xcrun momc \\"$
|
138
|
-
xcrun momc "$
|
148
|
+
echo "xcrun momc \\"$RESOURCE_PATH\\" \\"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\\""
|
149
|
+
xcrun momc "$RESOURCE_PATH" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
|
139
150
|
;;
|
140
151
|
*.xcmappingmodel)
|
141
|
-
echo "xcrun mapc \\"$
|
142
|
-
xcrun mapc "$
|
152
|
+
echo "xcrun mapc \\"$RESOURCE_PATH\\" \\"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\\""
|
153
|
+
xcrun mapc "$RESOURCE_PATH" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
|
143
154
|
;;
|
144
155
|
*.xcassets)
|
145
|
-
ABSOLUTE_XCASSET_FILE=$(realpath "$
|
156
|
+
ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH")
|
146
157
|
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
|
147
158
|
;;
|
148
|
-
/*)
|
149
|
-
echo "$1"
|
150
|
-
echo "$1" >> "$RESOURCES_TO_COPY"
|
151
|
-
;;
|
152
159
|
*)
|
153
|
-
echo "$
|
154
|
-
echo "$
|
160
|
+
echo "$RESOURCE_PATH"
|
161
|
+
echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
|
155
162
|
;;
|
156
163
|
esac
|
157
164
|
}
|
@@ -195,7 +202,7 @@ then
|
|
195
202
|
fi
|
196
203
|
done <<<"$OTHER_XCASSETS"
|
197
204
|
|
198
|
-
printf "%s\\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${
|
205
|
+
printf "%s\\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
199
206
|
fi
|
200
207
|
EOS
|
201
208
|
end
|
@@ -39,7 +39,8 @@ module Pod
|
|
39
39
|
#
|
40
40
|
def target_version
|
41
41
|
if target && target.respond_to?(:root_spec)
|
42
|
-
target.root_spec.version
|
42
|
+
version = target.root_spec.version
|
43
|
+
[version.major, version.minor, version.patch].join('.')
|
43
44
|
else
|
44
45
|
'1.0.0'
|
45
46
|
end
|
@@ -50,20 +51,35 @@ module Pod
|
|
50
51
|
# @return [String]
|
51
52
|
#
|
52
53
|
def generate
|
53
|
-
|
54
|
+
header + dict + footer
|
54
55
|
end
|
55
56
|
|
56
|
-
|
57
|
+
private
|
58
|
+
|
59
|
+
def header
|
60
|
+
<<-PLIST
|
57
61
|
<?xml version="1.0" encoding="UTF-8"?>
|
58
62
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
59
63
|
<plist version="1.0">
|
60
64
|
<dict>
|
65
|
+
PLIST
|
66
|
+
end
|
67
|
+
|
68
|
+
def footer
|
69
|
+
<<-PLIST
|
70
|
+
</dict>
|
71
|
+
</plist>
|
72
|
+
PLIST
|
73
|
+
end
|
74
|
+
|
75
|
+
def dict
|
76
|
+
dict = <<-PLIST
|
61
77
|
<key>CFBundleDevelopmentRegion</key>
|
62
78
|
<string>en</string>
|
63
79
|
<key>CFBundleExecutable</key>
|
64
80
|
<string>${EXECUTABLE_NAME}</string>
|
65
81
|
<key>CFBundleIdentifier</key>
|
66
|
-
<string
|
82
|
+
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
67
83
|
<key>CFBundleInfoDictionaryVersion</key>
|
68
84
|
<string>6.0</string>
|
69
85
|
<key>CFBundleName</key>
|
@@ -71,16 +87,26 @@ module Pod
|
|
71
87
|
<key>CFBundlePackageType</key>
|
72
88
|
<string>FMWK</string>
|
73
89
|
<key>CFBundleShortVersionString</key>
|
74
|
-
<string
|
90
|
+
<string>#{target_version}</string>
|
75
91
|
<key>CFBundleSignature</key>
|
76
92
|
<string>????</string>
|
77
93
|
<key>CFBundleVersion</key>
|
78
94
|
<string>${CURRENT_PROJECT_VERSION}</string>
|
79
95
|
<key>NSPrincipalClass</key>
|
80
96
|
<string></string>
|
81
|
-
|
82
|
-
|
83
|
-
|
97
|
+
PLIST
|
98
|
+
|
99
|
+
if target.platform.name == :tvos
|
100
|
+
dict << <<-PLIST
|
101
|
+
<key>UIRequiredDeviceCapabilities</key>
|
102
|
+
<array>
|
103
|
+
<string>arm64</string>
|
104
|
+
</array>
|
105
|
+
PLIST
|
106
|
+
end
|
107
|
+
|
108
|
+
dict
|
109
|
+
end
|
84
110
|
end
|
85
111
|
end
|
86
112
|
end
|
@@ -10,17 +10,12 @@ module Pod
|
|
10
10
|
#
|
11
11
|
attr_reader :target
|
12
12
|
|
13
|
-
# @return [Array<#to_s>] the private headers of the module
|
14
|
-
#
|
15
|
-
attr_accessor :private_headers
|
16
|
-
|
17
13
|
# Initialize a new instance
|
18
14
|
#
|
19
15
|
# @param [PodTarget] target @see target
|
20
16
|
#
|
21
17
|
def initialize(target)
|
22
18
|
@target = target
|
23
|
-
@private_headers = []
|
24
19
|
end
|
25
20
|
|
26
21
|
# Generates and saves the Info.plist to the given path.
|
@@ -42,24 +37,14 @@ module Pod
|
|
42
37
|
# @return [String]
|
43
38
|
#
|
44
39
|
def generate
|
45
|
-
|
40
|
+
<<-MODULE_MAP.strip_heredoc
|
46
41
|
framework module #{target.product_module_name} {
|
47
42
|
umbrella header "#{target.umbrella_header_path.basename}"
|
48
43
|
|
49
44
|
export *
|
50
45
|
module * { export * }
|
51
|
-
|
52
|
-
|
53
|
-
result << "\n#{generate_private_header_exports}" unless private_headers.empty?
|
54
|
-
result << "}\n"
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
def generate_private_header_exports
|
60
|
-
private_headers.reduce('') do |string, header|
|
61
|
-
string << %( private header "#{header}"\n)
|
62
|
-
end
|
46
|
+
}
|
47
|
+
MODULE_MAP
|
63
48
|
end
|
64
49
|
end
|
65
50
|
end
|
@@ -87,15 +87,12 @@ module Pod
|
|
87
87
|
|
88
88
|
#---------------------------------------------------------------------#
|
89
89
|
|
90
|
-
|
90
|
+
protected
|
91
91
|
|
92
|
-
#
|
93
|
-
#
|
94
|
-
# - `#import <…>`
|
95
|
-
# - `#import "…"`
|
96
|
-
# - `@import …;` / `import …`
|
92
|
+
# @return [Hash<String, String>] the build settings necessary to import
|
93
|
+
# the pod targets.
|
97
94
|
#
|
98
|
-
def
|
95
|
+
def settings_to_import_pod_targets
|
99
96
|
if target.requires_frameworks?
|
100
97
|
framework_header_search_paths = pod_targets.select(&:should_build?).map do |target|
|
101
98
|
if target.scoped?
|
@@ -118,17 +115,32 @@ module Pod
|
|
118
115
|
if pod_targets.any? { |t| t.should_build? && t.scoped? }
|
119
116
|
build_settings['FRAMEWORK_SEARCH_PATHS'] = '"$PODS_FRAMEWORK_BUILD_PATH"'
|
120
117
|
end
|
121
|
-
|
118
|
+
build_settings
|
122
119
|
else
|
123
120
|
# Make headers discoverable from $PODS_ROOT/Headers directory
|
124
121
|
header_search_paths = target.sandbox.public_headers.search_paths(target.platform)
|
125
|
-
|
122
|
+
{
|
126
123
|
# by `#import "…"`
|
127
124
|
'HEADER_SEARCH_PATHS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths),
|
128
125
|
# by `#import <…>`
|
129
126
|
'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths, '-isystem'),
|
130
127
|
}
|
131
|
-
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
private
|
132
|
+
|
133
|
+
# Add build settings, which ensure that the pod targets can be imported
|
134
|
+
# from the integrating target by all sort of imports, which are:
|
135
|
+
# - `#import <…>`
|
136
|
+
# - `#import "…"`
|
137
|
+
# - `@import …;` / `import …`
|
138
|
+
#
|
139
|
+
def generate_settings_to_import_pod_targets
|
140
|
+
@xcconfig.merge!(settings_to_import_pod_targets)
|
141
|
+
target.search_paths_aggregate_targets.each do |search_paths_target|
|
142
|
+
generator = AggregateXCConfig.new(search_paths_target, configuration_name)
|
143
|
+
@xcconfig.merge!(generator.settings_to_import_pod_targets)
|
132
144
|
end
|
133
145
|
end
|
134
146
|
|
@@ -50,7 +50,8 @@ module Pod
|
|
50
50
|
'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(search_paths),
|
51
51
|
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
|
52
52
|
'SKIP_INSTALL' => 'YES',
|
53
|
-
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) '
|
53
|
+
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) ',
|
54
|
+
'PRODUCT_BUNDLE_IDENTIFIER' => 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}',
|
54
55
|
# 'USE_HEADERMAP' => 'NO'
|
55
56
|
}
|
56
57
|
|
@@ -153,7 +153,8 @@ module Pod
|
|
153
153
|
# The path retrieved from Sandbox#root.
|
154
154
|
#
|
155
155
|
def self.add_library_build_settings(library_path, xcconfig, sandbox_root)
|
156
|
-
|
156
|
+
extension = File.extname(library_path)
|
157
|
+
name = File.basename(library_path, extension).sub(/\Alib/, '')
|
157
158
|
dirname = '${PODS_ROOT}/' + library_path.dirname.relative_path_from(sandbox_root).to_s
|
158
159
|
build_settings = {
|
159
160
|
'OTHER_LDFLAGS' => "-l#{name}",
|
@@ -44,11 +44,9 @@ module Pod
|
|
44
44
|
#
|
45
45
|
def initialize(name, plugin_name, block)
|
46
46
|
raise ArgumentError, 'Missing name' unless name
|
47
|
+
raise ArgumentError, 'Missing plugin_name' unless plugin_name
|
47
48
|
raise ArgumentError, 'Missing block' unless block
|
48
49
|
|
49
|
-
UI.warn '[Hooks] The use of hooks without specifying a `plugin_name` ' \
|
50
|
-
"has been deprecated (from file `#{block.binding.eval('File.expand_path __FILE__')}`)." unless plugin_name
|
51
|
-
|
52
50
|
@name = name
|
53
51
|
@plugin_name = plugin_name
|
54
52
|
@block = block
|
@@ -72,13 +70,7 @@ module Pod
|
|
72
70
|
# @param [Proc] block
|
73
71
|
# The block.
|
74
72
|
#
|
75
|
-
def register(plugin_name, hook_name
|
76
|
-
# TODO: Backwards compatibility with nameless plugins from CP 0.34
|
77
|
-
if hook_name.nil?
|
78
|
-
hook_name = plugin_name
|
79
|
-
plugin_name = nil
|
80
|
-
end
|
81
|
-
|
73
|
+
def register(plugin_name, hook_name, &block)
|
82
74
|
@registrations ||= {}
|
83
75
|
@registrations[hook_name] ||= []
|
84
76
|
@registrations[hook_name] << Hook.new(hook_name, plugin_name, block)
|
@@ -108,7 +100,7 @@ module Pod
|
|
108
100
|
UI.message "- Running #{name.to_s.tr('_', ' ')} hooks" do
|
109
101
|
hooks.each do |hook|
|
110
102
|
next if whitelisted_plugins && !whitelisted_plugins.key?(hook.plugin_name)
|
111
|
-
UI.message "- #{hook.plugin_name
|
103
|
+
UI.message "- #{hook.plugin_name} from " \
|
112
104
|
"`#{hook.block.source_location.first}`" do
|
113
105
|
block = hook.block
|
114
106
|
if block.arity > 1
|
data/lib/cocoapods/installer.rb
CHANGED
@@ -32,6 +32,7 @@ module Pod
|
|
32
32
|
autoload :AggregateTargetInstaller, 'cocoapods/installer/target_installer/aggregate_target_installer'
|
33
33
|
autoload :Analyzer, 'cocoapods/installer/analyzer'
|
34
34
|
autoload :FileReferencesInstaller, 'cocoapods/installer/file_references_installer'
|
35
|
+
autoload :InstallationOptions, 'cocoapods/installer/installation_options'
|
35
36
|
autoload :PostInstallHooksContext, 'cocoapods/installer/post_install_hooks_context'
|
36
37
|
autoload :PreInstallHooksContext, 'cocoapods/installer/pre_install_hooks_context'
|
37
38
|
autoload :SourceProviderHooksContext, 'cocoapods/installer/source_provider_hooks_context'
|
@@ -44,6 +45,9 @@ module Pod
|
|
44
45
|
autoload :UserProjectIntegrator, 'cocoapods/installer/user_project_integrator'
|
45
46
|
|
46
47
|
include Config::Mixin
|
48
|
+
include InstallationOptions::Mixin
|
49
|
+
|
50
|
+
delegate_installation_options { podfile }
|
47
51
|
|
48
52
|
# @return [Sandbox] The sandbox where the Pods should be installed.
|
49
53
|
#
|
@@ -109,12 +113,19 @@ module Pod
|
|
109
113
|
verify_no_static_framework_transitive_dependencies
|
110
114
|
verify_framework_usage
|
111
115
|
generate_pods_project
|
112
|
-
integrate_user_project if
|
116
|
+
integrate_user_project if installation_options.integrate_targets?
|
113
117
|
perform_post_install_actions
|
114
118
|
end
|
115
119
|
|
116
120
|
def prepare
|
121
|
+
# Raise if pwd is inside Pods
|
122
|
+
if Dir.pwd.start_with?(sandbox.root.to_path)
|
123
|
+
message = 'Command should be run from a directory outside Pods directory.'
|
124
|
+
message << "\n\n\tCurrent directory is #{UI.path(Pathname.pwd)}\n"
|
125
|
+
raise Informative, message
|
126
|
+
end
|
117
127
|
UI.message 'Preparing' do
|
128
|
+
deintegrate_if_different_major_version
|
118
129
|
sandbox.prepare
|
119
130
|
ensure_plugins_are_installed!
|
120
131
|
Migrator.migrate(sandbox)
|
@@ -135,7 +146,6 @@ module Pod
|
|
135
146
|
UI.section 'Analyzing dependencies' do
|
136
147
|
analyze(analyzer)
|
137
148
|
validate_build_configurations
|
138
|
-
prepare_for_legacy_compatibility
|
139
149
|
clean_sandbox
|
140
150
|
end
|
141
151
|
end
|
@@ -215,7 +225,9 @@ module Pod
|
|
215
225
|
end
|
216
226
|
|
217
227
|
def create_analyzer
|
218
|
-
Analyzer.new(sandbox, podfile, lockfile)
|
228
|
+
Analyzer.new(sandbox, podfile, lockfile).tap do |analyzer|
|
229
|
+
analyzer.installation_options = installation_options
|
230
|
+
end
|
219
231
|
end
|
220
232
|
|
221
233
|
# Ensures that the white-listed build configurations are known to prevent
|
@@ -237,17 +249,6 @@ module Pod
|
|
237
249
|
end
|
238
250
|
end
|
239
251
|
|
240
|
-
# Prepares the Pods folder in order to be compatible with the most recent
|
241
|
-
# version of CocoaPods.
|
242
|
-
#
|
243
|
-
# @return [void]
|
244
|
-
#
|
245
|
-
def prepare_for_legacy_compatibility
|
246
|
-
# move_target_support_files_if_needed
|
247
|
-
# move_Local_Podspecs_to_Podspecs_if_needed
|
248
|
-
# move_pods_to_sources_folder_if_needed
|
249
|
-
end
|
250
|
-
|
251
252
|
# @return [void] In this step we clean all the folders that will be
|
252
253
|
# regenerated from scratch and any file which might not be
|
253
254
|
# overwritten.
|
@@ -323,7 +324,7 @@ module Pod
|
|
323
324
|
end
|
324
325
|
|
325
326
|
@pod_installers ||= []
|
326
|
-
pod_installer = PodSourceInstaller.new(sandbox, specs_by_platform)
|
327
|
+
pod_installer = PodSourceInstaller.new(sandbox, specs_by_platform, :can_cache => installation_options.clean?)
|
327
328
|
@pod_installers << pod_installer
|
328
329
|
pod_installer
|
329
330
|
end
|
@@ -345,7 +346,7 @@ module Pod
|
|
345
346
|
# @todo Why the @pod_installers might be empty?
|
346
347
|
#
|
347
348
|
def clean_pod_sources
|
348
|
-
return unless
|
349
|
+
return unless installation_options.clean?
|
349
350
|
return unless @pod_installers
|
350
351
|
@pod_installers.each(&:clean!)
|
351
352
|
end
|
@@ -367,7 +368,7 @@ module Pod
|
|
367
368
|
# @todo Why the @pod_installers might be empty?
|
368
369
|
#
|
369
370
|
def lock_pod_sources
|
370
|
-
return unless
|
371
|
+
return unless installation_options.lock_pod_sources?
|
371
372
|
return unless @pod_installers
|
372
373
|
@pod_installers.each do |installer|
|
373
374
|
pod_target = pod_targets.find { |target| target.pod_name == installer.name }
|
@@ -386,6 +387,7 @@ module Pod
|
|
386
387
|
aggregate_targets.each do |aggregate_target|
|
387
388
|
aggregate_target.pod_targets.each do |pod_target|
|
388
389
|
pod_target.host_requires_frameworks ||= aggregate_target.requires_frameworks?
|
390
|
+
pod_target.platform = nil # needs to be recomputed
|
389
391
|
end
|
390
392
|
end
|
391
393
|
end
|
@@ -394,7 +396,7 @@ module Pod
|
|
394
396
|
aggregate_targets.each do |aggregate_target|
|
395
397
|
aggregate_target.user_build_configurations.keys.each do |config|
|
396
398
|
pod_targets = aggregate_target.pod_targets_for_build_configuration(config)
|
397
|
-
vendored_frameworks = pod_targets.flat_map(&:file_accessors).flat_map(&:vendored_frameworks)
|
399
|
+
vendored_frameworks = pod_targets.flat_map(&:file_accessors).flat_map(&:vendored_frameworks).uniq
|
398
400
|
frameworks = vendored_frameworks.map { |fw| fw.basename('.framework') }
|
399
401
|
frameworks += pod_targets.select { |pt| pt.should_build? && pt.requires_frameworks? }.map(&:product_module_name)
|
400
402
|
|
@@ -491,6 +493,25 @@ module Pod
|
|
491
493
|
context.sources
|
492
494
|
end
|
493
495
|
|
496
|
+
# Run the deintegrator against all projects in the installation root if the
|
497
|
+
# current CocoaPods major version part is different than the one in the
|
498
|
+
# lockfile.
|
499
|
+
#
|
500
|
+
# @return [void]
|
501
|
+
#
|
502
|
+
def deintegrate_if_different_major_version
|
503
|
+
return unless lockfile
|
504
|
+
return if lockfile.cocoapods_version.major == Version.create(VERSION).major
|
505
|
+
UI.section('Fully deintegrating due to major version update') do
|
506
|
+
projects = Pathname.glob(config.installation_root + '*.xcodeproj').map { |path| Xcodeproj::Project.open(path) }
|
507
|
+
deintegrator = Deintegrator.new
|
508
|
+
projects.sort.each do |project|
|
509
|
+
deintegrator.deintegrate_project(project)
|
510
|
+
project.save if project.dirty?
|
511
|
+
end
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|
494
515
|
# Ensures that all plugins specified in the {#podfile} are loaded.
|
495
516
|
#
|
496
517
|
# @return [void]
|
@@ -548,9 +569,7 @@ module Pod
|
|
548
569
|
#
|
549
570
|
def prepare_pods_project
|
550
571
|
UI.message '- Creating Pods project' do
|
551
|
-
object_version = aggregate_targets.map(&:
|
552
|
-
Xcodeproj::Project.open(path).object_version.to_i
|
553
|
-
end.min
|
572
|
+
object_version = aggregate_targets.map(&:user_project).compact.map { |p| p.object_version.to_i }.min
|
554
573
|
|
555
574
|
if object_version
|
556
575
|
@pods_project = Pod::Project.new(sandbox.project_path, false, object_version)
|
@@ -610,13 +629,13 @@ module Pod
|
|
610
629
|
def install_libraries
|
611
630
|
UI.message '- Installing targets' do
|
612
631
|
pod_targets.sort_by(&:name).each do |pod_target|
|
613
|
-
next if pod_target.target_definitions.
|
632
|
+
next if pod_target.target_definitions.all?(&:abstract?)
|
614
633
|
target_installer = PodTargetInstaller.new(sandbox, pod_target)
|
615
634
|
target_installer.install!
|
616
635
|
end
|
617
636
|
|
618
637
|
aggregate_targets.sort_by(&:name).each do |target|
|
619
|
-
next if target.target_definition.
|
638
|
+
next if target.target_definition.abstract?
|
620
639
|
target_installer = AggregateTargetInstaller.new(sandbox, target)
|
621
640
|
target_installer.install!
|
622
641
|
end
|
@@ -643,7 +662,8 @@ module Pod
|
|
643
662
|
frameworks_group = pods_project.frameworks_group
|
644
663
|
aggregate_targets.each do |aggregate_target|
|
645
664
|
is_app_extension = !(aggregate_target.user_targets.map(&:symbol_type) &
|
646
|
-
[:app_extension, :watch_extension, :watch2_extension]).empty?
|
665
|
+
[:app_extension, :watch_extension, :watch2_extension, :tv_extension]).empty?
|
666
|
+
is_app_extension ||= aggregate_target.user_targets.any? { |ut| ut.common_resolved_build_setting('APPLICATION_EXTENSION_API_ONLY') == 'YES' }
|
647
667
|
|
648
668
|
aggregate_target.pod_targets.each do |pod_target|
|
649
669
|
configure_app_extension_api_only_for_target(aggregate_target) if is_app_extension
|
@@ -692,7 +712,7 @@ module Pod
|
|
692
712
|
pods_project.development_pods.remove_from_project if pods_project.development_pods.empty?
|
693
713
|
pods_project.sort(:groups_position => :below)
|
694
714
|
pods_project.recreate_user_schemes(false)
|
695
|
-
if
|
715
|
+
if installation_options.deterministic_uuids?
|
696
716
|
UI.message('- Generating deterministic UUIDs') { pods_project.predictabilize_uuids }
|
697
717
|
end
|
698
718
|
pods_project.save
|