cocoapods-tt 0.0.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 +7 -0
- data/lib/cocoapods-tt/command/native/install.rb +56 -0
- data/lib/cocoapods-tt/command/native/update.rb +157 -0
- data/lib/cocoapods-tt/command/tt/make.rb +92 -0
- data/lib/cocoapods-tt/command/tt.rb +115 -0
- data/lib/cocoapods-tt/command.rb +1 -0
- data/lib/cocoapods-tt/gem_version.rb +3 -0
- data/lib/cocoapods-tt/native/command.rb +185 -0
- data/lib/cocoapods-tt/native/config.rb +366 -0
- data/lib/cocoapods-tt/native/core_overrides.rb +1 -0
- data/lib/cocoapods-tt/native/downloader/cache.rb +322 -0
- data/lib/cocoapods-tt/native/downloader/request.rb +86 -0
- data/lib/cocoapods-tt/native/downloader/response.rb +16 -0
- data/lib/cocoapods-tt/native/downloader.rb +192 -0
- data/lib/cocoapods-tt/native/executable.rb +247 -0
- data/lib/cocoapods-tt/native/external_sources/abstract_external_source.rb +205 -0
- data/lib/cocoapods-tt/native/external_sources/downloader_source.rb +30 -0
- data/lib/cocoapods-tt/native/external_sources/path_source.rb +55 -0
- data/lib/cocoapods-tt/native/external_sources/podspec_source.rb +54 -0
- data/lib/cocoapods-tt/native/external_sources.rb +57 -0
- data/lib/cocoapods-tt/native/gem_version.rb +5 -0
- data/lib/cocoapods-tt/native/generator/acknowledgements/markdown.rb +44 -0
- data/lib/cocoapods-tt/native/generator/acknowledgements/plist.rb +94 -0
- data/lib/cocoapods-tt/native/generator/acknowledgements.rb +107 -0
- data/lib/cocoapods-tt/native/generator/app_target_helper.rb +363 -0
- data/lib/cocoapods-tt/native/generator/bridge_support.rb +22 -0
- data/lib/cocoapods-tt/native/generator/constant.rb +19 -0
- data/lib/cocoapods-tt/native/generator/copy_dsyms_script.rb +56 -0
- data/lib/cocoapods-tt/native/generator/copy_resources_script.rb +223 -0
- data/lib/cocoapods-tt/native/generator/copy_xcframework_script.rb +227 -0
- data/lib/cocoapods-tt/native/generator/dummy_source.rb +31 -0
- data/lib/cocoapods-tt/native/generator/embed_frameworks_script.rb +196 -0
- data/lib/cocoapods-tt/native/generator/file_list.rb +39 -0
- data/lib/cocoapods-tt/native/generator/header.rb +103 -0
- data/lib/cocoapods-tt/native/generator/info_plist_file.rb +128 -0
- data/lib/cocoapods-tt/native/generator/module_map.rb +99 -0
- data/lib/cocoapods-tt/native/generator/prefix_header.rb +60 -0
- data/lib/cocoapods-tt/native/generator/script_phase_constants.rb +100 -0
- data/lib/cocoapods-tt/native/generator/umbrella_header.rb +46 -0
- data/lib/cocoapods-tt/native/hooks_manager.rb +132 -0
- data/lib/cocoapods-tt/native/installer/analyzer/analysis_result.rb +87 -0
- data/lib/cocoapods-tt/native/installer/analyzer/locking_dependency_analyzer.rb +103 -0
- data/lib/cocoapods-tt/native/installer/analyzer/pod_variant.rb +87 -0
- data/lib/cocoapods-tt/native/installer/analyzer/pod_variant_set.rb +175 -0
- data/lib/cocoapods-tt/native/installer/analyzer/podfile_dependency_cache.rb +55 -0
- data/lib/cocoapods-tt/native/installer/analyzer/sandbox_analyzer.rb +268 -0
- data/lib/cocoapods-tt/native/installer/analyzer/specs_state.rb +108 -0
- data/lib/cocoapods-tt/native/installer/analyzer/target_inspection_result.rb +58 -0
- data/lib/cocoapods-tt/native/installer/analyzer/target_inspector.rb +258 -0
- data/lib/cocoapods-tt/native/installer/analyzer.rb +1204 -0
- data/lib/cocoapods-tt/native/installer/base_install_hooks_context.rb +135 -0
- data/lib/cocoapods-tt/native/installer/installation_options.rb +195 -0
- data/lib/cocoapods-tt/native/installer/pod_source_installer.rb +224 -0
- data/lib/cocoapods-tt/native/installer/pod_source_preparer.rb +77 -0
- data/lib/cocoapods-tt/native/installer/podfile_validator.rb +168 -0
- data/lib/cocoapods-tt/native/installer/post_install_hooks_context.rb +9 -0
- data/lib/cocoapods-tt/native/installer/post_integrate_hooks_context.rb +9 -0
- data/lib/cocoapods-tt/native/installer/pre_install_hooks_context.rb +51 -0
- data/lib/cocoapods-tt/native/installer/pre_integrate_hooks_context.rb +9 -0
- data/lib/cocoapods-tt/native/installer/project_cache/project_cache.rb +11 -0
- data/lib/cocoapods-tt/native/installer/project_cache/project_cache_analysis_result.rb +53 -0
- data/lib/cocoapods-tt/native/installer/project_cache/project_cache_analyzer.rb +200 -0
- data/lib/cocoapods-tt/native/installer/project_cache/project_cache_version.rb +43 -0
- data/lib/cocoapods-tt/native/installer/project_cache/project_installation_cache.rb +103 -0
- data/lib/cocoapods-tt/native/installer/project_cache/project_metadata_cache.rb +73 -0
- data/lib/cocoapods-tt/native/installer/project_cache/target_cache_key.rb +176 -0
- data/lib/cocoapods-tt/native/installer/project_cache/target_metadata.rb +74 -0
- data/lib/cocoapods-tt/native/installer/sandbox_dir_cleaner.rb +105 -0
- data/lib/cocoapods-tt/native/installer/sandbox_header_paths_installer.rb +45 -0
- data/lib/cocoapods-tt/native/installer/source_provider_hooks_context.rb +34 -0
- data/lib/cocoapods-tt/native/installer/target_uuid_generator.rb +34 -0
- data/lib/cocoapods-tt/native/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +179 -0
- data/lib/cocoapods-tt/native/installer/user_project_integrator/target_integrator.rb +815 -0
- data/lib/cocoapods-tt/native/installer/user_project_integrator.rb +280 -0
- data/lib/cocoapods-tt/native/installer/xcode/multi_pods_project_generator.rb +82 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/aggregate_target_dependency_installer.rb +66 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/aggregate_target_installer.rb +192 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/app_host_installer.rb +154 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/file_references_installer.rb +329 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb +195 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pod_target_installer.rb +1239 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pod_target_integrator.rb +312 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pods_project_writer.rb +90 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/project_generator.rb +120 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/target_installation_result.rb +140 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/target_installer.rb +257 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/target_installer_helper.rb +110 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator.rb +291 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator_result.rb +54 -0
- data/lib/cocoapods-tt/native/installer/xcode/single_pods_project_generator.rb +38 -0
- data/lib/cocoapods-tt/native/installer/xcode/target_validator.rb +170 -0
- data/lib/cocoapods-tt/native/installer/xcode.rb +11 -0
- data/lib/cocoapods-tt/native/installer.rb +1044 -0
- data/lib/cocoapods-tt/native/native_target_extension.rb +60 -0
- data/lib/cocoapods-tt/native/open-uri.rb +33 -0
- data/lib/cocoapods-tt/native/podfile.rb +13 -0
- data/lib/cocoapods-tt/native/project.rb +544 -0
- data/lib/cocoapods-tt/native/resolver/lazy_specification.rb +88 -0
- data/lib/cocoapods-tt/native/resolver/resolver_specification.rb +41 -0
- data/lib/cocoapods-tt/native/resolver.rb +600 -0
- data/lib/cocoapods-tt/native/sandbox/file_accessor.rb +532 -0
- data/lib/cocoapods-tt/native/sandbox/headers_store.rb +163 -0
- data/lib/cocoapods-tt/native/sandbox/path_list.rb +242 -0
- data/lib/cocoapods-tt/native/sandbox/pod_dir_cleaner.rb +71 -0
- data/lib/cocoapods-tt/native/sandbox/podspec_finder.rb +23 -0
- data/lib/cocoapods-tt/native/sandbox.rb +470 -0
- data/lib/cocoapods-tt/native/sources_manager.rb +221 -0
- data/lib/cocoapods-tt/native/target/aggregate_target.rb +558 -0
- data/lib/cocoapods-tt/native/target/build_settings.rb +1385 -0
- data/lib/cocoapods-tt/native/target/pod_target.rb +1168 -0
- data/lib/cocoapods-tt/native/target.rb +378 -0
- data/lib/cocoapods-tt/native/user_interface/error_report.rb +204 -0
- data/lib/cocoapods-tt/native/user_interface/inspector_reporter.rb +102 -0
- data/lib/cocoapods-tt/native/user_interface.rb +463 -0
- data/lib/cocoapods-tt/native/validator.rb +1170 -0
- data/lib/cocoapods-tt/native/version_metadata.rb +26 -0
- data/lib/cocoapods-tt/native/xcode/framework_paths.rb +54 -0
- data/lib/cocoapods-tt/native/xcode/linkage_analyzer.rb +22 -0
- data/lib/cocoapods-tt/native/xcode/xcframework/xcframework_slice.rb +138 -0
- data/lib/cocoapods-tt/native/xcode/xcframework.rb +99 -0
- data/lib/cocoapods-tt/native/xcode.rb +7 -0
- data/lib/cocoapods-tt.rb +1 -0
- data/lib/cocoapods_plugin.rb +17 -0
- metadata +193 -0
@@ -0,0 +1,128 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
# Generates Info.plist files. A Info.plist file is generated for each
|
4
|
+
# Pod and for each Pod target definition, that requires to be built as
|
5
|
+
# framework. It states public attributes.
|
6
|
+
#
|
7
|
+
class InfoPlistFile
|
8
|
+
# @return [String] version The version to use for when generating this Info.plist file.
|
9
|
+
#
|
10
|
+
attr_reader :version
|
11
|
+
|
12
|
+
# @return [Platform] The platform to use for when generating this Info.plist file.
|
13
|
+
#
|
14
|
+
attr_reader :platform
|
15
|
+
|
16
|
+
# @return [Symbol] the CFBundlePackageType of the target this Info.plist
|
17
|
+
# file is for.
|
18
|
+
#
|
19
|
+
attr_reader :bundle_package_type
|
20
|
+
|
21
|
+
# @return [Hash] any additional entries to include in this Info.plist
|
22
|
+
#
|
23
|
+
attr_reader :additional_entries
|
24
|
+
|
25
|
+
# Initialize a new instance
|
26
|
+
#
|
27
|
+
# @param [String] version @see #version
|
28
|
+
# @param [Platform] platform @see #platform
|
29
|
+
# @param [Symbol] bundle_package_type @see #bundle_package_type
|
30
|
+
# @param [Hash] additional_entries @see #additional_entries
|
31
|
+
#
|
32
|
+
def initialize(version, platform, bundle_package_type = :fmwk, additional_entries = {})
|
33
|
+
@version = version
|
34
|
+
@platform = platform
|
35
|
+
@bundle_package_type = bundle_package_type
|
36
|
+
@additional_entries = additional_entries
|
37
|
+
end
|
38
|
+
|
39
|
+
# Generates and saves the Info.plist to the given path.
|
40
|
+
#
|
41
|
+
# @param [Pathname] path
|
42
|
+
# the path where the prefix header should be stored.
|
43
|
+
#
|
44
|
+
# @return [void]
|
45
|
+
#
|
46
|
+
def save_as(path)
|
47
|
+
contents = generate
|
48
|
+
path.open('w') do |f|
|
49
|
+
f.write(contents)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Generates the contents of the Info.plist
|
54
|
+
#
|
55
|
+
# @return [String]
|
56
|
+
#
|
57
|
+
def generate
|
58
|
+
to_plist(info)
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def header
|
64
|
+
<<-PLIST
|
65
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
66
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
67
|
+
<plist version="1.0">
|
68
|
+
PLIST
|
69
|
+
end
|
70
|
+
|
71
|
+
def footer
|
72
|
+
<<-PLIST
|
73
|
+
</plist>
|
74
|
+
PLIST
|
75
|
+
end
|
76
|
+
|
77
|
+
def to_plist(root)
|
78
|
+
serialize(root, header) << footer
|
79
|
+
end
|
80
|
+
|
81
|
+
def serialize(value, output, indentation = 0)
|
82
|
+
indent = ' ' * indentation
|
83
|
+
case value
|
84
|
+
when Array
|
85
|
+
output << indent << "<array>\n"
|
86
|
+
value.each { |v| serialize(v, output, indentation + 2) }
|
87
|
+
output << indent << "</array>\n"
|
88
|
+
when Hash
|
89
|
+
output << indent << "<dict>\n"
|
90
|
+
value.to_a.sort_by(&:first).each do |key, v|
|
91
|
+
output << indent << ' ' << "<key>#{key}</key>\n"
|
92
|
+
serialize(v, output, indentation + 2)
|
93
|
+
end
|
94
|
+
output << indent << "</dict>\n"
|
95
|
+
when String
|
96
|
+
output << indent << "<string>#{value}</string>\n"
|
97
|
+
when true
|
98
|
+
output << indent << "<true/>\n"
|
99
|
+
when false
|
100
|
+
output << indent << "<false/>\n"
|
101
|
+
end
|
102
|
+
output
|
103
|
+
end
|
104
|
+
|
105
|
+
def info
|
106
|
+
info = {
|
107
|
+
'CFBundleIdentifier' => '${PRODUCT_BUNDLE_IDENTIFIER}',
|
108
|
+
'CFBundleInfoDictionaryVersion' => '6.0',
|
109
|
+
'CFBundleName' => '${PRODUCT_NAME}',
|
110
|
+
'CFBundlePackageType' => bundle_package_type.to_s.upcase,
|
111
|
+
'CFBundleShortVersionString' => version,
|
112
|
+
'CFBundleSignature' => '????',
|
113
|
+
'CFBundleVersion' => '${CURRENT_PROJECT_VERSION}',
|
114
|
+
'NSPrincipalClass' => '',
|
115
|
+
'CFBundleDevelopmentRegion' => 'en',
|
116
|
+
}
|
117
|
+
|
118
|
+
info['CFBundleExecutable'] = '${EXECUTABLE_NAME}' if bundle_package_type != :bndl
|
119
|
+
info['CFBundleVersion'] = '1' if bundle_package_type == :bndl
|
120
|
+
info['NSPrincipalClass'] = 'NSApplication' if bundle_package_type == :appl && platform == :osx
|
121
|
+
|
122
|
+
info.merge!(additional_entries)
|
123
|
+
|
124
|
+
info
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
# Generates LLVM module map files. A module map file is generated for each
|
4
|
+
# Pod and for each Pod target definition that is built as a framework. It
|
5
|
+
# specifies a different umbrella header than usual to avoid name conflicts
|
6
|
+
# with existing headers of the podspec.
|
7
|
+
#
|
8
|
+
class ModuleMap
|
9
|
+
# @return [PodTarget, AggregateTarget] the target the module map is generated for.
|
10
|
+
#
|
11
|
+
attr_reader :target
|
12
|
+
|
13
|
+
attr_reader :headers
|
14
|
+
|
15
|
+
Header = Struct.new(:path, :umbrella, :private, :textual, :exclude, :size, :mtime) do
|
16
|
+
alias_method :private?, :private
|
17
|
+
def to_s
|
18
|
+
[
|
19
|
+
(:private if private?),
|
20
|
+
(:textual if textual),
|
21
|
+
(:umbrella if umbrella),
|
22
|
+
(:exclude if exclude),
|
23
|
+
'header',
|
24
|
+
%("#{path.to_s.gsub('"', '\"')}"),
|
25
|
+
attrs,
|
26
|
+
].compact.join(' ')
|
27
|
+
end
|
28
|
+
|
29
|
+
def attrs
|
30
|
+
attrs = {
|
31
|
+
'size' => size,
|
32
|
+
'mtime' => mtime,
|
33
|
+
}.reject { |_k, v| v.nil? }
|
34
|
+
return nil if attrs.empty?
|
35
|
+
attrs.to_s
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Initialize a new instance
|
40
|
+
#
|
41
|
+
# @param [PodTarget, AggregateTarget] target @see target
|
42
|
+
#
|
43
|
+
def initialize(target)
|
44
|
+
@target = target
|
45
|
+
@headers = [
|
46
|
+
Header.new(target.umbrella_header_path.basename, true),
|
47
|
+
]
|
48
|
+
end
|
49
|
+
|
50
|
+
# Generates and saves the Info.plist to the given path.
|
51
|
+
#
|
52
|
+
# @param [Pathname] path
|
53
|
+
# the path where the prefix header should be stored.
|
54
|
+
#
|
55
|
+
# @return [void]
|
56
|
+
#
|
57
|
+
def save_as(path)
|
58
|
+
contents = generate
|
59
|
+
path.open('w') do |f|
|
60
|
+
f.write(contents)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Generates the contents of the module.modulemap file.
|
65
|
+
#
|
66
|
+
# @return [String]
|
67
|
+
#
|
68
|
+
def generate
|
69
|
+
<<-MODULE_MAP.strip_heredoc
|
70
|
+
#{module_specifier_prefix}module #{target.product_module_name}#{module_declaration_attributes} {
|
71
|
+
#{headers.join("\n ")}
|
72
|
+
|
73
|
+
export *
|
74
|
+
module * { export * }
|
75
|
+
}
|
76
|
+
MODULE_MAP
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
# The prefix to `module` to prepend in the module map.
|
82
|
+
# Ensures that only framework targets have `framework` prepended.
|
83
|
+
#
|
84
|
+
def module_specifier_prefix
|
85
|
+
if target.build_as_framework?
|
86
|
+
'framework '
|
87
|
+
else
|
88
|
+
''
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# The suffix attributes to `module`.
|
93
|
+
#
|
94
|
+
def module_declaration_attributes
|
95
|
+
''
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
# Generates a prefix header file for a Pods library. The prefix header is
|
4
|
+
# generated according to the platform of the target and the pods.
|
5
|
+
#
|
6
|
+
# According to the platform the prefix header imports `UIKit/UIKit.h` or
|
7
|
+
# `Cocoa/Cocoa.h`.
|
8
|
+
#
|
9
|
+
class PrefixHeader < Header
|
10
|
+
# @return [Array<FileAccessor>] The file accessors for which to generate
|
11
|
+
# the prefix header.
|
12
|
+
#
|
13
|
+
attr_reader :file_accessors
|
14
|
+
|
15
|
+
# Initialize a new instance
|
16
|
+
#
|
17
|
+
# @param [Array<FileAccessor>] file_accessors
|
18
|
+
# @see #file_accessors
|
19
|
+
#
|
20
|
+
# @param [Platform] platform
|
21
|
+
# @see Header#platform
|
22
|
+
#
|
23
|
+
def initialize(file_accessors, platform)
|
24
|
+
@file_accessors = file_accessors
|
25
|
+
super platform
|
26
|
+
end
|
27
|
+
|
28
|
+
# Generates the contents of the prefix header according to the platform
|
29
|
+
# and the pods.
|
30
|
+
#
|
31
|
+
# @note Only unique prefix_header_contents are added to the prefix
|
32
|
+
# header.
|
33
|
+
#
|
34
|
+
# @return [String]
|
35
|
+
#
|
36
|
+
# @todo Subspecs can specify prefix header information too.
|
37
|
+
# @todo Check to see if we have a similar duplication issue with
|
38
|
+
# file_accessor.prefix_header.
|
39
|
+
#
|
40
|
+
def generate
|
41
|
+
result = super
|
42
|
+
|
43
|
+
unique_prefix_header_contents = file_accessors.map do |file_accessor|
|
44
|
+
file_accessor.spec_consumer.prefix_header_contents
|
45
|
+
end.compact.uniq
|
46
|
+
|
47
|
+
unique_prefix_header_contents.each do |prefix_header_contents|
|
48
|
+
result << prefix_header_contents
|
49
|
+
result << "\n"
|
50
|
+
end
|
51
|
+
|
52
|
+
file_accessors.map(&:prefix_header).compact.uniq.each do |prefix_header|
|
53
|
+
result << Pathname(prefix_header).read
|
54
|
+
end
|
55
|
+
|
56
|
+
result
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
module ScriptPhaseConstants
|
4
|
+
DEFAULT_SCRIPT_PHASE_HEADER = <<-SH.strip_heredoc.freeze
|
5
|
+
#!/bin/sh
|
6
|
+
set -e
|
7
|
+
set -u
|
8
|
+
set -o pipefail
|
9
|
+
|
10
|
+
function on_error {
|
11
|
+
echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
|
12
|
+
}
|
13
|
+
trap 'on_error $LINENO' ERR
|
14
|
+
SH
|
15
|
+
|
16
|
+
RSYNC_PROTECT_TMP_FILES = <<-SH.strip_heredoc.freeze
|
17
|
+
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
18
|
+
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
19
|
+
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
20
|
+
SH
|
21
|
+
|
22
|
+
STRIP_INVALID_ARCHITECTURES_METHOD = <<-SH.strip_heredoc.freeze
|
23
|
+
# Used as a return value for each invocation of `strip_invalid_archs` function.
|
24
|
+
STRIP_BINARY_RETVAL=0
|
25
|
+
|
26
|
+
# Strip invalid architectures
|
27
|
+
strip_invalid_archs() {
|
28
|
+
binary="$1"
|
29
|
+
warn_missing_arch=${2:-true}
|
30
|
+
# Get architectures for current target binary
|
31
|
+
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
|
32
|
+
# Intersect them with the architectures we are building for
|
33
|
+
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\\n' | sort | uniq -d)"
|
34
|
+
# If there are no archs supported by this binary then warn the user
|
35
|
+
if [[ -z "$intersected_archs" ]]; then
|
36
|
+
if [[ "$warn_missing_arch" == "true" ]]; then
|
37
|
+
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
|
38
|
+
fi
|
39
|
+
STRIP_BINARY_RETVAL=1
|
40
|
+
return
|
41
|
+
fi
|
42
|
+
stripped=""
|
43
|
+
for arch in $binary_archs; do
|
44
|
+
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
|
45
|
+
# Strip non-valid architectures in-place
|
46
|
+
lipo -remove "$arch" -output "$binary" "$binary"
|
47
|
+
stripped="$stripped $arch"
|
48
|
+
fi
|
49
|
+
done
|
50
|
+
if [[ "$stripped" ]]; then
|
51
|
+
echo "Stripped $binary of architectures:$stripped"
|
52
|
+
fi
|
53
|
+
STRIP_BINARY_RETVAL=0
|
54
|
+
}
|
55
|
+
SH
|
56
|
+
|
57
|
+
INSTALL_DSYM_METHOD = <<-SH.strip_heredoc.freeze
|
58
|
+
# Copies and strips a vendored dSYM
|
59
|
+
install_dsym() {
|
60
|
+
local source="$1"
|
61
|
+
warn_missing_arch=${2:-true}
|
62
|
+
if [ -r "$source" ]; then
|
63
|
+
# Copy the dSYM into the targets temp dir.
|
64
|
+
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${DERIVED_FILES_DIR}\\""
|
65
|
+
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
|
66
|
+
|
67
|
+
local basename
|
68
|
+
basename="$(basename -s .dSYM "$source")"
|
69
|
+
binary_name="$(ls "$source/Contents/Resources/DWARF")"
|
70
|
+
binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}"
|
71
|
+
|
72
|
+
# Strip invalid architectures from the dSYM.
|
73
|
+
if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then
|
74
|
+
strip_invalid_archs "$binary" "$warn_missing_arch"
|
75
|
+
fi
|
76
|
+
if [[ $STRIP_BINARY_RETVAL == 0 ]]; then
|
77
|
+
# Move the stripped file into its final destination.
|
78
|
+
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\\" \\"${DWARF_DSYM_FOLDER_PATH}\\""
|
79
|
+
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
|
80
|
+
else
|
81
|
+
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
|
82
|
+
mkdir -p "${DWARF_DSYM_FOLDER_PATH}"
|
83
|
+
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM"
|
84
|
+
fi
|
85
|
+
fi
|
86
|
+
}
|
87
|
+
SH
|
88
|
+
|
89
|
+
INSTALL_BCSYMBOLMAP_METHOD = <<-SH.strip_heredoc.freeze
|
90
|
+
# Copies the bcsymbolmap files of a vendored framework
|
91
|
+
install_bcsymbolmap() {
|
92
|
+
local bcsymbolmap_path="$1"
|
93
|
+
local destination="${BUILT_PRODUCTS_DIR}"
|
94
|
+
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${bcsymbolmap_path}\" \"${destination}\""
|
95
|
+
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"
|
96
|
+
}
|
97
|
+
SH
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
# Generates an umbrella header file for clang modules, which are used by
|
4
|
+
# dynamic frameworks on iOS 8 and OSX 10.10 under the hood.
|
5
|
+
#
|
6
|
+
# If the target is a +PodTarget+, then the umbrella header is required
|
7
|
+
# to make all public headers in a convenient manner available without the
|
8
|
+
# need to write out header declarations for every library header.
|
9
|
+
#
|
10
|
+
class UmbrellaHeader < Header
|
11
|
+
# @return [Target]
|
12
|
+
# the target, which provides the product name
|
13
|
+
attr_reader :target
|
14
|
+
|
15
|
+
# Initialize a new instance
|
16
|
+
#
|
17
|
+
# @param [Target] target
|
18
|
+
# @see target
|
19
|
+
#
|
20
|
+
def initialize(target)
|
21
|
+
super(target.platform)
|
22
|
+
@target = target
|
23
|
+
end
|
24
|
+
|
25
|
+
# Generates the contents of the umbrella header according to the included
|
26
|
+
# pods.
|
27
|
+
#
|
28
|
+
# @return [String]
|
29
|
+
#
|
30
|
+
def generate
|
31
|
+
result = super
|
32
|
+
|
33
|
+
result << "\n"
|
34
|
+
|
35
|
+
result << <<-eos.strip_heredoc
|
36
|
+
FOUNDATION_EXPORT double #{target.product_module_name}VersionNumber;
|
37
|
+
FOUNDATION_EXPORT const unsigned char #{target.product_module_name}VersionString[];
|
38
|
+
eos
|
39
|
+
|
40
|
+
result << "\n"
|
41
|
+
|
42
|
+
result
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
# Provides support for the hook system of CocoaPods. The system is designed
|
5
|
+
# especially for plugins. Interested clients can register to notifications by
|
6
|
+
# name.
|
7
|
+
#
|
8
|
+
# The blocks, to prevent compatibility issues, will receive
|
9
|
+
# one and only one argument: a context object. This object should be simple
|
10
|
+
# storage of information (a typed hash). Notifications senders are
|
11
|
+
# responsible to indicate the class of the object associated with their
|
12
|
+
# notification name.
|
13
|
+
#
|
14
|
+
# Context object should not remove attribute accessors to not break
|
15
|
+
# compatibility with the plugins (this promise will be honoured strictly
|
16
|
+
# from CocoaPods 1.0).
|
17
|
+
#
|
18
|
+
module HooksManager
|
19
|
+
# Represents a single registered hook.
|
20
|
+
#
|
21
|
+
class Hook
|
22
|
+
# @return [String]
|
23
|
+
# The name of the plugin that registered the hook.
|
24
|
+
#
|
25
|
+
attr_reader :plugin_name
|
26
|
+
|
27
|
+
# @return [String]
|
28
|
+
# The name of the hook.
|
29
|
+
#
|
30
|
+
attr_reader :name
|
31
|
+
|
32
|
+
# @return [Proc]
|
33
|
+
# The block.
|
34
|
+
#
|
35
|
+
attr_reader :block
|
36
|
+
|
37
|
+
# Initialize a new instance
|
38
|
+
#
|
39
|
+
# @param [String] name @see {#name}.
|
40
|
+
#
|
41
|
+
# @param [String] plugin_name @see {#plugin_name}.
|
42
|
+
#
|
43
|
+
# @param [Proc] block @see {#block}.
|
44
|
+
#
|
45
|
+
def initialize(name, plugin_name, block)
|
46
|
+
raise ArgumentError, 'Missing name' unless name
|
47
|
+
raise ArgumentError, 'Missing plugin_name' unless plugin_name
|
48
|
+
raise ArgumentError, 'Missing block' unless block
|
49
|
+
|
50
|
+
@name = name
|
51
|
+
@plugin_name = plugin_name
|
52
|
+
@block = block
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class << self
|
57
|
+
# @return [Hash{Symbol => Array<Hook>}] The list of the hooks that are
|
58
|
+
# registered for each hook name.
|
59
|
+
#
|
60
|
+
attr_reader :registrations
|
61
|
+
|
62
|
+
# Registers a block for the hook with the given name.
|
63
|
+
#
|
64
|
+
# @param [String] plugin_name
|
65
|
+
# The name of the plugin the hook comes from.
|
66
|
+
#
|
67
|
+
# @param [Symbol] hook_name
|
68
|
+
# The name of the notification.
|
69
|
+
#
|
70
|
+
# @param [Proc] block
|
71
|
+
# The block.
|
72
|
+
#
|
73
|
+
def register(plugin_name, hook_name, &block)
|
74
|
+
@registrations ||= {}
|
75
|
+
@registrations[hook_name] ||= []
|
76
|
+
@registrations[hook_name] << Hook.new(hook_name, plugin_name, block)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Returns all the hooks to run for the given event name
|
80
|
+
# and set of whitelisted plugins
|
81
|
+
#
|
82
|
+
# @see #run
|
83
|
+
#
|
84
|
+
# @return [Array<Hook>] the hooks to run
|
85
|
+
#
|
86
|
+
def hooks_to_run(name, whitelisted_plugins = nil)
|
87
|
+
return [] unless registrations
|
88
|
+
hooks = registrations.fetch(name, [])
|
89
|
+
return hooks unless whitelisted_plugins
|
90
|
+
hooks.select { |hook| whitelisted_plugins.key?(hook.plugin_name) }
|
91
|
+
end
|
92
|
+
|
93
|
+
# Runs all the registered blocks for the hook with the given name.
|
94
|
+
#
|
95
|
+
# @param [Symbol] name
|
96
|
+
# The name of the hook.
|
97
|
+
#
|
98
|
+
# @param [Object] context
|
99
|
+
# The context object which should be passed to the blocks.
|
100
|
+
#
|
101
|
+
# @param [Hash<String, Hash>] whitelisted_plugins
|
102
|
+
# The plugins that should be run, in the form of a hash keyed by
|
103
|
+
# plugin name, where the values are the custom options that should
|
104
|
+
# be passed to the hook's block if it supports taking a second
|
105
|
+
# argument.
|
106
|
+
#
|
107
|
+
def run(name, context, whitelisted_plugins = nil)
|
108
|
+
raise ArgumentError, 'Missing name' unless name
|
109
|
+
raise ArgumentError, 'Missing options' unless context
|
110
|
+
|
111
|
+
hooks = hooks_to_run(name, whitelisted_plugins)
|
112
|
+
return if hooks.empty?
|
113
|
+
|
114
|
+
UI.message "- Running #{name.to_s.tr('_', ' ')} hooks" do
|
115
|
+
hooks.each do |hook|
|
116
|
+
UI.message "- #{hook.plugin_name} from " \
|
117
|
+
"`#{hook.block.source_location.first}`" do
|
118
|
+
block = hook.block
|
119
|
+
if block.arity > 1
|
120
|
+
user_options = whitelisted_plugins[hook.plugin_name]
|
121
|
+
user_options = user_options.with_indifferent_access if user_options
|
122
|
+
block.call(context, user_options)
|
123
|
+
else
|
124
|
+
block.call(context)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module Pod
|
2
|
+
class Installer
|
3
|
+
class Analyzer
|
4
|
+
# A simple container produced after a analysis is completed by the {Analyzer}.
|
5
|
+
#
|
6
|
+
class AnalysisResult
|
7
|
+
# @return [SpecsState] the states of the Podfile specs.
|
8
|
+
#
|
9
|
+
attr_reader :podfile_state
|
10
|
+
|
11
|
+
# @return [Hash{TargetDefinition => Array<Specification>}] the specifications grouped by target.
|
12
|
+
#
|
13
|
+
attr_reader :specs_by_target
|
14
|
+
|
15
|
+
# @return [Hash{Source => Array<Specification>}] the specifications grouped by spec repo source.
|
16
|
+
#
|
17
|
+
attr_reader :specs_by_source
|
18
|
+
|
19
|
+
# @return [Array<Specification>] the specifications of the resolved version of Pods that should be installed.
|
20
|
+
#
|
21
|
+
attr_reader :specifications
|
22
|
+
|
23
|
+
# @return [SpecsState] the states of the {Sandbox} respect the resolved specifications.
|
24
|
+
#
|
25
|
+
attr_reader :sandbox_state
|
26
|
+
|
27
|
+
# @return [Array<AggregateTarget>] The aggregate targets created for each {TargetDefinition} from the {Podfile}.
|
28
|
+
#
|
29
|
+
attr_reader :targets
|
30
|
+
|
31
|
+
# @return [Array<PodTarget>] The pod targets created for all the aggregate targets.
|
32
|
+
#
|
33
|
+
attr_reader :pod_targets
|
34
|
+
|
35
|
+
# @return [PodfileDependencyCache] the cache of all dependencies in the podfile.
|
36
|
+
#
|
37
|
+
attr_reader :podfile_dependency_cache
|
38
|
+
|
39
|
+
def initialize(podfile_state, specs_by_target, specs_by_source, specifications, sandbox_state, targets, pod_targets,
|
40
|
+
podfile_dependency_cache)
|
41
|
+
@podfile_state = podfile_state
|
42
|
+
@specs_by_target = specs_by_target
|
43
|
+
@specs_by_source = specs_by_source
|
44
|
+
@specifications = specifications
|
45
|
+
@sandbox_state = sandbox_state
|
46
|
+
@targets = targets
|
47
|
+
@pod_targets = pod_targets
|
48
|
+
@podfile_dependency_cache = podfile_dependency_cache
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [Hash{String=>Symbol}] A hash representing all the user build
|
52
|
+
# configurations across all integration targets. Each key
|
53
|
+
# corresponds to the name of a configuration and its value to
|
54
|
+
# its type (`:debug` or `:release`).
|
55
|
+
#
|
56
|
+
def all_user_build_configurations
|
57
|
+
targets.reduce({}) do |result, target|
|
58
|
+
result.merge(target.user_build_configurations)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# @return [Bool] Whether an installation should be performed or this
|
63
|
+
# CocoaPods project is already up to date.
|
64
|
+
#
|
65
|
+
def needs_install?
|
66
|
+
podfile_needs_install? || sandbox_needs_install?
|
67
|
+
end
|
68
|
+
|
69
|
+
# @return [Bool] Whether the podfile has changes respect to the lockfile.
|
70
|
+
#
|
71
|
+
def podfile_needs_install?
|
72
|
+
state = podfile_state
|
73
|
+
needing_install = state.added.length + state.changed.length + state.deleted.length
|
74
|
+
needing_install > 0
|
75
|
+
end
|
76
|
+
|
77
|
+
# @return [Bool] Whether the sandbox is in synch with the lockfile.
|
78
|
+
#
|
79
|
+
def sandbox_needs_install?
|
80
|
+
state = sandbox_state
|
81
|
+
needing_install = state.added.length + state.changed.length + state.deleted.length
|
82
|
+
needing_install > 0
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|