cocoapods-flutter-dt 0.2.7 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51c1e6b26f94766910cca087a1697b87106b48e2cc13474960262b6a90c1112e
4
- data.tar.gz: 82b73cbf5750b86d629d881b049db9969662f1715f0581ac4c4c6ca81676620e
3
+ metadata.gz: 70acc69141278cc52466ce8627ea2ed9647d456f62e31660cc8ce133eadf8480
4
+ data.tar.gz: 77c5a34281bd9ec62c1ac0a5393df90f6d264619358e7ec6157500135a5b232d
5
5
  SHA512:
6
- metadata.gz: 431372086b26158d86be83052d27fa5d1caee2844e00b056662645a17cfc7f66a0fc2b7f207cd01b165a2295ca5ab3911e340d28d974126e447013e248514aeb
7
- data.tar.gz: cf5b96dad0f26cd345dfe6a05eaf1db9bebb72d2853d54d2deef3bf49e1a28d141de2618a27420285713e4980d9c045df190e9ab485f429d6c74d40949c35aab
6
+ metadata.gz: '07395563b55e1ed0d9a630764257dcd72676a67bb6260ee7365eb20d3f3358ca294d2b7218a0725f5eb0fdb2802b91eb3d994e51d75818799292613f94d3452e'
7
+ data.tar.gz: c25ec94332249ac292e20f122fc0210faae4cfce96661e9b1b0f9e9f37eedbf94875c8e4827fcdfadb39d795c65fa64a340f936cc820ff4c3aceee67770bf4ec
@@ -20,10 +20,11 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'parallel'
22
22
  spec.add_dependency 'plist'
23
- spec.add_dependency 'cocoapods', '~> 1.11.2'
23
+ spec.add_dependency 'cocoapods', '~> 1.13.0'
24
24
  spec.add_dependency 'rubyzip', '>= 1.0.0'
25
25
  spec.add_dependency 'rest-client'
26
26
  spec.add_dependency 'molinillo'
27
+ spec.add_dependency 'yaml'
27
28
  spec.add_development_dependency 'bundler', '~> 1.3'
28
29
  spec.add_development_dependency 'rake'
29
30
  end
@@ -23,36 +23,40 @@ module Pod
23
23
  ['--buildrun', 'run build-runner'],
24
24
  ['--debug', 'debug mode'],
25
25
  ['--release', 'release mode'],
26
+ ['--major', 'major version'],
27
+ ['--minor', 'minor version'],
28
+ ['--patch', 'patch version'],
26
29
  ].concat(Pod::Command::Repo::Push.options).concat(super).uniq
27
30
  end
28
31
 
29
32
  def initialize(argv)
30
33
  @module_name = argv.shift_argument
31
- tmp_version = argv.shift_argument
32
- #如果满足
33
- if tmp_version =~ /([0-9]+\.)+[0-9]+/
34
- @version = tmp_version
35
- else
36
- tmp_str = tmp_version.dup
37
- last_v = "0"
38
- mid_v = "0"
39
- main_v = "0"
40
- unless tmp_str.empty?
41
- last_v = tmp_str.slice!(tmp_str.length - 1, 1)
42
- end
43
- unless tmp_str.empty?
44
- mid_v = tmp_str.slice!(tmp_str.length - 1, 1)
45
- end
46
- unless tmp_str.empty?
47
- main_v = tmp_str
48
- end
49
-
50
- versions = Array.new
51
- versions << main_v
52
- versions << mid_v
53
- versions << last_v
54
- @version = versions.join "."
55
- end
34
+ @version = [argv.option('major'), argv.option('minor'), argv.option('patch')].join "."
35
+ # tmp_version = argv.shift_argument
36
+ # #如果满足
37
+ # if tmp_version =~ /([0-9]+\.)+[0-9]+/
38
+ # @version = tmp_version
39
+ # else
40
+ # tmp_str = tmp_version.dup
41
+ # last_v = "0"
42
+ # mid_v = "0"
43
+ # main_v = "0"
44
+ # unless tmp_str.empty?
45
+ # last_v = tmp_str.slice!(tmp_str.length - 1, 1)
46
+ # end
47
+ # unless tmp_str.empty?
48
+ # mid_v = tmp_str.slice!(tmp_str.length - 1, 1)
49
+ # end
50
+ # unless tmp_str.empty?
51
+ # main_v = tmp_str
52
+ # end
53
+ #
54
+ # versions = Array.new
55
+ # versions << main_v
56
+ # versions << mid_v
57
+ # versions << last_v
58
+ # @version = versions.join "."
59
+ # end
56
60
 
57
61
 
58
62
  @build_modes = []
@@ -60,7 +64,7 @@ module Pod
60
64
  @sources = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
61
65
  @flutter_wrapper = argv.option('wrapper', 'flutter')
62
66
  @pub_upgrade = argv.flag?('upgrade', true)
63
- @flutter_version = argv.option('flutterversion', default_fluttter_version)
67
+ @flutter_version = argv.option('flutterversion')
64
68
  @build_run = argv.flag?('buildrun', true)
65
69
  @working_dir = Dir.pwd
66
70
 
@@ -81,7 +85,7 @@ module Pod
81
85
 
82
86
  def default_fluttter_version
83
87
  flutter_version = ''
84
- stdin, stdout_stderr, wait_thr = Open3.popen2e(@flutter_wrapper, '--version');
88
+ stdin, stdout_stderr, wait_thr = Open3.popen2e('fvm', @flutter_wrapper, '--version');
85
89
  stdout_stderr.each_line do |line|
86
90
  if line.start_with?('Flutter ')
87
91
  flutter_version = line.split(' • ').first.split(' ').last
@@ -1,3 +1,3 @@
1
1
  module CocoapodsFlutter
2
- VERSION = "0.2.7"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -5,6 +5,7 @@ require 'cocoapods-flutter/native/archive/zip_tool'
5
5
  require 'cocoapods-flutter/native/archive/remote'
6
6
  require 'molinillo'
7
7
  require 'plist'
8
+ require 'yaml'
8
9
 
9
10
  class Archiver
10
11
 
@@ -54,6 +55,9 @@ class Archiver
54
55
  # end
55
56
  # end
56
57
 
58
+ #使用fvm切换flutter 版本
59
+ flutter_sdk_version_switch @flutter_version
60
+
57
61
  @pub_upgrade ? pub_upgrade : pub_get
58
62
  if local_podfile_exists?
59
63
  use_local_podfile
@@ -64,12 +68,13 @@ class Archiver
64
68
  if @build_run
65
69
  excute_build_run
66
70
  end
71
+
67
72
  build_framework
68
73
  @plugins = fetch_plugins
69
74
 
70
75
  if @build_modes.include?('debug')
71
76
  # Debug瘦身
72
- thin_arm64 "#{@product_dir}Debug/App.framework/App"
77
+ #thin_arm64 "#{@product_dir}Debug/App.framework/App"
73
78
  debug
74
79
  end
75
80
 
@@ -80,41 +85,21 @@ class Archiver
80
85
  Pod::UserInterface.message "All is ready to use!, now you can use 'flutter_pod '#{@module_name}', '#{@version}', :mode=>'debug/release' to use the pod"
81
86
  end
82
87
 
83
- def make_flutter_pods(mode)
84
- @pub_upgrade ? pub_upgrade : pub_get
85
- setup_pod_sources
86
- if @build_run
87
- excute_build_run
88
- end
89
-
90
- build_app mode
88
+ private
91
89
 
92
- flutter_spec_dir = @product_dir + 'Flutter'
93
- flutter_spec_file = flutter_spec_dir + '/Flutter.podspec.json'
94
- flutter_spec = Pod::Spec.from_file @working_dir + '/.ios/Flutter/engine/Flutter.podspec'
95
- flutter_spec.vendored_frameworks = ['Flutter.framework', 'App.framework']
96
- plugin_registrant_spec_file = @working_dir + '/.ios/Flutter/FlutterPluginRegistrant/FlutterPluginRegistrant.podspec'
90
+ def flutter_sdk_version_switch(version)
97
91
 
98
- unless Dir.exist? flutter_spec_dir
99
- FileUtils.mkdir_p flutter_spec_dir
100
- end
92
+ commands = [
93
+ 'fvm',
94
+ 'use',
95
+ version
96
+ ]
101
97
 
102
- File.open flutter_spec_file, "w+" do |file|
103
- file.write flutter_spec.to_pretty_json
98
+ if CommandRunner.run(*commands) == false
99
+ # raise "Error running #{commands.join ' '} "
104
100
  end
105
-
106
- FileUtils.cp_r @working_dir + '/.ios/Flutter/engine/Flutter.framework', flutter_spec_dir
107
- FileUtils.cp_r @working_dir + '/.ios/Flutter/App.framework', flutter_spec_dir
108
-
109
- plugins = fetch_plugins
110
- plugins.append Plugins.new('Flutter',flutter_spec_file,flutter_spec)
111
- plugins.append Plugins.new('FlutterPluginRegistrant',plugin_registrant_spec_file, Pod::Spec.from_file(plugin_registrant_spec_file))
112
-
113
- plugins
114
101
  end
115
102
 
116
- private
117
-
118
103
  def thin_arm64(path)
119
104
  # thin arm64
120
105
  thin_commands = [
@@ -144,13 +129,13 @@ class Archiver
144
129
  end
145
130
 
146
131
  def pub_upgrade
147
- if CommandRunner.run(@flutter_wrapper, 'pub', 'upgrade') == false
132
+ if CommandRunner.run('fvm', @flutter_wrapper, 'pub', 'upgrade') == false
148
133
  raise "Pub upgrade fail"
149
134
  end
150
135
  end
151
136
 
152
137
  def pub_get
153
- if CommandRunner.run(@flutter_wrapper, 'pub', 'get') == false
138
+ if CommandRunner.run('fvm', @flutter_wrapper, 'pub', 'get') == false
154
139
  raise "Pub get fail"
155
140
  end
156
141
  end
@@ -219,7 +204,7 @@ class Archiver
219
204
  end
220
205
 
221
206
  def excute_build_run
222
- if CommandRunner.run(@flutter_wrapper, 'packages','pub','run','build_runner','build','--delete-conflicting-outputs') == false
207
+ if CommandRunner.run('fvm', @flutter_wrapper, 'packages','pub','run','build_runner','build','--delete-conflicting-outputs') == false
223
208
  raise "Error running #{@flutter_wrapper} packages pub run build_runner build --delete-conflicting-outputs"
224
209
  end
225
210
  end
@@ -227,6 +212,7 @@ class Archiver
227
212
  def build_framework
228
213
 
229
214
  commands = [
215
+ 'fvm',
230
216
  @flutter_wrapper,
231
217
  'build',
232
218
  'ios-framework',
@@ -249,16 +235,17 @@ class Archiver
249
235
 
250
236
  end
251
237
 
252
- def build_app(mode)
253
- if CommandRunner.run(@flutter_wrapper, 'build','ios',"--#{mode}" ,"--no-codesign") == false
254
- # FileUtils.remove_dir product_dir, true
255
- raise "Error running #{@flutter_wrapper} build ios --#{mode} --no-codesign"
256
- end
257
- end
238
+ # def build_app(mode)
239
+ # if CommandRunner.run('fvm', @flutter_wrapper, 'build','ios',"--#{mode}" ,"--no-codesign") == false
240
+ # # FileUtils.remove_dir product_dir, true
241
+ # raise "Error running #{@flutter_wrapper} build ios --#{mode} --no-codesign"
242
+ # end
243
+ # end
258
244
 
259
245
  def fetch_plugins
260
246
  results = []
261
247
  flutter_plugins_list = @working_dir + '/.flutter-plugins'
248
+
262
249
  lines = IO.readlines(flutter_plugins_list)
263
250
  lines.each do |line|
264
251
  unless line =~ /^#/
@@ -266,8 +253,38 @@ class Archiver
266
253
  key = key_val[0]
267
254
  value = key_val[1]
268
255
  value = value.gsub /\n/, ''
269
- path = "#{value}ios/#{key}.podspec"
270
- results.append Plugins.new(key, path, Pod::Specification.from_file(path))
256
+ yaml_content = YAML.load_file value + 'pubspec.yaml'
257
+ f_h = yaml_content['flutter']
258
+ if f_h != nil then
259
+ p_h = f_h['plugin']
260
+ if p_h != nil then
261
+ pl_h = p_h['platforms']
262
+ if pl_h != nil then
263
+ if pl_h['ios'] != nil
264
+ path = "#{value}ios/#{key}.podspec"
265
+ if File.exist? path
266
+ results.append Plugins.new(key, path, Pod::Specification.from_file(path))
267
+ end
268
+ end
269
+ else
270
+ path = "#{value}ios/#{key}.podspec"
271
+ if File.exist? path
272
+ results.append Plugins.new(key, path, Pod::Specification.from_file(path))
273
+ end
274
+ end
275
+ else
276
+ path = "#{value}ios/#{key}.podspec"
277
+ if File.exist? path
278
+ results.append Plugins.new(key, path, Pod::Specification.from_file(path))
279
+ end
280
+ end
281
+ else
282
+ path = "#{value}ios/#{key}.podspec"
283
+ if File.exist? path
284
+ results.append Plugins.new(key, path, Pod::Specification.from_file(path))
285
+ end
286
+ end
287
+
271
288
  end
272
289
  end
273
290
  results
@@ -294,12 +311,12 @@ class Archiver
294
311
  zipfile.get_output_stream("info.json") { |f| f.write json }
295
312
  zipfile.add 'pubspec.lock', "#{@working_dir}/pubspec.lock"
296
313
  zipfile.get_output_stream("download_sdk.rb") { |f| f.write sdk_download }
297
- zipfile.add_dir "App.framework", "#{product_dir}/App.framework"
298
- zipfile.add_dir "FlutterPluginRegistrant.framework","#{product_dir}/FlutterPluginRegistrant.framework"
314
+ zipfile.add_dir "App.xcframework", "#{product_dir}/App.xcframework"
315
+ zipfile.add_dir "FlutterPluginRegistrant.xcframework","#{product_dir}/FlutterPluginRegistrant.xcframework"
299
316
  plugins.each do |plugin|
300
- file = File.join(product_dir, "#{plugin.spec.name}.framework")
317
+ file = File.join(product_dir, "#{plugin.spec.name}.xcframework")
301
318
  if Dir.exist? file
302
- zipfile.add_dir("#{plugin.spec.name}.framework", file)
319
+ zipfile.add_dir("#{plugin.spec.name}.xcframework", file)
303
320
  end
304
321
  end
305
322
  end
@@ -314,10 +331,11 @@ class Archiver
314
331
  end
315
332
 
316
333
  Zip::File.open sdk_file, Zip::File::CREATE do |zipfile|
317
- file = File.join(product_dir, "Flutter.framework")
318
- zipfile.add_dir "Flutter/Flutter.framework", file
334
+ file = File.join(product_dir, "Flutter.xcframework")
335
+ zipfile.add_dir "Flutter/Flutter.xcframework", file
319
336
  #读取Flutter.framework中的info.plist文件中的FlutterEngine的值
320
- info_plist_path = File.join(file, "Info.plist")
337
+ info_plist_path = info_plist_from_xcframework file, 1
338
+ # info_plist_path = File.join(file, "Info.plist")
321
339
  info_plist = Plist.parse_xml(info_plist_path)
322
340
  engine_hash = info_plist["FlutterEngine"]
323
341
  dsym_dir = File.join(flutter_sdk_dsym_dir, engine_hash)
@@ -357,6 +375,23 @@ class Archiver
357
375
  [zip_file, sdk_file]
358
376
  end
359
377
 
378
+ #depth 1为第一层
379
+ def info_plist_from_xcframework(path, depth)
380
+ children = Dir.children path
381
+ for child in children
382
+ child_path = File.join path, child
383
+ if File.directory? child_path then
384
+ r = info_plist_from_xcframework child_path, depth + 1
385
+ if r != nil
386
+ return r
387
+ end
388
+ elsif depth > 1 && child == 'Info.plist' then
389
+ return child_path
390
+ end
391
+ end
392
+ return nil
393
+ end
394
+
360
395
  def sdk_download
361
396
 
362
397
  ruby_code = <<-CODE
@@ -373,7 +408,7 @@ end
373
408
  def download(url, dest)
374
409
  open(url) do |u|
375
410
  File.open(dest, "w+") do |file|
376
- file.write u.read.force_encoding("UTF-8")
411
+ file.write u.read
377
412
  end
378
413
  end
379
414
  end
@@ -400,6 +435,7 @@ end
400
435
  end
401
436
 
402
437
  def upload_files(app_file, flutter_sdk, mode)
438
+
403
439
  Pod::UserInterface.info 'Start upload resources'
404
440
  remote = Remote.new()
405
441
  Pod::UserInterface.info "Checking #{@module_name}_#{@version}_#{mode.downcase}..."
@@ -440,7 +476,7 @@ end
440
476
 
441
477
  dependency_graph = Molinillo::DependencyGraph.new
442
478
  @plugins.each do |plugin|
443
- plugin.spec.all_dependencies.each do |dep|
479
+ plugin.spec.all_dependencies('ios').each do |dep|
444
480
  unless ignore_dependency? dep.name
445
481
  dependency_graph.add_vertex(dep.name, dep, true)
446
482
  end
@@ -464,9 +500,9 @@ end
464
500
  s.prepare_command = "ruby download_sdk.rb #{sdk_download_url}"
465
501
  s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64 x86_64' }
466
502
  s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64 x86_64' }
467
- vendored_frameworks = ["App.framework", "Flutter/Flutter.framework", "FlutterPluginRegistrant.framework"]
503
+ vendored_frameworks = ["App.xcframework", "Flutter/Flutter.xcframework", "FlutterPluginRegistrant.xcframework"]
468
504
  @plugins.each do |plugin|
469
- vendored_frameworks.append "#{plugin.name}.framework"
505
+ vendored_frameworks.append "#{plugin.name}.xcframework"
470
506
  end
471
507
  s.vendored_frameworks = vendored_frameworks
472
508
 
@@ -8,6 +8,7 @@ class Remote
8
8
  raise StandardError, "Need 'FLUTTER_BINARY_SERVER_BASEURL' in env"
9
9
  end
10
10
  @base_url = ENV['FLUTTER_BINARY_SERVER_BASEURL']
11
+ @coverage_base_url = ENV['COVERAGE_SERVER_BASEURL']
11
12
  end
12
13
 
13
14
  def exist?(name, version, tag)
@@ -70,4 +71,17 @@ class Remote
70
71
  req.execute
71
72
  end
72
73
 
74
+ def config_coverage(bundle_id, version, git_commit_hash, index_db_path, git_repo, build_base_dir)
75
+ uri = URI.join @coverage_base_url, "/coverage/flutter/report/config"
76
+ Pod::UserInterface.info "Uploading coverage config info to #{uri.to_s}"
77
+ resp = RestClient.post(uri.to_s, {
78
+ index_db: File.new(index_db_path, 'rb'),
79
+ git_commit_hash: git_commit_hash,
80
+ git_repo: git_repo,
81
+ build_base_dir: build_base_dir,
82
+ bundle_id: bundle_id,
83
+ version: version
84
+ })
85
+ end
86
+
73
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-flutter-dt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "\bDreamtracer"
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-22 00:00:00.000000000 Z
11
+ date: 2023-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.11.2
47
+ version: 1.13.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.11.2
54
+ version: 1.13.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubyzip
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: yaml
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: bundler
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -161,7 +175,7 @@ homepage: https://github.com/NicolasKim/cocoapods-flutter-dt.git
161
175
  licenses:
162
176
  - MIT
163
177
  metadata: {}
164
- post_install_message:
178
+ post_install_message:
165
179
  rdoc_options: []
166
180
  require_paths:
167
181
  - lib
@@ -176,8 +190,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
190
  - !ruby/object:Gem::Version
177
191
  version: '0'
178
192
  requirements: []
179
- rubygems_version: 3.0.6
180
- signing_key:
193
+ rubygems_version: 3.0.3.1
194
+ signing_key:
181
195
  specification_version: 4
182
196
  summary: Simple way to foryou and use
183
197
  test_files: