cocoapods-swordfish 0.1.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 721947b07fdb080d739ebf37d1ed4f99db011ac6ef356f412b1dd4a58b971c47
4
- data.tar.gz: 067416a8676c02a51ab0ac40f0a2e81843f113e9337f878994b260c9658815d8
3
+ metadata.gz: 7b70406c682172f53aacf5c8a6a5ef5fd6d46bb6c862b99a8004ece30f23fac0
4
+ data.tar.gz: e761e99d16daf5119687e93a7a03d4c28b2648f1ed486809007bfff21298e677
5
5
  SHA512:
6
- metadata.gz: d891a5eb61264bd27a9569b27d307e5f276bed2d594260796857e39978a99b9bcdf87e6aa5f5fa872a4dab765fa1fa6abc5dc75a96a6aa5f43dc751cdee5a4cc
7
- data.tar.gz: a3f5eddbe0b5a4b5604f75b8d20feb117009b791fa9ab8ac8b6608515c26442ffee2b8d70a1220996d079d0e1c0bc1703180fb72f34e86ddcaffb666438aa145
6
+ metadata.gz: 9a8ff4e6db1928e96ec245abb3204cb0a8000170d5424be56fd7b9248c3edeb2d3123287332ed744251205b08958ba31cadf09bfda1320bb57cb4187d419425e
7
+ data.tar.gz: ec9b55de1f3226e32a1a2fc8ea5c7bc8a6c6cce4ca6b11f2bd10fce134d61f4098361ee55ce48ad13c95e7704c9804071f31e47694572343350426ac57942662
@@ -4,7 +4,7 @@ require 'swordfish/hmap'
4
4
  require 'swordfish/native/target_architectures'
5
5
 
6
6
  module Ocean
7
- Pod::HooksManager.register('cocoapods-swordfish', :post_install) do |post_context, user_options|
7
+ Pod::HooksManager.register('cocoapods-swordfish', :post_install) do |post_context|
8
8
  if $hmap_enable
9
9
  generate_type = $strict_mode ? HmapGenerator::ANGLE_BRACKET : HmapGenerator::BOTH
10
10
  post_context.aggregate_targets.each do |one|
@@ -19,15 +19,10 @@ module Ocean
19
19
  end
20
20
  one.save_hmap(pods_hmap)
21
21
  end
22
- # arm64
23
- Xcodeproj::Project.set_archs_arm64(post_context, $archs_only_arm64)
24
- # m1 EXCLUDED_ARCHS
25
- Pod::Target.excluded_archs_simulator(post_context, $excluded_archs_simulator)
22
+
23
+ Pod::Target.set_archs(post_context, $archs_only_arm64)
26
24
  else
27
- # arm64
28
- Xcodeproj::Project.set_archs_arm64(post_context, $archs_only_arm64)
29
- # m1 EXCLUDED_ARCHS
30
- Pod::Target.excluded_archs_simulator(post_context, $excluded_archs_simulator)
25
+ Pod::Target.set_archs(post_context, $archs_only_arm64)
31
26
  end
32
27
  end
33
28
 
data/lib/gem_version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ocean
4
- VERSION = "0.1.7"
4
+ VERSION = "1.0.0"
5
5
  end
6
6
 
7
7
  module Pod
@@ -147,7 +147,7 @@ module Ocean
147
147
  end
148
148
 
149
149
  def ios_build_options
150
- "ARCHS=\'#{ios_architectures.join(' ')}\' "
150
+ "ARCHS=\'#{ios_architectures.join(' ')}\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'"
151
151
  end
152
152
 
153
153
  def ios_architectures
@@ -163,8 +163,8 @@ module Ocean
163
163
  # iphone5,iphone5s以下的模拟器
164
164
  # >x86_64
165
165
  # iphone6以上的模拟器
166
- # archs = %w[x86_64 arm64 armv7s i386]
167
166
  archs = %w[arm64 armv7]
167
+ # archs = %w[x86_64 arm64 armv7s i386]
168
168
  # @vendored_libraries.each do |library|
169
169
  # archs = `lipo -info #{library}`.split & archs
170
170
  # end
@@ -188,7 +188,7 @@ module Ocean
188
188
  archs = ios_architectures
189
189
  # archs = %w[arm64 armv7 armv7s]
190
190
  archs.map do |arch|
191
- xcodebuild(defines, "ARCHS=\'#{arch}\' ","build-#{arch}",@build_model)
191
+ xcodebuild(defines, "ARCHS=\'#{arch}\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'","build-#{arch}",@build_model)
192
192
  end
193
193
  # else
194
194
  # xcodebuild(defines,options)
@@ -212,6 +212,7 @@ module Ocean
212
212
  end
213
213
 
214
214
  def xcodebuild(defines = '', args = '', build_dir = 'build', build_model = 'Debug')
215
+
215
216
  unless File.exist?("Pods.xcodeproj") #cocoapods-generate v2.0.0
216
217
  command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{File.join(File.expand_path("..", build_dir), File.basename(build_dir))} clean build -configuration #{build_model} SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES -target #{target_name} -project ./Pods/Pods.xcodeproj 2>&1"
217
218
  else
@@ -219,8 +220,7 @@ module Ocean
219
220
  end
220
221
 
221
222
  UI.message "command = #{command}"
222
- output_str = `#{command}`
223
- output = output_str.lines.to_a
223
+ output = `#{command}`.lines.to_a
224
224
 
225
225
  if $CHILD_STATUS.exitstatus != 0
226
226
  raise <<~EOF
@@ -368,7 +368,7 @@ module Ocean
368
368
 
369
369
  def copy_resources
370
370
  resource_dir = './build/*.bundle'
371
- # resource_dir = './build-armv7/*.bundle' if File.exist?('./build-armv7')
371
+ resource_dir = './build-armv7/*.bundle' if File.exist?('./build-armv7')
372
372
  resource_dir = './build-arm64/*.bundle' if File.exist?('./build-arm64')
373
373
 
374
374
  bundles = Dir.glob(resource_dir)
@@ -3,7 +3,6 @@ require 'cocoapods'
3
3
  require 'swordfish/native/podfile_env'
4
4
 
5
5
  $archs_only_arm64 = false
6
- $excluded_archs_simulator = false
7
6
 
8
7
  module Pod
9
8
  class Podfile
@@ -14,10 +13,6 @@ module Pod
14
13
  $archs_only_arm64 = true
15
14
  end
16
15
 
17
- def set_excluded_archs_simulator
18
- $excluded_archs_simulator = true
19
- end
20
-
21
16
  def allow_prerelease
22
17
  set_internal_hash_value(ALLOW_PRERELEASE, true)
23
18
  end
@@ -116,6 +116,15 @@ module Pod
116
116
  end
117
117
 
118
118
  # Parallel.map(rspecs, in_threads: 8) do |rspec|
119
+
120
+ # 当不开启use_binaries时
121
+ if use_binary_rspecs.empty?
122
+ specs_by_target[target] = rspecs.map do |rspec|
123
+ rspec
124
+ end
125
+ next
126
+ end
127
+
119
128
  specs_by_target[target] = rspecs.map do |rspec|
120
129
  # 含有 subspecs 的组件暂不处理
121
130
  # next rspec if rspec.spec.subspec? || rspec.spec.subspecs.any?
@@ -126,7 +135,6 @@ module Pod
126
135
  # next rspec
127
136
  # end
128
137
  #
129
- #
130
138
 
131
139
  spec_version = rspec.spec.version
132
140
  UI.message 'cocoapods-swordfish 插件'
@@ -135,19 +143,24 @@ module Pod
135
143
  # 采用二进制依赖并且不为开发组件
136
144
  use_binary = use_binary_rspecs.include?(rspec)
137
145
 
138
- # source = sources_manager.binary_source
139
- # # 采用非二进制
140
- # unless use_binary
141
- # # missing_binary_specs << rspec.spec
142
- # # next rspec
143
- # source = @aggregate.sources.select { |s|
144
- # logger.info ""
145
- # }
146
- # end
147
-
148
146
  # 只实现二进制效果
149
147
  # source = use_binary ? sources_manager.binary_source : sources_manager.code_source
148
+ # 非二进制遍历取podfile中的source
150
149
  source = sources_manager.binary_source
150
+ if !use_binary
151
+ @sources.uniq.each do |s|
152
+ next if s.name == source.name
153
+ begin
154
+ specification = s.specification(rspec.root.name, spec_version)
155
+ if specification != nil
156
+ source = s
157
+ break
158
+ end
159
+ rescue Pod::StandardError => e
160
+ # 无
161
+ end
162
+ end
163
+ end
151
164
 
152
165
  begin
153
166
  # 从新 source 中获取 spec,在bin archive中会异常,因为找不到
@@ -161,23 +174,11 @@ module Pod
161
174
  # 造成 subspec_by_name 返回 nil,这个是正常现象
162
175
  next unless specification
163
176
 
164
- used_by_only = if Pod.match_version?('~> 1.7')
165
- rspec.used_by_non_library_targets_only
166
- else
167
- rspec.used_by_tests_only
168
- end
169
- # used_by_only = rspec.respond_to?(:used_by_tests_only) ? rspec.used_by_tests_only : rspec.used_by_non_library_targets_only
170
- # 组装新的 rspec ,替换原 rspec
171
- if use_binary
172
- rspec = ResolverSpecification.new(specification, used_by_only, source)
173
- UI.message "组装新的 rspec ,替换原 rspec #{rspec.root.name} #{spec_version} \r\n specification =#{specification} \r\n #{rspec} "
174
-
175
- end
177
+ used_by_only = rspec.used_by_non_library_targets_only
178
+ rspec = ResolverSpecification.new(specification, used_by_only, source)
176
179
 
177
180
  rescue Pod::StandardError => e
178
181
  # 没有从新的 source 找到对应版本组件,直接返回原 rspec
179
-
180
- # missing_binary_specs << rspec.spec if use_binary
181
182
  missing_binary_specs << rspec.spec
182
183
  rspec
183
184
  end
@@ -1,24 +1,24 @@
1
1
 
2
2
  module Pod
3
3
  class Target
4
- def self.excluded_archs_simulator(post_context, is_arm64)
4
+ def self.set_archs(post_context, is_only_arm64)
5
5
  post_context.aggregate_targets.each do |one|
6
6
  one.pod_targets.each { |target|
7
- target.excluded_archs_simulator(is_arm64)
7
+ target.loop_set_archs(is_only_arm64)
8
8
  }
9
- one.excluded_archs_simulator(is_arm64)
9
+ one.set_archs(is_only_arm64)
10
10
  end
11
11
  end
12
12
  end
13
13
 
14
14
  class PodTarget
15
- def excluded_archs_simulator(is_arm64)
15
+ def loop_set_archs(is_arm64)
16
16
  build_settings.each do |config_name, setting|
17
17
  config_file = setting.xcconfig
18
18
  if is_arm64
19
- config_file.set_excluded_archs_simulator
19
+ config_file.set_archs_arm64
20
20
  else
21
- config_file.set_excluded_archs_simulator_default
21
+ config_file.set_archs_default
22
22
  end
23
23
  config_path = xcconfig_path(config_name)
24
24
  config_file.save_as(config_path)
@@ -27,12 +27,12 @@ module Pod
27
27
  end
28
28
 
29
29
  class AggregateTarget
30
- def excluded_archs_simulator(is_arm64)
30
+ def set_archs(is_arm64)
31
31
  xcconfigs.each do |config_name, config_file|
32
32
  if is_arm64
33
- config_file.set_excluded_archs_simulator
33
+ config_file.set_archs_arm64
34
34
  else
35
- config_file.set_excluded_archs_simulator_default
35
+ config_file.set_archs_default
36
36
  end
37
37
  config_path = xcconfig_path(config_name)
38
38
  config_file.save_as(config_path)
@@ -43,37 +43,12 @@ end
43
43
 
44
44
  module Xcodeproj
45
45
  class Config
46
- def set_excluded_archs_simulator_default
47
- remove_attr_with_key('EXCLUDED_ARCHS[sdk=iphonesimulator*]"')
46
+ def set_archs_default
47
+ remove_attr_with_key('ARCHS')
48
48
  end
49
49
 
50
- def set_excluded_archs_simulator
51
- @attributes["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = 'arm64'
52
- end
53
- end
54
-
55
- class Project
56
- def self.set_archs_arm64(post_context, is_arm64)
57
- temp_project = post_context.umbrella_targets.first.user_project
58
- temp_project.targets.each do | target |
59
- build_configurations = target.build_configurations
60
- build_configurations.each do | config |
61
- config.set_archs(is_arm64)
62
- end
63
- end
64
- temp_project.save
65
- end
66
-
67
- module Object
68
- class XCBuildConfiguration
69
- def set_archs(is_arm64)
70
- if is_arm64
71
- build_settings['ARCHS'] = "arm64"
72
- else
73
- build_settings['ARCHS'] = "$(ARCHS_STANDARD)"
74
- end
75
- end
76
- end
50
+ def set_archs_arm64
51
+ @attributes['ARCHS'] = 'arm64'
77
52
  end
78
53
  end
79
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-swordfish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - yuanli
8
- autorequire:
7
+ - lizhi
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-07 00:00:00.000000000 Z
11
+ date: 2022-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -82,7 +82,7 @@ dependencies:
82
82
  version: '0'
83
83
  description: swordfish是一款支持pod二进制化,hmap优化等特性的cocoapods插件.
84
84
  email:
85
- - yuanli_kk925@163.com
85
+ - ios@lizhi.fm
86
86
  executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
@@ -140,12 +140,11 @@ files:
140
140
  - lib/swordfish/native/target_architectures.rb
141
141
  - lib/swordfish/native/target_validator.rb
142
142
  - lib/swordfish/native/validator.rb
143
- homepage: http://rubygems.org/gems/cocoapods-swordfish
143
+ homepage: https://github.com/EXAMPLE/swordfish
144
144
  licenses: []
145
145
  metadata:
146
- allowed_push_host: https://rubygems.org
147
- homepage_uri: http://rubygems.org/gems/cocoapods-swordfish
148
- post_install_message:
146
+ homepage_uri: https://github.com/EXAMPLE/swordfish
147
+ post_install_message:
149
148
  rdoc_options: []
150
149
  require_paths:
151
150
  - lib
@@ -160,8 +159,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
159
  - !ruby/object:Gem::Version
161
160
  version: '0'
162
161
  requirements: []
163
- rubygems_version: 3.2.32
164
- signing_key:
162
+ rubygems_version: 3.0.3.1
163
+ signing_key:
165
164
  specification_version: 4
166
165
  summary: swordfish编译加速插件.
167
166
  test_files: []