fir-cli 1.6.13 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/fir-cli.gemspec +1 -5
- data/lib/fir/util/build_ipa.rb +3 -233
- data/lib/fir/util/parser/apk.rb +18 -13
- data/lib/fir/version.rb +1 -1
- metadata +6 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8c6da4ee5e12418303fdb4050554e145e04ce70b033e4460f6ca390d1fd9e18
|
4
|
+
data.tar.gz: ce18cbd160ac0018f5e04d1c02076281d162107449b6d3bdc5d647d5728aa1d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df1656d6250cdc7224eb7f4a5f1fe6a83df2cc3a6bd12d73b9d0a9c4582c5139ab575e5911d9077209700225865256a668e122310f77077d30fe0fd2cdf1ce73
|
7
|
+
data.tar.gz: f6f70fc679141dad2be96059a31b64542cd1f22f7d98538cedcb5642c72db41b26e873f8e156bf56d4e5c01ccd5d63cdec652ddd9b5d7ec0112a8cc4eb8a599d
|
data/README.md
CHANGED
@@ -14,10 +14,9 @@ fir.im-cli 可以通过指令查看, 上传, iOS/Android 应用.
|
|
14
14
|
|
15
15
|
|
16
16
|
# 重要提示
|
17
|
-
|
17
|
+
- 已过期 build_ipa 功能, 推荐用户使用 fastlane (fastlane gym)进行打包,生成好 ipa 文件后,再使用 `fir publish` 上传生成的ipa [2019年03月21日]
|
18
18
|
- 由于 CDN 厂商技术原因, 部分老版本用户会出现 579 错误,解决该问题请升级fir-cli 至最新版
|
19
19
|
- 由于部分地区上传时遇到的证书问题, 新版本默认忽略证书校验. 如需打开, 请在命令前加入`UPLOAD_VERIFY_SSL=1`
|
20
|
-
- 介于在ios 等编译越来越复杂化, fir-cli 自带的 `build_ipa` 编译功能较为简单, 不能很好的满足用户需求, 推荐用户使用 fastlane (fastlane gym)进行打包,生成好 ipa 文件后,再使用 `fir publish` 上传生成的ipa
|
21
20
|
- 现已添加 docker 版本, 具体请见 `Docker 运行 fir-cli ` 说明
|
22
21
|
- 关于因为境外到境内网络不佳的而在上传出现 `stream closed`的问题, 我们已经联系了 CDN 厂商处理, 并将超时时间改为了 300 (秒), 如需修改, 可传入环境变量 `FIR_TIMEOUT=xxx`
|
23
22
|
|
@@ -45,7 +44,7 @@ fir.im-cli 可以通过指令查看, 上传, iOS/Android 应用.
|
|
45
44
|
docker run firhq/fir-cli:latest -e API_TOKEN=XXXX -v ./1.apk:1.apk publish 1.apk
|
46
45
|
```
|
47
46
|
|
48
|
-
##
|
47
|
+
## 在持续集成工具 flow.ci 中的 Docker 使用 fir-cli
|
49
48
|
```
|
50
49
|
# 方便之处是: 不需要安装 Ruby 环境只需要安装Docker环境就行把镜像 flowci/fir-cli 拉下来就能跑
|
51
50
|
# 不方便之处是: 不能使用 xcode 或者 gradle 编译代码,只能 publish 编译好的文件
|
@@ -58,6 +57,7 @@ fir help
|
|
58
57
|
```
|
59
58
|
|
60
59
|
## 最近更新
|
60
|
+
- (1.7.0) 过期了ipa_build 功能, 增加了对 android manifest instant run 的兼容
|
61
61
|
- (1.6.13) 上传图标逻辑修改
|
62
62
|
- (1.6.12) 修复了部分机器没有默认安装 byebug 的问题
|
63
63
|
- (1.6.11) 变化了 ruby gem 仓库地址
|
data/fir-cli.gemspec
CHANGED
@@ -27,13 +27,10 @@ Gem::Specification.new do |spec|
|
|
27
27
|
/_/ /___/_/ |_| \____/_____/___/
|
28
28
|
|
29
29
|
## 更新记录
|
30
|
+
- (1.7.0) 过期了ipa_build 功能, 增加了对 android manifest instant run 的兼容
|
30
31
|
- (1.6.13) 上传图标逻辑修改
|
31
32
|
- (1.6.12) 修复了部分机器没有默认安装 byebug 的问题
|
32
33
|
- (1.6.11) 变化了 ruby gem 仓库地址
|
33
|
-
- (1.6.10) 增加显示release_id 以及 app_id
|
34
|
-
- (1.6.9) 取消了依赖 cfpropertylist 的具体版本号
|
35
|
-
- (1.6.8) 取消了远端回调, 改为本地callback
|
36
|
-
- (1.6.8) fir-cli 也支持了私有部署模式
|
37
34
|
- [fir-cli](https://github.com/firhq/fir-cli) 已经开源
|
38
35
|
- 欢迎 fork, issue 和 pull request
|
39
36
|
)
|
@@ -50,5 +47,4 @@ Gem::Specification.new do |spec|
|
|
50
47
|
spec.add_dependency 'CFPropertyList'
|
51
48
|
spec.add_dependency 'api_tools'
|
52
49
|
spec.add_dependency 'byebug'
|
53
|
-
spec.add_dependency 'xcodeproj'
|
54
50
|
end
|
data/lib/fir/util/build_ipa.rb
CHANGED
@@ -1,241 +1,11 @@
|
|
1
|
-
#
|
2
|
-
require 'xcodeproj'
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
3
|
module FIR
|
5
4
|
module BuildIpa
|
6
|
-
|
7
|
-
|
8
|
-
logger.warn "fir build ipa 即将过期, 请及时迁移打包部分, 推荐使用 fastlane gym"
|
9
|
-
initialize_build_common_options(args, options)
|
10
|
-
|
11
|
-
@build_tmp_dir = Dir.mktmpdir
|
12
|
-
@build_cmd = initialize_ipa_build_cmd(args, options)
|
13
|
-
|
14
|
-
logger_info_and_run_build_command
|
15
|
-
|
16
|
-
output_ipa_and_dsym
|
17
|
-
publish_build_app(options) if options.publish?
|
18
|
-
upload_build_dsym_mapping_file if options.mapping?
|
19
|
-
|
20
|
-
logger_info_blank_line
|
5
|
+
def build_ipa(*_args, _options)
|
6
|
+
logger.error "fir build ipa \b功能已过期, 请及时迁移打包部分, 推荐使用 fastlane gym 生成ipa 后再使用 fir-cli 上传"
|
21
7
|
end
|
22
8
|
|
23
9
|
private
|
24
|
-
|
25
|
-
def initialize_ipa_build_cmd(args, options)
|
26
|
-
@configuration = options[:configuration] || 'Release'
|
27
|
-
@target_name = options[:target]
|
28
|
-
@scheme_name = options[:scheme]
|
29
|
-
@profile_name = options[:profile]
|
30
|
-
@destination = options[:destination]
|
31
|
-
@export_method = options[:export_method] || 'ad-hoc'
|
32
|
-
@optionPlistPath = options[:optionPlistPath]
|
33
|
-
|
34
|
-
build_cmd = 'xcodebuild archive -sdk iphoneos'
|
35
|
-
build_cmd += initialize_xcode_build_path(options)
|
36
|
-
|
37
|
-
build_settings = find_build_setting
|
38
|
-
@team_id = build_settings['DEVELOPMENT_TEAM']
|
39
|
-
provisioning_profile_id = build_settings['PROVISIONING_PROFILE']
|
40
|
-
|
41
|
-
check_ios_scheme(@scheme_name)
|
42
|
-
build_cmd += " -scheme '#{@scheme_name}'" unless @scheme_name.blank?
|
43
|
-
build_cmd += " -configuration '#{@configuration}'" unless @configuration.blank?
|
44
|
-
|
45
|
-
# build_cmd += " -target '#{@target_name}'" unless @target_name.blank?
|
46
|
-
|
47
|
-
# xcarchive name for build -exportArchive
|
48
|
-
@xcarchive_name = @scheme_name.nil? ? @target_name : @scheme_name + '.xcarchive'
|
49
|
-
@xcarchive_path = "#{@build_dir}/fir_build/#{@xcarchive_name}"
|
50
|
-
|
51
|
-
build_cmd += " -archivePath #{@xcarchive_path}"
|
52
|
-
build_cmd += " PROVISIONING_PROFILE='#{provisioning_profile_id}'"
|
53
|
-
build_cmd += " #{ipa_custom_settings(args)} 2>&1"
|
54
|
-
build_cmd
|
55
|
-
end
|
56
|
-
|
57
|
-
def ipa_custom_settings(args)
|
58
|
-
custom_settings = split_assignment_array_to_hash(args)
|
59
|
-
|
60
|
-
setting_str = convert_hash_to_assignment_string(custom_settings)
|
61
|
-
setting_str += " TARGET_BUILD_DIR='#{@build_tmp_dir}'" unless custom_settings['TARGET_BUILD_DIR']
|
62
|
-
setting_str += " CONFIGURATION_BUILD_DIR='#{@build_tmp_dir}'" unless custom_settings['CONFIGURATION_BUILD_DIR']
|
63
|
-
setting_str += " DWARF_DSYM_FOLDER_PATH='#{@output_path}'" unless custom_settings['DWARF_DSYM_FOLDER_PATH']
|
64
|
-
setting_str
|
65
|
-
end
|
66
|
-
|
67
|
-
def output_ipa_and_dsym
|
68
|
-
apps = Dir["#{@build_tmp_dir}/*.app"].sort_by(&:size)
|
69
|
-
# check_no_output_app(apps)
|
70
|
-
|
71
|
-
@temp_ipa = "#{@build_tmp_dir}/#{Time.now.to_i}.ipa"
|
72
|
-
archive_ipa(apps)
|
73
|
-
|
74
|
-
# check_archived_ipa_is_exist
|
75
|
-
rename_ipa_and_dsym
|
76
|
-
|
77
|
-
FileUtils.rm_rf(@build_tmp_dir) unless $DEBUG
|
78
|
-
logger.info 'Build Success'
|
79
|
-
end
|
80
|
-
|
81
|
-
def archive_ipa(apps)
|
82
|
-
logger.info 'Archiving......'
|
83
|
-
logger_info_dividing_line
|
84
|
-
|
85
|
-
option_plist_path = @optionPlistPath || gen_option_plist
|
86
|
-
|
87
|
-
@xcrun_cmd = "#{FIR::Config::XCODE_WRAPPER_PATH} -exportArchive"
|
88
|
-
@xcrun_cmd += " -archivePath #{@xcarchive_path}"
|
89
|
-
@xcrun_cmd += " -exportOptionsPlist #{option_plist_path}"
|
90
|
-
@xcrun_cmd += " -exportPath #{@build_dir}/fir_build"
|
91
|
-
|
92
|
-
puts @xcrun_cmd if $DEBUG
|
93
|
-
logger.info `#{@xcrun_cmd}`
|
94
|
-
end
|
95
|
-
|
96
|
-
def check_archived_ipa_is_exist
|
97
|
-
unless File.exist?(@temp_ipa)
|
98
|
-
logger.error 'Archive failed'
|
99
|
-
exit 1
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def gen_option_plist
|
104
|
-
plist = "
|
105
|
-
<plist version=\"1.0\">
|
106
|
-
<dict>
|
107
|
-
<key>teamID</key>
|
108
|
-
<string>#{@team_id}</string>
|
109
|
-
<key>method</key>
|
110
|
-
<string>#{@export_method}</string>
|
111
|
-
<key>uploadSymbols</key>
|
112
|
-
<true/>
|
113
|
-
<key>compileBitcode</key>
|
114
|
-
<false/>
|
115
|
-
<key>uploadBitcode</key>
|
116
|
-
<false/>
|
117
|
-
</dict>
|
118
|
-
</plist>"
|
119
|
-
|
120
|
-
logger.info 'Generated plist file for exportOptionsPlist argument'
|
121
|
-
logger.info "{"
|
122
|
-
logger.info " teamID:#{@team_id}" unless @team_id.nil?
|
123
|
-
logger.info " method:#{@export_method}"
|
124
|
-
logger.info " uploadSymbols:true"
|
125
|
-
logger.info " uploadBitcode:false"
|
126
|
-
logger.info "}"
|
127
|
-
|
128
|
-
begin
|
129
|
-
plist_path = "#{@build_dir}/fir_build/exportOptions.plist"
|
130
|
-
file = File.open(plist_path, "w")
|
131
|
-
file.write(plist)
|
132
|
-
plist_path
|
133
|
-
rescue IOError => e
|
134
|
-
raise e
|
135
|
-
ensure
|
136
|
-
file.close unless file.nil?
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
# Find build setting from xcode project by target and configuration
|
141
|
-
def find_build_setting
|
142
|
-
project = Xcodeproj::Project.open(@xc_project)
|
143
|
-
|
144
|
-
# find target
|
145
|
-
used_target = project.targets[0]
|
146
|
-
if @target_name
|
147
|
-
project.targets.each do |target|
|
148
|
-
if target.name == @target_name
|
149
|
-
used_target = target
|
150
|
-
end
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
# find configuration settings
|
155
|
-
used_target.build_configurations.each do |config|
|
156
|
-
if config.name == @configuration
|
157
|
-
return config.build_settings
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
logger.info "configuration '#{@configuration}' not found"
|
162
|
-
end
|
163
|
-
|
164
|
-
def rename_ipa_and_dsym
|
165
|
-
@temp_ipa = "#{@build_dir}/fir_build/#{@scheme_name}.ipa"
|
166
|
-
ipa_info = FIR.ipa_info(@temp_ipa)
|
167
|
-
|
168
|
-
if @name.blank?
|
169
|
-
@ipa_name = "#{ipa_info[:name]}-#{ipa_info[:version]}-build-#{ipa_info[:build]}"
|
170
|
-
else
|
171
|
-
@ipa_name = @name
|
172
|
-
end
|
173
|
-
|
174
|
-
@builded_app_path = "#{@output_path}/#{@ipa_name}.ipa"
|
175
|
-
dsym_name = " #{@output_path}/#{ipa_info[:name]}.app.dSYM"
|
176
|
-
|
177
|
-
FileUtils.mv(@temp_ipa, @builded_app_path, force: true)
|
178
|
-
if File.exist?(dsym_name)
|
179
|
-
FileUtils.mv(dsym_name, "#{@output_path}/#{@ipa_name}.app.dSYM", force: true)
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
def upload_build_dsym_mapping_file
|
184
|
-
logger_info_blank_line
|
185
|
-
|
186
|
-
@app_info = ipa_info(@builded_app_path)
|
187
|
-
@mapping_file = Dir["#{@output_path}/#{@ipa_name}.app.dSYM/Contents/Resources/DWARF/*"].first
|
188
|
-
|
189
|
-
mapping @mapping_file, proj: @proj,
|
190
|
-
build: @app_info[:build],
|
191
|
-
version: @app_info[:version],
|
192
|
-
token: @token
|
193
|
-
end
|
194
|
-
|
195
|
-
def initialize_xcode_build_path(options)
|
196
|
-
@xc_workspace = check_and_find_ios_xcworkspace(@build_dir)
|
197
|
-
@xc_project = check_and_find_ios_xcodeproj(@build_dir)
|
198
|
-
|
199
|
-
if options.workspace?
|
200
|
-
" -workspace '#{@xc_workspace}'"
|
201
|
-
else
|
202
|
-
" -project '#{@xc_project}'"
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
%w(xcodeproj xcworkspace).each do |workplace|
|
207
|
-
define_method "check_and_find_ios_#{workplace}" do |path|
|
208
|
-
unless File.exist?(path)
|
209
|
-
logger.error "The first param BUILD_DIR must be a #{workplace} directory"
|
210
|
-
exit 1
|
211
|
-
end
|
212
|
-
|
213
|
-
if File.extname(path) == ".#{workplace}"
|
214
|
-
build_dir = path
|
215
|
-
else
|
216
|
-
build_dir = Dir["#{path}/*.#{workplace}"].first
|
217
|
-
if build_dir.blank?
|
218
|
-
logger.error "The #{workplace} file is missing, check the BUILD_DIR"
|
219
|
-
exit 1
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
build_dir
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
def check_ios_scheme(scheme_name)
|
228
|
-
if scheme_name.blank?
|
229
|
-
logger.error 'Must provide a scheme by `-S` option when build a workspace'
|
230
|
-
exit 1
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
def check_no_output_app(apps)
|
235
|
-
if apps.length == 0
|
236
|
-
logger.error 'Builded has no output app, Can not be packaged'
|
237
|
-
exit 1
|
238
|
-
end
|
239
|
-
end
|
240
10
|
end
|
241
11
|
end
|
data/lib/fir/util/parser/apk.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative './common'
|
4
4
|
|
5
|
+
require 'byebug'
|
5
6
|
module FIR
|
6
7
|
module Parser
|
7
8
|
class Apk
|
@@ -13,30 +14,34 @@ module FIR
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def full_info(options)
|
16
|
-
if options.fetch(:full_info, false)
|
17
|
-
basic_info.merge!(icons: tmp_icons)
|
18
|
-
end
|
17
|
+
basic_info[:icons] = tmp_icons if options.fetch(:full_info, false)
|
19
18
|
|
20
19
|
basic_info
|
21
20
|
end
|
22
21
|
|
23
22
|
def basic_info
|
24
23
|
@basic_info ||= {
|
25
|
-
type:
|
24
|
+
type: 'android',
|
25
|
+
name: fetch_label,
|
26
26
|
identifier: @apk.manifest.package_name,
|
27
|
-
|
28
|
-
|
29
|
-
version: @apk.manifest.version_name.to_s
|
27
|
+
build: @apk.manifest.version_code.to_s,
|
28
|
+
version: @apk.manifest.version_name.to_s
|
30
29
|
}
|
30
|
+
@basic_info.reject! { |_k, v| v.nil? }
|
31
|
+
@basic_info
|
31
32
|
end
|
32
33
|
|
33
34
|
# @apk.icon is a hash, { icon_name: icon_binary_data }
|
34
35
|
def tmp_icons
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
@apk.icon.map { |_, data| generate_tmp_icon(data, :apk) }
|
37
|
+
rescue StandardError
|
38
|
+
[]
|
39
|
+
end
|
40
|
+
|
41
|
+
def fetch_label
|
42
|
+
@apk.label
|
43
|
+
rescue NoMethodError
|
44
|
+
nil
|
40
45
|
end
|
41
46
|
end
|
42
47
|
end
|
data/lib/fir/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fir-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NaixSpirit
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-03-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -165,20 +165,6 @@ dependencies:
|
|
165
165
|
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
|
-
- !ruby/object:Gem::Dependency
|
169
|
-
name: xcodeproj
|
170
|
-
requirement: !ruby/object:Gem::Requirement
|
171
|
-
requirements:
|
172
|
-
- - ">="
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
version: '0'
|
175
|
-
type: :runtime
|
176
|
-
prerelease: false
|
177
|
-
version_requirements: !ruby/object:Gem::Requirement
|
178
|
-
requirements:
|
179
|
-
- - ">="
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: '0'
|
182
168
|
description: fir.im command tool, support iOS and Android
|
183
169
|
email:
|
184
170
|
- atpking@gmail.com
|
@@ -262,10 +248,10 @@ metadata: {}
|
|
262
248
|
post_install_message: "\n ______________ ________ ____\n /
|
263
249
|
____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
|
264
250
|
/\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
|
265
|
-
\ ## 更新记录\n - (1.
|
266
|
-
|
267
|
-
|
268
|
-
|
251
|
+
\ ## 更新记录\n - (1.7.0) 过期了ipa_build 功能, 增加了对 android manifest instant run 的兼容\n
|
252
|
+
\ - (1.6.13) 上传图标逻辑修改\n - (1.6.12) 修复了部分机器没有默认安装 byebug 的问题\n - (1.6.11) 变化了 ruby
|
253
|
+
gem 仓库地址\n - [fir-cli](https://github.com/firhq/fir-cli) 已经开源\n - 欢迎 fork, issue
|
254
|
+
和 pull request\n "
|
269
255
|
rdoc_options: []
|
270
256
|
require_paths:
|
271
257
|
- lib
|