fastlane-plugin-native_symbols 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7a57aede3dea37ac61c48fefc49306d595d8cf53b31419912865f9392fbd93fc
4
+ data.tar.gz: dd3608c1e668d899e4ce660a8d6400e5e6031c22135f5a13d375cba1d8abfe0d
5
+ SHA512:
6
+ metadata.gz: 94f773b9f1e32697a0a85e906d19dc3ec25f70169837186663f4390d0c65870274b4a359d8167754a45a41aecc0cb43b179abcc8cb3b8ff53423713683b1d3f5
7
+ data.tar.gz: 81cbbe443f733b7c25801c42e7ccf526ab02dc3a9c22cce752abe5d0687615b942ae7c9519f819d0f0e18581335d969832e3a61633d62311311b85517dace2ce
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # fastlane-plugin-native_symbols
2
+
3
+ [![fastlane-plugin-native_symbols](https://img.shields.io/badge/fastlane-native_symbols-blue.svg)](https://fastlane.tools)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a fastlane plugin that makes it easier to zip native symbols and get the retrace mapping file within your fastlane lanes.
8
+
9
+ To get started, add the plugin to your `Pluginfile`:
10
+
11
+ ```ruby
12
+ plugins_path "fastlane/Pluginfile"
13
+
14
+ plugin "fastlane-plugin-native_symbols"
15
+ ```
16
+
17
+ Then run `bundle exec fastlane add_plugin native_symbols` to install it into your lane configuration.
18
+
19
+ ## Usage
20
+
21
+ Refer to the action documentation generated in `actions/native_symbols.rb`. You can discover all available options using `bundle exec fastlane action native_symbols` after installing the plugin.
22
+
23
+ ## Development
24
+
25
+ 1. Run `bundle install` to install dependencies.
26
+ 2. Use `bundle exec rspec` to run the test suite.
27
+ 3. To release a new version, update the version number in `lib/fastlane/plugin/native_symbols/version.rb`, commit your changes, and run `bundle exec rake release`.
28
+
29
+ ## Issues and Contributions
30
+
31
+ Please create a GitHub issue if you run into a problem or have a feature request. Pull requests are always welcome.
32
+
33
+ ## References
34
+
35
+ - https://issuetracker.google.com/u/0/issues/234737605?pli=1#comment19
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require "standard/rake"
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task default: [:spec]
@@ -0,0 +1,3 @@
1
+ # Autogenerated by fastlane. Edit cautiously, file is used to manage plugin dependencies.
2
+
3
+ gem "fastlane-plugin-native_symbols", path: "../"
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+ require "tmpdir"
5
+
6
+ module Fastlane
7
+ module Actions
8
+ class NativeSymbolsAction < Action
9
+ def self.run(params)
10
+ config = params || FastlaneCore::Configuration.create(available_options, {})
11
+ app_path = Pathname.new(config[:app_path] || Dir.getwd)
12
+ unless app_path.directory?
13
+ UI.user_error!("native_symbols: app_path '#{app_path}' does not exist or is not a directory")
14
+ end
15
+ variant = config[:variant].to_s
16
+ UI.user_error!("native_symbols: variant is required") if variant.empty?
17
+ native_symbols_path = Helper::NativeSymbolsHelper.find_native_symbols_path(app_path, variant)
18
+ unless native_symbols_path
19
+ message = "native_symbols: could not find native symbols path for '#{variant}' variant"
20
+ if config[:raise]
21
+ UI.user_error!(message)
22
+ else
23
+ UI.important("#{message}, skipping...")
24
+ return nil
25
+ end
26
+ end
27
+ temp_dir = Pathname.new(Dir.mktmpdir("fastlane-native-symbols-"))
28
+ output_path = Helper::NativeSymbolsHelper.initialize_output_path(temp_dir)
29
+ zip_path = Helper::NativeSymbolsHelper.zip_native_symbols(native_symbols_path, output_path)
30
+ retrace_mapping_path = Helper::NativeSymbolsHelper.find_retrace_mapping(app_path, variant)
31
+ [zip_path, retrace_mapping_path]
32
+ end
33
+
34
+ def self.description
35
+ "Native debug symbols for Play Store"
36
+ end
37
+
38
+ def self.details
39
+ "Use this action to zip native symbols and get the retrace mapping file as part of a fastlane lane."
40
+ end
41
+
42
+ def self.return_value
43
+ "Hash with :zip_path (Pathname) and :retrace_mapping_path (Pathname or nil)"
44
+ end
45
+
46
+ def self.authors
47
+ ["Nuno Pinge"]
48
+ end
49
+
50
+ def self.available_options
51
+ [
52
+ FastlaneCore::ConfigItem.new(
53
+ key: :app_path,
54
+ description: "Root path of the Android application project",
55
+ optional: true,
56
+ type: String
57
+ ),
58
+ FastlaneCore::ConfigItem.new(
59
+ key: :variant,
60
+ description: "Android build variant to inspect for native symbols",
61
+ optional: true,
62
+ default_value: "release",
63
+ type: String
64
+ ),
65
+ FastlaneCore::ConfigItem.new(
66
+ key: :raise,
67
+ description: "Raise an error when the native symbols path cannot be found",
68
+ optional: true,
69
+ default_value: true,
70
+ type: Fastlane::Boolean
71
+ )
72
+ ]
73
+ end
74
+
75
+ def self.example_code
76
+ [
77
+ 'native_symbols(
78
+ app_path: "./android",
79
+ variant: "release",
80
+ raise: true
81
+ )'
82
+ ]
83
+ end
84
+
85
+ def self.is_supported?(platform)
86
+ platform == :android
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "tmpdir"
4
+ require "pathname"
5
+ require "zip"
6
+
7
+ NATIVE_LIBS_PATH = Pathname.new("app/build/intermediates/merged_native_libs").freeze
8
+ MAPPING_BASE_PATH = Pathname.new("app/build/outputs/mapping").freeze
9
+
10
+ module Fastlane
11
+ module Helper
12
+ class NativeSymbolsHelper
13
+ def self.find_native_symbols_path(app_path, variant)
14
+ base = ensure_pathname(app_path)
15
+ variant_name = variant.to_s
16
+ raise ArgumentError, "variant is required" if variant_name.empty?
17
+ variant_root = base.join(NATIVE_LIBS_PATH, variant_name)
18
+ [
19
+ variant_root.join("merge#{upcase_first(variant_name)}NativeLibs", "out", "lib"),
20
+ variant_root.join("out", "lib")
21
+ ].each do |candidate|
22
+ return candidate.realpath if candidate.exist?
23
+ end
24
+ nil
25
+ end
26
+
27
+ def self.find_retrace_mapping(app_path, variant)
28
+ base = ensure_pathname(app_path)
29
+ variant_name = variant.to_s
30
+ return nil if variant_name.empty?
31
+ mapping_file = base.join(MAPPING_BASE_PATH, variant_name, "mapping.txt")
32
+ mapping_file.exist? ? mapping_file.realpath : nil
33
+ end
34
+
35
+ def self.initialize_output_path(temp_path)
36
+ temp_dir = ensure_pathname(temp_path)
37
+ raise ArgumentError, "temporary path '#{temp_dir}' does not exist" unless temp_dir.directory?
38
+ created = nil
39
+ Dir::Tmpname.create(["native-symbols", ".zip"], temp_dir.to_s) do |filename|
40
+ File.open(filename, File::WRONLY | File::CREAT | File::EXCL, 0o600, &:close)
41
+ created = filename
42
+ end
43
+ Pathname.new(created)
44
+ end
45
+
46
+ def self.zip_native_symbols(source_path, output_path)
47
+ source = ensure_pathname(source_path)
48
+ output = ensure_pathname(output_path)
49
+ raise ArgumentError, "native symbols directory '#{source}' does not exist" unless source.directory?
50
+ raise ArgumentError, "output path '#{output}' must be a file" unless output.file?
51
+ Zip::File.open(output.to_s, Zip::File::CREATE) do |zip_file|
52
+ Dir[File.join(source.to_s, "**", "*")].sort.each do |file|
53
+ next if File.directory?(file)
54
+ relative = Pathname.new(file).relative_path_from(source).to_s
55
+ zip_file.add(relative, file)
56
+ end
57
+ end
58
+ output
59
+ end
60
+
61
+ private_class_method def self.ensure_pathname(path)
62
+ path.is_a?(Pathname) ? path : Pathname.new(path.to_s)
63
+ end
64
+
65
+ private_class_method def self.upcase_first(variant)
66
+ "#{variant[0].upcase}#{variant[1..]}"
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Fastlane
4
+ module NativeSymbols
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fastlane/plugin/native_symbols/version"
4
+
5
+ module Fastlane
6
+ module NativeSymbols
7
+ # Autoload all Ruby files in actions and helper directories
8
+ def self.all_classes
9
+ Dir[File.expand_path("**/{actions,helper}/*.rb", __dir__)].sort.each do |file|
10
+ require file
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+ Fastlane::NativeSymbols.all_classes
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-native_symbols
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nuno Pinge
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-11-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fastlane
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.96.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 2.96.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
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
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubyzip
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: standard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Zip native symbols and get the retrace mapping file from within Fastlane.
112
+ email:
113
+ - nuno@pinge.org
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - LICENSE
119
+ - README.md
120
+ - Rakefile
121
+ - fastlane/Pluginfile
122
+ - lib/fastlane/plugin/native_symbols.rb
123
+ - lib/fastlane/plugin/native_symbols/actions/native_symbols_action.rb
124
+ - lib/fastlane/plugin/native_symbols/helper/native_symbols_helper.rb
125
+ - lib/fastlane/plugin/native_symbols/version.rb
126
+ homepage: https://github.com/pinge/fastlane-plugin-native_symbols
127
+ licenses:
128
+ - MIT
129
+ metadata:
130
+ homepage_uri: https://github.com/pinge/fastlane-plugin-native_symbols
131
+ source_code_uri: https://github.com/pinge/fastlane-plugin-native_symbols
132
+ changelog_uri: https://github.com/pinge/fastlane-plugin-native_symbols/CHANGELOG.md
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubygems_version: 3.1.6
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Fastlane plugin to prepare native debug symbols for the Play Store
152
+ test_files: []