cocoapods-binary-flutter 0.0.10 → 0.0.12

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: 45a78d4160a4185a779ffa96559f7212d15772a2a6f13f97e8ed5b351f53f5ed
4
- data.tar.gz: dc70a593e669e3559f45f843762a3f1553a51e8d57fbe455ba0c7001b867e0f9
3
+ metadata.gz: 2154b92602c5874fad79ae07a09119ecfef58df5955297e487970ffcbf1da980
4
+ data.tar.gz: 825dd77579ae4b1278fb76c629f65692116bf3bed1080813c276b4b5afb86727
5
5
  SHA512:
6
- metadata.gz: 13197e4f417b28527a2abe258710b01d9b7d821c2d6f6085a56fcaef86b94c9c745d223e9ea354fae4ddd92a5e4887fc57bb733716d2151e6748c62f4fccb594
7
- data.tar.gz: 9487dc0b7b8985d8ac0a1ebde6f4438776f5e049a9bf72c2e4794094b293764c841f3f8eacc392a61cfc9f349ed635b00c209c28cfcef8a7b4dfaf5596e49073
6
+ metadata.gz: 71c62a143918470efb10364a4022cf175d728d201a62d7d117e7c01a2db75b67e418c286a255d18fbdf452b09012d510e1b22cf034c47e94e8863de25faceaef
7
+ data.tar.gz: dbb069fed9cced7694aee7aae7fe337c29cdda18654cccf84ec8c52a1c88351bb43bfccdcd11b060197af0fd3f3af3811a62cb85ae2f43e2efeee17587f4d59d
@@ -1,3 +1,3 @@
1
1
  module CocoapodsBinaryFlutter
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -12,6 +12,17 @@ module Pod
12
12
  class Podfile
13
13
  module DSL
14
14
 
15
+ @@enable_fix_flutter_post_install = false
16
+
17
+ def self.enable_fix_flutter_post_install
18
+ @@enable_fix_flutter_post_install
19
+ end
20
+
21
+ def enable_fix_flutter_post_install!
22
+ @@enable_fix_flutter_post_install = true
23
+ end
24
+
25
+
15
26
  #下载
16
27
  def install_remote_flutter_binary(url = nil)
17
28
  #md5
@@ -40,12 +51,18 @@ module Pod
40
51
 
41
52
  end
42
53
 
43
- #判断缓存
44
- if File::directory?(flutter_binary_path) == false
45
- #下载
46
- puts "开始下载 "+url
54
+ #下载解压
55
+ if File.directory?(flutter_binary_path) == false
56
+ # 获取文件大小
47
57
  uri = URI(url)
48
- download_file = open(flutter_binary_home+"/binary.zip", "wb")
58
+ http = Net::HTTP.new(uri.host, uri.port)
59
+ http.use_ssl = true if uri.scheme == 'https'
60
+ response = http.head(uri.request_uri)
61
+ expected_size = response['Content-Length'].to_i
62
+
63
+ # 下载文件
64
+ puts "开始下载 " + url
65
+ download_file = open(File.join(flutter_binary_home, "binary.zip"), "wb")
49
66
  Net::HTTP.start(uri.host, uri.port,
50
67
  :use_ssl => uri.scheme == 'https',
51
68
  :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
@@ -60,9 +77,22 @@ module Pod
60
77
  download_file.close
61
78
  end
62
79
  end
63
- #解压
64
- puts "开始解压"+flutter_binary_home
65
- system("unzip", "-n", flutter_binary_home+'/binary.zip', "-d", flutter_binary_home)
80
+
81
+ # 校验文件大小
82
+ actual_size = File.size(File.join(flutter_binary_home, "binary.zip"))
83
+ if actual_size != expected_size
84
+ puts "文件大小和预期不匹配"
85
+ raise "文件大小和预期不匹配"
86
+ end
87
+
88
+ # 解压文件
89
+ puts "开始解压 " + flutter_binary_home
90
+ begin
91
+ system("unzip", "-n", File.join(flutter_binary_home, "binary.zip"), "-d", flutter_binary_home)
92
+ rescue => exception
93
+ puts "解压失败: " + exception.message
94
+ raise "解压失败"
95
+ end
66
96
  end
67
97
 
68
98
  #集成
@@ -1,2 +1,33 @@
1
1
  require 'cocoapods-binary-flutter/command'
2
2
  require 'cocoapods-binary-flutter/hook'
3
+
4
+ # 解决多工程 target 的情况下,编译错误,找不到 <Flutter/Flutter.h> 文件
5
+ Pod::HooksManager.register('cocoapods-binary-flutter', :pre_install) do |_installer_context, _options|
6
+ break unless Pod::Podfile::DSL.enable_fix_flutter_post_install
7
+ break unless defined?(Pod::Podfile.instance_method(:flutter_post_install))
8
+
9
+ swizzled_parse_subspecs = Pod::Podfile.instance_method(:flutter_post_install)
10
+
11
+ define_method(:flutter_post_install) do |installer, _skip: false|
12
+ puts '解决多工程 target 的情况下,编译错误,找不到 <Flutter/Flutter.h> 文件'
13
+ # 解决多工程 target 的情况下,编译错误,找不到 <Flutter/Flutter.h> 文件
14
+ installer.aggregate_targets.each do |t|
15
+ t.user_project.native_targets.each do |target|
16
+ # 如果本来就有依赖 Flutter 的话,就不处理了
17
+ flutter_target = nil
18
+ if target.dependencies.map(&:name).filter { |name| name == 'Flutter' }.empty?
19
+ # 添加一个 Flutter 的依赖 Target,用于欺骗 Flutter 的 podhelper 脚本来未工程添加配置,用完后去除,避免影响工程
20
+ flutter_target = Xcodeproj::Project::Object::PBXTargetDependency.new(target.project, nil)
21
+ flutter_target.name = 'Flutter'
22
+ target.dependencies << flutter_target
23
+ end
24
+ flutter_additional_ios_build_settings(target)
25
+ target.dependencies.delete flutter_target unless flutter_target.nil?
26
+ target.project.save
27
+ end
28
+ end
29
+
30
+ # Call old method
31
+ swizzled_parse_subspecs.bind(self).call(installer)
32
+ end
33
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-binary-flutter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-30 00:00:00.000000000 Z
11
+ date: 2023-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
57
  - !ruby/object:Gem::Version
58
58
  version: '0'
59
59
  requirements: []
60
- rubygems_version: 3.1.4
60
+ rubygems_version: 3.1.6
61
61
  signing_key:
62
62
  specification_version: 4
63
63
  summary: A longer description of cocoapods-binary-flutter.