cocoapods-tj 1.0.0

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 (69) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +1 -0
  4. data/lib/cocoapods-tj/command/bin/archive.rb +203 -0
  5. data/lib/cocoapods-tj/command/bin/auto.rb +189 -0
  6. data/lib/cocoapods-tj/command/bin/code.rb +198 -0
  7. data/lib/cocoapods-tj/command/bin/imy.rb +45 -0
  8. data/lib/cocoapods-tj/command/bin/init.rb +65 -0
  9. data/lib/cocoapods-tj/command/bin/initHotKey.rb +66 -0
  10. data/lib/cocoapods-tj/command/bin/install.rb +41 -0
  11. data/lib/cocoapods-tj/command/bin/lib/lint.rb +66 -0
  12. data/lib/cocoapods-tj/command/bin/local.rb +142 -0
  13. data/lib/cocoapods-tj/command/bin/repo/update.rb +42 -0
  14. data/lib/cocoapods-tj/command/bin/spec/create.rb +68 -0
  15. data/lib/cocoapods-tj/command/bin/spec/push.rb +114 -0
  16. data/lib/cocoapods-tj/command/bin/update.rb +144 -0
  17. data/lib/cocoapods-tj/command/bin.rb +42 -0
  18. data/lib/cocoapods-tj/command.rb +2 -0
  19. data/lib/cocoapods-tj/config/config.rb +129 -0
  20. data/lib/cocoapods-tj/config/config_asker.rb +49 -0
  21. data/lib/cocoapods-tj/config/config_builder.rb +201 -0
  22. data/lib/cocoapods-tj/config/config_hot_key.rb +102 -0
  23. data/lib/cocoapods-tj/config/config_hot_key_asker.rb +48 -0
  24. data/lib/cocoapods-tj/gem_version.rb +10 -0
  25. data/lib/cocoapods-tj/helpers/Info.plist +0 -0
  26. data/lib/cocoapods-tj/helpers/build_helper.rb +154 -0
  27. data/lib/cocoapods-tj/helpers/build_utils.rb +62 -0
  28. data/lib/cocoapods-tj/helpers/framework.rb +79 -0
  29. data/lib/cocoapods-tj/helpers/framework_builder.rb +391 -0
  30. data/lib/cocoapods-tj/helpers/library.rb +54 -0
  31. data/lib/cocoapods-tj/helpers/library_builder.rb +89 -0
  32. data/lib/cocoapods-tj/helpers/local/loca_llibrary.rb +57 -0
  33. data/lib/cocoapods-tj/helpers/local/local_build_helper.rb +177 -0
  34. data/lib/cocoapods-tj/helpers/local/local_framework.rb +85 -0
  35. data/lib/cocoapods-tj/helpers/local/local_framework_builder.rb +226 -0
  36. data/lib/cocoapods-tj/helpers/local/local_library_builder.rb +91 -0
  37. data/lib/cocoapods-tj/helpers/sources_helper.rb +32 -0
  38. data/lib/cocoapods-tj/helpers/spec_creator.rb +150 -0
  39. data/lib/cocoapods-tj/helpers/spec_files_helper.rb +73 -0
  40. data/lib/cocoapods-tj/helpers/spec_source_creator.rb +189 -0
  41. data/lib/cocoapods-tj/helpers/upload_helper.rb +81 -0
  42. data/lib/cocoapods-tj/helpers.rb +5 -0
  43. data/lib/cocoapods-tj/native/acknowledgements.rb +26 -0
  44. data/lib/cocoapods-tj/native/analyzer.rb +29 -0
  45. data/lib/cocoapods-tj/native/file_accessor.rb +20 -0
  46. data/lib/cocoapods-tj/native/installation_options.rb +21 -0
  47. data/lib/cocoapods-tj/native/installer.rb +106 -0
  48. data/lib/cocoapods-tj/native/linter.rb +26 -0
  49. data/lib/cocoapods-tj/native/path_source.rb +29 -0
  50. data/lib/cocoapods-tj/native/pod_source_installer.rb +18 -0
  51. data/lib/cocoapods-tj/native/pod_target_installer.rb +81 -0
  52. data/lib/cocoapods-tj/native/podfile.rb +91 -0
  53. data/lib/cocoapods-tj/native/podfile_env.rb +37 -0
  54. data/lib/cocoapods-tj/native/podfile_generator.rb +135 -0
  55. data/lib/cocoapods-tj/native/podspec_finder.rb +23 -0
  56. data/lib/cocoapods-tj/native/resolver.rb +202 -0
  57. data/lib/cocoapods-tj/native/sandbox_analyzer.rb +11 -0
  58. data/lib/cocoapods-tj/native/source.rb +35 -0
  59. data/lib/cocoapods-tj/native/sources_manager.rb +18 -0
  60. data/lib/cocoapods-tj/native/specification.rb +10 -0
  61. data/lib/cocoapods-tj/native/target_validator.rb +41 -0
  62. data/lib/cocoapods-tj/native/validator.rb +40 -0
  63. data/lib/cocoapods-tj/native.rb +23 -0
  64. data/lib/cocoapods-tj/source_provider_hook.rb +50 -0
  65. data/lib/cocoapods-tj.rb +2 -0
  66. data/lib/cocoapods_plugin.rb +3 -0
  67. data/spec/command/bin_spec.rb +12 -0
  68. data/spec/spec_helper.rb +50 -0
  69. metadata +182 -0
@@ -0,0 +1,106 @@
1
+
2
+
3
+ require 'parallel'
4
+ require 'cocoapods'
5
+ require 'cocoapods-tj/native/pod_source_installer'
6
+
7
+ module Pod
8
+ class Installer
9
+ alias old_create_pod_installer create_pod_installer
10
+ def create_pod_installer(pod_name)
11
+ installer = old_create_pod_installer(pod_name)
12
+ installer.installation_options = installation_options
13
+ installer
14
+ end
15
+
16
+ alias old_install_pod_sources install_pod_sources
17
+ def install_pod_sources
18
+ if installation_options.install_with_multi_threads
19
+ if Pod.match_version?('~> 1.4.0')
20
+ install_pod_sources_for_version_in_1_4_0
21
+ elsif Pod.match_version?('~> 1.5')
22
+ install_pod_sources_for_version_above_1_5_0
23
+ else
24
+ old_install_pod_sources
25
+ end
26
+ else
27
+ old_install_pod_sources
28
+ end
29
+ end
30
+
31
+ # rewrite install_pod_sources
32
+ def install_pod_sources_for_version_in_1_4_0
33
+ @installed_specs = []
34
+ pods_to_install = sandbox_state.added | sandbox_state.changed
35
+ title_options = { verbose_prefix: '-> '.green }
36
+ Parallel.each(root_specs.sort_by(&:name), in_threads: 4) do |spec|
37
+ if pods_to_install.include?(spec.name)
38
+ if sandbox_state.changed.include?(spec.name) && sandbox.manifest
39
+ previous = sandbox.manifest.version(spec.name)
40
+ title = "Installing #{spec.name} #{spec.version} (was #{previous})"
41
+ else
42
+ title = "Installing #{spec}"
43
+ end
44
+ UI.titled_section(title.green, title_options) do
45
+ install_source_of_pod(spec.name)
46
+ end
47
+ else
48
+ UI.titled_section("Using #{spec}", title_options) do
49
+ create_pod_installer(spec.name)
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ def install_pod_sources_for_version_above_1_5_0
56
+ @installed_specs = []
57
+ pods_to_install = sandbox_state.added | sandbox_state.changed
58
+ title_options = { verbose_prefix: '-> '.green }
59
+
60
+ Parallel.each(root_specs.sort_by(&:name), in_threads: 4) do |spec|
61
+ if pods_to_install.include?(spec.name)
62
+ if sandbox_state.changed.include?(spec.name) && sandbox.manifest
63
+ current_version = spec.version
64
+ previous_version = sandbox.manifest.version(spec.name)
65
+ has_changed_version = current_version != previous_version
66
+ current_repo = analysis_result.specs_by_source.detect do |key, values|
67
+ break key if values.map(&:name).include?(spec.name)
68
+ end
69
+ current_repo &&= current_repo.url || current_repo.name
70
+ previous_spec_repo = sandbox.manifest.spec_repo(spec.name)
71
+ has_changed_repo = !previous_spec_repo.nil? && current_repo && (current_repo != previous_spec_repo)
72
+ title = "Installing #{spec.name} #{spec.version}"
73
+ if has_changed_version && has_changed_repo
74
+ title += " (was #{previous_version} and source changed to `#{current_repo}` from `#{previous_spec_repo}`)"
75
+ end
76
+ if has_changed_version && !has_changed_repo
77
+ title += " (was #{previous_version})"
78
+ end
79
+ if !has_changed_version && has_changed_repo
80
+ title += " (source changed to `#{current_repo}` from `#{previous_spec_repo}`)"
81
+ end
82
+ else
83
+ title = "Installing #{spec}"
84
+ end
85
+ UI.titled_section(title.green, title_options) do
86
+ install_source_of_pod(spec.name)
87
+ end
88
+ else
89
+ UI.titled_section("Using #{spec}", title_options) do
90
+ create_pod_installer(spec.name)
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
96
+
97
+ module Downloader
98
+ class Cache
99
+ @@lock = Mutex.new
100
+ alias old_ensure_matching_version ensure_matching_version
101
+ def ensure_matching_version
102
+ @@lock.synchronize { old_ensure_matching_version }
103
+ end
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,26 @@
1
+
2
+
3
+ require 'cocoapods-tj/native/specification'
4
+
5
+ module Pod
6
+ class Specification
7
+ class Linter
8
+ # !@group Lint steps
9
+
10
+ # Checks that the spec's root name matches the filename.
11
+ #
12
+ # @return [void]
13
+ #
14
+ def validate_root_name
15
+ if spec.root.name && file
16
+ acceptable_names = Specification::VALID_EXTNAME.map { |extname| "#{spec.root.name}#{extname}" }
17
+ names_match = acceptable_names.include?(file.basename.to_s)
18
+ unless names_match
19
+ results.add_error('name', 'The name of the spec should match the ' \
20
+ 'name of the file.')
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,29 @@
1
+
2
+
3
+ require 'cocoapods-tj/native/specification'
4
+
5
+ module Pod
6
+ module ExternalSources
7
+ # Provides support for fetching a specification file from a path local to
8
+ # the machine running the installation.
9
+ #
10
+ class PathSource < AbstractExternalSource
11
+ def normalized_podspec_path(declared_path)
12
+ extension = File.extname(declared_path)
13
+
14
+ if extension == '.podspec' || extension == '.json'
15
+ path_with_ext = declared_path
16
+ else
17
+ path_with_ext = Specification::VALID_EXTNAME
18
+ .map { |extname| "#{declared_path}/#{name}#{extname}" }
19
+ .find { |file| File.exist?(file) } || "#{declared_path}/#{name}.podspec"
20
+ end
21
+
22
+
23
+ podfile_dir = File.dirname(podfile_path || '')
24
+
25
+ File.expand_path(path_with_ext, podfile_dir)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,18 @@
1
+
2
+
3
+ require 'cocoapods-tj/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
+ if installation_options.warn_for_unsecure_source?
13
+ old_verify_source_is_secure(root_spec)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,81 @@
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
+
12
+ alias old_add_swift_library_compatibility_header_phase add_swift_library_compatibility_header_phase
13
+
14
+ def add_swift_library_compatibility_header_phase(native_target)
15
+ if $ARGV[1] == "auto"
16
+
17
+ if custom_module_map
18
+ raise Informative, 'Using Swift static libraries with custom module maps is currently not supported. ' \
19
+ "Please build `#{target.label}` as a framework or remove the custom module map."
20
+ end
21
+
22
+ build_phase = native_target.new_shell_script_build_phase('Copy generated compatibility header')
23
+
24
+ relative_module_map_path = target.module_map_path.relative_path_from(target.sandbox.root)
25
+ relative_umbrella_header_path = target.umbrella_header_path.relative_path_from(target.sandbox.root)
26
+
27
+ build_phase.shell_script = <<-SH.strip_heredoc
28
+ COMPATIBILITY_HEADER_PATH="${BUILT_PRODUCTS_DIR}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}-Swift.h"
29
+ MODULE_MAP_PATH="${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap"
30
+
31
+ ditto "${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h" "${COMPATIBILITY_HEADER_PATH}"
32
+ ditto "${PODS_ROOT}/#{relative_module_map_path}" "${MODULE_MAP_PATH}"
33
+ ditto "${PODS_ROOT}/#{relative_umbrella_header_path}" "${BUILT_PRODUCTS_DIR}"
34
+
35
+ COPY_PATH="${PODS_CONFIGURATION_BUILD_DIR}/${PRODUCT_MODULE_NAME}"
36
+ UMBRELLA_PATH="${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}-umbrella.h"
37
+ SWIFTMODULE_PATH="${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.swiftmodule"
38
+
39
+ ditto "${MODULE_MAP_PATH}" "${PODS_CONFIGURATION_BUILD_DIR}/${PRODUCT_MODULE_NAME}/${PRODUCT_MODULE_NAME}.modulemap"
40
+ ditto "${COMPATIBILITY_HEADER_PATH}" "${COPY_PATH}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}-Swift.h"
41
+ ditto "${COMPATIBILITY_HEADER_PATH}" "${COPY_PATH}"
42
+ ditto "${UMBRELLA_PATH}" "${COPY_PATH}"
43
+ ditto "${SWIFTMODULE_PATH}" "${COPY_PATH}/${PRODUCT_MODULE_NAME}.swiftmodule"
44
+ ditto "${SWIFTMODULE_PATH}" "${COPY_PATH}/${PRODUCT_MODULE_NAME}.swiftmodule"
45
+
46
+ if [ ${PRODUCT_MODULE_NAME} != ${PRODUCT_NAME} ] ; then
47
+ ditto "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}-umbrella.h" "${COPY_PATH}"
48
+ ditto "${COPY_PATH}" "${PODS_CONFIGURATION_BUILD_DIR}/${PRODUCT_NAME}"
49
+ fi
50
+
51
+ MODULE_MAP_SEARCH_PATH = "${PODS_CONFIGURATION_BUILD_DIR}/${PRODUCT_MODULE_NAME}/${PRODUCT_MODULE_NAME}.modulemap"
52
+
53
+ if [${MODULE_MAP_PATH} != ${MODULE_MAP_SEARCH_PATH}] ; then
54
+ 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}"
55
+ fi
56
+
57
+ printf "\\n\\nmodule ${PRODUCT_MODULE_NAME}.Swift {\\n header \\"${COMPATIBILITY_HEADER_PATH}\\"\\n requires objc\\n}\\n" >> "${MODULE_MAP_PATH}"
58
+
59
+ SH
60
+ build_phase.input_paths = %W(
61
+ ${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h
62
+ ${PODS_ROOT}/#{relative_module_map_path}
63
+ ${PODS_ROOT}/#{relative_umbrella_header_path}
64
+ )
65
+ build_phase.output_paths = %W(
66
+ ${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap
67
+ ${BUILT_PRODUCTS_DIR}/#{relative_umbrella_header_path.basename}
68
+ ${BUILT_PRODUCTS_DIR}/Swift\ Compatibility\ Header/${PRODUCT_MODULE_NAME}-Swift.h
69
+ )
70
+ else
71
+ old_add_swift_library_compatibility_header_phase(native_target)
72
+ end
73
+
74
+ end
75
+
76
+ #-----------------------------------------------------------------------#
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,91 @@
1
+
2
+
3
+ require 'cocoapods'
4
+ require 'cocoapods-tj/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-tj')
76
+ raise Pod::Informative, 'You should add `plugin \'cocoapods-tj\'` 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-tj' }, &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,135 @@
1
+
2
+
3
+ require 'parallel'
4
+ require 'cocoapods'
5
+ require 'cocoapods-tj/native/pod_source_installer'
6
+
7
+
8
+ require 'parallel'
9
+ require 'cocoapods'
10
+
11
+ module Pod
12
+ module Generate
13
+ class PodfileGenerator
14
+ alias old_podfile_for_spec podfile_for_spec
15
+
16
+ def podfile_for_spec(spec)
17
+ generator = self
18
+ dir = configuration.gen_dir_for_pod(spec.name)
19
+
20
+ Pod::Podfile.new do
21
+ project "#{spec.name}.xcodeproj"
22
+ workspace "#{spec.name}.xcworkspace"
23
+
24
+ plugin 'cocoapods-generate'
25
+
26
+ install! 'cocoapods', generator.installation_options
27
+
28
+ generator.podfile_plugins.each do |name, options|
29
+ plugin(*[name, options].compact)
30
+ end
31
+
32
+ use_frameworks!(generator.configuration.use_frameworks?)
33
+
34
+ if (supported_swift_versions = generator.supported_swift_versions)
35
+ supports_swift_versions(supported_swift_versions)
36
+ end
37
+
38
+ # Explicitly set sources
39
+ generator.configuration.sources.each do |source_url|
40
+ source(source_url)
41
+ end
42
+
43
+ self.defined_in_file = dir.join('CocoaPods.podfile.yaml')
44
+
45
+ test_specs = spec.recursive_subspecs.select(&:test_specification?)
46
+ app_specs = if spec.respond_to?(:app_specification?)
47
+ spec.recursive_subspecs.select(&:app_specification?)
48
+ else
49
+ []
50
+ end
51
+
52
+ spec_platform_names = spec.available_platforms.map(&:string_name).flatten.each.reject do |platform_name|
53
+ !generator.configuration.platforms.nil? && !generator.configuration.platforms.include?(platform_name.downcase)
54
+ end
55
+
56
+ spec_platform_names.sort.each do |platform_name|
57
+ target "App-#{platform_name}" do
58
+ current_target_definition.swift_version = generator.swift_version if generator.swift_version
59
+ end
60
+ end
61
+
62
+
63
+ inhibit_all_warnings! if generator.inhibit_all_warnings?
64
+ use_modular_headers! if generator.use_modular_headers?
65
+
66
+
67
+ pod_options = generator.dependency_compilation_kwargs(spec.name)
68
+ pod_options[:path] = spec.defined_in_file.relative_path_from(dir).to_s
69
+
70
+
71
+ { testspecs: test_specs, appspecs: app_specs }.each do |key, specs|
72
+ pod_options[key] = specs.map { |s| s.name.sub(%r{^#{Regexp.escape spec.root.name}/}, '') }.sort unless specs.empty?
73
+ end
74
+
75
+ pod spec.name, **pod_options
76
+
77
+ if Pod::Config.instance.podfile
78
+ target_definitions['Pods'].instance_exec do
79
+ target_definition = nil
80
+ Pod::Config.instance.podfile.target_definition_list.each do |target|
81
+ if target.label == "Pods-#{spec.name}"
82
+ target_definition = target
83
+ break
84
+ end
85
+ end
86
+ if(target_definition && target_definition.use_modular_headers_hash.values.any?)
87
+ target_definition.use_modular_headers_hash.values.each do |f|
88
+ f.each { | pod_name| self.set_use_modular_headers_for_pod(pod_name, true) }
89
+ end
90
+ end
91
+
92
+
93
+ if target_definition
94
+ value = target_definition.to_hash['dependencies']
95
+ next if value.blank?
96
+ value.each do |f|
97
+ if f.is_a?(Hash) && f.keys.first == spec.name
98
+ value.delete f
99
+ break
100
+ end
101
+ end
102
+ old_value = self.to_hash['dependencies'].first
103
+ value << old_value unless (old_value == nil || value.include?(old_value))
104
+
105
+ set_hash_value(%w(dependencies).first, value)
106
+
107
+ value = target_definition.to_hash['configuration_pod_whitelist']
108
+ next if value.blank?
109
+ set_hash_value(%w(configuration_pod_whitelist).first, value)
110
+
111
+
112
+ end
113
+
114
+
115
+ end
116
+
117
+ end
118
+
119
+
120
+ next if generator.configuration.local_sources.empty?
121
+ generator.transitive_local_dependencies(spec, generator.configuration.local_sources).each do |dependency, podspec_file|
122
+ pod_options = generator.dependency_compilation_kwargs(dependency.name)
123
+ pod_options[:path] = if podspec_file[0] == '/' # absolute path
124
+ podspec_file
125
+ else
126
+ '../../' + podspec_file
127
+ end
128
+ pod dependency.name, **pod_options
129
+ end
130
+ end
131
+ end
132
+ end
133
+ end
134
+ end
135
+
@@ -0,0 +1,23 @@
1
+
2
+
3
+ require 'cocoapods-tj/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
+ spec_files = spec_files.reject { |p| Specification::DEFAULT_TEMPLATE_EXTNAME.find { |e| p.to_s.end_with?(e) } }
14
+ spec_files.sort_by { |p| -p.to_path.split(File::SEPARATOR).size }.each do |file|
15
+ spec = Specification.from_file(file)
16
+ spec.validate_cocoapods_version
17
+ @specs_by_name[spec.name] = spec
18
+ end
19
+ @specs_by_name
20
+ end
21
+ end
22
+ end
23
+ end