fastlane-plugin-analyze_ios_framework 0.1.0 → 0.1.1

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: f5f437bcbed329cd23c6ede616b8f135a072dc13cda326b2612dfc35a42243ed
4
- data.tar.gz: 2559b865e2bd426bcdd88144f7e435b7e6b809224cf49c21ee4d49eb5e1bfd49
3
+ metadata.gz: 376fa98d4fdebd8b6a1029273b8478555779f91021a38c8f64d234ca37a82954
4
+ data.tar.gz: e9f1b7b45bd0bb0774803b3853d468edb0d07424d30858a77155fd94aabe313e
5
5
  SHA512:
6
- metadata.gz: 100426b2c6f0a7e7159232a434dbd1e893171cd2c4ab2e915f7c0010039de39bfb2e1dab47dd2c5af14414927289e95e8461391a51e1c1b1a61e517c60a45993
7
- data.tar.gz: 6d18cd8c3c253e13f05b600a925e9e2f349c14925d33d8a398ad921576fae5232f60add148c6276a6df53ca7277e3ae758a0f079ea594d2950b4b54db9bb6e30
6
+ metadata.gz: 9f1a8489dd6d483b01387f9cc812c9d226fbd5eee1d52f24d76c11d7daae10e53e8032e049fe49abab733d02f0aaa0f4f637671a52e53bec7744a845d5dc215f
7
+ data.tar.gz: 3c87380636f3c27a9d2fd4940512553560925198bbd502f4ce6894300645cc6989458ba12ac1fd5eb055db560b415fecd3b8914b3b5e58bfd9f60e53a5ab601d
@@ -19,10 +19,10 @@ module Fastlane
19
19
 
20
20
  frameworks = Fastlane::Helper::AnalyzeIosFrameworkHelper.frameworks(pods, build, app)
21
21
  Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::ANALYZE_IOS_FRAMEWORK_PATHS] = frameworks
22
- # pp Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::ANALYZE_IOS_FRAMEWORK_PATHS]
22
+ pp Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::ANALYZE_IOS_FRAMEWORK_PATHS]
23
23
 
24
24
  Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::ANALYZE_IOS_FRAMEWORK_PATHS] = Fastlane::Helper::AnalyzeIosFrameworkHelper.generate(frameworks)
25
- # pp Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::ANALYZE_IOS_FRAMEWORK_PATHS]
25
+ pp Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::ANALYZE_IOS_FRAMEWORK_PATHS]
26
26
  end
27
27
 
28
28
  def self.description
@@ -34,7 +34,6 @@ module Fastlane
34
34
  end
35
35
 
36
36
  def self.return_value
37
- # If your method provides a return value, you can describe here what it does
38
37
  end
39
38
 
40
39
  def self.details
@@ -31,13 +31,23 @@ module Fastlane
31
31
 
32
32
  total = 0
33
33
  frameworks.each do |path|
34
+ binary_map = binary(path)
35
+ next unless binary_map
36
+
34
37
  sub_map = {}
35
38
  basename = File.basename(path)
36
39
  sub_map[:path] = path
37
- sub_map[:real_size] = file_size(path)
38
- sub_map[:format_size] = format_size(sub_map[:real_size])
40
+ sub_map[:size] = file_size(path)
41
+ sub_map[:format_size] = format_size(sub_map[:size])
42
+ sub_map[:binary_name] = binary_map[:binary_name]
43
+ sub_map[:binary_path] = binary_map[:binary_path]
44
+ sub_map[:binary_size] = binary_map[:binary_size]
45
+ sub_map[:format_binary_size] = binary_map[:format_binary_size]
46
+ sub_map[:exclude_binary_size] = sub_map[:size] - sub_map[:binary_size]
47
+ sub_map[:format_exclude_binary_size] = format_size(sub_map[:exclude_binary_size])
48
+ sub_map[:static] = binary_map[:static]
39
49
  map[basename.to_sym] = sub_map
40
- total += sub_map[:real_size]
50
+ total += sub_map[:size]
41
51
  end
42
52
 
43
53
  map[:real_total] = total
@@ -45,6 +55,63 @@ module Fastlane
45
55
  map
46
56
  end
47
57
 
58
+ def self.binary(framework)
59
+ static = true
60
+ binary_file = 'unknown'
61
+ binary_size = 0
62
+ files = Dir.glob(File.expand_path('*', framework))
63
+
64
+ files.each do |file|
65
+ pp file
66
+ str = `file #{file}`
67
+ # puts "[type] #{str}"
68
+
69
+ # static lib ==> /ar archive/
70
+ # ~/Downloads/ZHUDID.framework  file ZHUDID
71
+ # ZHUDID: Mach-O universal binary with 3 architectures: [arm_v7:current ar archive random library] [arm64:current ar archive random library]
72
+ # ZHUDID (for architecture armv7): current ar archive random library
73
+ # ZHUDID (for architecture x86_64): current ar archive random library
74
+ # ZHUDID (for architecture arm64): current ar archive random library
75
+
76
+ # dynamic lib ==> /linked shared library/
77
+ # ~/Downloads/du/SDK/du.framework  file du
78
+ # du: Mach-O universal binary with 2 architectures: [arm_v7:Mach-O dynamically linked shared library arm_v7] [arm64]
79
+ # du (for architecture armv7): Mach-O dynamically linked shared library arm_v7
80
+ # du (for architecture arm64): Mach-O 64-bit dynamically linked shared library arm64
81
+
82
+ #
83
+ # - 1) ar archive
84
+ # - 2) Mach-O universal binary
85
+ # - 1) dynamically linked shared
86
+ #
87
+
88
+ if str.match(/ar archive/)
89
+ static = true
90
+ binary_file = file
91
+ binary_size = file_size(file)
92
+ break
93
+ end
94
+
95
+ next unless str.match(/Mach-O universal binary/)
96
+ static = if str.match(/dynamically linked shared/)
97
+ false
98
+ else
99
+ true
100
+ end
101
+ binary_file = file
102
+ binary_size = file_size(file)
103
+ break
104
+ end
105
+
106
+ {
107
+ static: static,
108
+ binary_path: binary_file,
109
+ binary_name: File.basename(binary_file),
110
+ binary_size: binary_size,
111
+ format_binary_size: format_size(binary_size),
112
+ }
113
+ end
114
+
48
115
  def self.file_size(file_path)
49
116
  return 0 unless File.exist?(file_path)
50
117
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AnalyzeIosFramework
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-analyze_ios_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - xiongzenghui
@@ -170,5 +170,5 @@ requirements: []
170
170
  rubygems_version: 3.0.4
171
171
  signing_key:
172
172
  specification_version: 4
173
- summary: xx
173
+ summary: analysis ios framework in buildout or pods dir
174
174
  test_files: []