# LlvmEnvironmentVariableSupplier
Date: 2011-05-02

## org.eclipse.cdt.managedbuilder.llvm.ui
Class LlvmEnvironmentVariableSupplier

    java.lang.Object
      org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier

All Implemented Interfaces:
  org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier

    public class LlvmEnvironmentVariableSupplier

extends java.lang.Object
implements org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier

Contains LLVM environment variables.

Field Summary
`private static java.lang.String` `ENV_VAR_NAME_INCLUDE_PATH`
`private static java.lang.String` `ENV_VAR_NAME_LIBRARIES`
`private static java.lang.String` `ENV_VAR_NAME_LIBRARY_PATH`
`private static java.lang.String` `ENV_VAR_NAME_LLVM_BIN`
`private static java.lang.String` `ENV_VAR_NAME_LLVMINTERP`
`private static java.lang.String` `ENV_VAR_NAME_PATH`
`private static java.util.HashMap<java.lang.String,LlvmBuildEnvironmentVariable>` `llvmEnvironmentVariables`
`private static boolean` `preferencesChanged`

Constructor Summary
`LlvmEnvironmentVariableSupplier()` Constructor.

Method Summary
`static void` `addIncludePath(java.lang.String path)` Append a new include path.
`static void` `addLibrary(java.lang.String lib)` Append a new library.
`static void` `addLibraryPath(java.lang.String path)` Append a new library path.
`private static void` `appendLlvmEnvironmentVariable(java.lang.String name, java.lang.String oldPath, java.lang.String path)` Append a new LLVM environment variable to existing list.
`private static java.lang.String` `findBinDir(java.lang.String pathKey, java.lang.String subDirName)` Get a specific path for given parameters.
`private static java.lang.String` `getBinDirIfLlvm_ar(java.lang.String binPathTemp)` Get the full path for llvm executable if the bin path given as a parameter is found and executable exists in that path.
`static java.lang.String` `getBinPath()` Get LLVM bin path
`private static java.lang.String` `getDirIfLlvmFound(java.lang.String candidatePath, java.lang.String subPath)` Get LLVM executable path.
`static java.lang.String` `getIncludePath()` Get LLVM include paths
`static java.lang.String` `getLibraries()` Get LLVM libraries
`static java.lang.String` `getLibraryPath()` Get LLVM library paths
`static LlvmBuildEnvironmentVariable` `getLlvmEnvironmentVariable(java.lang.String envName)` Get LLVM environment variable.
`private static java.lang.String` `getSysEnvPath(java.lang.String envName)` Returns a system environment variable path
`org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable` `getVariable(java.lang.String variableName, org.eclipse.cdt.managedbuilder.core.IConfiguration configuration, org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider provider)`
`org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable[]` `getVariables(org.eclipse.cdt.managedbuilder.core.IConfiguration configuration, org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider provider)`
`private static void` `initializePaths()` Initializes llvm environment variable paths from the system environment variables.
`static void` `notifyPreferenceChange()` This is to be called if some of the preference paths have changed.
`static void` `setBinPath(java.lang.String path)` Set path to LLVM bin.
`private static void` `setLlvmEnvironmentVariable(java.lang.String name, java.lang.String path)` Set LLVM environment variable.
`static void` `setLlvmEnvironmentVariableReplace(java.lang.String name, java.lang.String path)` Set LLVM environment variable by replacing the existing paths.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### preferencesChanged

    private static boolean preferencesChanged

### llvmEnvironmentVariables

    private static java.util.HashMap<java.lang.String,LlvmBuildEnvironmentVariable> llvmEnvironmentVariables

### ENV_VAR_NAME_LLVM_BIN

    private static final java.lang.String ENV_VAR_NAME_LLVM_BIN

See Also:
  Constant Field Values

### ENV_VAR_NAME_LLVMINTERP

    private static final java.lang.String ENV_VAR_NAME_LLVMINTERP

See Also:
  Constant Field Values

### ENV_VAR_NAME_PATH

    private static final java.lang.String ENV_VAR_NAME_PATH

See Also:
  Constant Field Values

### ENV_VAR_NAME_INCLUDE_PATH

    private static final java.lang.String ENV_VAR_NAME_INCLUDE_PATH

See Also:
  Constant Field Values

### ENV_VAR_NAME_LIBRARY_PATH

    private static final java.lang.String ENV_VAR_NAME_LIBRARY_PATH

See Also:
  Constant Field Values

### ENV_VAR_NAME_LIBRARIES

    private static final java.lang.String ENV_VAR_NAME_LIBRARIES

See Also:
  Constant Field Values

Constructor Detail

### LlvmEnvironmentVariableSupplier

    public LlvmEnvironmentVariableSupplier()

  Constructor.

Method Detail

### initializePaths

    private static void initializePaths()

  Initializes llvm environment variable paths from the system environment variables.

### getBinPath

    public static java.lang.String getBinPath()

  Get LLVM bin path

  Returns:
    LLVM bin path

### getIncludePath

    public static java.lang.String getIncludePath()

  Get LLVM include paths

  Returns:
    LLVM include paths

### getLibraryPath

    public static java.lang.String getLibraryPath()

  Get LLVM library paths

  Returns:
    LLVM library paths

### getLibraries

    public static java.lang.String getLibraries()

  Get LLVM libraries

  Returns:
    LLVM libraries

### setBinPath

    public static void setBinPath(java.lang.String path)

  Set path to LLVM bin.

  Parameters:
    `path` - Path to LLVM bin location.

### addIncludePath

    public static void addIncludePath(java.lang.String path)

  Append a new include path.

  Parameters:
    `path` - Include path

### addLibraryPath

    public static void addLibraryPath(java.lang.String path)

  Append a new library path.

  Parameters:
    `path` - Library path

### addLibrary

    public static void addLibrary(java.lang.String lib)

  Append a new library.

  Parameters:
    `lib` - Library file

### notifyPreferenceChange

    public static void notifyPreferenceChange()

  This is to be called if some of the preference paths have changed.

### findBinDir

    private static java.lang.String findBinDir(java.lang.String pathKey,
                                               java.lang.String subDirName)

  Get a specific path for given parameters.

  Parameters:
    `pathKey` - Path for specific location
    `subDirName` - Additional sub-path
  Returns:
    bin path

### getDirIfLlvmFound

    private static java.lang.String getDirIfLlvmFound(java.lang.String candidatePath,
                                                      java.lang.String subPath)

  Get LLVM executable path.

  Parameters:
    `candidatePath` - Suggestion for LLVM executable path
    `subPath` - Additional sub-path for LLVM executable path
  Returns:
    Full path for LLVM executable if valid, otherwise null

### getBinDirIfLlvm_ar

    private static java.lang.String getBinDirIfLlvm_ar(java.lang.String binPathTemp)

  Get the full path for llvm executable if the bin path given as a parameter is found and executable exists in that path.

  Parameters:
    `binPathTemp` - User provided bin directory path
  Returns:
    bin path where llvm-ar is located if executable exists

### getLlvmEnvironmentVariable

    public static LlvmBuildEnvironmentVariable getLlvmEnvironmentVariable(java.lang.String envName)

  Get LLVM environment variable.

  Parameters:
    `envName` - Name of the environment variable

### setLlvmEnvironmentVariable

    private static void setLlvmEnvironmentVariable(java.lang.String name,
                                                   java.lang.String path)

  Set LLVM environment variable.

  Parameters:
    `name` - Name for the environment variable
    `path` - Path for the environment variable

### setLlvmEnvironmentVariableReplace

    public static void setLlvmEnvironmentVariableReplace(java.lang.String name,
                                                         java.lang.String path)

  Set LLVM environment variable by replacing the existing paths.

  Parameters:
    `name` - Name for the environment variable
    `path` - Path for the environment variable

### appendLlvmEnvironmentVariable

    private static void appendLlvmEnvironmentVariable(java.lang.String name,
                                                      java.lang.String oldPath,
                                                      java.lang.String path)

  Append a new LLVM environment variable to existing list.

  Parameters:
    `name` - Name of the preference
    `oldPath` - Old paths/preference values
    `path` - New path to be added to the environment variable

### getSysEnvPath

    private static java.lang.String getSysEnvPath(java.lang.String envName)

  Returns a system environment variable path

  Parameters:
    `envName` - Environment variable name
  Returns:
    system environment variable path

### getVariable

    public org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable getVariable(java.lang.String variableName,
                                                                                       org.eclipse.cdt.managedbuilder.core.IConfiguration configuration,
                                                                                       org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider provider)

  Specified by:
    `getVariable` in interface `org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier`

### getVariables

    public org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable[] getVariables(org.eclipse.cdt.managedbuilder.core.IConfiguration configuration,
                                                                                          org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider provider)

  Specified by:
    `getVariables` in interface `org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier`