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,179 @@
1
+ module Pod
2
+ class Installer
3
+ class UserProjectIntegrator
4
+ class TargetIntegrator
5
+ # Configures an user target to use the CocoaPods xcconfigs which allow
6
+ # lo link against the Pods.
7
+ #
8
+ class XCConfigIntegrator
9
+ # Integrates the user target.
10
+ #
11
+ # @param [Target::AggregateTarget] pod_bundle
12
+ # The Pods bundle.
13
+ #
14
+ # @param [Array<PBXNativeTarget>] targets
15
+ # The native targets associated which should be integrated
16
+ # with the Pod bundle.
17
+ #
18
+ def self.integrate(pod_bundle, targets)
19
+ targets.each do |target|
20
+ target.build_configurations.each do |config|
21
+ set_target_xcconfig(pod_bundle, target, config)
22
+ end
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ # @!group Integration steps
29
+ #-------------------------------------------------------------------#
30
+
31
+ # Creates a file reference to the xcconfig generated by
32
+ # CocoaPods (if needed) and sets it as the base configuration of
33
+ # build configuration of the user target.
34
+ #
35
+ # @param [Target::AggregateTarget] pod_bundle
36
+ # The Pods bundle.
37
+ #
38
+ # @param [PBXNativeTarget] target
39
+ # The native target.
40
+ #
41
+ # @param [Xcodeproj::XCBuildConfiguration] config
42
+ # The build configuration.
43
+ #
44
+ def self.set_target_xcconfig(pod_bundle, target, config)
45
+ file_ref = create_xcconfig_ref(pod_bundle, config)
46
+ path = file_ref.path
47
+
48
+ existing = config.base_configuration_reference
49
+
50
+ if existing && existing != file_ref
51
+ if existing.real_path.to_path.start_with?(pod_bundle.sandbox.root.to_path << '/')
52
+ config.base_configuration_reference = file_ref
53
+ elsif !xcconfig_includes_target_xcconfig?(config.base_configuration_reference, path)
54
+ unless existing_config_is_identical_to_pod_config?(existing.real_path, pod_bundle.xcconfig_path(config.name))
55
+ UI.warn 'CocoaPods did not set the base configuration of your ' \
56
+ 'project because your project already has a custom ' \
57
+ 'config set. In order for CocoaPods integration to work at ' \
58
+ 'all, please either set the base configurations of the target ' \
59
+ "`#{target.name}` to `#{path}` or include the `#{path}` in your " \
60
+ "build configuration (#{UI.path(existing.real_path)})."
61
+ end
62
+ end
63
+ elsif config.base_configuration_reference.nil? || file_ref.nil?
64
+ config.base_configuration_reference = file_ref
65
+ end
66
+ end
67
+
68
+ private
69
+
70
+ # @!group Private helpers
71
+ #-------------------------------------------------------------------#
72
+
73
+ # Prints a warning informing the user that a build configuration of
74
+ # the integrated target is overriding the CocoaPods build settings.
75
+ #
76
+ # @param [Target::AggregateTarget] pod_bundle
77
+ # The Pods bundle.
78
+ #
79
+ # @param [XcodeProj::PBXNativeTarget] target
80
+ # The native target.
81
+ #
82
+ # @param [Xcodeproj::XCBuildConfiguration] config
83
+ # The build configuration.
84
+ #
85
+ # @param [String] key
86
+ # The key of the overridden build setting.
87
+ #
88
+ def self.print_override_warning(pod_bundle, target, config, key)
89
+ actions = [
90
+ 'Use the `$(inherited)` flag, or',
91
+ 'Remove the build settings from the target.',
92
+ ]
93
+ message = "The `#{target.name} [#{config.name}]` " \
94
+ "target overrides the `#{key}` build setting defined in " \
95
+ "`#{pod_bundle.pod_bundle.xcconfig_relative_path(config.name)}'. " \
96
+ 'This can lead to problems with the CocoaPods installation'
97
+ UI.warn(message, actions)
98
+ end
99
+
100
+ # Naively checks to see if a given PBXFileReference imports a given
101
+ # path.
102
+ #
103
+ # @param [PBXFileReference] base_config_ref
104
+ # A file reference to an `.xcconfig` file.
105
+ #
106
+ # @param [String] target_config_path
107
+ # The path to check for.
108
+ #
109
+ SILENCE_WARNINGS_STRING = '// @COCOAPODS_SILENCE_WARNINGS@ //'
110
+ def self.xcconfig_includes_target_xcconfig?(base_config_ref, target_config_path)
111
+ return unless base_config_ref && base_config_ref.real_path.file?
112
+ regex = %r{
113
+ ^(
114
+ (\s* # Possible, but unlikely, space before include statement
115
+ \#include(\?)?\s+ # Include statement
116
+ ['"] # Open quote
117
+ (.*\/)? # Possible prefix to path
118
+ #{Regexp.quote(target_config_path)} # The path should end in the target_config_path
119
+ ['"] # Close quote
120
+ )
121
+ |
122
+ (#{Regexp.quote(SILENCE_WARNINGS_STRING)}) # Token to treat xcconfig as good and silence pod install warnings
123
+ )
124
+ }x
125
+ base_config_ref.real_path.readlines.find { |line| line =~ regex }
126
+ end
127
+
128
+ # Checks to see if the config files at two paths exist and are identical
129
+ #
130
+ # @param The existing config path
131
+ #
132
+ # @param The pod config path
133
+ #
134
+ def self.existing_config_is_identical_to_pod_config?(existing_config_path, pod_config_path)
135
+ existing_config_path.file? && (!pod_config_path.file? || FileUtils.compare_file(existing_config_path, pod_config_path))
136
+ end
137
+
138
+ # Creates a file reference to the xcconfig generated by
139
+ # CocoaPods (if needed).
140
+ # If the Pods group not exists, create the group and set
141
+ # the location to the `Pods` directory.
142
+ # If the file reference exists, the location is different
143
+ # with the xcconfig's path and the symlink target paths
144
+ # are different, we will update the location.
145
+ #
146
+ # @param [Target::AggregateTarget] pod_bundle
147
+ # The Pods bundle.
148
+ #
149
+ # @param [Xcodeproj::XCBuildConfiguration] config
150
+ # The build configuration.
151
+ #
152
+ # @return [PBXFileReference] the xcconfig reference.
153
+ #
154
+ def self.create_xcconfig_ref(pod_bundle, config)
155
+ # Xcode root group's path is absolute, we must get the relative path of the sandbox to the user project
156
+ group_path = pod_bundle.relative_pods_root_path
157
+ group = config.project['Pods'] || config.project.new_group('Pods', group_path)
158
+
159
+ # support user custom paths of Pods group and xcconfigs files.
160
+ group_path = Pathname.new(group.real_path)
161
+ xcconfig_path = Pathname.new(pod_bundle.xcconfig_path(config.name))
162
+ path = xcconfig_path.relative_path_from(group_path)
163
+
164
+ filename = path.basename.to_s
165
+ file_ref = group.files.find { |f| f.display_name == filename }
166
+ if file_ref && file_ref.path != path
167
+ file_ref_path = Pathname.new(file_ref.real_path)
168
+ if !file_ref_path.exist? || !xcconfig_path.exist? || file_ref_path.realpath != xcconfig_path.realpath
169
+ file_ref.path = path.to_s
170
+ end
171
+ end
172
+
173
+ file_ref || group.new_file(path.to_s)
174
+ end
175
+ end
176
+ end
177
+ end
178
+ end
179
+ end