cocoapods-binary-flutter 0.0.9 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-binary-flutter/gem_version.rb +1 -1
- data/lib/cocoapods-binary-flutter/hook/podfile.rb +39 -10
- data/lib/cocoapods_plugin.rb +35 -0
- metadata +3 -17
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
|
@@ -7,12 +7,22 @@ require 'fileutils'
|
|
7
7
|
require 'uri'
|
8
8
|
require 'net/http'
|
9
9
|
require 'net/https'
|
10
|
-
require 'colorize'
|
11
10
|
|
12
11
|
module Pod
|
13
12
|
class Podfile
|
14
13
|
module DSL
|
15
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
|
+
|
16
26
|
#下载
|
17
27
|
def install_remote_flutter_binary(url = nil)
|
18
28
|
#md5
|
@@ -41,12 +51,18 @@ module Pod
|
|
41
51
|
|
42
52
|
end
|
43
53
|
|
44
|
-
|
45
|
-
if File
|
46
|
-
|
47
|
-
puts "开始下载 "+url
|
54
|
+
#下载解压
|
55
|
+
if File.directory?(flutter_binary_path) == false
|
56
|
+
# 获取文件大小
|
48
57
|
uri = URI(url)
|
49
|
-
|
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")
|
50
66
|
Net::HTTP.start(uri.host, uri.port,
|
51
67
|
:use_ssl => uri.scheme == 'https',
|
52
68
|
:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
|
@@ -61,9 +77,22 @@ module Pod
|
|
61
77
|
download_file.close
|
62
78
|
end
|
63
79
|
end
|
64
|
-
|
65
|
-
|
66
|
-
|
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
|
67
96
|
end
|
68
97
|
|
69
98
|
#集成
|
@@ -80,7 +109,7 @@ module Pod
|
|
80
109
|
|
81
110
|
raise "产物依赖需要修改 flutter_post_install(installer) 增加define判断` in Podfile `post_install` block
|
82
111
|
flutter_post_install(installer) if defined?(flutter_post_install)
|
83
|
-
"
|
112
|
+
"
|
84
113
|
|
85
114
|
end
|
86
115
|
|
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
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: colorize
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
description: lz binary flutter zip integrated.
|
42
28
|
email:
|
43
29
|
- shanhaoqiang@lizhi.fm
|
@@ -71,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
57
|
- !ruby/object:Gem::Version
|
72
58
|
version: '0'
|
73
59
|
requirements: []
|
74
|
-
rubygems_version: 3.1.
|
60
|
+
rubygems_version: 3.1.6
|
75
61
|
signing_key:
|
76
62
|
specification_version: 4
|
77
63
|
summary: A longer description of cocoapods-binary-flutter.
|