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.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/lib/cocoapods-tt/command/native/install.rb +56 -0
  3. data/lib/cocoapods-tt/command/native/update.rb +157 -0
  4. data/lib/cocoapods-tt/command/tt/make.rb +92 -0
  5. data/lib/cocoapods-tt/command/tt.rb +115 -0
  6. data/lib/cocoapods-tt/command.rb +1 -0
  7. data/lib/cocoapods-tt/gem_version.rb +3 -0
  8. data/lib/cocoapods-tt/native/command.rb +185 -0
  9. data/lib/cocoapods-tt/native/config.rb +366 -0
  10. data/lib/cocoapods-tt/native/core_overrides.rb +1 -0
  11. data/lib/cocoapods-tt/native/downloader/cache.rb +322 -0
  12. data/lib/cocoapods-tt/native/downloader/request.rb +86 -0
  13. data/lib/cocoapods-tt/native/downloader/response.rb +16 -0
  14. data/lib/cocoapods-tt/native/downloader.rb +192 -0
  15. data/lib/cocoapods-tt/native/executable.rb +247 -0
  16. data/lib/cocoapods-tt/native/external_sources/abstract_external_source.rb +205 -0
  17. data/lib/cocoapods-tt/native/external_sources/downloader_source.rb +30 -0
  18. data/lib/cocoapods-tt/native/external_sources/path_source.rb +55 -0
  19. data/lib/cocoapods-tt/native/external_sources/podspec_source.rb +54 -0
  20. data/lib/cocoapods-tt/native/external_sources.rb +57 -0
  21. data/lib/cocoapods-tt/native/gem_version.rb +5 -0
  22. data/lib/cocoapods-tt/native/generator/acknowledgements/markdown.rb +44 -0
  23. data/lib/cocoapods-tt/native/generator/acknowledgements/plist.rb +94 -0
  24. data/lib/cocoapods-tt/native/generator/acknowledgements.rb +107 -0
  25. data/lib/cocoapods-tt/native/generator/app_target_helper.rb +363 -0
  26. data/lib/cocoapods-tt/native/generator/bridge_support.rb +22 -0
  27. data/lib/cocoapods-tt/native/generator/constant.rb +19 -0
  28. data/lib/cocoapods-tt/native/generator/copy_dsyms_script.rb +56 -0
  29. data/lib/cocoapods-tt/native/generator/copy_resources_script.rb +223 -0
  30. data/lib/cocoapods-tt/native/generator/copy_xcframework_script.rb +227 -0
  31. data/lib/cocoapods-tt/native/generator/dummy_source.rb +31 -0
  32. data/lib/cocoapods-tt/native/generator/embed_frameworks_script.rb +196 -0
  33. data/lib/cocoapods-tt/native/generator/file_list.rb +39 -0
  34. data/lib/cocoapods-tt/native/generator/header.rb +103 -0
  35. data/lib/cocoapods-tt/native/generator/info_plist_file.rb +128 -0
  36. data/lib/cocoapods-tt/native/generator/module_map.rb +99 -0
  37. data/lib/cocoapods-tt/native/generator/prefix_header.rb +60 -0
  38. data/lib/cocoapods-tt/native/generator/script_phase_constants.rb +100 -0
  39. data/lib/cocoapods-tt/native/generator/umbrella_header.rb +46 -0
  40. data/lib/cocoapods-tt/native/hooks_manager.rb +132 -0
  41. data/lib/cocoapods-tt/native/installer/analyzer/analysis_result.rb +87 -0
  42. data/lib/cocoapods-tt/native/installer/analyzer/locking_dependency_analyzer.rb +103 -0
  43. data/lib/cocoapods-tt/native/installer/analyzer/pod_variant.rb +87 -0
  44. data/lib/cocoapods-tt/native/installer/analyzer/pod_variant_set.rb +175 -0
  45. data/lib/cocoapods-tt/native/installer/analyzer/podfile_dependency_cache.rb +55 -0
  46. data/lib/cocoapods-tt/native/installer/analyzer/sandbox_analyzer.rb +268 -0
  47. data/lib/cocoapods-tt/native/installer/analyzer/specs_state.rb +108 -0
  48. data/lib/cocoapods-tt/native/installer/analyzer/target_inspection_result.rb +58 -0
  49. data/lib/cocoapods-tt/native/installer/analyzer/target_inspector.rb +258 -0
  50. data/lib/cocoapods-tt/native/installer/analyzer.rb +1204 -0
  51. data/lib/cocoapods-tt/native/installer/base_install_hooks_context.rb +135 -0
  52. data/lib/cocoapods-tt/native/installer/installation_options.rb +195 -0
  53. data/lib/cocoapods-tt/native/installer/pod_source_installer.rb +224 -0
  54. data/lib/cocoapods-tt/native/installer/pod_source_preparer.rb +77 -0
  55. data/lib/cocoapods-tt/native/installer/podfile_validator.rb +168 -0
  56. data/lib/cocoapods-tt/native/installer/post_install_hooks_context.rb +9 -0
  57. data/lib/cocoapods-tt/native/installer/post_integrate_hooks_context.rb +9 -0
  58. data/lib/cocoapods-tt/native/installer/pre_install_hooks_context.rb +51 -0
  59. data/lib/cocoapods-tt/native/installer/pre_integrate_hooks_context.rb +9 -0
  60. data/lib/cocoapods-tt/native/installer/project_cache/project_cache.rb +11 -0
  61. data/lib/cocoapods-tt/native/installer/project_cache/project_cache_analysis_result.rb +53 -0
  62. data/lib/cocoapods-tt/native/installer/project_cache/project_cache_analyzer.rb +200 -0
  63. data/lib/cocoapods-tt/native/installer/project_cache/project_cache_version.rb +43 -0
  64. data/lib/cocoapods-tt/native/installer/project_cache/project_installation_cache.rb +103 -0
  65. data/lib/cocoapods-tt/native/installer/project_cache/project_metadata_cache.rb +73 -0
  66. data/lib/cocoapods-tt/native/installer/project_cache/target_cache_key.rb +176 -0
  67. data/lib/cocoapods-tt/native/installer/project_cache/target_metadata.rb +74 -0
  68. data/lib/cocoapods-tt/native/installer/sandbox_dir_cleaner.rb +105 -0
  69. data/lib/cocoapods-tt/native/installer/sandbox_header_paths_installer.rb +45 -0
  70. data/lib/cocoapods-tt/native/installer/source_provider_hooks_context.rb +34 -0
  71. data/lib/cocoapods-tt/native/installer/target_uuid_generator.rb +34 -0
  72. data/lib/cocoapods-tt/native/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +179 -0
  73. data/lib/cocoapods-tt/native/installer/user_project_integrator/target_integrator.rb +815 -0
  74. data/lib/cocoapods-tt/native/installer/user_project_integrator.rb +280 -0
  75. data/lib/cocoapods-tt/native/installer/xcode/multi_pods_project_generator.rb +82 -0
  76. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/aggregate_target_dependency_installer.rb +66 -0
  77. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/aggregate_target_installer.rb +192 -0
  78. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/app_host_installer.rb +154 -0
  79. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/file_references_installer.rb +329 -0
  80. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb +195 -0
  81. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pod_target_installer.rb +1239 -0
  82. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pod_target_integrator.rb +312 -0
  83. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pods_project_writer.rb +90 -0
  84. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/project_generator.rb +120 -0
  85. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/target_installation_result.rb +140 -0
  86. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/target_installer.rb +257 -0
  87. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/target_installer_helper.rb +110 -0
  88. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator.rb +291 -0
  89. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator_result.rb +54 -0
  90. data/lib/cocoapods-tt/native/installer/xcode/single_pods_project_generator.rb +38 -0
  91. data/lib/cocoapods-tt/native/installer/xcode/target_validator.rb +170 -0
  92. data/lib/cocoapods-tt/native/installer/xcode.rb +11 -0
  93. data/lib/cocoapods-tt/native/installer.rb +1044 -0
  94. data/lib/cocoapods-tt/native/native_target_extension.rb +60 -0
  95. data/lib/cocoapods-tt/native/open-uri.rb +33 -0
  96. data/lib/cocoapods-tt/native/podfile.rb +13 -0
  97. data/lib/cocoapods-tt/native/project.rb +544 -0
  98. data/lib/cocoapods-tt/native/resolver/lazy_specification.rb +88 -0
  99. data/lib/cocoapods-tt/native/resolver/resolver_specification.rb +41 -0
  100. data/lib/cocoapods-tt/native/resolver.rb +600 -0
  101. data/lib/cocoapods-tt/native/sandbox/file_accessor.rb +532 -0
  102. data/lib/cocoapods-tt/native/sandbox/headers_store.rb +163 -0
  103. data/lib/cocoapods-tt/native/sandbox/path_list.rb +242 -0
  104. data/lib/cocoapods-tt/native/sandbox/pod_dir_cleaner.rb +71 -0
  105. data/lib/cocoapods-tt/native/sandbox/podspec_finder.rb +23 -0
  106. data/lib/cocoapods-tt/native/sandbox.rb +470 -0
  107. data/lib/cocoapods-tt/native/sources_manager.rb +221 -0
  108. data/lib/cocoapods-tt/native/target/aggregate_target.rb +558 -0
  109. data/lib/cocoapods-tt/native/target/build_settings.rb +1385 -0
  110. data/lib/cocoapods-tt/native/target/pod_target.rb +1168 -0
  111. data/lib/cocoapods-tt/native/target.rb +378 -0
  112. data/lib/cocoapods-tt/native/user_interface/error_report.rb +204 -0
  113. data/lib/cocoapods-tt/native/user_interface/inspector_reporter.rb +102 -0
  114. data/lib/cocoapods-tt/native/user_interface.rb +463 -0
  115. data/lib/cocoapods-tt/native/validator.rb +1170 -0
  116. data/lib/cocoapods-tt/native/version_metadata.rb +26 -0
  117. data/lib/cocoapods-tt/native/xcode/framework_paths.rb +54 -0
  118. data/lib/cocoapods-tt/native/xcode/linkage_analyzer.rb +22 -0
  119. data/lib/cocoapods-tt/native/xcode/xcframework/xcframework_slice.rb +138 -0
  120. data/lib/cocoapods-tt/native/xcode/xcframework.rb +99 -0
  121. data/lib/cocoapods-tt/native/xcode.rb +7 -0
  122. data/lib/cocoapods-tt.rb +1 -0
  123. data/lib/cocoapods_plugin.rb +17 -0
  124. metadata +193 -0
@@ -0,0 +1,227 @@
1
+ require 'cocoapods/xcode'
2
+
3
+ module Pod
4
+ module Generator
5
+ class CopyXCFrameworksScript
6
+ # @return [Array<Pod::Xcode::XCFramework>] List of xcframeworks to copy
7
+ #
8
+ attr_reader :xcframeworks
9
+
10
+ # @return [Pathname] the root directory of the sandbox
11
+ #
12
+ attr_reader :sandbox_root
13
+
14
+ # @return [Platform] the platform of the target for which this script will run
15
+ #
16
+ attr_reader :platform
17
+
18
+ # Creates a script for copying XCFramework slcies into an intermediate build directory
19
+ #
20
+ # @param [Array<Pod::Xcode::XCFramework>] xcframeworks
21
+ # the list of xcframeworks to copy
22
+ #
23
+ # @param [Pathname] sandbox_root
24
+ # the root of the Sandbox into which this script will be installed
25
+ #
26
+ # @param [Platform] platform
27
+ # the platform of the target for which this script will be run
28
+ #
29
+ def initialize(xcframeworks, sandbox_root, platform)
30
+ @xcframeworks = xcframeworks
31
+ @sandbox_root = sandbox_root
32
+ @platform = platform
33
+ end
34
+
35
+ # Saves the resource script to the given pathname.
36
+ #
37
+ # @param [Pathname] pathname
38
+ # The path where the embed frameworks script should be saved.
39
+ #
40
+ # @return [void]
41
+ #
42
+ def save_as(pathname)
43
+ pathname.open('w') do |file|
44
+ file.puts(script)
45
+ end
46
+ File.chmod(0o755, pathname.to_s)
47
+ end
48
+
49
+ # @return [String] The contents of the embed frameworks script.
50
+ #
51
+ def generate
52
+ script
53
+ end
54
+
55
+ private
56
+
57
+ # @!group Private Helpers
58
+
59
+ # @return [String] The contents of the prepare artifacts script.
60
+ #
61
+ def script
62
+ script = <<-SH.strip_heredoc
63
+ #{Pod::Generator::ScriptPhaseConstants::DEFAULT_SCRIPT_PHASE_HEADER}
64
+
65
+ #{Pod::Generator::ScriptPhaseConstants::RSYNC_PROTECT_TMP_FILES}
66
+
67
+ #{variant_for_slice}
68
+
69
+ #{archs_for_slice}
70
+
71
+ copy_dir()
72
+ {
73
+ local source="$1"
74
+ local destination="$2"
75
+
76
+ # Use filter instead of exclude so missing patterns don't throw errors.
77
+ echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" \\"${source}*\\" \\"${destination}\\""
78
+ rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" "${source}"/* "${destination}"
79
+ }
80
+
81
+ SELECT_SLICE_RETVAL=""
82
+
83
+ select_slice() {
84
+ local xcframework_name="$1"
85
+ xcframework_name="${xcframework_name##*/}"
86
+ local paths=("${@:2}")
87
+ # Locate the correct slice of the .xcframework for the current architectures
88
+ local target_path=""
89
+
90
+ # Split archs on space so we can find a slice that has all the needed archs
91
+ local target_archs=$(echo $ARCHS | tr " " "\\n")
92
+
93
+ local target_variant=""
94
+ if [[ "$PLATFORM_NAME" == *"simulator" ]]; then
95
+ target_variant="simulator"
96
+ fi
97
+ if [[ ! -z ${EFFECTIVE_PLATFORM_NAME+x} && "$EFFECTIVE_PLATFORM_NAME" == *"maccatalyst" ]]; then
98
+ target_variant="maccatalyst"
99
+ fi
100
+ for i in ${!paths[@]}; do
101
+ local matched_all_archs="1"
102
+ local slice_archs="$(archs_for_slice "${xcframework_name}/${paths[$i]}")"
103
+ local slice_variant="$(variant_for_slice "${xcframework_name}/${paths[$i]}")"
104
+ for target_arch in $target_archs; do
105
+ if ! [[ "${slice_variant}" == "$target_variant" ]]; then
106
+ matched_all_archs="0"
107
+ break
108
+ fi
109
+
110
+ if ! echo "${slice_archs}" | tr " " "\\n" | grep -F -q -x "$target_arch"; then
111
+ matched_all_archs="0"
112
+ break
113
+ fi
114
+ done
115
+
116
+ if [[ "$matched_all_archs" == "1" ]]; then
117
+ # Found a matching slice
118
+ echo "Selected xcframework slice ${paths[$i]}"
119
+ SELECT_SLICE_RETVAL=${paths[$i]}
120
+ break
121
+ fi
122
+ done
123
+ }
124
+
125
+ install_xcframework() {
126
+ local basepath="$1"
127
+ local name="$2"
128
+ local package_type="$3"
129
+ local paths=("${@:4}")
130
+
131
+ # Locate the correct slice of the .xcframework for the current architectures
132
+ select_slice "${basepath}" "${paths[@]}"
133
+ local target_path="$SELECT_SLICE_RETVAL"
134
+ if [[ -z "$target_path" ]]; then
135
+ echo "warning: [CP] $(basename ${basepath}): Unable to find matching slice in '${paths[@]}' for the current build architectures ($ARCHS) and platform (${EFFECTIVE_PLATFORM_NAME-${PLATFORM_NAME}})."
136
+ return
137
+ fi
138
+ local source="$basepath/$target_path"
139
+
140
+ local destination="#{Pod::Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/${name}"
141
+
142
+ if [ ! -d "$destination" ]; then
143
+ mkdir -p "$destination"
144
+ fi
145
+
146
+ copy_dir "$source/" "$destination"
147
+ echo "Copied $source to $destination"
148
+ }
149
+
150
+ SH
151
+ xcframeworks.each do |xcframework|
152
+ slices = xcframework.slices.select { |f| f.platform.symbolic_name == platform.symbolic_name }
153
+ next if slices.empty?
154
+ args = install_xcframework_args(xcframework, slices)
155
+ script << "install_xcframework #{args}\n"
156
+ end
157
+
158
+ script << "\n" unless xcframeworks.empty?
159
+ script
160
+ end
161
+
162
+ def shell_escape(value)
163
+ "\"#{value}\""
164
+ end
165
+
166
+ def install_xcframework_args(xcframework, slices)
167
+ root = xcframework.path
168
+ args = [shell_escape("${PODS_ROOT}/#{root.relative_path_from(sandbox_root)}")]
169
+ args << shell_escape(xcframework.target_name)
170
+ is_framework = xcframework.build_type.framework?
171
+ args << shell_escape(is_framework ? 'framework' : 'library')
172
+ slices.each do |slice|
173
+ args << shell_escape(slice.path.dirname.relative_path_from(root))
174
+ end
175
+ args.join(' ')
176
+ end
177
+
178
+ def variant_for_slice
179
+ script = ''
180
+ script << "variant_for_slice()\n"
181
+ script << "{\n"
182
+ script << " case \"$1\" in\n"
183
+ xcframeworks.each do |xcframework|
184
+ root = xcframework.path
185
+ xcframework.slices.each do |slice|
186
+ script << " #{shell_escape(root.basename.join(slice.path.dirname.relative_path_from(root)))})\n"
187
+ script << " echo \"#{slice.platform_variant}\"\n"
188
+ script << " ;;\n"
189
+ end
190
+ end
191
+ script << " esac\n"
192
+ script << '}'
193
+ end
194
+
195
+ def archs_for_slice
196
+ script = ''
197
+ script << "archs_for_slice()\n"
198
+ script << "{\n"
199
+ script << " case \"$1\" in\n"
200
+ xcframeworks.each do |xcframework|
201
+ root = xcframework.path
202
+ xcframework.slices.each do |slice|
203
+ script << " #{shell_escape(root.basename.join(slice.path.dirname.relative_path_from(root)))})\n"
204
+ script << " echo \"#{slice.supported_archs.sort.join(' ')}\"\n"
205
+ script << " ;;\n"
206
+ end
207
+ end
208
+ script << " esac\n"
209
+ script << '}'
210
+ end
211
+
212
+ class << self
213
+ # @param [Pathname] xcframework_path
214
+ # the base path of the .xcframework bundle
215
+ #
216
+ # @return [Array<Pathname>] all found .dSYM paths
217
+ #
218
+ def dsym_folder(xcframework_path)
219
+ basename = File.basename(xcframework_path, '.xcframework')
220
+ dsym_basename = basename + '.dSYMs'
221
+ path = xcframework_path.dirname + dsym_basename
222
+ Pathname.new(path) if File.directory?(path)
223
+ end
224
+ end
225
+ end
226
+ end
227
+ end
@@ -0,0 +1,31 @@
1
+ module Pod
2
+ module Generator
3
+ class DummySource
4
+ attr_reader :class_name
5
+
6
+ def initialize(class_name_identifier)
7
+ validated_class_name_identifier = class_name_identifier.gsub(/[^0-9a-z_]/i, '_')
8
+ @class_name = "PodsDummy_#{validated_class_name_identifier}"
9
+ end
10
+
11
+ # @return [String] the string contents of the dummy source file.
12
+ #
13
+ def generate
14
+ result = <<-source.strip_heredoc
15
+ #import <Foundation/Foundation.h>
16
+ @interface #{class_name} : NSObject
17
+ @end
18
+ @implementation #{class_name}
19
+ @end
20
+ source
21
+ result
22
+ end
23
+
24
+ def save_as(pathname)
25
+ pathname.open('w') do |source|
26
+ source.write(generate)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,196 @@
1
+ require 'cocoapods/xcode'
2
+
3
+ module Pod
4
+ module Generator
5
+ class EmbedFrameworksScript
6
+ # @return [Hash{String => Array<FrameworkPaths>}] Multiple lists of frameworks per
7
+ # configuration.
8
+ #
9
+ attr_reader :frameworks_by_config
10
+
11
+ # @return [Hash{String => Array<XCFrameworkPaths>}] Multiple lists of frameworks per
12
+ # configuration.
13
+ #
14
+ attr_reader :xcframeworks_by_config
15
+
16
+ # @param [Hash{String => Array<FrameworkPaths>] frameworks_by_config
17
+ # @see #frameworks_by_config
18
+ #
19
+ # @param [Hash{String => Array<XCFramework>] xcframeworks_by_config
20
+ # @see #xcframeworks_by_config
21
+ #
22
+ def initialize(frameworks_by_config, xcframeworks_by_config)
23
+ @frameworks_by_config = frameworks_by_config
24
+ @xcframeworks_by_config = xcframeworks_by_config
25
+ end
26
+
27
+ # Saves the resource script to the given pathname.
28
+ #
29
+ # @param [Pathname] pathname
30
+ # The path where the embed frameworks script should be saved.
31
+ #
32
+ # @return [void]
33
+ #
34
+ def save_as(pathname)
35
+ pathname.open('w') do |file|
36
+ file.puts(script)
37
+ end
38
+ File.chmod(0755, pathname.to_s)
39
+ end
40
+
41
+ # @return [String] The contents of the embed frameworks script.
42
+ #
43
+ def generate
44
+ script
45
+ end
46
+
47
+ private
48
+
49
+ # @!group Private Helpers
50
+
51
+ # @return [String] The contents of the embed frameworks script.
52
+ #
53
+ def script
54
+ script = <<-SH.strip_heredoc
55
+ #{Pod::Generator::ScriptPhaseConstants::DEFAULT_SCRIPT_PHASE_HEADER}
56
+ if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
57
+ # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
58
+ # frameworks to, so exit 0 (signalling the script phase was successful).
59
+ exit 0
60
+ fi
61
+
62
+ echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
63
+ mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
64
+
65
+ COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}"
66
+ SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
67
+ BCSYMBOLMAP_DIR="BCSymbolMaps"
68
+
69
+
70
+ #{Pod::Generator::ScriptPhaseConstants::RSYNC_PROTECT_TMP_FILES}
71
+ # Copies and strips a vendored framework
72
+ install_framework()
73
+ {
74
+ if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
75
+ local source="${BUILT_PRODUCTS_DIR}/$1"
76
+ elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
77
+ local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
78
+ elif [ -r "$1" ]; then
79
+ local source="$1"
80
+ fi
81
+
82
+ local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
83
+
84
+ if [ -L "${source}" ]; then
85
+ echo "Symlinked..."
86
+ source="$(readlink "${source}")"
87
+ fi
88
+
89
+ if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then
90
+ # Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied
91
+ find "${source}/${BCSYMBOLMAP_DIR}" -name "*.bcsymbolmap"|while read f; do
92
+ echo "Installing $f"
93
+ install_bcsymbolmap "$f" "$destination"
94
+ rm "$f"
95
+ done
96
+ rmdir "${source}/${BCSYMBOLMAP_DIR}"
97
+ fi
98
+
99
+ # Use filter instead of exclude so missing patterns don't throw errors.
100
+ echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${destination}\\""
101
+ rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
102
+
103
+ local basename
104
+ basename="$(basename -s .framework "$1")"
105
+ binary="${destination}/${basename}.framework/${basename}"
106
+
107
+ if ! [ -r "$binary" ]; then
108
+ binary="${destination}/${basename}"
109
+ elif [ -L "${binary}" ]; then
110
+ echo "Destination binary is symlinked..."
111
+ dirname="$(dirname "${binary}")"
112
+ binary="${dirname}/$(readlink "${binary}")"
113
+ fi
114
+
115
+ # Strip invalid architectures so "fat" simulator / device frameworks work on device
116
+ if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
117
+ strip_invalid_archs "$binary"
118
+ fi
119
+
120
+ # Resign the code if required by the build settings to avoid unstable apps
121
+ code_sign_if_enabled "${destination}/$(basename "$1")"
122
+
123
+ # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
124
+ if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
125
+ local swift_runtime_libs
126
+ swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\\\/\\(.+dylib\\).*/\\\\1/g | uniq -u)
127
+ for lib in $swift_runtime_libs; do
128
+ echo "rsync -auv \\"${SWIFT_STDLIB_PATH}/${lib}\\" \\"${destination}\\""
129
+ rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
130
+ code_sign_if_enabled "${destination}/${lib}"
131
+ done
132
+ fi
133
+ }
134
+ #{Pod::Generator::ScriptPhaseConstants::INSTALL_DSYM_METHOD}
135
+ #{Pod::Generator::ScriptPhaseConstants::STRIP_INVALID_ARCHITECTURES_METHOD}
136
+ #{Pod::Generator::ScriptPhaseConstants::INSTALL_BCSYMBOLMAP_METHOD}
137
+ # Signs a framework with the provided identity
138
+ code_sign_if_enabled() {
139
+ if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
140
+ # Use the current code_sign_identity
141
+ echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
142
+ local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
143
+
144
+ if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
145
+ code_sign_cmd="$code_sign_cmd &"
146
+ fi
147
+ echo "$code_sign_cmd"
148
+ eval "$code_sign_cmd"
149
+ fi
150
+ }
151
+ SH
152
+ contents_by_config = Hash.new do |hash, key|
153
+ hash[key] = ''
154
+ end
155
+ frameworks_by_config.each do |config, frameworks|
156
+ frameworks.each do |framework|
157
+ contents_by_config[config] << %( install_framework "#{framework.source_path}"\n)
158
+ end
159
+ end
160
+ xcframeworks_by_config.each do |config, xcframeworks|
161
+ xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.each do |xcframework|
162
+ target_name = xcframework.target_name
163
+ name = xcframework.name
164
+ contents_by_config[config] << %( install_framework "#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{target_name}/#{name}.framework"\n)
165
+ end
166
+ end
167
+ script << "\n" unless contents_by_config.empty?
168
+ contents_by_config.keys.sort.each do |config|
169
+ contents = contents_by_config[config]
170
+ next if contents.empty?
171
+ script << %(if [[ "$CONFIGURATION" == "#{config}" ]]; then\n)
172
+ script << contents
173
+ script << "fi\n"
174
+ end
175
+ script << <<-SH.strip_heredoc
176
+ if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
177
+ wait
178
+ fi
179
+ SH
180
+ script
181
+ end
182
+
183
+ # @param [Xcode::FrameworkPaths] framework_path
184
+ # the framework path containing the dSYM
185
+ #
186
+ # @return [String, Nil] the name of the dSYM binary, if found
187
+ #
188
+ def dsym_binary_name(framework_path)
189
+ return nil if framework_path.dsym_path.nil?
190
+ if (path = Pathname.glob(framework_path.dsym_path.join('Contents/Resources/DWARF', '**/*')).first)
191
+ File.basename(path)
192
+ end
193
+ end
194
+ end
195
+ end
196
+ end
@@ -0,0 +1,39 @@
1
+ module Pod
2
+ module Generator
3
+ # Generates an xcfilelist file.
4
+ #
5
+ class FileList
6
+ # @return [Array<String>] The paths of the files in the file list.
7
+ #
8
+ attr_reader :paths
9
+
10
+ # Initialize a new instance
11
+ #
12
+ # @param [Array<String>] paths
13
+ # @see paths
14
+ #
15
+ def initialize(paths)
16
+ @paths = paths
17
+ end
18
+
19
+ # Generates the contents of the file list.
20
+ #
21
+ # @return [String]
22
+ #
23
+ def generate
24
+ paths.join("\n")
25
+ end
26
+
27
+ # Generates and saves the file list to the given path.
28
+ #
29
+ # @param [Pathname] path
30
+ # The path where the file list should be stored.
31
+ #
32
+ # @return [void]
33
+ #
34
+ def save_as(path)
35
+ path.open('w') { |file_list| file_list.write(generate) }
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,103 @@
1
+ module Pod
2
+ module Generator
3
+ # Generates a header file.
4
+ #
5
+ # According to the platform the header imports `UIKit/UIKit.h` or
6
+ # `Cocoa/Cocoa.h`.
7
+ #
8
+ class Header
9
+ # @return [Symbol] the platform for which the prefix header will be
10
+ # generated.
11
+ #
12
+ attr_reader :platform
13
+
14
+ # @return [Array<String>] The list of the headers to import.
15
+ #
16
+ attr_accessor :imports
17
+
18
+ # @return [Array<String>] The list of the modules to import.
19
+ #
20
+ attr_reader :module_imports
21
+
22
+ # Initialize a new instance
23
+ #
24
+ # @param [Symbol] platform
25
+ # @see platform
26
+ #
27
+ def initialize(platform)
28
+ @platform = platform
29
+ @imports = []
30
+ @module_imports = []
31
+ end
32
+
33
+ # Generates the contents of the header according to the platform.
34
+ #
35
+ # @note If the platform is iOS an import call to `UIKit/UIKit.h` is
36
+ # added to the top of the prefix header. For OS X `Cocoa/Cocoa.h`
37
+ # is imported.
38
+ #
39
+ # @return [String]
40
+ #
41
+ def generate
42
+ result = ''
43
+ result << "#ifdef __OBJC__\n"
44
+ result << generate_platform_import_header
45
+ result << "#else\n"
46
+ result << "#ifndef FOUNDATION_EXPORT\n"
47
+ result << "#if defined(__cplusplus)\n"
48
+ result << "#define FOUNDATION_EXPORT extern \"C\"\n"
49
+ result << "#else\n"
50
+ result << "#define FOUNDATION_EXPORT extern\n"
51
+ result << "#endif\n"
52
+ result << "#endif\n"
53
+ result << "#endif\n"
54
+ result << "\n"
55
+
56
+ imports.each do |import|
57
+ result << %(#import "#{import}"\n)
58
+ end
59
+
60
+ unless module_imports.empty?
61
+ module_imports.each do |import|
62
+ result << %(\n@import #{import})
63
+ end
64
+ result << "\n"
65
+ end
66
+
67
+ result
68
+ end
69
+
70
+ # Generates and saves the header to the given path.
71
+ #
72
+ # @param [Pathname] path
73
+ # The path where the header should be stored.
74
+ #
75
+ # @return [void]
76
+ #
77
+ def save_as(path)
78
+ path.open('w') { |header| header.write(generate) }
79
+ end
80
+
81
+ #-----------------------------------------------------------------------#
82
+
83
+ protected
84
+
85
+ # Generates the contents of the header according to the platform.
86
+ #
87
+ # @note If the platform is iOS an import call to `UIKit/UIKit.h` is
88
+ # added to the top of the header. For OS X `Cocoa/Cocoa.h` is
89
+ # imported.
90
+ #
91
+ # @return [String]
92
+ #
93
+ def generate_platform_import_header
94
+ case platform.name
95
+ when :ios then "#import <UIKit/UIKit.h>\n"
96
+ when :tvos then "#import <UIKit/UIKit.h>\n"
97
+ when :osx then "#import <Cocoa/Cocoa.h>\n"
98
+ else "#import <Foundation/Foundation.h>\n"
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end