fastlane-plugin-debug_file 0.2.1 → 0.3.0

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: '079226ebaba880735af3cabaed19276177316c093b6db6d81ddaa9c89279bd81'
4
- data.tar.gz: 2c8c6d1e32ca4d7cb468bd8b16339d8e91d5f2074c15efad70c1ac8475b18e10
3
+ metadata.gz: 6de0426bbcc785a3db2a4483af51de043a9e862a8cb6f792d7ffee43e773bb4d
4
+ data.tar.gz: 3d296aba5604d577407a2f8c7cb64914e8fd940b83b9a532d16c57617b60e869
5
5
  SHA512:
6
- metadata.gz: 5375e5d39b154be40cc1e58712bed9d0dce3417f85c3ef0a6abfc0690979e8e342cd484101bc407307120f0955b5ebea87f0d01728a41d339fd6b0e064b64171
7
- data.tar.gz: a5e53a19cdf77e09f4f4328a3f18c5e2f8ac8a2bc0618190c012b3b0273c914a584cfc4f9ce3b50a3d2a70df5f12796ff40ae25dfbd9c2b3b1ffe2cea981f126
6
+ metadata.gz: f8b7037b037a4280d390dc92358c41e81993211b87106274807d2b4c66e3c6a54813c48811d10caa2c2dc528598e503f770e2adef084481b61b854754f8f8c3e
7
+ data.tar.gz: f20e6363150ab34eba59af8616764f730f3a65a95b7e6e6d13d87dabf8943d4c9285c9d16a792ff800444be6fa516d41a45fd493b6465ae88081a3c13ac9f9c0
@@ -14,29 +14,32 @@ module Fastlane
14
14
  OUTPUT_PATH = '.'
15
15
 
16
16
  def self.run(params)
17
- archive_path = File.expand_path(params[:archive_path])
18
- scheme = params[:scheme]
19
17
  overwrite = params[:overwrite]
20
18
 
21
- app_dsym_filename = "#{scheme}.app.dsym"
22
-
23
- output_path = params[:output_path]
24
- output_file = File.join(output_path, "#{app_dsym_filename}.zip")
25
-
26
- Helper::DebugFileHelper.determine_output_file(output_file, overwrite)
19
+ archive_path = params[:archive_path]
20
+ scheme = params[:scheme]
21
+ runner = ::DebugFile::Runner.new({
22
+ archive_path: archive_path,
23
+ scheme: scheme
24
+ })
25
+
26
+ dsym = runner.latest_dsym
27
+ unless dsym
28
+ UI.user_error! "Not matched any archive [#{archive_path}] with scheme [#{scheme}]"
29
+ end
27
30
 
28
- archive_dsym_path = last_created_dsym(scheme, archive_path)
29
- if archive_dsym_path && !Dir.exist?(archive_dsym_path)
30
- UI.user_error! "Not matched any archive with scheme: #{scheme}"
31
+ Fastlane::UI.success "Selected #{dsym[:name]} #{dsym[:release_version]} (#{dsym[:build]}) - #{dsym[:created_at]}"
32
+ dsym[:machos].each do |macho|
33
+ Fastlane::UI.message " #{macho[:uuid]} (#{macho[:arch]})"
31
34
  end
32
35
 
33
- xcarchive_file = File.basename(File.dirname(archive_dsym_path))
34
- xcarchive_info_file = File.join(File.expand_path('../', archive_dsym_path), 'Info.plist')
35
- xcarchive_info = Helper::DebugFileHelper.xcarchive_metadata(xcarchive_info_file)
36
- release_version, build_version, created_at = version_info(xcarchive_info)
37
- UI.success "Selected dSYM archive: #{release_version} (#{build_version}) [#{xcarchive_file}] #{created_at}"
36
+ app_dsym_filename = File.basename(dsym[:dsym_path])
37
+ output_file = File.join(params[:output_path], "#{app_dsym_filename}.zip")
38
+ Helper::DebugFileHelper.determine_output_file(output_file, overwrite)
38
39
 
40
+ archive_dsym_path = File.dirname(dsym[:dsym_path])
39
41
  extra_dsym = params[:extra_dsym] || []
42
+
40
43
  dsym_files = [app_dsym_filename].concat(extra_dsym).uniq
41
44
  dsym_files.each_with_index do |filename, i|
42
45
  path = File.join(archive_dsym_path, filename)
@@ -46,47 +49,15 @@ module Fastlane
46
49
  dsym_files.delete_at(i)
47
50
  end
48
51
  end
49
- UI.success "Prepare #{dsym_files.size} dSYM file(s) compressing"
52
+
53
+ UI.message "Prepare #{dsym_files.size} dSYM file(s) compressing"
54
+ UI.verbose dsym_files
50
55
  Helper::DebugFileHelper.compress(dsym_files, output_file)
51
56
 
52
57
  UI.success "Compressed dSYM file: #{output_file}"
53
58
  Helper::DebugFileHelper.store_shard_value SharedValues::DF_DSYM_ZIP_PATH, output_file
54
59
  end
55
60
 
56
- def self.last_created_dsym(scheme, archive_path)
57
- info_path = File.join(archive_path, '**', '*.xcarchive', 'Info.plist')
58
- matched_paths = []
59
-
60
- UI.verbose "Finding #{scheme} xcarchive in #{archive_path} ..."
61
- Dir.glob(info_path) do |path|
62
- info = Helper::DebugFileHelper.xcarchive_metadata(path)
63
- name = Helper::DebugFileHelper.fetch_key(info, 'Name')
64
- if scheme == name
65
- xcarchive = File.basename(File.dirname(path))
66
- release_version, build_version, created_at = version_info(info)
67
- UI.verbose " => #{release_version} (#{build_version}) [#{xcarchive}] was created at #{created_at}"
68
-
69
- matched_paths << path
70
- end
71
- end
72
-
73
- return if matched_paths.empty?
74
-
75
- UI.verbose "Found #{matched_paths.size} matched dSYM archive(s) of #{scheme}"
76
- last_created_path = matched_paths.size == 1 ? matched_paths.first : matched_paths.max_by { |p| File.stat(p).mtime }
77
- File.join(File.dirname(last_created_path), 'dSYMs')
78
- end
79
- private_class_method :last_created_dsym
80
-
81
- def self.version_info(info)
82
- release_version = Helper::DebugFileHelper.fetch_key(info, 'ApplicationProperties', 'CFBundleShortVersionString')
83
- build = Helper::DebugFileHelper.fetch_key(info, 'ApplicationProperties', 'CFBundleVersion')
84
- created_at = Helper::DebugFileHelper.fetch_key(info, 'CreationDate')
85
-
86
- [release_version, build, created_at]
87
- end
88
- private_class_method :version_info
89
-
90
61
  #####################################################
91
62
  # @!group Documentation
92
63
  #####################################################
@@ -100,12 +71,13 @@ module Fastlane
100
71
  FastlaneCore::ConfigItem.new(key: :archive_path,
101
72
  env_name: 'DF_DSYM_ARCHIVE_PATH',
102
73
  description: 'The archive path of xcode',
103
- type: String,
104
74
  default_value: Actions.lane_context[SharedValues::XCODEBUILD_ARCHIVE] || ::DebugFile::Runner::ARCHIVE_PATH,
105
- optional: true),
75
+ optional: true,
76
+ type: String),
106
77
  FastlaneCore::ConfigItem.new(key: :scheme,
107
78
  env_name: 'DF_DSYM_SCHEME',
108
79
  description: 'The scheme name of app',
80
+ optional: true,
109
81
  type: String),
110
82
  FastlaneCore::ConfigItem.new(key: :extra_dsym,
111
83
  env_name: 'DF_DSYM_EXTRA_DSYM',
@@ -19,52 +19,64 @@ module DebugFile
19
19
  end
20
20
 
21
21
  def list_dsym
22
- archive_path = File.expand_path(options.fetch(:archive_path, ARCHIVE_PATH))
22
+ return [fetch_project_info(archive_path)] if project_archive_path? && !options[:scheme]
23
+
23
24
  search_dsym(archive_path, options[:scheme])
24
25
  end
25
26
 
26
27
  private
27
28
 
28
29
  def search_dsym(path, scheme = nil)
29
- info_path = File.join(path, '**', '*.xcarchive', 'Info.plist')
30
- matched_paths = []
31
-
30
+ project_path = File.join(path, '**', '*.xcarchive')
32
31
  obj = []
33
- Dir.glob(info_path) do |path|
34
- info = Fastlane::Helper::DebugFileHelper.xcarchive_metadata(path)
35
- name = Fastlane::Helper::DebugFileHelper.fetch_key(info, 'Name')
36
- next unless scheme.to_s.empty? || scheme == name
32
+ Dir.glob(project_path) do |path|
33
+ next unless item = fetch_project_info(path, scheme)
37
34
 
38
- release_version = Fastlane::Helper::DebugFileHelper.fetch_key(info, 'ApplicationProperties', 'CFBundleShortVersionString')
39
- build = Fastlane::Helper::DebugFileHelper.fetch_key(info, 'ApplicationProperties', 'CFBundleVersion')
40
- dsym_path = Dir.glob(File.join(File.dirname(path), 'dSYMs', "#{name}.app.dSYM", '**', '*', name)).first
41
- created_at = Fastlane::Helper::DebugFileHelper.fetch_key(info, 'CreationDate')
35
+ yield item if block_given?
36
+ obj << item
37
+ end
42
38
 
43
- machos = []
44
- Fastlane::Helper::DebugFileHelper.macho_metadata(dsym_path).each do |macho|
45
- machos << {
46
- arch: macho.cpusubtype,
47
- uuid: macho[:LC_UUID][0].uuid_string
48
- }
49
- end
39
+ obj
40
+ end
50
41
 
51
- item = {
52
- root_path: File.basename(File.dirname(path)),
53
- dsym_path: dsym_path,
54
- machos: machos,
55
- info: info,
56
- name: name,
57
- release_version: release_version,
58
- build: build,
59
- created_at: created_at,
60
- }
42
+ def fetch_project_info(path, scheme = nil)
43
+ info = Fastlane::Helper::DebugFileHelper.xcarchive_metadata(File.join(path, 'Info.plist'))
44
+ name = Fastlane::Helper::DebugFileHelper.fetch_key(info, 'Name')
45
+ return unless scheme.to_s.empty? || scheme == name
61
46
 
62
- yield item if block_given?
47
+ release_version = Fastlane::Helper::DebugFileHelper.fetch_key(info, 'ApplicationProperties', 'CFBundleShortVersionString')
48
+ build = Fastlane::Helper::DebugFileHelper.fetch_key(info, 'ApplicationProperties', 'CFBundleVersion')
49
+ dsym_path = File.join(path, 'dSYMs', "#{name}.app.dSYM")
50
+ dsym_binray_path = Dir.glob(File.join(dsym_path, '**', '*', name)).first
51
+ created_at = Fastlane::Helper::DebugFileHelper.fetch_key(info, 'CreationDate')
63
52
 
64
- obj << item
53
+ machos = []
54
+ Fastlane::Helper::DebugFileHelper.macho_metadata(dsym_binray_path).each do |macho|
55
+ machos << {
56
+ arch: macho.cpusubtype,
57
+ uuid: macho[:LC_UUID][0].uuid_string
58
+ }
65
59
  end
66
60
 
67
- obj
61
+ {
62
+ root_path: File.basename(File.dirname(path)),
63
+ dsym_path: dsym_path,
64
+ machos: machos,
65
+ info: info,
66
+ name: name,
67
+ release_version: release_version,
68
+ build: build,
69
+ created_at: created_at,
70
+ }
71
+ end
72
+
73
+ def project_archive_path?
74
+ File.file?(File.join(archive_path, 'Info.plist')) &&
75
+ Dir.exist?(File.join(archive_path, 'dSYMs'))
76
+ end
77
+
78
+ def archive_path
79
+ @archive_path ||= File.expand_path(options.fetch(:archive_path, ARCHIVE_PATH))
68
80
  end
69
81
  end
70
82
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module DebugFile
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-debug_file
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - icyleaf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-17 00:00:00.000000000 Z
11
+ date: 2020-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-macho