// Path: src/com/thoughtworks/calabash/android/Environment.java
// public static final String ENV_ANDROID_HOME = "ANDROID_HOME";
// 
// Path: src/com/thoughtworks/calabash/android/Environment.java
// public static final String ENV_JAVA_HOME = "JAVA_HOME";


import java.io.File;
import static com.thoughtworks.calabash.android.Environment.ENV_ANDROID_HOME;
import static com.thoughtworks.calabash.android.Environment.ENV_JAVA_HOME;
package com.thoughtworks.calabash.android;



public class EnvironmentInitializer {

    public static final String KEYTOOL = Environment.getPlatformExecutable("keytool");
    public static final String JARSIGNER = Environment.getPlatformExecutable("jarsigner");
    public static final String PROPERTY_JAVA_HOME = "java.home";
    public static final String PATH_SEPARATOR = Environment.getPathSeparator();

    public static Environment initialize(AndroidConfiguration configuration) throws CalabashException {
        String javaHome = null;
        String androidHome = findAndroidHome(configuration);
        String keytool = findExecutableFromPath(KEYTOOL);
        String jarsigner = findExecutableFromPath(JARSIGNER);
        if (keytool == null || jarsigner == null) {
            CalabashLogger.info("Finding executables relative to " + ENV_JAVA_HOME);
            javaHome = findJavaHome(configuration);

            if (javaHome == null) {
                throw new CalabashException(ENV_JAVA_HOME + " is not set");
            }
            File bin = new File(javaHome, "bin");
            keytool = getPathIfExists(new File(bin, KEYTOOL));
// Path: src/com/thoughtworks/calabash/android/Environment.java
// public static final String ENV_ANDROID_HOME = "ANDROID_HOME";
// 
// Path: src/com/thoughtworks/calabash/android/Environment.java
// public static final String ENV_JAVA_HOME = "JAVA_HOME";


// Path: src/com/thoughtworks/calabash/android/EnvironmentInitializer.java
import java.io.File;
import static com.thoughtworks.calabash.android.Environment.ENV_ANDROID_HOME;
import static com.thoughtworks.calabash.android.Environment.ENV_JAVA_HOME;

package com.thoughtworks.calabash.android;



public class EnvironmentInitializer {

    public static final String KEYTOOL = Environment.getPlatformExecutable("keytool");
    public static final String JARSIGNER = Environment.getPlatformExecutable("jarsigner");
    public static final String PROPERTY_JAVA_HOME = "java.home";
    public static final String PATH_SEPARATOR = Environment.getPathSeparator();

    public static Environment initialize(AndroidConfiguration configuration) throws CalabashException {
        String javaHome = null;
        String androidHome = findAndroidHome(configuration);
        String keytool = findExecutableFromPath(KEYTOOL);
        String jarsigner = findExecutableFromPath(JARSIGNER);
        if (keytool == null || jarsigner == null) {
            CalabashLogger.info("Finding executables relative to " + ENV_JAVA_HOME);
            javaHome = findJavaHome(configuration);

            if (javaHome == null) {
                throw new CalabashException(ENV_JAVA_HOME + " is not set");
            }
            File bin = new File(javaHome, "bin");
            keytool = getPathIfExists(new File(bin, KEYTOOL));
            jarsigner = getPathIfExists(new File(bin, JARSIGNER));