forked from parse-community/parse-cli
/
symbols_cmd.go
66 lines (61 loc) · 1.68 KB
/
symbols_cmd.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package main
import (
"fmt"
"github.com/facebookgo/stackerr"
"github.com/spf13/cobra"
)
type symbolsCmd struct {
path string
apk string
manifest string
aapt string
skipOsCheck bool
}
func (s *symbolsCmd) run(e *env, c *client) error {
android := &androidSymbolUploader{
Path: s.path,
Apk: s.apk,
Manifest: s.manifest,
AAPT: s.aapt}
ios := &iosSymbolUploader{
Path: s.path,
SkipOsCheck: s.skipOsCheck}
switch {
case android.acceptsPath():
if err := android.validate(); err != nil {
return err
}
fmt.Fprintln(e.Out, "Uploading Android symbol files...")
return android.uploadSymbols(e)
case ios.acceptsPath():
if err := ios.validate(); err != nil {
return err
}
fmt.Fprintln(e.Out, "Uploading iOS symbol files...")
return ios.uploadSymbols(e)
default:
if s.path == "" {
return stackerr.New("Please specify path to symbol files")
}
return stackerr.Newf("Do not understand symbol files at : %s", s.path)
}
}
func newSymbolsCmd(e *env) *cobra.Command {
var s symbolsCmd
cmd := &cobra.Command{
Use: "symbols [app]",
Short: "Uploads symbol files",
Long: `Uploads the symbol files for the application to symbolicate crash reports with.
Path specifies the path to xcarchive/dSYM/DWARF for iOS or mapping.txt for Android.`,
Run: runWithClient(e, s.run),
}
cmd.Flags().StringVarP(&s.path, "path", "p", s.path,
"Path to symbols files")
cmd.Flags().StringVarP(&s.apk, "apk", "a", s.apk,
"Path to apk file")
cmd.Flags().StringVarP(&s.manifest, "manifest", "m", s.manifest,
"Path to AndroidManifest.xml file")
cmd.Flags().StringVarP(&s.aapt, "aapt", "t", s.aapt,
"Path to aapt for android")
return cmd
}