/*
 * Copyright (C) 2009 Jayway AB
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.jayway.maven.plugins.android;

/**
 * Can sign Android applications (apk's).
 *
 * @author hugo.josefson@jayway.com
 */
public class AndroidSigner {

    public enum Debug {TRUE,FALSE,AUTO};

    private final Debug debug;

    public AndroidSigner(String debug) {
        this.debug = Debug.valueOf(debug);
    }

    public AndroidSigner(Debug debug) {
        this.debug = debug;
    }

    public boolean isSignWithDebugKeyStore() {
        if (debug == Debug.TRUE){
            return true;
        }
        if (debug == Debug.FALSE){
            return false;
        }
        if (debug == Debug.AUTO){
            //TODO: This is where to add logic for skipping debug sign if there are other keystores configured.
            return true;
        }
        throw new IllegalStateException("Could not determine whether to sign with debug keystore.");
    }

}
@@ -880,42 +880,382 @@
     
-this.debug = Debug.valueOf(debug);
+if (debug == null) %7B%0A            throw new IllegalArgumentException(%22android.sign.debug must be 'true', 'false' or 'auto'.%22);%0A        %7D%0A        try %7B%0A            this.debug = Debug.valueOf(debug.toUpperCase());%0A        %7Dcatch(IllegalArgumentException e) %7B%0A            throw new IllegalArgumentException(%22android.sign.debug must be 'true', 'false' or 'auto'.%22, e); %0A        %7D
 %0A   
@@ -1412,16 +1412,17 @@
 ug.TRUE)
+ 
 %7B%0A      
@@ -1483,16 +1483,17 @@
 g.FALSE)
+ 
 %7B%0A      
@@ -1554,16 +1554,17 @@
 ug.AUTO)
+ 
 %7B%0A      

Allow lowercase values for android.sign.debug.