cocoapods-binary-flutter 0.0.10 → 0.0.11
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b88c597014cb78cd0a8e606d2898626bd7f196cfb7ce1f4fca3963799364ed1a
|
4
|
+
data.tar.gz: af937c5707eedf713370c9cd377fe2acae5d439ad211c3d08789351c5c20ef21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15b2c41508730bcab43c192c6785deb78621a162dd816103eca1e09b520a8d8cbda3849499d280622246e41af79cf3dd853ca4b29ee5e1e6e362f18ba913be84
|
7
|
+
data.tar.gz: a2716823fc3d0bc5cfd619716bdb6d5616b1fb15de2280fb06f7c1a258cf85f4190c1d005be55eb9ab9cbd9ee64bc5bb21382ca188fceb7594083592cb3fcb66
|
@@ -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
|
45
|
-
|
46
|
-
puts "开始下载 "+url
|
54
|
+
#下载解压
|
55
|
+
if File.directory?(flutter_binary_path) == false
|
56
|
+
# 获取文件大小
|
47
57
|
uri = URI(url)
|
48
|
-
|
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
|
-
|
65
|
-
|
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
|
#集成
|
data/lib/cocoapods_plugin.rb
CHANGED
@@ -1,2 +1,37 @@
|
|
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
|
+
return unless Pod::Podfile::DSL.enable_fix_flutter_post_install
|
7
|
+
return 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
|
+
next if (target.dependencies.map(&:name).filter { |name| name == 'Flutter' } || []).length > 0
|
18
|
+
|
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
|
+
flutter_additional_ios_build_settings(target)
|
24
|
+
target.dependencies.delete flutter_target
|
25
|
+
target.project.save
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Call old method
|
30
|
+
swizzled_parse_subspecs.bind(self).(installer)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
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.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
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.
|
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.
|