cocoapods-imy-bin 0.2.9.1 → 0.3.0.11

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.
@@ -20,12 +20,12 @@ module CBin
20
20
  end
21
21
 
22
22
  def create
23
- spec = create_from_code_spec
24
-
25
- # Pod::UI.message '生成二进制 podspec 内容: '
26
- # spec.to_pretty_json.split("\n").each do |text|
27
- # Pod::UI.message text
28
- # end
23
+ # spec = nil
24
+ if CBin::Build::Utils.is_framework(@code_spec)
25
+ spec = create_framework_from_code_spec
26
+ else
27
+ spec = create_from_code_spec
28
+ end
29
29
 
30
30
  spec
31
31
  end
@@ -121,12 +121,69 @@ module CBin
121
121
  @spec.vendored_libraries = binary_vendored_libraries
122
122
  @spec.resources = binary_resources if @spec.attributes_hash.keys.include?("resources")
123
123
  @spec.description = <<-EOF
124
- 「 converted automatically by plugin cocoapods-imy-bin @slj 」
124
+ 「 converted automatically by plugin cocoapods-imy-bin @厦门美柚 - slj 」
125
+ #{@spec.description}
126
+ EOF
127
+ @spec
128
+ end
129
+
130
+ def create_framework_from_code_spec
131
+ @spec = code_spec.dup
132
+ # vendored_frameworks | resources | source | source_files | public_header_files
133
+ # license | resource_bundles | vendored_libraries
134
+
135
+ # Project Linkin
136
+ @spec.vendored_frameworks = "#{code_spec.root.name}.framework"
137
+
138
+ # Resources
139
+ extnames = []
140
+ extnames << '*.bundle' if code_spec_consumer.resource_bundles.any?
141
+ if code_spec_consumer.resources.any?
142
+ extnames += code_spec_consumer.resources.map { |r| File.basename(r) }
143
+ end
144
+ if extnames.any?
145
+ @spec.resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
146
+ end
147
+
148
+ # Source Location
149
+ @spec.source = binary_source
150
+
151
+ # Source Code
152
+ # @spec.source_files = framework_contents('Headers/*')
153
+ # @spec.public_header_files = framework_contents('Headers/*')
154
+
155
+ # Unused for binary
156
+ spec_hash = @spec.to_hash
157
+ # spec_hash.delete('license')
158
+ spec_hash.delete('resource_bundles')
159
+ spec_hash.delete('exclude_files')
160
+ spec_hash.delete('preserve_paths')
161
+ # 这里不确定 vendored_libraries 指定的时动态/静态库
162
+ # 如果是静态库的话,需要移除,否则就不移除
163
+ # 最好是静态库都独立成 Pod ,cocoapods-package 打静态库去 collect 目标文件时好做过滤
164
+ # 这里统一只对命名后缀 .a 文件做处理
165
+ # spec_hash.delete('vendored_libraries')
166
+ # libraries 只能假设为动态库不做处理了,如果有例外,需要开发者自行处理
167
+ vendored_libraries = spec_hash.delete('vendored_libraries')
168
+ vendored_libraries = Array(vendored_libraries).reject { |l| l.end_with?('.a') }
169
+ if vendored_libraries.any?
170
+ spec_hash['vendored_libraries'] = vendored_libraries
171
+ end
172
+
173
+ # Filter platforms
174
+ platforms = spec_hash['platforms']
175
+ selected_platforms = platforms.select { |k, _v| @platforms.include?(k) }
176
+ spec_hash['platforms'] = selected_platforms.empty? ? platforms : selected_platforms
177
+
178
+ @spec = Pod::Specification.from_hash(spec_hash)
179
+ @spec.description = <<-EOF
180
+ 「 converted automatically by plugin cocoapods-imy-bin @厦门美柚 - slj 」
125
181
  #{@spec.description}
126
- EOF
182
+ EOF
127
183
  @spec
128
184
  end
129
185
 
186
+
130
187
  def binary_source
131
188
  { http: format(CBin.config.binary_download_url, code_spec.root.name, code_spec.version), type: CBin.config.download_file_type }
132
189
  end
@@ -47,14 +47,19 @@ module CBin
47
47
  def curl_zip
48
48
  zip_file = "#{CBin::Config::Builder.instance.library_file(@spec)}.zip"
49
49
  res = File.exist?(zip_file)
50
- print <<EOF
50
+ unless res
51
+ zip_file = CBin::Config::Builder.instance.framework_zip_file(@spec) + ".zip"
52
+ res = File.exist?(zip_file)
53
+ end
54
+ if res
55
+ print <<EOF
51
56
  上传二进制文件
52
57
  curl #{CBin.config.binary_upload_url} -F "name=#{@spec.name}" -F "version=#{@spec.version}" -F "annotate=#{@spec.name}_#{@spec.version}_log" -F "file=@#{zip_file}"
53
58
  EOF
54
- `curl #{CBin.config.binary_upload_url} -F "name=#{@spec.name}" -F "version=#{@spec.version}" -F "annotate=#{@spec.name}_#{@spec.version}_log" -F "file=@#{zip_file}"` if res
59
+ `curl #{CBin.config.binary_upload_url} -F "name=#{@spec.name}" -F "version=#{@spec.version}" -F "annotate=#{@spec.name}_#{@spec.version}_log" -F "file=@#{zip_file}"` if res
60
+ end
55
61
 
56
62
  res
57
-
58
63
  end
59
64
 
60
65
 
@@ -16,4 +16,8 @@ if Pod.match_version?('~> 1.4')
16
16
  require 'cocoapods-imy-bin/native/acknowledgements'
17
17
  require 'cocoapods-imy-bin/native/sandbox_analyzer'
18
18
  require 'cocoapods-imy-bin/native/podspec_finder'
19
+ require 'cocoapods-imy-bin/native/file_accessor'
20
+ require 'cocoapods-imy-bin/native/pod_target_installer'
21
+ require 'cocoapods-imy-bin/native/target_validator'
22
+
19
23
  end
@@ -48,6 +48,8 @@ module Pod
48
48
  old_update_repositories
49
49
  end
50
50
  end
51
+
52
+
51
53
  end
52
54
  end
53
55
  end
@@ -0,0 +1,28 @@
1
+ require 'macho'
2
+ require 'cocoapods'
3
+
4
+ module Pod
5
+ class Sandbox
6
+ class FileAccessor
7
+
8
+ # swift动态库 需要设置为true
9
+ def dynamic_binary?(binary)
10
+ @cached_dynamic_binary_results ||= {}
11
+ return @cached_dynamic_binary_results[binary] unless @cached_dynamic_binary_results[binary].nil?
12
+ return false unless binary.file?
13
+
14
+ @cached_dynamic_binary_results[binary] = MachO.open(binary).dylib?
15
+ rescue MachO::MachOError
16
+ @cached_dynamic_binary_results[binary] = true
17
+
18
+ end
19
+
20
+ # def expanded_paths(patterns, options = {})
21
+ # return [] if patterns.empty?
22
+ # path_list.glob(patterns, options).flatten.compact.uniq
23
+ # end
24
+
25
+ #-----------------------------------------------------------------------#
26
+ end
27
+ end
28
+ 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
@@ -126,6 +126,14 @@ module Pod
126
126
  break
127
127
  end
128
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
+
129
137
  if target_definition
130
138
  value = target_definition.to_hash['dependencies']
131
139
  next if value.blank?
@@ -139,15 +147,16 @@ module Pod
139
147
  old_value = self.to_hash['dependencies'].first
140
148
  value << old_value unless (old_value == nil || value.include?(old_value))
141
149
 
142
- set_hash_value(%w(dependencies).first, value)
150
+ set_hash_value(%w(dependencies).first, value)
143
151
 
144
152
  value = target_definition.to_hash['configuration_pod_whitelist']
145
153
  next if value.blank?
146
154
  set_hash_value(%w(configuration_pod_whitelist).first, value)
147
155
 
148
- # self.children = Array.new
156
+
149
157
  end
150
158
 
159
+
151
160
  end
152
161
 
153
162
  end
@@ -0,0 +1,41 @@
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
+
9
+
10
+
11
+ def verify_swift_pods_have_module_dependencies
12
+ error_messages = []
13
+ pod_targets.each do |pod_target|
14
+ next unless pod_target.uses_swift?
15
+
16
+ non_module_dependencies = []
17
+ pod_target.dependent_targets.each do |dependent_target|
18
+ next if !dependent_target.should_build? || dependent_target.defines_module?
19
+ non_module_dependencies << dependent_target.name
20
+ end
21
+
22
+ next if non_module_dependencies.empty?
23
+
24
+ error_messages << "The Swift pod `#{pod_target.name}` depends upon #{non_module_dependencies.map { |d| "`#{d}`" }.to_sentence}, " \
25
+ "which #{non_module_dependencies.count == 1 ? 'does' : 'do'} not define modules. " \
26
+ 'To opt into those targets generating module maps '\
27
+ '(which is necessary to import them from Swift when building as static libraries), ' \
28
+ 'you may set `use_modular_headers!` globally in your Podfile, '\
29
+ 'or specify `:modular_headers => true` for particular dependencies.'
30
+ end
31
+ return false
32
+
33
+ # raise Informative, 'The following Swift pods cannot yet be integrated '\
34
+ # "as static libraries:\n\n#{error_messages.join("\n\n")}"
35
+ end
36
+
37
+
38
+ end
39
+ end
40
+ end
41
+ end
@@ -14,44 +14,7 @@ module Pod
14
14
  # Perform analysis for a given spec (or subspec)
15
15
  #
16
16
  def perform_extensive_analysis(spec)
17
- if spec.non_library_specification?
18
- error('spec', "Validating a non library spec (`#{spec.name}`) is not supported.")
19
- return false
20
- end
21
- validate_homepage(spec)
22
- validate_screenshots(spec)
23
- validate_social_media_url(spec)
24
- validate_documentation_url(spec)
25
- validate_source_url(spec)
26
-
27
- platforms = platforms_to_lint(spec)
28
-
29
- valid = platforms.send(fail_fast ? :all? : :each) do |platform|
30
- UI.message "\n\n#{spec} - Analyzing on #{platform} platform.".green.reversed
31
- @consumer = spec.consumer(platform)
32
- setup_validation_environment
33
- begin
34
- create_app_project
35
- # download_pod
36
- # check_file_patterns
37
- # install_pod
38
- # validate_swift_version
39
- # add_app_project_import
40
- # validate_vendored_dynamic_frameworks
41
- # build_pod
42
- # test_pod unless skip_tests
43
- ensure
44
- tear_down_validation_environment
45
- end
46
- validated?
47
- end
48
- return false if fail_fast && !valid
49
- perform_extensive_subspec_analysis(spec) unless @no_subspecs
50
- rescue => e
51
- message = e.to_s
52
- message << "\n" << e.backtrace.join("\n") << "\n" if config.verbose?
53
- error('unknown', "Encountered an unknown error (#{message}) during validation.")
54
- false
17
+ return true
55
18
  end
56
19
 
57
20
  #覆盖
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-imy-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9.1
4
+ version: 0.3.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - 苏良锦
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-18 00:00:00.000000000 Z
11
+ date: 2020-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -113,7 +113,9 @@ files:
113
113
  - lib/cocoapods-imy-bin/config/config_hot_key_asker.rb
114
114
  - lib/cocoapods-imy-bin/gem_version.rb
115
115
  - lib/cocoapods-imy-bin/helpers.rb
116
+ - lib/cocoapods-imy-bin/helpers/Info.plist
116
117
  - lib/cocoapods-imy-bin/helpers/build_helper.rb
118
+ - lib/cocoapods-imy-bin/helpers/build_utils.rb
117
119
  - lib/cocoapods-imy-bin/helpers/framework.rb
118
120
  - lib/cocoapods-imy-bin/helpers/framework_builder.rb
119
121
  - lib/cocoapods-imy-bin/helpers/library.rb
@@ -131,11 +133,13 @@ files:
131
133
  - lib/cocoapods-imy-bin/native.rb
132
134
  - lib/cocoapods-imy-bin/native/acknowledgements.rb
133
135
  - lib/cocoapods-imy-bin/native/analyzer.rb
136
+ - lib/cocoapods-imy-bin/native/file_accessor.rb
134
137
  - lib/cocoapods-imy-bin/native/installation_options.rb
135
138
  - lib/cocoapods-imy-bin/native/installer.rb
136
139
  - lib/cocoapods-imy-bin/native/linter.rb
137
140
  - lib/cocoapods-imy-bin/native/path_source.rb
138
141
  - lib/cocoapods-imy-bin/native/pod_source_installer.rb
142
+ - lib/cocoapods-imy-bin/native/pod_target_installer.rb
139
143
  - lib/cocoapods-imy-bin/native/podfile.rb
140
144
  - lib/cocoapods-imy-bin/native/podfile_env.rb
141
145
  - lib/cocoapods-imy-bin/native/podfile_generator.rb
@@ -145,6 +149,7 @@ files:
145
149
  - lib/cocoapods-imy-bin/native/source.rb
146
150
  - lib/cocoapods-imy-bin/native/sources_manager.rb
147
151
  - lib/cocoapods-imy-bin/native/specification.rb
152
+ - lib/cocoapods-imy-bin/native/target_validator.rb
148
153
  - lib/cocoapods-imy-bin/native/validator.rb
149
154
  - lib/cocoapods-imy-bin/source_provider_hook.rb
150
155
  - lib/cocoapods_plugin.rb
@@ -169,7 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
174
  - !ruby/object:Gem::Version
170
175
  version: '0'
171
176
  requirements: []
172
- rubygems_version: 3.0.1
177
+ rubyforge_project:
178
+ rubygems_version: 2.5.2.3
173
179
  signing_key:
174
180
  specification_version: 4
175
181
  summary: cocoapods-imy-bin is a plugin which helps develpers switching pods between