1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.simpligility.maven.plugins.android;
17
18
19
20
21
22
23 public class AndroidSigner
24 {
25
26
27
28
29 public enum Debug
30 {
31 TRUE, FALSE, BOTH, AUTO
32 }
33
34 ;
35
36 private final Debug debug;
37
38 public AndroidSigner( String debug )
39 {
40 if ( debug == null )
41 {
42 throw new IllegalArgumentException( "android.sign.debug must be 'true', 'false', 'both' or 'auto'." );
43 }
44 try
45 {
46 this.debug = Debug.valueOf( debug.toUpperCase() );
47 }
48 catch ( IllegalArgumentException e )
49 {
50 throw new IllegalArgumentException( "android.sign.debug must be 'true', 'false', 'both' or 'auto'.", e );
51 }
52 }
53
54 public AndroidSigner( Debug debug )
55 {
56 this.debug = debug;
57 }
58
59 public boolean isSignWithDebugKeyStore()
60 {
61 if ( debug == Debug.TRUE )
62 {
63 return true;
64 }
65 if ( debug == Debug.BOTH )
66 {
67 return true;
68 }
69 if ( debug == Debug.FALSE )
70 {
71 return false;
72 }
73 if ( debug == Debug.AUTO )
74 {
75
76 return true;
77 }
78 throw new IllegalStateException( "Could not determine whether to sign with debug keystore." );
79 }
80
81 public boolean shouldCreateBothSignedAndUnsignedApk()
82 {
83 return debug == Debug.BOTH;
84 }
85
86 }