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,54 @@
1
+ module Pod
2
+ class Installer
3
+ class Xcode
4
+ class PodsProjectGenerator
5
+ # A simple container produced after a pod project generation is completed.
6
+ #
7
+ class PodsProjectGeneratorResult
8
+ # @return [Project] project
9
+ #
10
+ attr_reader :project
11
+
12
+ # @return [Hash{Project => Array<PodTargets>}] Project by pod targets map
13
+ #
14
+ attr_reader :projects_by_pod_targets
15
+
16
+ # @return [InstallationResults] target installation results
17
+ #
18
+ attr_reader :target_installation_results
19
+
20
+ # Initialize a new instance
21
+ #
22
+ # @param [Project] project @see #project
23
+ # @param [Hash{Project => Array<PodTargets>}] projects_by_pod_targets @see #projects_by_pod_targets
24
+ # @param [InstallationResults] target_installation_results @see #target_installation_results
25
+ #
26
+ def initialize(project, projects_by_pod_targets, target_installation_results)
27
+ @project = project
28
+ @projects_by_pod_targets = projects_by_pod_targets
29
+ @target_installation_results = target_installation_results
30
+ end
31
+
32
+ # @param [Pod::Specification] spec
33
+ # A spec which was included in the generated project
34
+ #
35
+ # @return [Xcodeproj::PBXNativeTarget] the native target for the spec
36
+ #
37
+ def native_target_for_spec(spec)
38
+ installation_results_by_spec[spec.root].native_target_for_spec(spec)
39
+ end
40
+
41
+ private
42
+
43
+ def installation_results_by_spec
44
+ @target_installation_results_by_spec ||= begin
45
+ target_installation_results.pod_target_installation_results.values.each_with_object({}) do |installation_results, hash|
46
+ hash[installation_results.target.root_spec] = installation_results
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,38 @@
1
+ module Pod
2
+ class Installer
3
+ class Xcode
4
+ # The {SinglePodsProjectGenerator} handles generation of the 'Pods/Pods.xcodeproj'
5
+ #
6
+ class SinglePodsProjectGenerator < PodsProjectGenerator
7
+ # Generates single `Pods/Pods.xcodeproj`.
8
+ #
9
+ # @return [PodsProjectGeneratorResult]
10
+ #
11
+ def generate!
12
+ project_path = sandbox.project_path
13
+ platforms = aggregate_targets.map(&:platform)
14
+ project_generator = ProjectGenerator.new(sandbox, project_path, pod_targets, build_configurations,
15
+ platforms, project_object_version, config.podfile_path)
16
+ project = project_generator.generate!
17
+ install_file_references(project, pod_targets)
18
+
19
+ pod_target_installation_results = install_all_pod_targets(project, pod_targets)
20
+ aggregate_target_installation_results = install_aggregate_targets(project, aggregate_targets)
21
+ target_installation_results = InstallationResults.new(pod_target_installation_results, aggregate_target_installation_results)
22
+
23
+ integrate_targets(target_installation_results.pod_target_installation_results)
24
+ wire_target_dependencies(target_installation_results)
25
+ PodsProjectGeneratorResult.new(project, {}, target_installation_results)
26
+ end
27
+
28
+ private
29
+
30
+ def install_all_pod_targets(project, pod_targets)
31
+ UI.message '- Installing Pod Targets' do
32
+ install_pod_targets(project, pod_targets)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,170 @@
1
+ module Pod
2
+ class Installer
3
+ class Xcode
4
+ # The {Xcode::TargetValidator} ensures that the pod and aggregate target
5
+ # configuration is valid for installation.
6
+ #
7
+ class TargetValidator
8
+ # @return [Array<AggregateTarget>] The aggregate targets that should be validated.
9
+ #
10
+ attr_reader :aggregate_targets
11
+
12
+ # @return [Array<PodTarget>] The pod targets that should be validated.
13
+ #
14
+ attr_reader :pod_targets
15
+
16
+ # @return [InstallationOptions] The installation options used during this installation.
17
+ #
18
+ attr_reader :installation_options
19
+
20
+ # Create a new TargetValidator with aggregate and pod targets to
21
+ # validate.
22
+ #
23
+ # @param [Array<AggregateTarget>] aggregate_targets #see #aggregate_targets
24
+ # @param [Array<PodTarget>] pod_targets see #pod_targets
25
+ # @param [InstallationOptions] installation_options see #installation_options
26
+ #
27
+ def initialize(aggregate_targets, pod_targets, installation_options)
28
+ @aggregate_targets = aggregate_targets
29
+ @pod_targets = pod_targets
30
+ @installation_options = installation_options
31
+ end
32
+
33
+ # Perform the validation steps for the provided aggregate and pod
34
+ # targets.
35
+ #
36
+ def validate!
37
+ verify_no_duplicate_framework_and_library_names
38
+ verify_no_static_framework_transitive_dependencies
39
+ verify_swift_pods_swift_version
40
+ verify_swift_pods_have_module_dependencies
41
+ verify_no_multiple_project_names if installation_options.generate_multiple_pod_projects?
42
+ end
43
+
44
+ private
45
+
46
+ def verify_no_duplicate_framework_and_library_names
47
+ aggregate_targets.each do |aggregate_target|
48
+ aggregate_target.user_build_configurations.each_key do |config|
49
+ pod_targets = aggregate_target.pod_targets_for_build_configuration(config)
50
+ file_accessors = pod_targets.flat_map(&:file_accessors).select { |fa| fa.spec.library_specification? }
51
+
52
+ frameworks = file_accessors.flat_map(&:vendored_frameworks).uniq.map(&:basename)
53
+ frameworks += pod_targets.select { |pt| pt.should_build? && pt.build_as_framework? }.map(&:product_module_name).uniq
54
+ verify_no_duplicate_names(frameworks, aggregate_target.label, 'frameworks')
55
+
56
+ libraries = file_accessors.flat_map(&:vendored_libraries).uniq.map(&:basename)
57
+ libraries += pod_targets.select { |pt| pt.should_build? && pt.build_as_library? }.map(&:product_name)
58
+ verify_no_duplicate_names(libraries, aggregate_target.label, 'libraries')
59
+ end
60
+ end
61
+ end
62
+
63
+ def verify_no_duplicate_names(names, label, type)
64
+ duplicates = names.group_by { |n| n.to_s.downcase }.select { |_, v| v.size > 1 }.keys
65
+
66
+ unless duplicates.empty?
67
+ raise Informative, "The '#{label}' target has " \
68
+ "#{type} with conflicting names: #{duplicates.to_sentence}."
69
+ end
70
+ end
71
+
72
+ def verify_no_static_framework_transitive_dependencies
73
+ aggregate_targets.each do |aggregate_target|
74
+ aggregate_target.user_build_configurations.each_key do |config|
75
+ pod_targets = aggregate_target.pod_targets_for_build_configuration(config)
76
+ built_targets, unbuilt_targets = pod_targets.partition(&:should_build?)
77
+ dynamic_pod_targets = built_targets.select(&:build_as_dynamic?)
78
+
79
+ dependencies = dynamic_pod_targets.flat_map(&:dependent_targets).uniq
80
+ depended_upon_targets = unbuilt_targets & dependencies
81
+
82
+ static_libs = depended_upon_targets.flat_map(&:file_accessors).flat_map(&:vendored_static_artifacts)
83
+ unless static_libs.empty?
84
+ raise Informative, "The '#{aggregate_target.label}' target has " \
85
+ "transitive dependencies that include statically linked binaries: (#{static_libs.to_sentence})"
86
+ end
87
+
88
+ static_deps = dynamic_pod_targets.flat_map(&:recursive_dependent_targets).uniq.select(&:build_as_static?)
89
+ unless static_deps.empty?
90
+ raise Informative, "The '#{aggregate_target.label}' target has " \
91
+ "transitive dependencies that include statically linked binaries: (#{static_deps.flat_map(&:name).to_sentence})"
92
+ end
93
+ end
94
+ end
95
+ end
96
+
97
+ def verify_swift_pods_swift_version
98
+ error_message_for_target_definition = lambda do |target_definition|
99
+ "`#{target_definition.name}` (Swift #{target_definition.swift_version})"
100
+ end
101
+ swift_pod_targets = pod_targets.select(&:uses_swift?)
102
+ error_messages = swift_pod_targets.map do |swift_pod_target|
103
+ # Legacy targets that do not specify Swift versions derive their Swift version from the target definitions
104
+ # they are integrated with. An error is displayed if the target definition Swift versions collide or none
105
+ # of target definitions specify the `SWIFT_VERSION` attribute.
106
+ if swift_pod_target.spec_swift_versions.empty?
107
+ swift_target_definitions = swift_pod_target.target_definitions.reject { |target| target.swift_version.blank? }
108
+ next if swift_target_definitions.uniq(&:swift_version).count == 1
109
+ if swift_target_definitions.empty?
110
+ "- `#{swift_pod_target.name}` does not specify a Swift version and none of the targets " \
111
+ "(#{swift_pod_target.target_definitions.map { |td| "`#{td.name}`" }.to_sentence}) integrating it have the " \
112
+ '`SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at ' \
113
+ 'least one of the targets that integrate this pod.'
114
+ else
115
+ target_errors = swift_target_definitions.map(&error_message_for_target_definition).to_sentence
116
+ "- `#{swift_pod_target.name}` is integrated by multiple targets that use a different Swift version: #{target_errors}."
117
+ end
118
+ elsif !swift_pod_target.swift_version.nil? && swift_pod_target.swift_version.empty?
119
+ "- `#{swift_pod_target.name}` does not specify a Swift version (#{swift_pod_target.spec_swift_versions.map { |v| "`#{v}`" }.to_sentence}) " \
120
+ "that is satisfied by any of targets (#{swift_pod_target.target_definitions.map { |td| "`#{td.name}`" }.to_sentence}) integrating it."
121
+ end
122
+ end.compact
123
+
124
+ unless error_messages.empty?
125
+ raise Informative, "Unable to determine Swift version for the following pods:\n\n#{error_messages.join("\n")}"
126
+ end
127
+ end
128
+
129
+ def verify_swift_pods_have_module_dependencies
130
+ error_messages = []
131
+ pod_targets.each do |pod_target|
132
+ next unless pod_target.uses_swift? && pod_target.should_build?
133
+
134
+ non_module_dependencies = []
135
+ pod_target.dependent_targets.each do |dependent_target|
136
+ next if !dependent_target.should_build? || dependent_target.defines_module?
137
+ non_module_dependencies << dependent_target.name
138
+ end
139
+
140
+ next if non_module_dependencies.empty?
141
+
142
+ error_messages << "The Swift pod `#{pod_target.name}` depends upon #{non_module_dependencies.map { |d| "`#{d}`" }.to_sentence}, " \
143
+ "which #{non_module_dependencies.count == 1 ? 'does' : 'do'} not define modules. " \
144
+ 'To opt into those targets generating module maps '\
145
+ '(which is necessary to import them from Swift when building as static libraries), ' \
146
+ 'you may set `use_modular_headers!` globally in your Podfile, '\
147
+ 'or specify `:modular_headers => true` for particular dependencies.'
148
+ end
149
+ return if error_messages.empty?
150
+
151
+ raise Informative, 'The following Swift pods cannot yet be integrated '\
152
+ "as static libraries:\n\n#{error_messages.join("\n\n")}"
153
+ end
154
+
155
+ def verify_no_multiple_project_names
156
+ error_messages = pod_targets.map do |pod_target|
157
+ project_names = pod_target.target_definitions.map { |td| td.project_name_for_pod(pod_target.pod_name) }.compact.uniq
158
+ next unless project_names.count > 1
159
+ "- `#{pod_target.name}` specifies multiple project names (#{project_names.map { |pn| "`#{pn}`" }.to_sentence}) " \
160
+ "in different targets (#{pod_target.target_definitions.map { |td| "`#{td.name}`" }.to_sentence})."
161
+ end.compact
162
+ return if error_messages.empty?
163
+
164
+ raise Informative, 'The following pods cannot be integrated:' \
165
+ "\n\n#{error_messages.join("\n\n")}"
166
+ end
167
+ end
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,11 @@
1
+ module Pod
2
+ class Installer
3
+ class Xcode
4
+ autoload :PodsProjectGenerator, 'cocoapods/installer/xcode/pods_project_generator'
5
+ autoload :SinglePodsProjectGenerator, 'cocoapods/installer/xcode/single_pods_project_generator'
6
+ autoload :MultiPodsProjectGenerator, 'cocoapods/installer/xcode/multi_pods_project_generator'
7
+ autoload :PodsProjectWriter, 'cocoapods/installer/xcode/pods_project_generator/pods_project_writer'
8
+ autoload :TargetValidator, 'cocoapods/installer/xcode/target_validator'
9
+ end
10
+ end
11
+ end