fastlane-plugin-ipa_info 0.6.0 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -2
- data/lib/fastlane/plugin/ipa_info/actions/ipa_info_action.rb +14 -1
- data/lib/fastlane/plugin/ipa_info/helper/ipa_analyze_helper.rb +58 -43
- data/lib/fastlane/plugin/ipa_info/helper/ipa_info_helper.rb +32 -88
- data/lib/fastlane/plugin/ipa_info/version.rb +1 -1
- metadata +5 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c274242eca7f3f6cef68b370aec94bba735967654c9bcb7c65515fa660f43caa
|
4
|
+
data.tar.gz: 992c705f7bee7050e8a5e7d41848e23dcda1b468c9fb83bb63906d6fb539b1d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ab5ef92d32a75621c6192bf4a01dc9bb605d54bdf24a3d467f83c1307f7a0d0ff67ac488f212bf9f8a2a2c229aca7b1d7939b21c1399405922e6faf6f30ad15
|
7
|
+
data.tar.gz: 8b4ea9fe529d8b1dcd72447ea1316f324d829742a45f8c133e0ea6304364374158e69af9868290e4298a93ef4a0d22c87ece2c69c402ebd123a872428b23005a
|
data/README.md
CHANGED
@@ -11,8 +11,7 @@ fastlane add_plugin ipa_info
|
|
11
11
|
```
|
12
12
|
|
13
13
|
## About ipa_info
|
14
|
-
|
15
|
-
show information of the info.plist file in the ipa file.
|
14
|
+
show the Provisioning Profile and Certificate information in the ipa file.
|
16
15
|
|
17
16
|
## Action
|
18
17
|
|
@@ -22,6 +21,14 @@ ipa_info(
|
|
22
21
|
)
|
23
22
|
```
|
24
23
|
|
24
|
+
|
25
|
+
```
|
26
|
+
ipa_info(
|
27
|
+
ipa_file: ${your_ipa_file_path},
|
28
|
+
add_extract_info_plist_params: [[ "CFBundleIdentifier", "BundleIdentifier" ]]
|
29
|
+
)
|
30
|
+
```
|
31
|
+
|
25
32
|
```
|
26
33
|
lane :build do
|
27
34
|
gym
|
@@ -48,6 +55,9 @@ end
|
|
48
55
|
```
|
49
56
|
|
50
57
|
### Example Result
|
58
|
+
Info.plist Information is optional.
|
59
|
+
|
60
|
+
When use add_extract_info_plist_params, display Info.plist Information.
|
51
61
|
|
52
62
|
```
|
53
63
|
+------------+-----------------------------------+
|
@@ -70,6 +80,14 @@ end
|
|
70
80
|
| BuildVersion | 37 |
|
71
81
|
+--------------+-------+
|
72
82
|
|
83
|
+
+------------------+------------------------------------+
|
84
|
+
| Info.plist Information |
|
85
|
+
+------------------+------------------------------------+
|
86
|
+
| Name | Value |
|
87
|
+
+------------------+------------------------------------+
|
88
|
+
| BundleIdentifier | com.example.tarappo |
|
89
|
+
+------------------+------------------------------------+
|
90
|
+
|
73
91
|
+-------------------------+---------------------------+
|
74
92
|
| Mobile Provision |
|
75
93
|
+-------------------------+---------------------------+
|
@@ -80,8 +98,31 @@ end
|
|
80
98
|
| ExpirationDate | 2019-03-08T00:11:53+00:00 |
|
81
99
|
| DeadLine | 230 day |
|
82
100
|
+-------------------------+---------------------------+
|
101
|
+
|
102
|
+
+------------+-------+
|
103
|
+
| Certificate |
|
104
|
+
+------------+-------+
|
105
|
+
| Name | Value |
|
106
|
+
+------------+-------+
|
107
|
+
| CodeSigned | true |
|
108
|
+
+------------+-------+
|
83
109
|
```
|
84
110
|
|
111
|
+
### Environment
|
112
|
+
All values are set in environment variables.
|
113
|
+
|
114
|
+
- FL_XCODE
|
115
|
+
- FL_XCODEBUILD
|
116
|
+
- FL_MACOS
|
117
|
+
- FL_BUNDLENAME
|
118
|
+
- FL_VERSION
|
119
|
+
- FL_BUILDVERSION
|
120
|
+
- FL_TEAMNAME
|
121
|
+
- FL_PROVISIONINGPROFILENAME
|
122
|
+
- FL_COUNT_DAY
|
123
|
+
- FL_CODESIGNED
|
124
|
+
|
125
|
+
|
85
126
|
## Run tests for this plugin
|
86
127
|
|
87
128
|
To run both the tests, and code style validation, run
|
@@ -20,6 +20,13 @@ module Fastlane
|
|
20
20
|
summary_table = Helper::IpaInfoHelper.summary_table(title: "ipa Information", rows: rows)
|
21
21
|
puts(summary_table)
|
22
22
|
|
23
|
+
# show customize info extract Info.plist
|
24
|
+
unless params[:add_extract_info_plist_params].empty?
|
25
|
+
rows = Helper::IpaInfoHelper.customize_information(ipa_info_result: info_result[:plist_info], add_extract_info_plist_params: params[:add_extract_info_plist_params])
|
26
|
+
summary_table = Helper::IpaInfoHelper.summary_table(title: "Info.plist Information", rows: rows)
|
27
|
+
puts(summary_table)
|
28
|
+
end
|
29
|
+
|
23
30
|
# mobile provisioning info
|
24
31
|
rows = Helper::IpaInfoHelper.mobileprovisioning_information(provision_info_result: info_result[:provisiong_info])
|
25
32
|
summary_table = Helper::IpaInfoHelper.summary_table(title: "Mobile Provision", rows: rows)
|
@@ -55,7 +62,13 @@ module Fastlane
|
|
55
62
|
optional: true,
|
56
63
|
verify_block: proc do |value|
|
57
64
|
raise "Couldn't find ipa file".red unless File.exist?(value)
|
58
|
-
end)
|
65
|
+
end),
|
66
|
+
FastlaneCore::ConfigItem.new(key: :add_extract_info_plist_params,
|
67
|
+
env_name: 'ADD_EXTRACT_INFO_PLIST_PARAMS',
|
68
|
+
description: 'extract customize params for Info.plist. ',
|
69
|
+
default_value: [],
|
70
|
+
is_string: false,
|
71
|
+
optional: true)
|
59
72
|
]
|
60
73
|
end
|
61
74
|
|
@@ -1,44 +1,31 @@
|
|
1
1
|
require 'tempfile'
|
2
2
|
require 'tmpdir'
|
3
|
-
require 'zip'
|
4
|
-
require 'zip/filesystem'
|
5
3
|
require 'fileutils'
|
6
4
|
require 'plist'
|
7
5
|
require 'open3'
|
8
6
|
require 'fastlane_core/ui/ui'
|
7
|
+
require "securerandom"
|
9
8
|
|
10
9
|
module Fastlane
|
11
10
|
module Helper
|
12
11
|
class IpaAnalyzeHelper
|
13
12
|
def self.analyze(ipa_path)
|
14
|
-
|
15
|
-
app_folder_path = find_app_folder_path_in_ipa(ipa_path)
|
16
|
-
ipa_zipfile.close
|
17
|
-
|
18
|
-
# file path
|
19
|
-
mobileprovision_entry = ipa_zipfile.find_entry("#{app_folder_path}/embedded.mobileprovision")
|
20
|
-
UI.user_error!("mobileprovision not found in #{ipa_path}") unless mobileprovision_entry
|
21
|
-
info_plist_entry = ipa_zipfile.find_entry("#{app_folder_path}/Info.plist")
|
22
|
-
UI.user_error!("Info.plist not found in #{ipa_path}") unless info_plist_entry
|
23
|
-
|
13
|
+
# TODO: need to refactoring => only mkdir temp_dir
|
24
14
|
return {
|
25
|
-
provisiong_info: self.
|
26
|
-
plist_info: self.
|
27
|
-
certificate_info:
|
15
|
+
provisiong_info: self.analyze_file_with_unzip(ipa_path, "embedded.mobileprovision"),
|
16
|
+
plist_info: self.analyze_file_with_unzip(ipa_path, "Info.plist"),
|
17
|
+
certificate_info: analyze_file_with_unzip(ipa_path, "")
|
28
18
|
}
|
29
19
|
end
|
30
20
|
|
31
21
|
# Info plist
|
32
|
-
def self.analyze_info_plist(
|
22
|
+
def self.analyze_info_plist(tempfile)
|
33
23
|
result = {}
|
34
24
|
|
35
|
-
tempfile = Tempfile.new(::File.basename(info_plist_entry.name))
|
36
25
|
begin
|
37
|
-
|
38
|
-
UI.user_error!("Failed to convert binary Plist to XML") unless system("plutil -convert xml1 '#{tempfile.path}'")
|
39
|
-
|
40
|
-
plist = Plist.parse_xml(tempfile.path)
|
26
|
+
UI.user_error!("Failed to convert binary Plist to XML") unless system("plutil -convert xml1 '#{tempfile}'")
|
41
27
|
|
28
|
+
plist = Plist.parse_xml(tempfile)
|
42
29
|
plist.each do |key, value|
|
43
30
|
parse_value = value.class == Hash || value.class == Array ? value : value.to_s
|
44
31
|
|
@@ -47,20 +34,18 @@ module Fastlane
|
|
47
34
|
rescue StandardError => e
|
48
35
|
UI.user_error!(e.message)
|
49
36
|
ensure
|
50
|
-
|
37
|
+
FileUtils.rm_r(tempfile)
|
51
38
|
end
|
52
|
-
|
39
|
+
|
40
|
+
result
|
53
41
|
end
|
54
42
|
|
55
43
|
# mobileprovisioning
|
56
|
-
def self.analyze_mobileprovisioning(
|
44
|
+
def self.analyze_mobileprovisioning(tempfile)
|
57
45
|
result = {}
|
58
46
|
|
59
|
-
tempfile = Tempfile.new(::File.basename(mobileprovision_entry.name))
|
60
47
|
begin
|
61
|
-
|
62
|
-
mobileprovisioning = Plist.parse_xml(`security cms -D -i #{tempfile.path}`)
|
63
|
-
|
48
|
+
mobileprovisioning = Plist.parse_xml(`security cms -D -i #{tempfile}`)
|
64
49
|
mobileprovisioning.each do |key, value|
|
65
50
|
next if key == 'DeveloperCertificates'
|
66
51
|
|
@@ -71,38 +56,68 @@ module Fastlane
|
|
71
56
|
rescue StandardError => e
|
72
57
|
UI.user_error!(e.message)
|
73
58
|
ensure
|
74
|
-
|
59
|
+
FileUtils.rm_r(tempfile)
|
75
60
|
end
|
76
|
-
|
61
|
+
|
62
|
+
result
|
77
63
|
end
|
78
64
|
|
79
65
|
# certificate
|
80
|
-
def self.codesigned(
|
66
|
+
def self.codesigned(temp_file_path)
|
81
67
|
result = {}
|
82
|
-
tempdir = Dir.pwd + "/tmp"
|
83
68
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
end
|
69
|
+
cmd = "codesign -dv #{temp_file_path}"
|
70
|
+
_stdout, stderr, _status = Open3.capture3(cmd)
|
71
|
+
codesigned_flag = stderr.include?("Signed Time")
|
88
72
|
|
89
|
-
|
90
|
-
cmd = "codesign -dv #{app_path}"
|
91
|
-
_stdout, stderr, _status = Open3.capture3(cmd)
|
92
|
-
codesigned_flag = stderr.include?("Signed Time")
|
73
|
+
result["CodeSigned"] = codesigned_flag
|
93
74
|
|
94
|
-
|
75
|
+
return result
|
76
|
+
end
|
77
|
+
|
78
|
+
# unzip ipa file and analyze file
|
79
|
+
def self.analyze_file_with_unzip(ipa_path, target_file_name)
|
80
|
+
tempdir = Dir.pwd + "/tmp-#{SecureRandom.hex(10)}"
|
81
|
+
target_file_path = find_app_folder_path_in_ipa(ipa_path) + "/#{target_file_name}"
|
82
|
+
temp_file_path = "#{tempdir}/#{target_file_name}"
|
83
|
+
original_file_path = "#{tempdir}/#{target_file_path}"
|
84
|
+
|
85
|
+
begin
|
86
|
+
_, error, = Open3.capture3("unzip -o -d #{tempdir} #{ipa_path}")
|
87
|
+
UI.user_error!(error) unless error.empty?
|
88
|
+
|
89
|
+
copy_cmd = "#{original_file_path} #{temp_file_path}"
|
90
|
+
|
91
|
+
case target_file_name
|
92
|
+
when "Info.plist" then
|
93
|
+
self.copy_file(copy_cmd)
|
94
|
+
return self.analyze_info_plist(temp_file_path)
|
95
|
+
when "embedded.mobileprovision" then
|
96
|
+
self.copy_file(copy_cmd)
|
97
|
+
return self.analyze_mobileprovisioning(temp_file_path)
|
98
|
+
when "" then
|
99
|
+
return self.codesigned(original_file_path)
|
100
|
+
end
|
95
101
|
rescue StandardError => e
|
102
|
+
FileUtils.rm_r(tempdir)
|
96
103
|
UI.user_error!(e.message)
|
97
104
|
ensure
|
98
105
|
FileUtils.rm_r(tempdir)
|
99
106
|
end
|
100
|
-
|
107
|
+
|
108
|
+
return nil
|
109
|
+
end
|
110
|
+
|
111
|
+
# copy
|
112
|
+
def self.copy_file(cmd)
|
113
|
+
cmd = "cp #{cmd}"
|
114
|
+
_, error, = Open3.capture3(cmd)
|
115
|
+
UI.user_error!(error) unless error.empty?
|
101
116
|
end
|
102
117
|
|
103
118
|
# return app folder path
|
104
119
|
def self.find_app_folder_path_in_ipa(ipa_path)
|
105
|
-
return "Payload
|
120
|
+
return "Payload/*.app"
|
106
121
|
end
|
107
122
|
|
108
123
|
private_class_method :find_app_folder_path_in_ipa
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'fastlane_core/ui/ui'
|
2
|
+
require 'mac_ios_info'
|
2
3
|
|
3
4
|
module Fastlane
|
4
5
|
module Helper
|
@@ -6,8 +7,10 @@ module Fastlane
|
|
6
7
|
# build environment
|
7
8
|
def self.build_environment_information(ipa_info_result:)
|
8
9
|
rows = []
|
9
|
-
[%w[DTXcode Xcode],
|
10
|
-
|
10
|
+
list = [%w[DTXcode Xcode],
|
11
|
+
%w[DTXcodeBuild XcodeBuild]]
|
12
|
+
|
13
|
+
list.each do |key, name|
|
11
14
|
ENV["FL_#{name.upcase}"] = ipa_info_result[key]
|
12
15
|
rows << [name, ipa_info_result[key]]
|
13
16
|
end
|
@@ -16,8 +19,8 @@ module Fastlane
|
|
16
19
|
[%w[BuildMachineOSBuild MacOS]].each do |key, name|
|
17
20
|
mac_os_build = ipa_info_result[key]
|
18
21
|
|
19
|
-
mac_os_version =
|
20
|
-
mac_os_name =
|
22
|
+
mac_os_version = MacIosInfo.macos_build_to_macos_version(build_number: mac_os_build)
|
23
|
+
mac_os_name = MacIosInfo.macos_version_to_os_name(version: mac_os_version)
|
21
24
|
rows << [name, "#{mac_os_name} #{mac_os_version} (#{mac_os_build})"]
|
22
25
|
end
|
23
26
|
|
@@ -27,9 +30,30 @@ module Fastlane
|
|
27
30
|
# ipa info
|
28
31
|
def self.ipa_information(ipa_info_result:)
|
29
32
|
rows = []
|
30
|
-
[%w[CFBundleName BundleName],
|
31
|
-
|
32
|
-
|
33
|
+
list = [%w[CFBundleName BundleName],
|
34
|
+
%w[CFBundleShortVersionString Version],
|
35
|
+
%w[CFBundleVersion BuildVersion]]
|
36
|
+
|
37
|
+
list.each do |key, name|
|
38
|
+
next if key.nil?
|
39
|
+
next if ipa_info_result[key].nil?
|
40
|
+
ENV["FL_#{name.upcase}"] = ipa_info_result[key]
|
41
|
+
|
42
|
+
rows << [name, ipa_info_result[key]]
|
43
|
+
end
|
44
|
+
|
45
|
+
rows
|
46
|
+
end
|
47
|
+
|
48
|
+
# customize info
|
49
|
+
# @param add_extract_info_plist_params Info.plist key and display name
|
50
|
+
# example: [[ "CFBundleIdentifier", "BundleIdentifier" ]]
|
51
|
+
def self.customize_information(ipa_info_result:, add_extract_info_plist_params: nil)
|
52
|
+
rows = []
|
53
|
+
|
54
|
+
add_extract_info_plist_params.each do |key, name|
|
55
|
+
next if key.nil?
|
56
|
+
next if ipa_info_result[key].nil?
|
33
57
|
ENV["FL_#{name.upcase}"] = ipa_info_result[key]
|
34
58
|
|
35
59
|
rows << [name, ipa_info_result[key]]
|
@@ -75,87 +99,7 @@ module Fastlane
|
|
75
99
|
rows
|
76
100
|
end
|
77
101
|
|
78
|
-
#
|
79
|
-
# @return macOS version(High Sierra or higher)
|
80
|
-
def self.macos_build_to_macos_version(build:)
|
81
|
-
case build
|
82
|
-
# macOS Big Sur
|
83
|
-
when "20B29", "20B50" then
|
84
|
-
"11.0.1"
|
85
|
-
# macOS Catalina
|
86
|
-
when "19H2", "19H15" then
|
87
|
-
"10.15.7"
|
88
|
-
when "19G73", "19G2021" then
|
89
|
-
"10.15.6"
|
90
|
-
when "19F101", "19F96" then
|
91
|
-
"10.15.5"
|
92
|
-
when "19E266" then
|
93
|
-
"10.15.4"
|
94
|
-
when "19D76" then
|
95
|
-
"10.15.3"
|
96
|
-
when "19C57" then
|
97
|
-
"10.15.2"
|
98
|
-
when "19B88" then
|
99
|
-
"10.15.1"
|
100
|
-
when "19A583", "19A602", "19A603" then
|
101
|
-
"10.15"
|
102
|
-
# macOS Mojave
|
103
|
-
when "18G84", "18G103", "18G1012", "18G95" then
|
104
|
-
"10.14.6"
|
105
|
-
when "18F132", "18F203" then
|
106
|
-
"10.14.5"
|
107
|
-
when "18E226", "18E227" then
|
108
|
-
"10.14.4"
|
109
|
-
when "18D42", "18D43", "18D109" then
|
110
|
-
"10.14.3"
|
111
|
-
when "18C54" then
|
112
|
-
"10.14.2"
|
113
|
-
when "18B75", "18B2107", "18B3094" then
|
114
|
-
"10.14.1"
|
115
|
-
when "18A391" then
|
116
|
-
"10.14"
|
117
|
-
# macOS High Sierra
|
118
|
-
when "17G65", "17G6029" then
|
119
|
-
"10.13.6"
|
120
|
-
when "17F77" then
|
121
|
-
"10.13.5"
|
122
|
-
when "17E199", "17E201", "17E202" then
|
123
|
-
"10.13.4"
|
124
|
-
when "17D47", "17D102", "17D2047", "17D2102" then
|
125
|
-
"10.13.3"
|
126
|
-
when "17C88", "17C89", "17C205", "17C2205" then
|
127
|
-
"10.13.2"
|
128
|
-
when "17B48", "17B1002", "17B1003" then
|
129
|
-
"10.13.1"
|
130
|
-
when "17A365", "17A405" then
|
131
|
-
"10.13"
|
132
|
-
else
|
133
|
-
"UnKnown"
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
def self.macos_version_to_os_name(version:)
|
138
|
-
major_version = version.split(".")[0].to_i
|
139
|
-
minor_version = version.split(".")[1].to_i
|
140
|
-
# reference https://support.apple.com/ja-jp/HT201260
|
141
|
-
case major_version
|
142
|
-
when 11
|
143
|
-
return "macOS Big Sur"
|
144
|
-
end
|
145
|
-
case minor_version
|
146
|
-
when 15
|
147
|
-
"macOS Catalina"
|
148
|
-
when 14
|
149
|
-
"macOS Mojave"
|
150
|
-
when 13
|
151
|
-
"macOS High Sierra"
|
152
|
-
when 12
|
153
|
-
"macOS Sierra"
|
154
|
-
else
|
155
|
-
"UnKnown"
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
102
|
+
# create summary table
|
159
103
|
def self.summary_table(title:, rows:)
|
160
104
|
Terminal::Table.new(
|
161
105
|
title: title,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-ipa_info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tarappo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plist
|
@@ -31,25 +31,19 @@ dependencies:
|
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '3.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: mac_ios_info
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '1.1'
|
40
37
|
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
39
|
+
version: '0'
|
43
40
|
type: :runtime
|
44
41
|
prerelease: false
|
45
42
|
version_requirements: !ruby/object:Gem::Requirement
|
46
43
|
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '1.1'
|
50
44
|
- - ">="
|
51
45
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
46
|
+
version: '0'
|
53
47
|
- !ruby/object:Gem::Dependency
|
54
48
|
name: pry
|
55
49
|
requirement: !ruby/object:Gem::Requirement
|