cocoapods-lhj-bin 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 (64) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.md +11 -0
  4. data/lib/cocoapods-lhj-bin.rb +2 -0
  5. data/lib/cocoapods-lhj-bin/command.rb +1 -0
  6. data/lib/cocoapods-lhj-bin/command/bin.rb +59 -0
  7. data/lib/cocoapods-lhj-bin/command/bin/archive.rb +233 -0
  8. data/lib/cocoapods-lhj-bin/command/bin/auto.rb +198 -0
  9. data/lib/cocoapods-lhj-bin/command/bin/code.rb +232 -0
  10. data/lib/cocoapods-lhj-bin/command/bin/dup.rb +78 -0
  11. data/lib/cocoapods-lhj-bin/command/bin/init.rb +69 -0
  12. data/lib/cocoapods-lhj-bin/command/bin/initHotKey.rb +70 -0
  13. data/lib/cocoapods-lhj-bin/command/bin/install.rb +44 -0
  14. data/lib/cocoapods-lhj-bin/command/bin/lhj.rb +46 -0
  15. data/lib/cocoapods-lhj-bin/command/bin/lib/lint.rb +69 -0
  16. data/lib/cocoapods-lhj-bin/command/bin/repo/update.rb +43 -0
  17. data/lib/cocoapods-lhj-bin/command/bin/spec/create.rb +73 -0
  18. data/lib/cocoapods-lhj-bin/command/bin/spec/push.rb +115 -0
  19. data/lib/cocoapods-lhj-bin/command/bin/update.rb +153 -0
  20. data/lib/cocoapods-lhj-bin/config/config.rb +137 -0
  21. data/lib/cocoapods-lhj-bin/config/config_asker.rb +57 -0
  22. data/lib/cocoapods-lhj-bin/config/config_builder.rb +216 -0
  23. data/lib/cocoapods-lhj-bin/config/config_hot_key.rb +103 -0
  24. data/lib/cocoapods-lhj-bin/config/config_hot_key_asker.rb +57 -0
  25. data/lib/cocoapods-lhj-bin/gem_version.rb +9 -0
  26. data/lib/cocoapods-lhj-bin/helpers.rb +5 -0
  27. data/lib/cocoapods-lhj-bin/helpers/Info.plist +0 -0
  28. data/lib/cocoapods-lhj-bin/helpers/build_helper.rb +158 -0
  29. data/lib/cocoapods-lhj-bin/helpers/build_utils.rb +93 -0
  30. data/lib/cocoapods-lhj-bin/helpers/framework.rb +85 -0
  31. data/lib/cocoapods-lhj-bin/helpers/framework_builder.rb +444 -0
  32. data/lib/cocoapods-lhj-bin/helpers/library.rb +54 -0
  33. data/lib/cocoapods-lhj-bin/helpers/library_builder.rb +90 -0
  34. data/lib/cocoapods-lhj-bin/helpers/sources_helper.rb +36 -0
  35. data/lib/cocoapods-lhj-bin/helpers/spec_creator.rb +168 -0
  36. data/lib/cocoapods-lhj-bin/helpers/spec_files_helper.rb +75 -0
  37. data/lib/cocoapods-lhj-bin/helpers/spec_source_creator.rb +227 -0
  38. data/lib/cocoapods-lhj-bin/helpers/upload_helper.rb +87 -0
  39. data/lib/cocoapods-lhj-bin/native.rb +19 -0
  40. data/lib/cocoapods-lhj-bin/native/acknowledgements.rb +27 -0
  41. data/lib/cocoapods-lhj-bin/native/analyzer.rb +55 -0
  42. data/lib/cocoapods-lhj-bin/native/file_accessor.rb +28 -0
  43. data/lib/cocoapods-lhj-bin/native/installation_options.rb +25 -0
  44. data/lib/cocoapods-lhj-bin/native/installer.rb +135 -0
  45. data/lib/cocoapods-lhj-bin/native/linter.rb +26 -0
  46. data/lib/cocoapods-lhj-bin/native/path_source.rb +33 -0
  47. data/lib/cocoapods-lhj-bin/native/pod_source_installer.rb +19 -0
  48. data/lib/cocoapods-lhj-bin/native/pod_target_installer.rb +94 -0
  49. data/lib/cocoapods-lhj-bin/native/podfile.rb +91 -0
  50. data/lib/cocoapods-lhj-bin/native/podfile_env.rb +37 -0
  51. data/lib/cocoapods-lhj-bin/native/podfile_generator.rb +199 -0
  52. data/lib/cocoapods-lhj-bin/native/podspec_finder.rb +25 -0
  53. data/lib/cocoapods-lhj-bin/native/resolver.rb +230 -0
  54. data/lib/cocoapods-lhj-bin/native/sandbox_analyzer.rb +34 -0
  55. data/lib/cocoapods-lhj-bin/native/source.rb +35 -0
  56. data/lib/cocoapods-lhj-bin/native/sources_manager.rb +20 -0
  57. data/lib/cocoapods-lhj-bin/native/specification.rb +31 -0
  58. data/lib/cocoapods-lhj-bin/native/target_validator.rb +41 -0
  59. data/lib/cocoapods-lhj-bin/native/validator.rb +40 -0
  60. data/lib/cocoapods-lhj-bin/source_provider_hook.rb +66 -0
  61. data/lib/cocoapods_plugin.rb +2 -0
  62. data/spec/command/bin_spec.rb +12 -0
  63. data/spec/spec_helper.rb +50 -0
  64. metadata +177 -0
@@ -0,0 +1,19 @@
1
+
2
+
3
+ require 'cocoapods-lhj-bin/native/installation_options'
4
+
5
+ module Pod
6
+ class Installer
7
+ class PodSourceInstaller
8
+ attr_accessor :installation_options
9
+
10
+ alias old_verify_source_is_secure verify_source_is_secure
11
+ def verify_source_is_secure(root_spec)
12
+ # http source 默认不警告
13
+ if installation_options.warn_for_unsecure_source?
14
+ old_verify_source_is_secure(root_spec)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,94 @@
1
+ module Pod
2
+ class Installer
3
+ class Xcode
4
+ class PodsProjectGenerator
5
+ # Creates the target for the Pods libraries in the Pods project and the
6
+ # relative support files.
7
+ #
8
+ class PodTargetInstaller < TargetInstaller
9
+ require 'cocoapods/installer/xcode/pods_project_generator/app_host_installer'
10
+
11
+ # Adds a shell script phase, intended only for library targets that contain swift,
12
+ # to copy the ObjC compatibility header (the -Swift.h file that the swift compiler generates)
13
+ # to the built products directory. Additionally, the script phase copies the module map, appending a `.Swift`
14
+ # submodule that references the (moved) compatibility header. Since the module map has been moved, the umbrella header
15
+ # is _also_ copied, so that it is sitting next to the module map. This is necessary for a successful archive build.
16
+ #
17
+ # @param [PBXNativeTarget] native_target
18
+ # the native target to add the Swift static library script phase into.
19
+ #
20
+ # @return [Void]
21
+ #
22
+ alias old_add_swift_library_compatibility_header_phase add_swift_library_compatibility_header_phase
23
+
24
+ def add_swift_library_compatibility_header_phase(native_target)
25
+ UI.warn("========= swift add_swift_library_compatibility_header_phase")
26
+ if $ARGV[1] == "auto"
27
+ UI.warn("========= auto swift add_swift_library_compatibility_header_phase")
28
+
29
+ if custom_module_map
30
+ raise Informative, 'Using Swift static libraries with custom module maps is currently not supported. ' \
31
+ "Please build `#{target.label}` as a framework or remove the custom module map."
32
+ end
33
+
34
+ build_phase = native_target.new_shell_script_build_phase('Copy generated compatibility header')
35
+
36
+ relative_module_map_path = target.module_map_path.relative_path_from(target.sandbox.root)
37
+ relative_umbrella_header_path = target.umbrella_header_path.relative_path_from(target.sandbox.root)
38
+
39
+ build_phase.shell_script = <<-SH.strip_heredoc
40
+ COMPATIBILITY_HEADER_PATH="${BUILT_PRODUCTS_DIR}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}-Swift.h"
41
+ MODULE_MAP_PATH="${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap"
42
+
43
+ ditto "${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h" "${COMPATIBILITY_HEADER_PATH}"
44
+ ditto "${PODS_ROOT}/#{relative_module_map_path}" "${MODULE_MAP_PATH}"
45
+ ditto "${PODS_ROOT}/#{relative_umbrella_header_path}" "${BUILT_PRODUCTS_DIR}"
46
+
47
+ COPY_PATH="${PODS_CONFIGURATION_BUILD_DIR}/${PRODUCT_MODULE_NAME}"
48
+ UMBRELLA_PATH="${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}-umbrella.h"
49
+ SWIFTMODULE_PATH="${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.swiftmodule"
50
+
51
+ ditto "${MODULE_MAP_PATH}" "${PODS_CONFIGURATION_BUILD_DIR}/${PRODUCT_MODULE_NAME}/${PRODUCT_MODULE_NAME}.modulemap"
52
+ ditto "${COMPATIBILITY_HEADER_PATH}" "${COPY_PATH}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}-Swift.h"
53
+ ditto "${COMPATIBILITY_HEADER_PATH}" "${COPY_PATH}"
54
+ ditto "${UMBRELLA_PATH}" "${COPY_PATH}"
55
+ ditto "${SWIFTMODULE_PATH}" "${COPY_PATH}/${PRODUCT_MODULE_NAME}.swiftmodule"
56
+ ditto "${SWIFTMODULE_PATH}" "${COPY_PATH}/${PRODUCT_MODULE_NAME}.swiftmodule"
57
+
58
+ if [ ${PRODUCT_MODULE_NAME} != ${PRODUCT_NAME} ] ; then
59
+ ditto "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}-umbrella.h" "${COPY_PATH}"
60
+ ditto "${COPY_PATH}" "${PODS_CONFIGURATION_BUILD_DIR}/${PRODUCT_NAME}"
61
+ fi
62
+
63
+ MODULE_MAP_SEARCH_PATH = "${PODS_CONFIGURATION_BUILD_DIR}/${PRODUCT_MODULE_NAME}/${PRODUCT_MODULE_NAME}.modulemap"
64
+
65
+ if [${MODULE_MAP_PATH} != ${MODULE_MAP_SEARCH_PATH}] ; then
66
+ printf "\\n\\nmodule ${PRODUCT_MODULE_NAME}.Swift {\\n header \\"${COPY_PATH}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}-Swift.h\\"\\n requires objc\\n}\\n" >> "${MODULE_MAP_SEARCH_PATH}"
67
+ fi
68
+
69
+ printf "\\n\\nmodule ${PRODUCT_MODULE_NAME}.Swift {\\n header \\"${COMPATIBILITY_HEADER_PATH}\\"\\n requires objc\\n}\\n" >> "${MODULE_MAP_PATH}"
70
+
71
+ SH
72
+ build_phase.input_paths = %W(
73
+ ${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h
74
+ ${PODS_ROOT}/#{relative_module_map_path}
75
+ ${PODS_ROOT}/#{relative_umbrella_header_path}
76
+ )
77
+ build_phase.output_paths = %W(
78
+ ${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap
79
+ ${BUILT_PRODUCTS_DIR}/#{relative_umbrella_header_path.basename}
80
+ ${BUILT_PRODUCTS_DIR}/Swift\ Compatibility\ Header/${PRODUCT_MODULE_NAME}-Swift.h
81
+ )
82
+ else
83
+ UI.warn("========= null swift add_swift_library_compatibility_header_phase")
84
+ old_add_swift_library_compatibility_header_phase(native_target)
85
+ end
86
+
87
+ end
88
+
89
+ #-----------------------------------------------------------------------#
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,91 @@
1
+
2
+
3
+ require 'cocoapods'
4
+ require 'cocoapods-lhj-bin/native/podfile_env'
5
+
6
+ module Pod
7
+ class Podfile
8
+ # TREAT_DEVELOPMENTS_AS_NORMAL = 'treat_developments_as_normal'.freeze
9
+
10
+ module DSL
11
+ def allow_prerelease!
12
+ set_internal_hash_value(ALLOW_PRERELEASE, true)
13
+ end
14
+
15
+ def use_binaries!(flag = true)
16
+ set_internal_hash_value(USE_BINARIES, flag)
17
+ end
18
+
19
+ def use_binaries_with_spec_selector!(&block)
20
+ raise Informative, '必须提供选择需要二进制组件的 block !' unless block_given?
21
+
22
+ set_internal_hash_value(USE_BINARIES_SELECTOR, block)
23
+ end
24
+
25
+ def set_use_source_pods(pods)
26
+ hash_pods_use_source = get_internal_hash_value(USE_SOURCE_PODS) || []
27
+ hash_pods_use_source += Array(pods)
28
+ set_internal_hash_value(USE_SOURCE_PODS, hash_pods_use_source)
29
+ end
30
+
31
+ # 0 dev
32
+ # 1 debug_iphoneos
33
+ # 2 release_iphoneos
34
+ # 需要在podfile_env 先定义 CONFIGURATION_ENV
35
+ def set_configuration_env(env = "dev")
36
+ set_internal_hash_value(CONFIGURATION_ENV, env)
37
+ end
38
+ end
39
+
40
+ alias old_plugins plugins
41
+ def plugins
42
+ if ENV[USE_PLUGINS]
43
+ env_plugins = ENV[USE_PLUGINS].split(',').each_with_object({}) do |name, result|
44
+ result[name] = {}
45
+ end
46
+ env_plugins.merge!(old_plugins)
47
+ else
48
+ old_plugins
49
+ end
50
+ end
51
+
52
+ def use_binaries_selector
53
+ get_internal_hash_value(USE_BINARIES_SELECTOR, nil)
54
+ end
55
+
56
+ def allow_prerelease?
57
+ get_internal_hash_value(ALLOW_PRERELEASE, false) || ENV[ALLOW_PRERELEASE] == 'true'
58
+ end
59
+
60
+ def use_binaries?
61
+ get_internal_hash_value(USE_BINARIES, false) || ENV[USE_BINARIES] == 'true'
62
+ end
63
+
64
+ def use_source_pods
65
+ get_internal_hash_value(USE_SOURCE_PODS, []) + String(ENV[USE_SOURCE_PODS]).split('|').uniq
66
+ end
67
+
68
+ def configuration_env
69
+ get_internal_hash_value(CONFIGURATION_ENV, "dev") || ENV[CONFIGURATION_ENV] == "dev"
70
+ end
71
+
72
+ private
73
+
74
+ def valid_bin_plugin
75
+ unless plugins.keys.include?('cocoapods-lhj-bin')
76
+ raise Pod::Informative, 'You should add `plugin \'cocoapods-lhj-bin\'` before using its DSL'
77
+ end
78
+ end
79
+
80
+ # set_hash_value 有 key 限制
81
+ def set_internal_hash_value(key, value)
82
+ valid_bin_plugin
83
+
84
+ internal_hash[key] = value
85
+ end
86
+
87
+ def get_internal_hash_value(key, default = nil)
88
+ internal_hash.fetch(key, default)
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,37 @@
1
+
2
+
3
+ module Pod
4
+ class Podfile
5
+ USE_BINARIES = 'use_binaries'
6
+ USE_SOURCE_PODS = 'use_source_pods'
7
+ USE_BINARIES_SELECTOR = 'use_binaries_selector'
8
+ ALLOW_PRERELEASE = 'allow_prerelease'
9
+ USE_PLUGINS = 'use_plugins'
10
+ CONFIGURATION_ENV = 'configuration_env'
11
+
12
+ module ENVExecutor
13
+ def execute_with_bin_plugin(&block)
14
+ execute_with_key(USE_PLUGINS, -> { 'cocoapods-lhj-bin' }, &block)
15
+ end
16
+
17
+ def execute_with_allow_prerelease(allow_prerelease, &block)
18
+ execute_with_key(ALLOW_PRERELEASE, -> { allow_prerelease ? 'true' : 'false' }, &block)
19
+ end
20
+
21
+ def execute_with_use_binaries(use_binaries, &block)
22
+ execute_with_key(USE_BINARIES, -> { use_binaries ? 'true' : 'false' }, &block)
23
+ end
24
+
25
+ def execute_with_key(key, value_returner)
26
+ origin_value = ENV[key]
27
+ ENV[key] = value_returner.call
28
+
29
+ yield if block_given?
30
+
31
+ ENV[key] = origin_value
32
+ end
33
+ end
34
+
35
+ extend ENVExecutor
36
+ end
37
+ end
@@ -0,0 +1,199 @@
1
+
2
+
3
+ require 'parallel'
4
+ require 'cocoapods'
5
+ require 'cocoapods-lhj-bin/native/pod_source_installer'
6
+
7
+
8
+ require 'parallel'
9
+ require 'cocoapods'
10
+
11
+ module Pod
12
+ module Generate
13
+ # Generates podfiles for pod specifications given a configuration.
14
+ #
15
+ class PodfileGenerator
16
+ # @return [Podfile] a podfile suitable for installing the given spec
17
+ #
18
+ # @param [Specification] spec
19
+ #
20
+ alias old_podfile_for_spec podfile_for_spec
21
+
22
+ def podfile_for_spec(spec)
23
+ generator = self
24
+ dir = configuration.gen_dir_for_pod(spec.name)
25
+
26
+ Pod::Podfile.new do
27
+ project "#{spec.name}.xcodeproj"
28
+ workspace "#{spec.name}.xcworkspace"
29
+
30
+ plugin 'cocoapods-generate'
31
+
32
+ install! 'cocoapods', generator.installation_options
33
+
34
+ generator.podfile_plugins.each do |name, options|
35
+ plugin(*[name, options].compact)
36
+ end
37
+
38
+ use_frameworks!(generator.use_frameworks_value)
39
+
40
+ if (supported_swift_versions = generator.supported_swift_versions)
41
+ supports_swift_versions(supported_swift_versions)
42
+ end
43
+
44
+ # Explicitly set sources
45
+ generator.configuration.sources.each do |source_url|
46
+ source(source_url)
47
+ end
48
+
49
+ self.defined_in_file = dir.join('CocoaPods.podfile.yaml')
50
+
51
+ test_specs = spec.recursive_subspecs.select(&:test_specification?)
52
+ app_specs = if spec.respond_to?(:app_specification?)
53
+ spec.recursive_subspecs.select(&:app_specification?)
54
+ else
55
+ []
56
+ end
57
+
58
+ # Stick all of the transitive dependencies in an abstract target.
59
+ # This allows us to force CocoaPods to use the versions / sources / external sources
60
+ # that we want.
61
+ # By using an abstract target,
62
+
63
+ # 会导致多个dependencies出现, 注释by slj
64
+ # abstract_target 'Transitive Dependencies' do
65
+ # pods_for_transitive_dependencies = [spec.name]
66
+ # .concat(test_specs.map(&:name))
67
+ # .concat(test_specs.flat_map { |ts| ts.dependencies.flat_map(&:name) })
68
+ # .concat(app_specs.map(&:name))
69
+ # .concat(app_specs.flat_map { |as| as.dependencies.flat_map(&:name) })
70
+ #
71
+ # dependencies = generator
72
+ # .transitive_dependencies_by_pod
73
+ # .values_at(*pods_for_transitive_dependencies)
74
+ # .compact
75
+ # .flatten(1)
76
+ # .uniq
77
+ # .sort_by(&:name)
78
+ # .reject { |d| d.root_name == spec.root.name }
79
+ #
80
+ # dependencies.each do |dependency|
81
+ # pod_args = generator.pod_args_for_dependency(self, dependency)
82
+ # pod(*pod_args)
83
+ # end
84
+ # end
85
+
86
+ # Add platform-specific concrete targets that inherit the
87
+ # `pod` declaration for the local pod.
88
+ spec_platform_names = spec.available_platforms.map(&:string_name).flatten.each.reject do |platform_name|
89
+ !generator.configuration.platforms.nil? && !generator.configuration.platforms.include?(platform_name.downcase)
90
+ end
91
+
92
+ spec_platform_names.sort.each do |platform_name|
93
+ target "App-#{platform_name}" do
94
+ current_target_definition.swift_version = generator.swift_version if generator.swift_version
95
+ end
96
+ end
97
+
98
+ # this block has to come _before_ inhibit_all_warnings! / use_modular_headers!,
99
+ # and the local `pod` declaration
100
+ # 会导致多个dependencies出现, 注释by slj
101
+
102
+
103
+ inhibit_all_warnings! if generator.inhibit_all_warnings?
104
+ use_modular_headers! if generator.use_modular_headers?
105
+
106
+ # This is the pod declaration for the local pod,
107
+ # it will be inherited by the concrete target definitions below
108
+
109
+ pod_options = generator.dependency_compilation_kwargs(spec.name)
110
+ pod_options[:path] = spec.defined_in_file.relative_path_from(dir).to_s
111
+ # generator.configuration.podfile.dependencies[0].external_source
112
+
113
+
114
+ { testspecs: test_specs, appspecs: app_specs }.each do |key, specs|
115
+ pod_options[key] = specs.map { |s| s.name.sub(%r{^#{Regexp.escape spec.root.name}/}, '') }.sort unless specs.empty?
116
+ end
117
+
118
+ pod spec.name, **pod_options
119
+
120
+ if Pod::Config.instance.podfile
121
+ target_definitions['Pods'].instance_exec do
122
+ target_definition = nil
123
+ Pod::Config.instance.podfile.target_definition_list.each do |target|
124
+ if target.label == "Pods-#{spec.name}"
125
+ target_definition = target
126
+ break
127
+ end
128
+ end
129
+ # setting modular_headers_for
130
+ if(target_definition && target_definition.use_modular_headers_hash.values.any?)
131
+ target_definition.use_modular_headers_hash.values.each do |f|
132
+ f.each { | pod_name| self.set_use_modular_headers_for_pod(pod_name, true) }
133
+ end
134
+ end
135
+
136
+
137
+ if target_definition
138
+ value = target_definition.to_hash['dependencies']
139
+ next if value.blank?
140
+ #删除 本地库中的 spec.name,因为本地的./spec.name地址是错的
141
+ value.each do |f|
142
+ if f.is_a?(Hash) && f.keys.first == spec.name
143
+ value.delete f
144
+ break
145
+ end
146
+ end
147
+ old_value = self.to_hash['dependencies'].first
148
+ value << old_value unless (old_value == nil || value.include?(old_value))
149
+
150
+ set_hash_value(%w(dependencies).first, value)
151
+
152
+ value = target_definition.to_hash['configuration_pod_whitelist']
153
+ next if value.blank?
154
+ set_hash_value(%w(configuration_pod_whitelist).first, value)
155
+
156
+
157
+ end
158
+
159
+
160
+ end
161
+
162
+ end
163
+
164
+ # if generator.configuration && generator.configuration.podfile
165
+ # #变量本地podfile下的dependencies 写入新的验证文件中,指定依赖源
166
+ # generator.configuration.podfile.dependencies.each { |dependencies|
167
+ # #如果不存在dependencies.external_source,就不变量
168
+ # next unless dependencies.external_source
169
+ #
170
+ # dependencies.external_source.each { |key_d, value|
171
+ # pod_options = generator.dependency_compilation_kwargs(dependencies.name)
172
+ # pod_options[key_d] = value.to_s
173
+ # { testspecs: test_specs, appspecs: app_specs }.each do |key, specs|
174
+ # pod_options[key] = specs.map { |s| s.name.sub(%r{^#{Regexp.escape spec.root.name}/}, '') }.sort unless specs.empty?
175
+ # end
176
+ # # 过滤 dependencies.name == spec.name
177
+ # pod(dependencies.name, **pod_options) unless dependencies.name == spec.name
178
+ # }
179
+ # }
180
+ # end
181
+
182
+
183
+ # Implement local-sources option to set up dependencies to podspecs in the local filesystem.
184
+ next if generator.configuration.local_sources.empty?
185
+ generator.transitive_local_dependencies(spec, generator.configuration.local_sources).each do |dependency, podspec_file|
186
+ pod_options = generator.dependency_compilation_kwargs(dependency.name)
187
+ pod_options[:path] = if podspec_file[0] == '/' # absolute path
188
+ podspec_file
189
+ else
190
+ '../../' + podspec_file
191
+ end
192
+ pod dependency.name, **pod_options
193
+ end
194
+ end
195
+ end
196
+ end
197
+ end
198
+ end
199
+
@@ -0,0 +1,25 @@
1
+
2
+
3
+ require 'cocoapods-lhj-bin/native/specification'
4
+
5
+ module Pod
6
+ class Sandbox
7
+ class PodspecFinder
8
+ def podspecs
9
+ return @specs_by_name if @specs_by_name
10
+
11
+ @specs_by_name = {}
12
+ spec_files = Pathname.glob(root + '{,*}.podspec{,.json}')
13
+ # pod 指向分支时,如果目标组件有 subspec ,并且有 template spec ,request 之后使用的 spec 不应该为 template spec
14
+ # 这里做下过滤
15
+ spec_files = spec_files.reject { |p| Specification::DEFAULT_TEMPLATE_EXTNAME.find { |e| p.to_s.end_with?(e) } }
16
+ spec_files.sort_by { |p| -p.to_path.split(File::SEPARATOR).size }.each do |file|
17
+ spec = Specification.from_file(file)
18
+ spec.validate_cocoapods_version
19
+ @specs_by_name[spec.name] = spec
20
+ end
21
+ @specs_by_name
22
+ end
23
+ end
24
+ end
25
+ end