+This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+Overview
+
+
+
+The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
+
+Package
+
+
+
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:
+
Interfaces (italic)
Classes
Enums
Exceptions
Errors
Annotation Types
+
+
+Class/Interface
+
+
+
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+
Class inheritance diagram
Direct Subclasses
All Known Subinterfaces
All Known Implementing Classes
Class/interface declaration
Class/interface description
+
+
Nested Class Summary
Field Summary
Constructor Summary
Method Summary
+
+
Field Detail
Constructor Detail
Method Detail
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+
+
+Annotation Type
+
+
+
+Each annotation type has its own separate page with the following sections:
+
Annotation Type declaration
Annotation Type description
Required Element Summary
Optional Element Summary
Element Detail
+
+
+
+Enum
+
+
+
+Each enum has its own separate page with the following sections:
+
Enum declaration
Enum description
Enum Constant Summary
Enum Constant Detail
+
+
+Use
+
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+
+Tree (Class Hierarchy)
+
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
+
When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
+
+
+Deprecated API
+
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+
+Index
+
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+
+Prev/Next
+These links take you to the next or previous class, interface, package, or related page.
+Frames/No Frames
+These links show and hide the HTML frames. All pages are available with or without frames.
+
+
+Serialized Form
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+
Adds new include path to LLVM Assembler's Include path option for every project
+ in the workspace that use LLVM Toolchain and for for every build configuration.
+
Adds a new Library to LLVM linker's Libraries Option for every project
+ in the workspace that use LLVM Toolchain and for for every build configuration.
+
Adds a new Library search path directory to LLVM linker's Library search path Option
+ for every project in the workspace that use LLVM Toolchain and for for every
+ build configuration.
+
Copy/pasted from org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedGCCScannerInfoConsoleParser
+ because that class cannot be referenced to due to restrictions in the exported packages definition.
Removes an include path from LLVM Assembler's Include path option for every project
+ in the workspace that use LLVM Toolchain and for for every build configuration.
+
Removes a Library to LLVM linker's Libraries Option for every project
+ in the workspace that use LLVM Toolchain and for for every build configuration.
+
Removes a Library search path directory from LLVM linker's Library search path Option
+ for every project in the workspace that use LLVM Toolchain and for for every
+ build configuration.
+
The main purpose of this class is to add include paths and libraries and library search paths
+ for LLVM assembler and linker Tools which are added in Preferences->LLVM to all projects
+ and build configurations that use LLVM ToolChain.
+Implementation class for gathering the built-in compiler settings for
+ Clang/LLVM targets. The assumption is that the tools will answer path
+ information in POSIX format and that the Scanner will be able to search for
+ files using this format.
+
+
+
+
+
+
+
+
+
+
+
+
+Field Summary
+
+
+
+
+
+
Fields inherited from class org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector
+Copy/pasted from org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedGCCScannerInfoConsoleParser
+ because that class cannot be referenced to due to restrictions in the exported packages definition.
+
+ TODO: Javadoc comments
+
Copy/pasted from org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedGCCScannerInfoConsoleParser
+ because that class cannot be referenced to due to restrictions in the exported packages definition.
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.
isSupported(org.eclipse.cdt.managedbuilder.core.IToolChain toolChain,
+ org.osgi.framework.Version version,
+ java.lang.String instance)
+
+
+ Return a boolean value that informs if the LLVM Toolchain is supported.
+An abstract list editor that manages a list of input values.
+ The editor displays a list containing the values, buttons for adding and removing
+ values, and Up and Down buttons to adjust the order of elements in the list.
+
downPressed()
+
+
+ Notifies that the Down button has been pressed.
+
+
+
+ org.eclipse.swt.widgets.Composite
+
getButtonBoxControl(org.eclipse.swt.widgets.Composite parent)
+
+
+ Returns this field editor's button box containing the Add, Remove,
+ Up, and Down button.
+
+
+
+ org.eclipse.swt.widgets.List
+
getListControl(org.eclipse.swt.widgets.Composite parent)
+
+
+ Returns this field editor's list control.
Returns this field editor's selection listener. The listener is created if nessessary.
+
+
+
+
Returns:
the selection listener
+
+
+
+
+
+selectionChanged
+
+protected void selectionChanged()
+
+
Invoked when the selection in the list has changed.
+
+
+ The default implementation of this method utilizes the selection index
+ and the size of the list to toggle the enablement of the up, down and
+ remove buttons.
+
+
+
+
Overrides:
selectionChanged in class org.eclipse.jface.preference.ListEditor
+
+
+
+
+
+
+
+
+swap
+
+private void swap(boolean up)
+
+
Moves the currently selected item up or down.
+
+
+
Parameters:
up - true if the item should move up,
+ and false if it should move down
+This class represents a preference page that
+ is contributed to the Preferences dialog. By
+ subclassing FieldEditorPreferencePage, we
+ can use the field support built into JFace that allows
+ us to create a page that is small and knows how to
+ save, restore and apply itself.
+
+ This page is used to modify preferences only. They
+ are stored in the preference store that belongs to
+ the main plug-in class. That way, preferences can
+ be accessed directly via the preference store.
+
+ TODO: When creating a new project with LLVM, automatically get values
+ from PreferencePage to Paths & Symbols.
+
+
+
+
+
+
+
+
+
+
+
+
+Field Summary
+
+
+
+
+
+
Fields inherited from class org.eclipse.jface.preference.FieldEditorPreferencePage
Get values from the LLVM Preference store as a String array.
+ Used to get Preference store values which consist of multiple paths
+ separated by a path separator.
+
+
+
Parameters:
name - the name of the preference
+
Returns:
A String array containing all Preference store values
+The main purpose of this class is to add include paths and libraries and library search paths
+ for LLVM assembler and linker Tools which are added in Preferences->LLVM to all projects
+ and build configurations that use LLVM ToolChain. Values added in Preferences->LLVM will
+ show in Project->Properties->C/C++ General->Paths and Symbols tabs.
+
addIncludePathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ org.eclipse.cdt.managedbuilder.core.ITool cfTool,
+ org.eclipse.cdt.managedbuilder.core.IOption option,
+ java.lang.String newIncludePath)
+
+
+ Adds include path for given Build configuration's Tool's Include path Option.
+
+
+
+private static void
+
addInputToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ org.eclipse.cdt.managedbuilder.core.ITool cfTool,
+ org.eclipse.cdt.managedbuilder.core.IOption option,
+ java.lang.String newValue,
+ java.lang.String[] existingValues)
+
+
+ Adds a new value to specific Option.
+
+
+
+private static void
+
addLibrarySearchPathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ org.eclipse.cdt.managedbuilder.core.ITool cfTool,
+ org.eclipse.cdt.managedbuilder.core.IOption option,
+ java.lang.String newSearchPath)
+
+
+ Adds new Library search path for the Linker's Library search path Option.
+
+
+
+private static void
+
addLibraryToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ org.eclipse.cdt.managedbuilder.core.ITool cfTool,
+ org.eclipse.cdt.managedbuilder.core.IOption option,
+ java.lang.String newLibrary)
+
+
+ Adds new Library for the Linker's Libraries Option.
+
+
+
+static void
+
addLlvmIncludePath(java.lang.String includePath)
+
+
+ Adds new include path to LLVM Assembler's Include path option for every project
+ in the workspace that use LLVM Toolchain and for for every build configuration.
+
+
+
+private static boolean
+
addLlvmIncludePathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ java.lang.String newIncludePath)
+
+
+ Adds an include path to LLVM front-end's include path option.
+
+
+
+static void
+
addLlvmLib(java.lang.String lib)
+
+
+ Adds a new Library to LLVM linker's Libraries Option for every project
+ in the workspace that use LLVM Toolchain and for for every build configuration.
+
+
+
+static void
+
addLlvmLibSearchPath(java.lang.String libDir)
+
+
+ Adds a new Library search path directory to LLVM linker's Library search path Option
+ for every project in the workspace that use LLVM Toolchain and for for every
+ build configuration.
+
+
+
+private static boolean
+
addLlvmLibSearchPathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ java.lang.String libDir)
+
+
+ Adds a Library search path to LLVM linker's Library search path Option.
+
+
+
+private static boolean
+
addLlvmLibToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ java.lang.String lib)
+
+
+ Adds a Library to LLVM linker's Libraries Option.
+
+
+
+static java.lang.String[]
+
addNewPathToExistingPathList(java.lang.String[] existingPaths,
+ java.lang.String newPath)
+
+
+ Adds one or more paths to the list of paths.
+
+
+
+private static boolean
+
addPathToSelectedToolOptionBuildConf(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ java.lang.String path,
+ int var)
+
+
+ Add a path to specific build configuration's Tool option.
+
+
+
+private static void
+
addPathToToolOption(java.lang.String path,
+ int var)
+
+
+ Adds a path to Tool option.
+
+
+
+static java.lang.String
+
arrayToString(java.lang.String[] array)
+
+
+ Append an array of Strings to a String separated by a path separator.
pathExists(java.lang.String path)
+
+
+ Checks if a file path exists.
+
+
+
+private static void
+
removeIncludePathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ org.eclipse.cdt.managedbuilder.core.ITool cfTool,
+ org.eclipse.cdt.managedbuilder.core.IOption option,
+ java.lang.String removeIncludePath)
+
+
+ Removes an include path from given Build configuration's Tool's Include path Option.
+
+
+
+private static void
+
removeInputFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ org.eclipse.cdt.managedbuilder.core.ITool cfTool,
+ org.eclipse.cdt.managedbuilder.core.IOption option,
+ java.lang.String removeValue,
+ java.lang.String[] existingValues)
+
+
+ Removes a value from a specific Option.
+
+
+
+private static void
+
removeLibraryFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ org.eclipse.cdt.managedbuilder.core.ITool cfTool,
+ org.eclipse.cdt.managedbuilder.core.IOption option,
+ java.lang.String removeLibrary)
+
+
+ Removes a new Library from the Linker's Libraries Option.
+
+
+
+private static void
+
removeLibrarySearchPathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ org.eclipse.cdt.managedbuilder.core.ITool cfTool,
+ org.eclipse.cdt.managedbuilder.core.IOption option,
+ java.lang.String removeSearchPath)
+
+
+ Removes a Library search path from the Linker's Library search path Option.
+
+
+
+static void
+
removeLlvmIncludePath(java.lang.String includePath)
+
+
+ Removes an include path from LLVM Assembler's Include path option for every project
+ in the workspace that use LLVM Toolchain and for for every build configuration.
+
+
+
+private static boolean
+
removeLlvmIncludePathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ java.lang.String removeIncludePath)
+
+
+ Removes an include path from LLVM front-end's include path option.
+
+
+
+static void
+
removeLlvmLib(java.lang.String lib)
+
+
+ Removes a Library to LLVM linker's Libraries Option for every project
+ in the workspace that use LLVM Toolchain and for for every build configuration.
+
+
+
+private static boolean
+
removeLlvmLibFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ java.lang.String removeLib)
+
+
+ Removes a Library from LLVM linker's Libraries Option.
+
+
+
+static void
+
removeLlvmLibSearchPath(java.lang.String libDir)
+
+
+ Removes a Library search path directory from LLVM linker's Library search path Option
+ for every project in the workspace that use LLVM Toolchain and for for every
+ build configuration.
+
+
+
+private static boolean
+
removeLlvmLibSearchPathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ java.lang.String removeLibDir)
+
+
+ Removes a Library search path from LLVM linker's Library search path Option.
+
+
+
+static java.lang.String[]
+
removePathFromExistingPathList(java.lang.String[] existingPaths,
+ java.lang.String removePath)
+
+
+ Removes one path from the list of paths.
+
+
+
+private static boolean
+
removePathFromSelectedToolOptionBuildConf(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
+ java.lang.String path,
+ int var)
+
+
+ Removes a path from specific build configuration's Tool option.
+
+
+
+private static void
+
removePathFromToolOption(java.lang.String path,
+ int var)
+
+
+ Removes a path from Tool option.
+
+
+
+static java.lang.String[]
+
stringToArray(java.lang.String str)
+
+
+ Split paths to a String array.
Adds new include path to LLVM Assembler's Include path option for every project
+ in the workspace that use LLVM Toolchain and for for every build configuration.
+
+
+
Parameters:
includePath - Include path for LLVM assembler's Include Option
Removes an include path from LLVM Assembler's Include path option for every project
+ in the workspace that use LLVM Toolchain and for for every build configuration.
+
+
+
Parameters:
includePath - Include path for LLVM assembler's Include Option
Adds a new Library to LLVM linker's Libraries Option for every project
+ in the workspace that use LLVM Toolchain and for for every build configuration.
+
+
+
Parameters:
lib - Library name for the LLVM linker's Libraries Option
Removes a Library to LLVM linker's Libraries Option for every project
+ in the workspace that use LLVM Toolchain and for for every build configuration.
+
+
+
Parameters:
lib - Library name for the LLVM linker's Libraries Option
Adds a new Library search path directory to LLVM linker's Library search path Option
+ for every project in the workspace that use LLVM Toolchain and for for every
+ build configuration.
+
Removes a Library search path directory from LLVM linker's Library search path Option
+ for every project in the workspace that use LLVM Toolchain and for for every
+ build configuration.
+
newPath - New path to add. May include multiple directories with a path delimiter java.io.File.pathSeparator
+ (usually semicolon (Win) or colon (Linux/Mac), OS specific)
+
Returns:
String[] List that includes existing paths as well as new paths.
The main purpose of this class is to add include paths and libraries and library search paths
+ for LLVM assembler and linker Tools which are added in Preferences->LLVM to all projects
+ and build configurations that use LLVM ToolChain.
LLVM with Clang/GCC for Eclipse CDT plug-in provides LLVM toolchain with Clang or llvm-gcc compiler to compile C/C++ programs.
+
LLVM is a rather modern toolchain that supports the compilation of C/C++ code (among others) to LLVM virtual machine's bitcode, which in turn can be compiled to each platform's native binary.
+
The plug-in includes the following tools from the LLVM toolchain: Clang/Clang++/llvm-gcc/llvm-g++ (C/C++ compilers), llvm-ld (linker), llvm-ar (archiver), llvm-as (assembler), llc (static compiler) and lli (JIT/Interpreter).
+
+
\ No newline at end of file
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/help/initial_configuration.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/help/initial_configuration.html
new file mode 100755
index 00000000000..3b14c092593
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/help/initial_configuration.html
@@ -0,0 +1,14 @@
+
+
+
+
+Initial configuration
+
+
+
Initial configuration
+
When you launch an Eclipse workspace with LLVM plug-in for the first time, you may need to set paths to LLVM binaries, headers and libraries. This is done in Eclipse by navigating to Window -> Preferences -> LLVM. Set LLVM installation folder to point where your LLVM binaries are, include directory to point where your Clang includes are and library path to the directory where your LLVM libraries reside.
+
If your paths in Preferences and LLVM are correctly set and the plug-in is able to find your LLVM binaries, you should have the option to use "LLVM with Clang (Linux/MacOSX/Windows)" toolchain and "LLVM with GCC (Linux/MacOSX/Windows) toolchain". The toolchains are available in project types of 'executable', 'static library' and 'dynamic library' in both C and C++.
+
An alternative way is to set the LLVM binary path to PATH system environment variable.
+
You may also have to include the path to Standard C++ Library in order to compile C++ programs by adding the path in LLVM Preferences or appending it to LD_LIBRARY_PATH system environment variable.
+
+
\ No newline at end of file
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/help/llvm_specific.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/help/llvm_specific.html
new file mode 100755
index 00000000000..bc127ab3990
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/help/llvm_specific.html
@@ -0,0 +1,17 @@
+
+
+
+
+LLVM Specific Information
+
+
+
At the moment the executables built with the default settings of a LLVM with Clang project are native binaries and can be run and debugged as such. However LLVM does also support compiling programs to LLVM bitcode, which in turn can be run with lli, which is the LLVM toolchain's interpreter/JIT compiler. Unfortunately programs run with lli can not be efficiently debugged, since the only (usable) debugging information that you can get from them is the backtrace. You can, however, compile the bitcode versions of your programs, if you will (TODO: even though running them from Eclipse doesn't work at the moment).
+
Compiling to LLVM bitcode instead of native binary
+
You can compile your programs to LLVM bitcode instead of native binaries by unchecking the "Create native binary (-native)" checkbox in your project's properties in Properties → C/C++ Build → Settings → LLVM Linker → General LLVM options. After this Eclipse will not give the -native flag to llvm-ld, so the product of linking is just linked bitcode files (.bc) and a Bash script file with the name of the wanted executable. The Bash script will simply run the compiled LLVM bitcode file with lli.
The shared and static libraries generated with LLVM plugin are (TODO: for now) only LLVM bitcode files linked into one file and therefore cannot be used with gcc unless compiled to object code first. These libraries can naturally be used when working with the LLVM toolchain and on the other hand llvm-ld can use libraries that are object code.
+
+
\ No newline at end of file
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/help/toc.xml b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/help/toc.xml
new file mode 100755
index 00000000000..cd02aa7ae74
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/help/toc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/help/user_manual.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/help/user_manual.html
new file mode 100755
index 00000000000..6f6ddc9241f
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/help/user_manual.html
@@ -0,0 +1,17 @@
+
+
+
+
+User manual - LLVM with Clang/GCC for Eclipse CDT
+
+
+
LLVM with Clang/GCC for Eclipse CDT
+
This guide is intended for the users of the LLVM with Clang/GCC for Eclipse CDT plugin. It describes the initial configuration, general information and some special cases about the plugin.
+
+
\ No newline at end of file
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/CDT_Bug_318581.patch b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/CDT_Bug_318581.patch
new file mode 100644
index 00000000000..ec68da8ec8c
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/CDT_Bug_318581.patch
@@ -0,0 +1,1250 @@
+### Eclipse Workspace Patch 1.0
+#P org.eclipse.cdt.managedbuilder.core
+Index: META-INF/MANIFEST.MF
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF,v
+retrieving revision 1.22
+diff -u -r1.22 MANIFEST.MF
+--- META-INF/MANIFEST.MF 7 Feb 2010 17:14:28 -0000 1.22
++++ META-INF/MANIFEST.MF 8 Jul 2010 20:51:01 -0000
+@@ -2,7 +2,7 @@
+ Bundle-ManifestVersion: 2
+ Bundle-Name: %pluginName
+ Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core; singleton:=true
+-Bundle-Version: 7.0.0.qualifier
++Bundle-Version: 8.0.0.qualifier
+ Bundle-Activator: org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin
+ Bundle-Vendor: %providerName
+ Bundle-Localization: plugin
+Index: src/org/eclipse/cdt/managedbuilder/core/IBuildObject.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuildObject.java,v
+retrieving revision 1.8
+diff -u -r1.8 IBuildObject.java
+--- src/org/eclipse/cdt/managedbuilder/core/IBuildObject.java 8 Feb 2010 02:56:14 -0000 1.8
++++ src/org/eclipse/cdt/managedbuilder/core/IBuildObject.java 8 Jul 2010 20:51:01 -0000
+@@ -10,7 +10,7 @@
+ *******************************************************************************/
+ package org.eclipse.cdt.managedbuilder.core;
+
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ /**
+ * @noextend This class is not intended to be subclassed by clients.
+@@ -24,7 +24,9 @@
+ public String getId();
+ public String getName();
+ public String getBaseId();
+- public PluginVersionIdentifier getVersion();
+- public void setVersion(PluginVersionIdentifier version);
++ /** @since 8.0 */
++ public Version getVersion();
++ /** @since 8.0 */
++ public void setVersion(Version version);
+ public String getManagedBuildRevision();
+ }
+Index: src/org/eclipse/cdt/managedbuilder/core/IManagedIsToolChainSupported.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedIsToolChainSupported.java,v
+retrieving revision 1.2
+diff -u -r1.2 IManagedIsToolChainSupported.java
+--- src/org/eclipse/cdt/managedbuilder/core/IManagedIsToolChainSupported.java 20 Jun 2005 20:52:52 -0000 1.2
++++ src/org/eclipse/cdt/managedbuilder/core/IManagedIsToolChainSupported.java 8 Jul 2010 20:51:01 -0000
+@@ -10,7 +10,7 @@
+ *******************************************************************************/
+ package org.eclipse.cdt.managedbuilder.core;
+
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ /**
+ *
+@@ -18,11 +18,10 @@
+ */
+ public interface IManagedIsToolChainSupported {
+ /**
+- *
+ * @return true if the given tool-chain is supported on the system
+ * otherwise returns false
++ *
++ * @since 8.0
+ */
+- public boolean isSupported(IToolChain toolChain,
+- PluginVersionIdentifier version,
+- String instance);
++ public boolean isSupported(IToolChain toolChain, Version version, String instance);
+ }
+Index: src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java,v
+retrieving revision 1.134
+diff -u -r1.134 ManagedBuildManager.java
+--- src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java 2 Jul 2010 14:46:28 -0000 1.134
++++ src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java 8 Jul 2010 20:51:01 -0000
+@@ -122,7 +122,7 @@
+ import org.eclipse.core.runtime.NullProgressMonitor;
+ import org.eclipse.core.runtime.Path;
+ import org.eclipse.core.runtime.Platform;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+ import org.eclipse.core.runtime.Status;
+ import org.eclipse.core.runtime.SubProgressMonitor;
+ import org.eclipse.core.runtime.URIUtil;
+@@ -132,7 +132,6 @@
+ import org.eclipse.ui.IWorkbenchWindow;
+ import org.eclipse.ui.PlatformUI;
+ import org.osgi.framework.Bundle;
+-import org.osgi.framework.Version;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+@@ -194,7 +193,7 @@
+ private static final String ALL = "all"; //$NON-NLS-1$
+
+ // This is the version of the manifest and project files
+- private static final PluginVersionIdentifier buildInfoVersion = new PluginVersionIdentifier(4, 0, 0);
++ private static final Version buildInfoVersion = new Version(4, 0, 0);
+ private static final Version version = new Version(4, 0, 0);
+ private static Map depCalculatorsMap;
+ private static boolean projectTypesLoaded = false;
+@@ -1950,7 +1949,7 @@
+
+ private static boolean isVersionCompatible(IExtension extension) {
+ // We can ignore the qualifier
+- PluginVersionIdentifier version = null;
++ Version version = null;
+
+ // Get the version of the manifest
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+@@ -1958,7 +1957,7 @@
+ // Find the version string in the manifest
+ for (IConfigurationElement element : elements) {
+ if (element.getName().equals(REVISION_ELEMENT_NAME)) {
+- version = new PluginVersionIdentifier(element.getAttribute(VERSION_ELEMENT_NAME));
++ version = new Version(element.getAttribute(VERSION_ELEMENT_NAME));
+ break;
+ }
+ }
+@@ -1967,7 +1966,7 @@
+ // This is a 1.2 manifest and we are compatible for now
+ return true;
+ }
+- return(buildInfoVersion.isGreaterOrEqualTo(version));
++ return(buildInfoVersion.compareTo(version)>=0);
+ }
+
+ /**
+@@ -2011,8 +2010,9 @@
+ } else {
+ // Make sure that the version is compatible with the manager
+ fileVersion = rootElement.getNodeValue();
+- PluginVersionIdentifier version = new PluginVersionIdentifier(fileVersion);
+- if (buildInfoVersion.isGreaterThan(version)) {
++ Version version = new Version(fileVersion);
++ //if buildInfoVersion is greater than fileVersion
++ if (buildInfoVersion.compareTo(version)>0) {
+ // This is >= 2.0 project, but earlier than the current MBS version - it may need to be updated
+ } else {
+ // This is a
+@@ -2020,7 +2020,22 @@
+ // o The major versions are not equal
+ // o The major versions are equal, but the remainder of the .cdtbuild version # is
+ // greater than the MBS version #
+- if (!buildInfoVersion.isCompatibleWith(version)) {
++ boolean compatible=false;
++ if (version == null)
++ compatible=false;
++ if (buildInfoVersion.getMajor() != version.getMajor())
++ compatible=false;
++ if (buildInfoVersion.getMinor() > version.getMinor())
++ compatible=true;
++ if (buildInfoVersion.getMinor() < version.getMinor())
++ compatible=false;
++ if (buildInfoVersion.getMicro() > version.getMicro())
++ compatible=true;
++ if (buildInfoVersion.getMicro() < version.getMicro())
++ compatible=false;
++ if (buildInfoVersion.getQualifier().compareTo(version.getQualifier()) >= 0)
++ compatible=true;
++ if (!compatible) {
+ throw new BuildException(ManagedMakeMessages.getFormattedString(PROJECT_VERSION_ERROR, project.getName()));
+ }
+ }
+@@ -2035,10 +2050,10 @@
+ buildInfo = new ManagedBuildInfo(project, XmlStorageUtil.createCStorageTree((Element)node), true, fileVersion);
+ if (fileVersion != null) {
+ // buildInfo.setVersion(fileVersion);
+- PluginVersionIdentifier version = new PluginVersionIdentifier(fileVersion);
+- PluginVersionIdentifier version21 = new PluginVersionIdentifier("2.1"); //$NON-NLS-1$
++ Version version = new Version(fileVersion);
++ Version version21 = new Version("2.1"); //$NON-NLS-1$
+ // CDT 2.1 is the first version using the new MBS model
+- if (version.isGreaterOrEqualTo(version21)) {
++ if (version.compareTo(version21)>=0) {
+ // Check to see if all elements could be loaded correctly - for example,
+ // if references in the project file could not be resolved to extension
+ // elements
+@@ -3007,8 +3022,9 @@
+ * Answers the current version of the managed builder plugin.
+ *
+ * @return the current version of the managed builder plugin
++ * @since 8.0
+ */
+- public static PluginVersionIdentifier getBuildInfoVersion() {
++ public static Version getBuildInfoVersion() {
+ return buildInfoVersion;
+ }
+
+@@ -3179,7 +3195,7 @@
+ if ( index != -1) {
+ // Get the version number from tool id.
+ String version = idAndVersion.substring(index+1);
+- IStatus status = PluginVersionIdentifier.validateVersion(version);
++ IStatus status = (IStatus) Version.parseVersion(version);
+
+ // If there is a valid version then return 'version'
+ if ( status.isOK())
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/BuildObject.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BuildObject.java,v
+retrieving revision 1.9
+diff -u -r1.9 BuildObject.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/BuildObject.java 14 Jun 2007 19:08:49 -0000 1.9
++++ src/org/eclipse/cdt/managedbuilder/internal/core/BuildObject.java 8 Jul 2010 20:51:02 -0000
+@@ -14,14 +14,14 @@
+ import org.eclipse.cdt.managedbuilder.core.IBuildObject;
+ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+ import org.eclipse.core.runtime.IStatus;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ public class BuildObject implements IBuildObject {
+
+ protected String id;
+ protected String name;
+
+- protected PluginVersionIdentifier version = null;
++ protected Version version = null;
+ protected String managedBuildRevision = null;
+
+ /* (non-Javadoc)
+@@ -69,14 +69,14 @@
+ /**
+ * @return Returns the version.
+ */
+- public PluginVersionIdentifier getVersion() {
++ public Version getVersion() {
+ return version;
+ }
+
+ /**
+ * @param version The version to set.
+ */
+- public void setVersion(PluginVersionIdentifier version) {
++ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+@@ -88,7 +88,7 @@
+ }
+
+
+- public PluginVersionIdentifier getVersionFromId() {
++ public Version getVersionFromId() {
+ String versionNumber;
+ IStatus status = null;
+
+@@ -100,12 +100,12 @@
+ // So get the default version based on 'managedBuildRevision' attribute.
+
+ if ( getManagedBuildRevision() != null) {
+- PluginVersionIdentifier tmpManagedBuildRevision = new PluginVersionIdentifier( getManagedBuildRevision() );
+- if (tmpManagedBuildRevision.isEquivalentTo(new PluginVersionIdentifier("1.2.0")) ) //$NON-NLS-1$
++ Version tmpManagedBuildRevision = new Version( getManagedBuildRevision() );
++ if (tmpManagedBuildRevision.equals(new Version("1.2.0")) ) //$NON-NLS-1$
+ versionNumber = "0.0.1"; //$NON-NLS-1$
+- else if (tmpManagedBuildRevision.isEquivalentTo(new PluginVersionIdentifier("2.0.0")) ) //$NON-NLS-1$
++ else if (tmpManagedBuildRevision.equals(new Version("2.0.0")) ) //$NON-NLS-1$
+ versionNumber = "0.0.2"; //$NON-NLS-1$
+- else if (tmpManagedBuildRevision.isEquivalentTo(new PluginVersionIdentifier("2.1.0")) ) //$NON-NLS-1$
++ else if (tmpManagedBuildRevision.equals(new Version("2.1.0")) ) //$NON-NLS-1$
+ versionNumber = "0.0.3"; //$NON-NLS-1$
+ else
+ versionNumber = "0.0.4"; //$NON-NLS-1$
+@@ -113,7 +113,7 @@
+ versionNumber = "0.0.0"; //$NON-NLS-1$
+ }
+ }
+- return new PluginVersionIdentifier(versionNumber);
++ return new Version(versionNumber);
+ }
+
+ public void setManagedBuildRevision(String managedBuildRevision) {
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java,v
+retrieving revision 1.41
+diff -u -r1.41 Builder.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java 2 Jun 2010 19:54:43 -0000 1.41
++++ src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java 8 Jul 2010 20:51:02 -0000
+@@ -66,9 +66,9 @@
+ import org.eclipse.core.runtime.NullProgressMonitor;
+ import org.eclipse.core.runtime.Path;
+ import org.eclipse.core.runtime.Platform;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
+ import org.eclipse.core.variables.IStringVariableManager;
+ import org.eclipse.core.variables.VariablesPlugin;
++import org.osgi.framework.Version;
+
+ public class Builder extends BuildObject implements IBuilder, IMatchKeyProvider, IRealBuildObjectAssociation {
+
+@@ -1513,8 +1513,7 @@
+ String[] tmpVersions = versionsSupported.split(","); //$NON-NLS-1$
+
+ for (int j = 0; j < tmpVersions.length; j++) {
+- if (new PluginVersionIdentifier(version)
+- .equals(new PluginVersionIdentifier(
++ if (new Version(version).equals(new Version(
+ tmpVersions[j]))) {
+ // version is supported.
+ // Do the automatic conversion without
+@@ -1604,13 +1603,11 @@
+ // If it matches
+ String mbsVersion = element
+ .getAttribute("mbsVersion"); //$NON-NLS-1$
+- PluginVersionIdentifier currentMbsVersion = ManagedBuildManager
++ Version currentMbsVersion = ManagedBuildManager
+ .getBuildInfoVersion();
+
+ // set the converter element based on the MbsVersion
+- if (currentMbsVersion
+- .isGreaterThan(new PluginVersionIdentifier(
+- mbsVersion))) {
++ if (currentMbsVersion.compareTo(new Version(mbsVersion))>0) {
+ previousMbsVersionConversionElement = element;
+ } else {
+ currentMbsVersionConversionElement = element;
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java,v
+retrieving revision 1.91
+diff -u -r1.91 Configuration.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java 21 May 2010 16:01:26 -0000 1.91
++++ src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java 8 Jul 2010 20:51:02 -0000
+@@ -89,7 +89,7 @@
+ import org.eclipse.core.runtime.IPath;
+ import org.eclipse.core.runtime.Path;
+ import org.eclipse.core.runtime.Platform;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+ import org.osgi.service.prefs.Preferences;
+
+ public class Configuration extends BuildObject implements IConfiguration, IBuildPropertiesRestriction, IBuildPropertyChangeListener, IRealBuildObjectAssociation {
+@@ -1847,7 +1847,7 @@
+ /**
+ * @return Returns the version.
+ */
+- public PluginVersionIdentifier getVersion() {
++ public Version getVersion() {
+ if ( version == null) {
+ if ( rootFolderInfo.getToolChain() != null) {
+ return rootFolderInfo.getToolChain().getVersion();
+@@ -1856,7 +1856,7 @@
+ return version;
+ }
+
+- public void setVersion(PluginVersionIdentifier version) {
++ public void setVersion(Version version) {
+ // Do nothing
+ }
+
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java,v
+retrieving revision 1.29
+diff -u -r1.29 InputType.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java 2 Jun 2010 19:54:43 -0000 1.29
++++ src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java 8 Jul 2010 20:51:02 -0000
+@@ -38,7 +38,7 @@
+ import org.eclipse.core.runtime.IPath;
+ import org.eclipse.core.runtime.Path;
+ import org.eclipse.core.runtime.Platform;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+ import org.eclipse.core.runtime.content.IContentType;
+ import org.eclipse.core.runtime.content.IContentTypeManager;
+
+@@ -1593,7 +1593,7 @@
+ * @return Returns the version.
+ */
+ @Override
+- public PluginVersionIdentifier getVersion() {
++ public Version getVersion() {
+ if ( version == null) {
+ if ( getParent() != null) {
+ return getParent().getVersion();
+@@ -1603,7 +1603,7 @@
+ }
+
+ @Override
+- public void setVersion(PluginVersionIdentifier version) {
++ public void setVersion(Version version) {
+ // Do nothing
+ }
+
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java,v
+retrieving revision 1.24
+diff -u -r1.24 ManagedProject.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java 2 Jun 2010 19:54:43 -0000 1.24
++++ src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java 8 Jul 2010 20:51:02 -0000
+@@ -35,7 +35,7 @@
+ import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
+ import org.eclipse.core.resources.IResource;
+ import org.eclipse.core.runtime.CoreException;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ public class ManagedProject extends BuildObject implements IManagedProject, IBuildPropertiesRestriction, IBuildPropertyChangeListener {
+
+@@ -494,7 +494,7 @@
+ * @return Returns the version.
+ */
+ @Override
+- public PluginVersionIdentifier getVersion() {
++ public Version getVersion() {
+ if (version == null) {
+ if ( getProjectType() != null) {
+ return getProjectType().getVersion();
+@@ -504,7 +504,7 @@
+ }
+
+ @Override
+- public void setVersion(PluginVersionIdentifier version) {
++ public void setVersion(Version version) {
+ // Do nothing
+ }
+
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java,v
+retrieving revision 1.12
+diff -u -r1.12 MultiConfiguration.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java 21 May 2010 16:01:26 -0000 1.12
++++ src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java 8 Jul 2010 20:51:02 -0000
+@@ -46,7 +46,7 @@
+ import org.eclipse.core.resources.IResource;
+ import org.eclipse.core.runtime.CoreException;
+ import org.eclipse.core.runtime.IPath;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ /**
+ * This class represents a set of configurations
+@@ -1071,7 +1071,7 @@
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getVersion()
+ */
+- public PluginVersionIdentifier getVersion() {
++ public Version getVersion() {
+ if (DEBUG)
+ System.out.println("Strange multi access: MultiConfiguration.getVersion()"); //$NON-NLS-1$
+ return curr().getVersion();
+@@ -1080,7 +1080,7 @@
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuildObject#setVersion(org.eclipse.core.runtime.PluginVersionIdentifier)
+ */
+- public void setVersion(PluginVersionIdentifier version) {} // do nothing
++ public void setVersion(Version version) {} // do nothing
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuildObjectPropertiesContainer#getBuildProperties()
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/MultiResourceInfo.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiResourceInfo.java,v
+retrieving revision 1.8
+diff -u -r1.8 MultiResourceInfo.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/MultiResourceInfo.java 2 Jun 2010 19:54:43 -0000 1.8
++++ src/org/eclipse/cdt/managedbuilder/internal/core/MultiResourceInfo.java 8 Jul 2010 20:51:02 -0000
+@@ -23,7 +23,7 @@
+ import org.eclipse.cdt.managedbuilder.core.IToolChain;
+ import org.eclipse.cdt.managedbuilder.core.OptionStringValue;
+ import org.eclipse.core.runtime.IPath;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ /**
+ * This class holds a number of IResourceInfo objects
+@@ -352,14 +352,14 @@
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getVersion()
+ */
+- public PluginVersionIdentifier getVersion() {
++ public Version getVersion() {
+ return fRis[curr].getVersion();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuildObject#setVersion(org.eclipse.core.runtime.PluginVersionIdentifier)
+ */
+- public void setVersion(PluginVersionIdentifier version) {
++ public void setVersion(Version version) {
+ for (int i=0; i0) {
+ previousMbsVersionConversionElement = element;
+ } else {
+ currentMbsVersionConversionElement = element;
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java,v
+retrieving revision 1.28
+diff -u -r1.28 ResourceConfiguration.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java 16 Nov 2007 12:26:08 -0000 1.28
++++ src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java 8 Jul 2010 20:51:02 -0000
+@@ -39,7 +39,7 @@
+ import org.eclipse.core.resources.IResource;
+ import org.eclipse.core.runtime.IPath;
+ import org.eclipse.core.runtime.Path;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
+
+@@ -829,7 +829,7 @@
+ /**
+ * @return Returns the version.
+ */
+- public PluginVersionIdentifier getVersion() {
++ public Version getVersion() {
+ if ( version == null) {
+ if ( getParent() != null) {
+ return getParent().getVersion();
+@@ -838,7 +838,7 @@
+ return version;
+ }
+
+- public void setVersion(PluginVersionIdentifier version) {
++ public void setVersion(Version version) {
+ // Do nothing
+ }
+
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java,v
+retrieving revision 1.40
+diff -u -r1.40 Target.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/Target.java 14 Jun 2006 12:15:56 -0000 1.40
++++ src/org/eclipse/cdt/managedbuilder/internal/core/Target.java 8 Jul 2010 20:51:02 -0000
+@@ -34,7 +34,7 @@
+ import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildCPathEntryContainer;
+ import org.eclipse.core.resources.IResource;
+ import org.eclipse.core.runtime.Platform;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+@@ -1164,7 +1164,7 @@
+ /**
+ * @return Returns the version.
+ */
+- public PluginVersionIdentifier getVersion() {
++ public Version getVersion() {
+ if ( version == null) {
+ if ( getParent() != null) {
+ return getParent().getVersion();
+@@ -1173,7 +1173,7 @@
+ return version;
+ }
+
+- public void setVersion(PluginVersionIdentifier version) {
++ public void setVersion(Version version) {
+ // Do nothing
+ }
+
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java,v
+retrieving revision 1.10
+diff -u -r1.10 TargetPlatform.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java 2 Jun 2010 19:54:43 -0000 1.10
++++ src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java 8 Jul 2010 20:51:02 -0000
+@@ -24,7 +24,7 @@
+ import org.eclipse.cdt.managedbuilder.core.IToolChain;
+ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+ import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildTargetPlatformData;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ public class TargetPlatform extends BuildObject implements ITargetPlatform {
+
+@@ -606,7 +606,7 @@
+ /**
+ * @return Returns the version.
+ */
+- public PluginVersionIdentifier getVersion() {
++ public Version getVersion() {
+ if ( version == null) {
+ if ( getParent() != null) {
+ return getParent().getVersion();
+@@ -615,7 +615,7 @@
+ return version;
+ }
+
+- public void setVersion(PluginVersionIdentifier version) {
++ public void setVersion(Version version) {
+ // Do nothing
+ }
+
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java,v
+retrieving revision 1.99
+diff -u -r1.99 Tool.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java 2 Jun 2010 19:54:43 -0000 1.99
++++ src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java 8 Jul 2010 20:51:02 -0000
+@@ -79,7 +79,6 @@
+ import org.eclipse.core.runtime.IStatus;
+ import org.eclipse.core.runtime.Path;
+ import org.eclipse.core.runtime.Platform;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
+ import org.eclipse.core.runtime.Status;
+ import org.eclipse.core.runtime.content.IContentType;
+ import org.eclipse.core.runtime.content.IContentTypeSettings;
+@@ -3206,11 +3205,11 @@
+ // If it matches
+ String mbsVersion = element
+ .getAttribute("mbsVersion"); //$NON-NLS-1$
+- PluginVersionIdentifier currentMbsVersion = ManagedBuildManager
++ Version currentMbsVersion = ManagedBuildManager
+ .getBuildInfoVersion();
+
+ // set the converter element based on the MbsVersion
+- if (currentMbsVersion.isGreaterThan(new PluginVersionIdentifier(mbsVersion))) {
++ if (currentMbsVersion.compareTo(new Version(mbsVersion))>0) {
+ previousMbsVersionConversionElement = element;
+ } else {
+ currentMbsVersionConversionElement = element;
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java,v
+retrieving revision 1.52
+diff -u -r1.52 ToolChain.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java 2 Jun 2010 19:54:43 -0000 1.52
++++ src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java 8 Jul 2010 20:51:02 -0000
+@@ -55,7 +55,7 @@
+ import org.eclipse.core.runtime.IExtensionPoint;
+ import org.eclipse.core.runtime.IPath;
+ import org.eclipse.core.runtime.Platform;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ public class ToolChain extends HoldsOptions implements IToolChain, IBuildPropertiesRestriction, IMatchKeyProvider, IRealBuildObjectAssociation {
+
+@@ -1919,7 +1919,7 @@
+ String[] tmpVersions = versionsSupported.split(","); //$NON-NLS-1$
+
+ for (int j = 0; j < tmpVersions.length; j++) {
+- if (new PluginVersionIdentifier(version).equals(new PluginVersionIdentifier(tmpVersions[j]))) {
++ if (new Version(version).equals(new Version(tmpVersions[j]))) {
+ // version is supported.
+ // Do the automatic conversion without
+ // prompting the user.
+@@ -2006,13 +2006,11 @@
+ // If it matches
+ String mbsVersion = element
+ .getAttribute("mbsVersion"); //$NON-NLS-1$
+- PluginVersionIdentifier currentMbsVersion = ManagedBuildManager
++ Version currentMbsVersion = ManagedBuildManager
+ .getBuildInfoVersion();
+
+ // set the converter element based on the MbsVersion
+- if (currentMbsVersion
+- .isGreaterThan(new PluginVersionIdentifier(
+- mbsVersion))) {
++ if (currentMbsVersion.compareTo(new Version(mbsVersion))>0) {
+ previousMbsVersionConversionElement = element;
+ } else {
+ currentMbsVersionConversionElement = element;
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java,v
+retrieving revision 1.45
+diff -u -r1.45 ToolReference.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java 11 Jun 2008 15:48:35 -0000 1.45
++++ src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java 8 Jul 2010 20:51:02 -0000
+@@ -39,7 +39,7 @@
+ import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType;
+ import org.eclipse.core.runtime.IConfigurationElement;
+ import org.eclipse.core.runtime.IPath;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+ import org.w3c.dom.Document;
+ import org.w3c.dom.Element;
+ import org.w3c.dom.Node;
+@@ -1239,11 +1239,11 @@
+ return null;
+ }
+
+- public PluginVersionIdentifier getVersion() {
++ public Version getVersion() {
+ return null;
+ }
+
+- public void setVersion(PluginVersionIdentifier version) {
++ public void setVersion(Version version) {
+ // TODO Auto-generated method stub
+ }
+
+Index: src/org/eclipse/cdt/managedbuilder/internal/macros/MbsMacroSupplier.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/macros/MbsMacroSupplier.java,v
+retrieving revision 1.23
+diff -u -r1.23 MbsMacroSupplier.java
+--- src/org/eclipse/cdt/managedbuilder/internal/macros/MbsMacroSupplier.java 2 Jun 2010 19:54:42 -0000 1.23
++++ src/org/eclipse/cdt/managedbuilder/internal/macros/MbsMacroSupplier.java 8 Jul 2010 20:51:02 -0000
+@@ -43,7 +43,7 @@
+ import org.eclipse.core.resources.IWorkspace;
+ import org.eclipse.core.runtime.IPath;
+ import org.eclipse.core.runtime.Path;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+ import org.osgi.framework.Bundle;
+
+ /**
+@@ -575,7 +575,7 @@
+ macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT,cfg.getToolChain().getVersion().toString());
+ }
+ else if("BuilderVersion".equals(macroName)){ //$NON-NLS-1$
+- PluginVersionIdentifier version = cfg.getToolChain().getBuilder().getVersion();
++ Version version = cfg.getToolChain().getBuilder().getVersion();
+ if(version != null)
+ macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT,version.toString());
+ }
+Index: src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProjectManager.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProjectManager.java,v
+retrieving revision 1.16
+diff -u -r1.16 UpdateManagedProjectManager.java
+--- src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProjectManager.java 7 Feb 2010 17:14:08 -0000 1.16
++++ src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProjectManager.java 8 Jul 2010 20:51:03 -0000
+@@ -34,7 +34,7 @@
+ import org.eclipse.core.runtime.NullProgressMonitor;
+ import org.eclipse.core.runtime.OperationCanceledException;
+ import org.eclipse.core.runtime.Path;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+ import org.eclipse.core.runtime.Status;
+ import org.eclipse.core.runtime.jobs.ISchedulingRule;
+ import org.eclipse.ui.dialogs.IOverwriteQuery;
+@@ -111,21 +111,24 @@
+ return map;
+ }
+
+- static protected PluginVersionIdentifier getManagedBuildInfoVersion(String version){
++ /**
++ * @since 8.0
++ */
++ static protected Version getManagedBuildInfoVersion(String version){
+ if(version == null)
+ version = "1.2"; //$NON-NLS-1$
+- return new PluginVersionIdentifier(version);
++ return new Version(version);
+ }
+
+ static public boolean isCompatibleProject(IManagedBuildInfo info) {
+ if(info == null)
+ return false;
+
+- PluginVersionIdentifier projVersion = getManagedBuildInfoVersion(info.getVersion());
++ Version projVersion = getManagedBuildInfoVersion(info.getVersion());
+
+- PluginVersionIdentifier compVersion = ManagedBuildManager.getBuildInfoVersion();
++ Version compVersion = ManagedBuildManager.getBuildInfoVersion();
+
+- if(compVersion.isEquivalentTo(projVersion))
++ if(compVersion.equals(projVersion))
+ return true;
+ return false;
+ }
+@@ -308,7 +311,7 @@
+ }
+ });
+
+- PluginVersionIdentifier version = getManagedBuildInfoVersion(info.getVersion());
++ Version version = getManagedBuildInfoVersion(info.getVersion());
+
+ boolean shouldUpdate;
+ if(fUpdateProjectQuery != null)
+@@ -327,23 +330,23 @@
+ if(projectFile.exists())
+ backupFile(projectFile, "_initial", monitor, fProject); //$NON-NLS-1$
+
+- if(version.isEquivalentTo(new PluginVersionIdentifier(1,2,0))){
++ if(version.equals(new Version(1,2,0))){
+ UpdateManagedProject12.doProjectUpdate(monitor, fProject);
+ version = getManagedBuildInfoVersion(info.getVersion());
+ }
+- if(version.isEquivalentTo(new PluginVersionIdentifier(2,0,0))){
++ if(version.equals(new Version(2,0,0))){
+ UpdateManagedProject20.doProjectUpdate(monitor, fProject);
+ version = getManagedBuildInfoVersion(info.getVersion());
+ }
+- if(version.isEquivalentTo(new PluginVersionIdentifier(2,1,0))){
++ if(version.equals(new Version(2,1,0))){
+ UpdateManagedProject21.doProjectUpdate(monitor, fProject);
+ version = getManagedBuildInfoVersion(info.getVersion());
+ }
+- if(version.isEquivalentTo(new PluginVersionIdentifier(3,0,0))){
++ if(version.equals(new Version(3,0,0))){
+ UpdateManagedProject30.doProjectUpdate(monitor, fProject);
+ version = getManagedBuildInfoVersion(info.getVersion());
+ }
+- if (new PluginVersionIdentifier(4,0,0).isGreaterThan(version)){
++ if (new Version(4,0,0).compareTo(version)>0){
+ UpdateManagedProject31.doProjectUpdate(monitor, fProject);
+ version = getManagedBuildInfoVersion(info.getVersion());
+ }
+#P org.eclipse.cdt.managedbuilder.core.tests
+Index: META-INF/MANIFEST.MF
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core.tests/META-INF/MANIFEST.MF,v
+retrieving revision 1.15
+diff -u -r1.15 MANIFEST.MF
+--- META-INF/MANIFEST.MF 8 Feb 2010 01:02:30 -0000 1.15
++++ META-INF/MANIFEST.MF 8 Jul 2010 20:51:04 -0000
+@@ -2,7 +2,7 @@
+ Bundle-ManifestVersion: 2
+ Bundle-Name: Tests
+ Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core.tests; singleton:=true
+-Bundle-Version: 7.0.0.qualifier
++Bundle-Version: 8.0.0.qualifier
+ Bundle-Activator: org.eclipse.cdt.managedbuilder.testplugin.CTestPlugin
+ Bundle-Vendor: Eclipse CDT
+ Bundle-Localization: plugin
+Index: tests/org/eclipse/cdt/managedbuilder/core/tests/TestMacro.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestMacro.java,v
+retrieving revision 1.5
+diff -u -r1.5 TestMacro.java
+--- tests/org/eclipse/cdt/managedbuilder/core/tests/TestMacro.java 14 Jun 2007 20:10:11 -0000 1.5
++++ tests/org/eclipse/cdt/managedbuilder/core/tests/TestMacro.java 8 Jul 2010 20:51:04 -0000
+@@ -34,7 +34,7 @@
+ import org.eclipse.core.runtime.IPath;
+ import org.eclipse.core.runtime.IProgressMonitor;
+ import org.eclipse.core.runtime.MultiStatus;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ /**
+ *
+@@ -206,9 +206,7 @@
+ /**
+ *
+ */
+- public boolean isSupported(IToolChain toolChain,
+- PluginVersionIdentifier version,
+- String instance) {
++ public boolean isSupported(IToolChain toolChain, Version version, String instance) {
+ if ("One".equals(toolChain.getParent().getName())) return supported[0]; //$NON-NLS-1$
+ if ("Two".equals(toolChain.getParent().getName())) return supported[1]; //$NON-NLS-1$
+ if ("Three".equals(toolChain.getParent().getName())) return supported[2]; //$NON-NLS-1$
+#P org.eclipse.cdt.managedbuilder.gnu.ui
+Index: META-INF/MANIFEST.MF
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.gnu.ui/META-INF/MANIFEST.MF,v
+retrieving revision 1.12
+diff -u -r1.12 MANIFEST.MF
+--- META-INF/MANIFEST.MF 7 Feb 2010 17:45:39 -0000 1.12
++++ META-INF/MANIFEST.MF 8 Jul 2010 20:51:05 -0000
+@@ -2,14 +2,14 @@
+ Bundle-ManifestVersion: 2
+ Bundle-Name: %pluginName
+ Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.gnu.ui; singleton:=true
+-Bundle-Version: 7.0.0.qualifier
++Bundle-Version: 8.0.0.qualifier
+ Bundle-Activator: org.eclipse.cdt.managedbuilder.gnu.ui.GnuUIPlugin
+ Bundle-Vendor: %providerName
+ Bundle-Localization: plugin
+ Export-Package: org.eclipse.cdt.managedbuilder.gnu.cygwin,
+ org.eclipse.cdt.managedbuilder.gnu.ui
+ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+- org.eclipse.cdt.managedbuilder.core;bundle-version="[7.0.0,8.0.0)",
++ org.eclipse.cdt.managedbuilder.core;bundle-version="[8.0.0,9.0.0)",
+ org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)",
+ org.eclipse.core.resources
+ Bundle-ActivationPolicy: lazy
+Index: src/org/eclipse/cdt/managedbuilder/gnu/cygwin/IsGnuCygwinToolChainSupported.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/IsGnuCygwinToolChainSupported.java,v
+retrieving revision 1.11
+diff -u -r1.11 IsGnuCygwinToolChainSupported.java
+--- src/org/eclipse/cdt/managedbuilder/gnu/cygwin/IsGnuCygwinToolChainSupported.java 4 Mar 2010 17:51:55 -0000 1.11
++++ src/org/eclipse/cdt/managedbuilder/gnu/cygwin/IsGnuCygwinToolChainSupported.java 8 Jul 2010 20:51:05 -0000
+@@ -18,7 +18,7 @@
+
+ import org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported;
+ import org.eclipse.cdt.managedbuilder.core.IToolChain;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ /**
+ * This class implements the IManagedIsToolChainSupported for the Gnu Cygwin tool-chain
+@@ -44,8 +44,10 @@
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported#isSupported(org.eclipse.cdt.managedbuilder.core.IToolChain, org.eclipse.core.runtime.PluginVersionIdentifier, java.lang.String)
+ */
+- public boolean isSupported(IToolChain toolChain,
+- PluginVersionIdentifier version, String instance) {
++ /**
++ * @since 8.0
++ */
++ public boolean isSupported(IToolChain toolChain, Version version, String instance) {
+
+ if (suppChecked) return toolchainIsSupported;
+
+Index: src/org/eclipse/cdt/managedbuilder/gnu/mingw/MingwIsToolChainSupported.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/mingw/MingwIsToolChainSupported.java,v
+retrieving revision 1.3
+diff -u -r1.3 MingwIsToolChainSupported.java
+--- src/org/eclipse/cdt/managedbuilder/gnu/mingw/MingwIsToolChainSupported.java 8 Feb 2010 03:03:51 -0000 1.3
++++ src/org/eclipse/cdt/managedbuilder/gnu/mingw/MingwIsToolChainSupported.java 8 Jul 2010 20:51:05 -0000
+@@ -13,7 +13,7 @@
+
+ import org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported;
+ import org.eclipse.cdt.managedbuilder.core.IToolChain;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ /**
+ * @author Doug Schaefer
+@@ -29,8 +29,7 @@
+ supported = MingwEnvironmentVariableSupplier.getBinDir() != null;
+ }
+
+- public boolean isSupported(IToolChain toolChain,
+- PluginVersionIdentifier version, String instance) {
++ public boolean isSupported(IToolChain toolChain, Version version, String instance) {
+ return supported;
+ }
+
+#P org.eclipse.cdt.managedbuilder.ui
+Index: META-INF/MANIFEST.MF
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.ui/META-INF/MANIFEST.MF,v
+retrieving revision 1.23
+diff -u -r1.23 MANIFEST.MF
+--- META-INF/MANIFEST.MF 6 Jul 2010 22:16:06 -0000 1.23
++++ META-INF/MANIFEST.MF 8 Jul 2010 20:51:05 -0000
+@@ -16,7 +16,7 @@
+ org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)",
+ org.eclipse.cdt.ui;bundle-version="[5.0.0,6.0.0)",
+- org.eclipse.cdt.managedbuilder.core;bundle-version="[7.0.0,8.0.0)",
++ org.eclipse.cdt.managedbuilder.core;bundle-version="[8.0.0,9.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
+ org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
+#P org.eclipse.cdt.managedbuilder.ui.tests
+Index: META-INF/MANIFEST.MF
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.ui.tests/META-INF/MANIFEST.MF,v
+retrieving revision 1.13
+diff -u -r1.13 MANIFEST.MF
+--- META-INF/MANIFEST.MF 8 Feb 2010 01:02:17 -0000 1.13
++++ META-INF/MANIFEST.MF 8 Jul 2010 20:51:06 -0000
+@@ -2,7 +2,7 @@
+ Bundle-ManifestVersion: 2
+ Bundle-Name: Managed Build UI Tests Plug-in
+ Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.ui.tests; singleton:=true
+-Bundle-Version: 7.0.0.qualifier
++Bundle-Version: 8.0.0.qualifier
+ Bundle-Activator: org.eclipse.cdt.managedbuilder.ui.tests.testplugin.TestsPlugin
+ Bundle-Vendor: Eclipse CDT
+ Bundle-Localization: plugin
+Index: src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestConfiguration.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestConfiguration.java,v
+retrieving revision 1.6
+diff -u -r1.6 TestConfiguration.java
+--- src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestConfiguration.java 2 Jun 2010 19:48:12 -0000 1.6
++++ src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestConfiguration.java 8 Jul 2010 20:51:06 -0000
+@@ -34,7 +34,7 @@
+ import org.eclipse.core.resources.IFile;
+ import org.eclipse.core.resources.IResource;
+ import org.eclipse.core.runtime.IPath;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ public class TestConfiguration implements IConfiguration {
+
+@@ -518,12 +518,12 @@
+ return null;
+ }
+
+- public PluginVersionIdentifier getVersion() {
++ public Version getVersion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+- public void setVersion(PluginVersionIdentifier version) {
++ public void setVersion(Version version) {
+ // TODO Auto-generated method stub
+
+ }
+Index: src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestFolderInfo.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestFolderInfo.java,v
+retrieving revision 1.5
+diff -u -r1.5 TestFolderInfo.java
+--- src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestFolderInfo.java 13 Sep 2007 09:27:59 -0000 1.5
++++ src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestFolderInfo.java 8 Jul 2010 20:51:06 -0000
+@@ -23,7 +23,7 @@
+ import org.eclipse.cdt.managedbuilder.core.IToolChain;
+ import org.eclipse.cdt.managedbuilder.core.OptionStringValue;
+ import org.eclipse.core.runtime.IPath;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ public class TestFolderInfo implements IFolderInfo {
+
+@@ -222,12 +222,12 @@
+ return null;
+ }
+
+- public PluginVersionIdentifier getVersion() {
++ public Version getVersion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+- public void setVersion(PluginVersionIdentifier version) {
++ public void setVersion(Version version) {
+ // TODO Auto-generated method stub
+
+ }
+Index: src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestProjectType.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestProjectType.java,v
+retrieving revision 1.3
+diff -u -r1.3 TestProjectType.java
+--- src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestProjectType.java 14 Jun 2007 20:10:07 -0000 1.3
++++ src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestProjectType.java 8 Jul 2010 20:51:06 -0000
+@@ -17,7 +17,7 @@
+ import org.eclipse.cdt.managedbuilder.core.IProjectType;
+ import org.eclipse.cdt.managedbuilder.envvar.IProjectEnvironmentVariableSupplier;
+ import org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ public class TestProjectType implements IProjectType {
+ private IConfiguration[] cfgs = new IConfiguration[1];
+@@ -49,8 +49,8 @@
+ public String getId() { return null; }
+ public String getManagedBuildRevision() { return null; }
+ public String getName() { return null; }
+- public PluginVersionIdentifier getVersion() { return null; }
+- public void setVersion(PluginVersionIdentifier version) {}
++ public Version getVersion() { return null; }
++ public void setVersion(Version version) {}
+ public IBuildObjectProperties getBuildProperties() { return null; }
+
+ public IBuildPropertyValue getBuildArtefactType() {
+Index: src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestToolchain.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestToolchain.java,v
+retrieving revision 1.8
+diff -u -r1.8 TestToolchain.java
+--- src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestToolchain.java 14 Jun 2007 20:10:07 -0000 1.8
++++ src/org/eclipse/cdt/managedbuilder/ui/tests/util/TestToolchain.java 8 Jul 2010 20:51:06 -0000
+@@ -24,7 +24,7 @@
+ import org.eclipse.cdt.managedbuilder.internal.core.HoldsOptions;
+ import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
+ import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier;
+-import org.eclipse.core.runtime.PluginVersionIdentifier;
++import org.osgi.framework.Version;
+
+ public class TestToolchain extends HoldsOptions implements IToolChain {
+
+@@ -38,12 +38,12 @@
+ return null;
+ }
+
+- public PluginVersionIdentifier getVersion() {
++ public Version getVersion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+- public void setVersion(PluginVersionIdentifier version) {
++ public void setVersion(Version version) {
+ // TODO Auto-generated method stub
+
+ }
+
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/CDT_Bug_321040.patch b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/CDT_Bug_321040.patch
new file mode 100755
index 00000000000..f856ff034ca
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/CDT_Bug_321040.patch
@@ -0,0 +1,93 @@
+### Eclipse Workspace Patch 1.0
+#P org.eclipse.cdt.managedbuilder.core
+Index: src/org/eclipse/cdt/managedbuilder/core/IOption.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java,v
+retrieving revision 1.27
+diff -u -r1.27 IOption.java
+--- src/org/eclipse/cdt/managedbuilder/core/IOption.java 26 Mar 2010 17:45:40 -0000 1.27
++++ src/org/eclipse/cdt/managedbuilder/core/IOption.java 27 Jul 2010 15:36:46 -0000
+@@ -355,6 +355,14 @@
+ public String[] getLibraryFiles() throws BuildException ;
+
+ /**
++ * @return an array or Strings containing the library paths
++ * that must be linked into the project.
++ *
++ * @throws BuildException
++ */
++ public String[] getLibraryPaths() throws BuildException ;
++
++ /**
+ * @return a String containing the unique ID of the selected
+ * enumeration in an enumerated option. For an option that has not been
+ * changed by the user, the receiver will answer with the default defined
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java,v
+retrieving revision 1.48
+diff -u -r1.48 Option.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/Option.java 8 Jul 2010 20:57:05 -0000 1.48
++++ src/org/eclipse/cdt/managedbuilder/internal/core/Option.java 27 Jul 2010 15:36:48 -0000
+@@ -1388,7 +1388,6 @@
+ }
+ }
+
+-
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#getLibraryFiles()
+ */
+@@ -1407,6 +1406,23 @@
+ }
+
+ /* (non-Javadoc)
++ * @see org.eclipse.cdt.managedbuilder.core.IOption#getLibraryPaths()
++ */
++ public String[] getLibraryPaths() throws BuildException {
++ if (getValueType() != LIBRARY_PATHS) {
++ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
++ }
++ @SuppressWarnings("unchecked")
++ ArrayList v = (ArrayList)getValue();
++ if (v == null) {
++ return EMPTY_STRING_ARRAY;
++ } else {
++ v.trimToSize();
++ return v.toArray(new String[v.size()]);
++ }
++ }
++
++ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#getDefaultEnumValue()
+ */
+ public String getSelectedEnum() throws BuildException {
+Index: src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java,v
+retrieving revision 1.35
+diff -u -r1.35 OptionReference.java
+--- src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java 8 Jul 2010 20:57:05 -0000 1.35
++++ src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java 27 Jul 2010 15:36:49 -0000
+@@ -468,6 +468,21 @@
+ }
+
+ /* (non-Javadoc)
++ * @see org.eclipse.cdt.managedbuilder.core.IOption#getLibraryPaths()
++ */
++ public String[] getLibraryPaths() throws BuildException {
++ if (value == null)
++ return option.getLibraryPaths();
++ else if (getValueType() == LIBRARY_PATHS) {
++ @SuppressWarnings("unchecked")
++ ArrayList list = (ArrayList)value;
++ return list.toArray(new String[list.size()]);
++ }
++ else
++ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
++ }
++
++ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
+ */
+ public String getName() {
+
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/MinGW_export_fix.patch b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/MinGW_export_fix.patch
new file mode 100755
index 00000000000..ec39ddeafd2
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/MinGW_export_fix.patch
@@ -0,0 +1,17 @@
+### Eclipse Workspace Patch 1.0
+#P org.eclipse.cdt.managedbuilder.gnu.ui
+Index: META-INF/MANIFEST.MF
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.gnu.ui/META-INF/MANIFEST.MF,v
+retrieving revision 1.13
+diff -u -r1.13 MANIFEST.MF
+--- META-INF/MANIFEST.MF 8 Jul 2010 20:57:13 -0000 1.13
++++ META-INF/MANIFEST.MF 18 Aug 2010 09:49:45 -0000
+@@ -7,6 +7,7 @@
+ Bundle-Vendor: %providerName
+ Bundle-Localization: plugin
+ Export-Package: org.eclipse.cdt.managedbuilder.gnu.cygwin,
++ org.eclipse.cdt.managedbuilder.gnu.mingw,
+ org.eclipse.cdt.managedbuilder.gnu.ui
+ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.cdt.managedbuilder.core;bundle-version="[8.0.0,9.0.0)",
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/readme.txt b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/readme.txt
new file mode 100755
index 00000000000..a7dd99e52b1
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/readme.txt
@@ -0,0 +1,8 @@
+MinGW export fix patch is needed to get mingw path from MingwEnvironmentVariableSupplier in LlvmEnvironmentSupplier class.
+
+Bug 321040 patch adds getLibraryPaths method to IOption and Option CDT classes and is used in LlvmPathUtil class.
+
+Bug 318581 patch adds support for older CDT versions <~7.1.0
+
+Stack overflow bug patch prevents a typical CDT 7.0.0 error message. This has been fixed in the CDT 7.0.1 version.
+
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/stack_overflow_fix_bug_317004.patch b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/stack_overflow_fix_bug_317004.patch
new file mode 100755
index 00000000000..927e1546a18
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/patches/stack_overflow_fix_bug_317004.patch
@@ -0,0 +1,93 @@
+### Eclipse Workspace Patch 1.0
+#P org.eclipse.cdt.core
+Index: src/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java,v
+retrieving revision 1.146
+diff -u -r1.146 CVisitor.java
+--- src/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java 15 Jan 2010 18:28:40 -0000 1.146
++++ src/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java 23 Jun 2010 09:53:58 -0000
+@@ -29,6 +29,7 @@
+ import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
+ import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
+ import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
++import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
+ import org.eclipse.cdt.core.dom.ast.IASTExpression;
+ import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
+ import org.eclipse.cdt.core.dom.ast.IASTForStatement;
+@@ -53,6 +54,7 @@
+ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
+ import org.eclipse.cdt.core.dom.ast.IArrayType;
+ import org.eclipse.cdt.core.dom.ast.IBasicType;
++import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
+ import org.eclipse.cdt.core.dom.ast.IBinding;
+ import org.eclipse.cdt.core.dom.ast.ICompositeType;
+ import org.eclipse.cdt.core.dom.ast.IEnumeration;
+@@ -67,8 +69,6 @@
+ import org.eclipse.cdt.core.dom.ast.IType;
+ import org.eclipse.cdt.core.dom.ast.ITypedef;
+ import org.eclipse.cdt.core.dom.ast.IVariable;
+-import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
+-import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
+ import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
+ import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
+ import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
+@@ -638,28 +638,31 @@
+ IScope scope = getContainingScope(expr);
+ try {
+ IBinding[] bs = scope.find(PTRDIFF_T);
+- if (bs.length > 0) {
+- for (IBinding b : bs) {
+- if (b instanceof IType) {
+- if (b instanceof ICInternalBinding == false ||
+- CVisitor.declaredBefore(((ICInternalBinding) b).getPhysicalNode(), expr)) {
+- return (IType) b;
+- }
++ for (IBinding b : bs) {
++ if (b instanceof IType) {
++ if (b instanceof ICInternalBinding == false ||
++ CVisitor.declaredBefore(((ICInternalBinding) b).getPhysicalNode(), expr)) {
++ return (IType) b;
+ }
+ }
+ }
+ } catch (DOMException e) {
+ }
+
+- return new CBasicType(Kind.eInt, IBasicType.IS_UNSIGNED | IBasicType.IS_LONG, expr);
++ return new CBasicType(Kind.eInt, 0, expr);
+ }
+
+ static IType getSize_T(IASTExpression expr) {
+ IScope scope = getContainingScope(expr);
+ try {
+ IBinding[] bs = scope.find(SIZE_T);
+- if (bs.length > 0 && bs[0] instanceof IType) {
+- return (IType) bs[0];
++ for (IBinding b : bs) {
++ if (b instanceof IType) {
++ if (b instanceof ICInternalBinding == false ||
++ CVisitor.declaredBefore(((ICInternalBinding) b).getPhysicalNode(), expr)) {
++ return (IType) b;
++ }
++ }
+ }
+ } catch (DOMException e) {
+ }
+Index: src/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
+===================================================================
+RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java,v
+retrieving revision 1.123
+diff -u -r1.123 CPPVisitor.java
+--- src/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java 22 Jun 2010 12:21:17 -0000 1.123
++++ src/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java 23 Jun 2010 09:53:58 -0000
+@@ -2089,7 +2089,7 @@
+ }
+ } catch (DOMException e) {
+ }
+- basicType= new CPPBasicType(Kind.eInt, IBasicType.IS_LONG | IBasicType.IS_UNSIGNED);
++ basicType= new CPPBasicType(Kind.eInt, 0);
+ basicType.setFromExpression(binary);
+ return basicType;
+ }
+
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.properties b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.properties
new file mode 100755
index 00000000000..22a22f3d091
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.properties
@@ -0,0 +1,223 @@
+###############################################################################
+# Copyright (c) 2010 Nokia Siemens Networks Oyj, Finland.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Nokia Siemens Networks Oyj, initial LLVM support as an add-on to CDT.
+###############################################################################
+
+# plugin names
+pluginName=LLVM Managed Build Definitions
+providerName=Nokia Siemens Networks
+
+# Build Model Names
+TargetName.llvm=LLVM
+TargetName.llvm.bitcode=LLVM bitcode
+
+# Tool-chain names
+ToolChainName.llvm=LLVM
+ToolChainName.llvm.with.linker=LLVM with C/C++ Linker
+ToolChainName.llvm.with.static.compiler=LLVM with static compiler
+ToolChainName.llvm.static.compiler.linux=LLVM with static compiler (Linux)
+ToolChainName.llvm.static.compiler.macosx=LLVM with static compiler (MacOSX)
+ToolChainName.llvm.static.compiler.win32=LLVM with static compiler (Windows)
+ToolChainName.llvm.jit=LLVM with JIT/Interpreter
+ToolChainName.llvm.jit.linux=LLVM with JIT/Interpreter (Linux)
+ToolChainName.llvm.jit.macosx=LLVM with JIT/Interpreter (MacOSX)
+ToolChainName.llvm.jit.win32=LLVM with JIT/Interpreter (Windows)
+ToolChainName.llvm.clang=LLVM with Clang
+ToolChainName.llvm.clang.win32.mingw=LLVM with Clang (Windows) (MinGW)
+ToolChainName.llvm.clang.win32.cygwin=LLVM with Clang (Windows) (Cygwin)
+ToolChainName.llvm.linux=LLVM with Clang (Linux)
+ToolChainName.llvm.macosx=LLVM with Clang (MacOSX)
+ToolChainName.llvm.gnu=LLVM with GCC
+ToolChainName.llvm.gnu.linux=LLVM with GCC (Linux)
+ToolChainName.llvm.gnu.macosx=LLVM with GCC (MacOSX)
+ToolChainName.llvm.gnu.win32.cygwin=LLVM with GCC (Windows) (Cygwin)
+ToolChainName.llvm.gnu.win32.mingw=LLVM with GCC (Windows) (MinGW)
+
+# Default Configuration Names
+# START NON-TRANSLATABLE
+ConfigName.Rel=Release
+ConfigName.Dbg=Debug
+ConfigName.Rel.Win32=Release
+ConfigName.Dbg.Win32=Debug
+ConfigName.Rel.Gnu=Release
+ConfigName.Dbg.Gnu=Debug
+
+# END NON-TRANSLATABLE
+
+# Generic platform names (copied from org.eclipse.cdt.managedbuilder.gnu.ui)
+PlatformName.Rel=Release Platform
+PlatformName.Dbg=Debug Platform
+
+# LLVM tool names
+ToolName.archiver.llvm=LLVM archiver
+ToolName.assembler.llvm=LLVM assembler
+ToolName.compiler.llvm.abstract=Abstract LLVM C/C++ compiler
+ToolName.compiler.llvm.c=LLVM Clang
+ToolName.compiler.llvm.cpp=LLVM Clang++
+ToolName.compiler.llvm.gcc=LLVM GCC
+ToolName.compiler.llvm.g++=LLVM G++
+ToolName.linker.llvm.c=LLVM C linker
+ToolName.linker.llvm.cpp=LLVM C++ linker
+ToolName.llc.llvm=LLVM Static Compiler
+ToolName.llc.llvm.c=LLVM C Static Compiler
+ToolName.llc.llvm.cpp=LLVM C++ Static Compiler
+ToolName.lli.llvm=LLVM JIT compiler/Interpreter
+
+# Option Names
+# Generic Category Names
+#OptionCategory.Symbols = Symbols
+OptionCategory.Preproc=Preprocessor
+OptionCategory.Dirs=Directories
+OptionCategory.General=General
+OptionCategory.Optimize=Optimization
+OptionCategory.Debug=Debugging
+OptionCategory.Warn=Warnings
+OptionCategory.Misc=Miscellaneous
+OptionCategory.Includes=Includes
+OptionCategory.Libs=Libraries
+OptionCategory.Options=Options
+OptionCategory.Optimizations=Optimization Options
+OptionCategory.FloatingPointOptions=Floating Point Options
+OptionCategory.CodeGenerationOptions=Code Generation Options
+#OptionCategory.Shared.Settings=Shared Library Settings
+
+# Generic Option Names
+Option.Posix.PreprocOnly=Preprocess only (-E)
+#Option.Posix.Nostdinc=Do not search system directories (-nostdinc)
+
+Option.Posix.DefSym=Defined symbols (-D)
+Option.Posix.UndefSym=Undefined symbols (-U)
+
+Option.Posix.InclPaths=Include paths (-I)
+
+Option.Posix.OptLevel=Optimization Level
+Option.Posix.Optimize.None=None (-O0)
+Option.Posix.Optimize.Optimize=Optimize (-O1)
+Option.Posix.Optimize.More=Optimize more (-O2)
+Option.Posix.Optimize.Most=Optimize most (-O3)
+Option.Posix.Optimize.Runtime=Optimize at run-time (-O4)
+Option.Posix.Optimize.Flags=Other optimization flags
+
+Option.Posix.DebugLevel=Debug Level
+Option.Posix.Debug.None=None
+Option.Posix.Debug.Min=Minimal (-g1)
+Option.Posix.Debug.Def=Default (-g)
+Option.Posix.Debug.Max=Maximum (-g3)
+Option.Posix.Debug.Other=Other debugging flags
+#Option.Posix.Debug.gprof=Generate gprof information (-pg)
+#Option.Posix.Debug.prof=Generate prof information (-p)
+
+Option.Posix.Warn.Syntax=Check syntax only (-fsyntax-only)
+Option.Posix.Warn.Pedandic=Pedantic (-pedantic)
+Option.Posix.Warn.PedErrors=Pedantic warnings as errors (-pedantic-errors)
+Option.Posix.Warn.nowarn=Inhibit all warnings (-w)
+Option.Posix.Warn.allwarn=All warnings (-Wall)
+Option.Posix.Warn.toerrs=Warnings as errors (-Werror)
+
+Option.Posix.Verbose=Verbose (-v)
+Option.OtherFlags=Other flags
+#Option.Posix.Ansi=Support ANSI programs (-ansi)
+
+Option.Posix.Archiver.delete=Delete files from the archive
+Option.Posix.Archiver.print.contents=Print the table of contents
+#Option.Posix.Linker.NoStartFiles=Do not use standard start files (-nostartfiles)
+#Option.Posix.Linker.NoDefLibs=Do not use default libraries (-nodefaultlibs)
+#Option.Posix.Linker.NoStdLibs=No startup or default libs (-nostdlib)
+Option.Posix.Linker.Strip=Omit all debug and symbol information (-strip-all)
+Option.Posix.Linker.Strip.Debug=Omit all debug information (-strip-debug)
+Option.Posix.Linker.Stats=Print statistics
+Option.Posix.Linker.Verbose=Verbose mode
+Option.Posix.Linker.Verification=Verification pass
+Option.Posix.Linker.DisableInternalize=Disable Internalize
+Option.Posix.Linker.DisableOptimization=Disable Optimization
+Option.Posix.Linker.DisableInhiling=Disable Inhiling
+#Option.Posix.Linker.Static=No shared libraries (-static)
+#Option.Posix.Linker.XLinker=Other options (-Xlinker [option])
+Option.Posix.Linker.Flags=Linker flags
+Option.Posix.Libs=Libraries (-l)
+Option.Posix.Libsearch=Library search path (-L)
+Option.Posix.UserBcs=Other bytecode files
+#Option.Posix.Linker.Shared=Shared (-shared)
+#Option.Posix.Linker.SOName=Shared object name (-Wl,-soname=)
+#Option.Posix.Linker.Implib=Import Library name (-Wl,--out-implib=)
+#Option.Posix.Linker.Defname=DEF file name (-Wl,--output-def=)
+Option.Posix.Linker.link_as_library=Create a library
+Option.Posix.Linker.LlvmOptions=Input/Output Options
+Option.Posix.Linker.native=Create native binary (with LLVM native code generator)
+Option.Posix.Linker.nativeCBackend=Create native binary (with C backend code generator)
+Option.Posix.Static.Compiler.Flags=Static Compiler Flags
+
+Option.Llvm.printStats=Print statistics
+Option.Llvm.Archiver.Flags=Archiver flags
+Option.Llvm.Llc.Flags=LLC flags
+Option.Llvm.Llc.EmitC=Emit C code (not assembly)
+Option.Llvm.Llc.Arch=Specify architecture for assembly code (x86 or sparcv9)
+Option.Llvm.llc.optimization.disableExcessPrecisionOptimization=Disable optimizations that may produce excess precision for floating point
+Option.Llvm.llc.optimization.disableFramePointerEliminationOptimization=Disable frame pointer elimination optimization
+Option.Llvm.Lli.Flags=LLVM JIT/Interpreter flags
+Option.Llvm.Lli.ForceInterpreter=Force Interpreter
+Option.Llvm.Lli.disable-excess-fp-precision=Disable optimizations that may increase floating point precision
+Option.Llvm.Lli.enable-finite-only-fp-math=Enable optimizations that assume only finite floating point math
+Option.Llvm.Lli.enable-unsafe-fp-math=Enable optimizations that may decrease floating point precision
+Option.Llvm.Lli.soft-float=Generate software floating point library calls instead of equivalent hardware instructions
+Option.Llvm.Lli.disable-post-RA-scheduler=Disable scheduling after register allocation
+Option.Llvm.Lli.disable-spill-fusing=Disable fusing of spill code into instructions
+Option.Llvm.Lli.enable-correct-eh-support=Make the -lowerinvoke pass insert expensive, but correct, EH code
+Option.Llvm.Lli.jit-enable-eh=Exception handling should be enabled in the just-in-time compiler
+Option.Llvm.Assembler.Flags=Assembler flags
+Option.Llvm.Assembler.warn.suppress=Suppress warnings (-W)
+Option.Llvm.Assembler.version=Announce version (-v)
+
+# Platform specific option names
+#Option.Windows.Windres.OutputFormat = Output format
+#Option.Windows.Windres.OutputFormat.Coff = coff (--output-format coff)
+#Option.Windows.Windres.OutputFormat.RC = rc (--output-format rc)
+#Option.Windows.Windres.OutputFormat.Res = res (--output-format res)
+#Option.MacOSX.Linker.Shared=Shared (-dynamiclib)
+
+# Artifact types
+BuildProperty.type.name.bcexe=LLVM bytecode executable for LLI
+BuildProperty.type.name.bclib=LLVM bytecode library
+
+# Content types
+ContentType.LlvmBytecodeFileName=LLVM bytecode file
+#LLVM assembler file (human-readable)
+ContentType.LlvmSourceFileName=LLVM
+ContentType.LlvmExecutableFileName=LLVM executable
+ContentType.LlvmAssemblerCode=LLVM Assembly Code
+
+# Languages
+Language.LlvmAssembly=LLVM bytecode assembly
+
+option.name = Clang Option
+page.name = LLVM
+extension.name = Clang++ managed make per project SCD profile
+extension.name.0 = Clang managed make per project SCD profile
+extension.name.1 = LLVM-G++ managed make per project SCD profile
+extension.name.2 = LLVM-GCC managed make per project SCD profile
+option.tip = In this mode the linker will print additional information about the actions it takes, programs it executes, etc.
+option.tip.0 = Strip all debug and symbol information from the executable to make it smaller.
+option.tip.1 = Strip all debug information from the executable to make it smaller.
+option.tip.2 = Run the verification pass after each of the passes to verify intermediate results.
+option.tip.3 = Do not mark all symbols as internal.
+option.tip.4 = Completely disable optimization.
+option.tip.5 = Do not run the inlining pass. Functions will not be inlined into other functions.
+option.tip.6 = Generate a native machine code executable.
+option.tip.7 = Generate a native machine code executable with the LLVM C backend. Uses the C backend to generate code for the program instead of an LLVM native code generator.
+option.tip.8 = Link the bitcode files together as a library, not an executable. In this mode, undefined symbols will be permitted.
+option.tip.9 = Print the table of contents.
+option.tip.10 = Print statistics recorded by code-generation passes.
+option.tip.11 = Disable optimizations that may produce excess precision for floating point. Note that this option can dramatically slow down code on some systems (e.g. X86).
+option.tip.12 = Print statistics from the code-generation passes.
+enumeratedOptionValue.name = true
+enumeratedOptionValue.name.0 = false
+option.tip.13 = Causes lli to generate software floating point library calls instead of equivalent hardware instructions.
+option.tip.14 = Causes lli to enable optimizations that may decrease floating point precision.
+option.tip.15 = Disable optimizations that may increase floating point precision.
+option.tip.16 = Enable optimizations that assumes only finite floating point math. That is, there is no NAN or Inf values.
\ No newline at end of file
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.xml b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.xml
new file mode 100755
index 00000000000..1386b691280
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.xml
@@ -0,0 +1,5384 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/scripts/find_path.bat b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/scripts/find_path.bat
new file mode 100644
index 00000000000..622f3af1b60
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/scripts/find_path.bat
@@ -0,0 +1,9 @@
+@echo OFF
+
+for %%D in (c,d,e) do (
+ If exist %%D:\ (
+ for /f "delims=" %%f in ('dir /b /s %%D:\%1 2^> NUL') do (
+ @echo %1 found: %%~dpf
+ )
+ )
+)
\ No newline at end of file
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/scripts/stdlib_path.sh b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/scripts/stdlib_path.sh
new file mode 100644
index 00000000000..67a336013cf
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/scripts/stdlib_path.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo `locate libstdc++.a | sort -r | head -1 | sed "s/libstdc++.a$//"`
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2.java
new file mode 100755
index 00000000000..f1391378c61
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Leo Hippelainen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.makegen;
+
+import org.eclipse.cdt.managedbuilder.core.IBuildObject;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
+import org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+
+public class LlvmDependencyCalculator2 extends DefaultGCCDependencyCalculator2 {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath,
+ * org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
+ */
+ @Override
+ public IManagedDependencyInfo getDependencySourceInfo(IPath source, IResource resource, IBuildObject buildContext,
+ ITool tool, IPath topBuildDirectory) {
+ return new LlvmDependencyCalculator2Commands(source, resource, buildContext, tool, topBuildDirectory);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath,
+ * org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
+ */
+ @Override
+ public IManagedDependencyInfo getDependencySourceInfo(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
+ return new LlvmDependencyCalculator2Commands(source, buildContext, tool, topBuildDirectory);
+ }
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2Commands.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2Commands.java
new file mode 100755
index 00000000000..9e4fe92c9ab
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2Commands.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Leo Hippelainen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.makegen;
+
+import org.eclipse.cdt.managedbuilder.core.IBuildObject;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+
+public class LlvmDependencyCalculator2Commands extends
+ DefaultGCCDependencyCalculator2Commands {
+
+
+ /**
+ * @param source IPath
+ * @param resource IResource
+ * @param buildContext IBuildObject
+ * @param tool ITool
+ * @param topBuildDirectory IPath
+ */
+ public LlvmDependencyCalculator2Commands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory){
+ super(source, resource, buildContext, tool, topBuildDirectory);
+ }
+
+ /**
+ * @param source IPath
+ * @param buildContext IBuildObject
+ * @param tool ITool
+ * @param topBuildDirectory IPath
+ */
+ public LlvmDependencyCalculator2Commands(IPath source,
+ IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
+ super(source, buildContext, tool, topBuildDirectory);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands#getDependencyCommandOptions()
+ */
+ @Override
+ public String[] getDependencyCommandOptions() {
+ String[] options = new String[2];
+ // -MMD
+ options[0] = "-MMD"; //$NON-NLS-1$
+ // -MP
+ options[1] = "-MP"; //$NON-NLS-1$
+ // TODO: Check if -MF and/or -MT supported or needed with Clang
+ return options;
+ }
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/LlvmScannerInfoCollector.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/LlvmScannerInfoCollector.java
new file mode 100644
index 00000000000..c4587f89606
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/LlvmScannerInfoCollector.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Leo Hippelainen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.scannerconfig;
+
+import org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector;
+import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector;
+
+/**
+ * Implementation class for gathering the built-in compiler settings for
+ * Clang/LLVM targets. The assumption is that the tools will answer path
+ * information in POSIX format and that the Scanner will be able to search for
+ * files using this format.
+ *
+ */
+public class LlvmScannerInfoCollector
+ extends PerProjectSICollector
+ implements IManagedScannerInfoCollector {
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmBuildEnvironmentVariable.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmBuildEnvironmentVariable.java
new file mode 100755
index 00000000000..22ec9107b00
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmBuildEnvironmentVariable.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Leo Hippelainen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui;
+
+import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
+
+/**
+ * Implemented type that contains BuildEnvironmentalVariables.
+ *
+ */
+public class LlvmBuildEnvironmentVariable implements IBuildEnvironmentVariable {
+
+ private final String name;
+ private final String value;
+ private final int operation;
+
+ /**
+ * Constructor.
+ *
+ * @param name Name for the environment variable
+ * @param value Value for the environment variable
+ * @param operation Operation of the environment variable
+ */
+ public LlvmBuildEnvironmentVariable(String name, String value, int operation) {
+ super();
+ this.name = name;
+ this.value = value;
+ this.operation = operation;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable#getDelimiter()
+ */
+ /**
+ * Get a delimiter.
+ *
+ * @return String delimiter
+ */
+ public String getDelimiter() {
+ return ";"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable#getName()
+ */
+ /**
+ * Get name of the llvm environment variable.
+ *
+ * @return name The name of the llvm environment variable
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable#getOperation()
+ */
+ /**
+ * Get operation of the llvm environment variable.
+ *
+ * @return operation The operation of the llvm environment variable
+ */
+ public int getOperation() {
+ return this.operation;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable#getValue()
+ */
+ /**
+ * Get value of the llvm environment variable.
+ *
+ * @return value The value of the llvm environment variable.
+ */
+ public String getValue() {
+ return this.value;
+ }
+
+}
\ No newline at end of file
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmEnvironmentVariableSupplier.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmEnvironmentVariableSupplier.java
new file mode 100755
index 00000000000..6960e49dd82
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmEnvironmentVariableSupplier.java
@@ -0,0 +1,446 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Leo Hippelainen - Initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui;
+
+import java.io.File;
+import java.util.HashMap;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
+import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
+import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
+import org.eclipse.cdt.managedbuilder.gnu.cygwin.GnuCygwinConfigurationEnvironmentSupplier;
+import org.eclipse.cdt.managedbuilder.gnu.mingw.MingwEnvironmentVariableSupplier;
+import org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore;
+import org.eclipse.cdt.managedbuilder.llvm.util.Separators;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * Contains LLVM environment variables.
+ *
+ * @noextend This class is not intended to be subclassed by clients.
+ */
+public class LlvmEnvironmentVariableSupplier implements
+ IConfigurationEnvironmentVariableSupplier {
+
+ //toggle for preference changes
+ private static boolean preferencesChanged = true;
+ //LLVM environment variable data structure
+ private static HashMap llvmEnvironmentVariables =
+ new HashMap(6);
+ //Environment variables for HashMap usage
+ private static final String ENV_VAR_NAME_LLVM_BIN = "LLVM_BIN_PATH"; //$NON-NLS-1$
+ private static final String ENV_VAR_NAME_LLVMINTERP = "LLVMINTERP"; //$NON-NLS-1$
+ private static final String ENV_VAR_NAME_PATH = "PATH"; //$NON-NLS-1$
+ private static final String ENV_VAR_NAME_INCLUDE_PATH = "INCLUDE_PATH"; //$NON-NLS-1$
+ private static final String ENV_VAR_NAME_LIBRARY_PATH = "LLVM_LIB_SEARCH_PATH"; //$NON-NLS-1$
+ private static final String ENV_VAR_NAME_LIBRARIES = "LIBRARIES"; //$NON-NLS-1$
+
+ /**
+ * Initializes llvm environment variable paths from the system environment variables.
+ */
+ public static void initializePaths() { //TODO: Is this actually called anywhere?
+ //get bin path
+ String binPath = getBinPath();
+ //set LLVM bin path environment variable
+ setLlvmEnvironmentVariableReplace(ENV_VAR_NAME_LLVM_BIN, binPath);
+ //if bin path exists
+ if (binPath != null && binPath.length()!=0) {
+ String pathStr = binPath;
+ //if OS is Windows (Windows specific settings)
+ if (System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) { //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ //try to find mingw or cygwin path from PATH environment variable
+ IBuildEnvironmentVariable envPath = llvmEnvironmentVariables
+ .get(ENV_VAR_NAME_PATH);
+ IBuildEnvironmentVariable mingwPath=null, cygwinPath=null;
+ //if path is empty
+ if (envPath == null) {
+ //try to find mingw path from MingwEnvironmentVariableSupplier
+ IConfigurationEnvironmentVariableSupplier mingwEnvironmentVariables =
+ new MingwEnvironmentVariableSupplier();
+ mingwPath = mingwEnvironmentVariables.getVariable(
+ ENV_VAR_NAME_PATH, null, null);
+ //try to find cygwin path from GnuCygwinConfigurationEnvironmentSupplier
+ IConfigurationEnvironmentVariableSupplier cygwinEnvironmentVariables =
+ new GnuCygwinConfigurationEnvironmentSupplier();
+ cygwinPath = cygwinEnvironmentVariables.getVariable(
+ ENV_VAR_NAME_PATH, null, null);
+
+ }
+ //if mingw found
+ if (mingwPath != null) {
+ //form full path
+ pathStr = pathStr + System.getProperty("path.separator") + mingwPath.getValue(); //$NON-NLS-1$
+ }
+ //if cygwin found
+ if (cygwinPath != null) {
+ //form full path
+ pathStr = pathStr + System.getProperty("path.separator") + cygwinPath.getValue(); //$NON-NLS-1$
+ }
+ } catch (Exception e) {
+ //TODO: Emit proper error message and enter it to Eclipse error log.
+ e.printStackTrace();
+ }
+ }
+ //initialize environment variable cache values
+ setLlvmEnvironmentVariable(ENV_VAR_NAME_PATH, pathStr);
+ setLlvmEnvironmentVariable(ENV_VAR_NAME_LLVMINTERP, binPath + Separators.getFileSeparator() + "lli"); //$NON-NLS-1$
+ setLlvmEnvironmentVariable(ENV_VAR_NAME_INCLUDE_PATH, getSysEnvPath(ENV_VAR_NAME_INCLUDE_PATH));
+ setLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARY_PATH, getSysEnvPath(ENV_VAR_NAME_LIBRARY_PATH));
+ setLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARIES, getSysEnvPath(ENV_VAR_NAME_LIBRARIES));
+ preferencesChanged = false;
+ }
+ }
+
+ /**
+ * Get LLVM bin path
+ *
+ * @return LLVM bin path
+ */
+ public static String getBinPath() {
+ return findBinDir(ENV_VAR_NAME_LLVM_BIN, "bin"); //$NON-NLS-1$
+ }
+
+ /**
+ * Get LLVM include paths
+ *
+ * @return LLVM include paths
+ */
+ public static String getIncludePath() {
+ return getLlvmEnvironmentVariable(ENV_VAR_NAME_INCLUDE_PATH).getValue();
+ }
+
+ /**
+ * Get LLVM library paths
+ *
+ * @return LLVM library paths
+ */
+ public static String getLibraryPath() {
+ return getLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARY_PATH).getValue();
+ }
+
+ /**
+ * Get LLVM libraries
+ *
+ * @return LLVM libraries
+ */
+ public static String getLibraries() {
+ return getLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARIES).getValue();
+
+ }
+
+ /**
+ * Set path to LLVM bin.
+ *
+ * @param path Path to LLVM bin location.
+ */
+ public static void setBinPath(String path) {
+ setLlvmEnvironmentVariableReplace(ENV_VAR_NAME_LLVM_BIN, path);
+ }
+
+ /**
+ * Append a new include path.
+ *
+ * @param path Include path
+ */
+ public static void addIncludePath(String path) {
+ String existingIncPaths = getIncludePath();
+ //add the include path only if it doesn't already exists
+ if (!existingIncPaths.contains(path)) {
+ appendLlvmEnvironmentVariable(ENV_VAR_NAME_INCLUDE_PATH, existingIncPaths, path);
+ }
+ }
+
+ /**
+ * Append a new library path.
+ *
+ * @param path Library path
+ */
+ public static void addLibraryPath(String path) {
+ String existingLibPaths = getLibraryPath();
+ //add the library path only if it doesn't already exists
+ if (!existingLibPaths.contains(path)) {
+ appendLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARY_PATH, existingLibPaths, path);
+ }
+ }
+
+ /**
+ * Append a new library.
+ *
+ * @param lib Library file
+ */
+ public static void addLibrary(String lib) {
+ String existingLibs = getLibraries();
+ //add the library only if it doesn't already exists
+ if (!existingLibs.contains(lib)) {
+ appendLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARIES, existingLibs, lib);
+ }
+ }
+
+ /**
+ * This is to be called if some of the preference paths have changed.
+ */
+ public static void notifyPreferenceChange() { //TODO: Change
+ preferencesChanged = true;
+ }
+
+ /**
+ * Get a specific path for given parameters.
+ *
+ * @param pathKey Path for specific location
+ * @param subDirName Additional sub-path
+ * @return bin path
+ */
+ private static String findBinDir(String pathKey, String subDirName) {
+ String resultPath = null;
+ //if preferences haven't been changed
+ //try to find the bin path from the LLVM environment variable HashMap
+ if (!preferencesChanged) { //TODO: Change
+ //get current path
+ LlvmBuildEnvironmentVariable earlierValue = llvmEnvironmentVariables
+ .get(pathKey);
+ //if earlier LlvmBuildEnvironmentVariable exists
+ if (null != earlierValue) {
+ //return current path
+ return earlierValue.getValue();
+ }
+ } else {
+ // Try if the path is set in the LLVM plug-in preferences
+ String preferenceLocation = LlvmPreferenceStore.getBinPath();
+ //if preference exists
+ if (null != preferenceLocation) {
+ //remove white spaces from preference location
+ preferenceLocation = preferenceLocation.trim();
+ //if preference location is not empty
+ if (preferenceLocation.length()!=0) {
+ //get path for LLVM executable
+ resultPath = getDirIfLlvmFound(preferenceLocation, null);
+ //if LLVM executable path doesn't exist
+ if (null == resultPath) {
+ // If no luck check next with sub directory name appended
+ resultPath = getDirIfLlvmFound(preferenceLocation,
+ subDirName);
+ }
+ }
+ }
+ if (null == resultPath) {
+ // If still no luck try all folders listed in PATH
+ String pathVariable = System.getenv(ENV_VAR_NAME_PATH);
+ //split paths to String array
+ String[] paths = pathVariable.split(Separators.getPathSeparator());
+ //check every path if LLVM executable is found
+ for (String pathStr : paths) {
+ resultPath = getDirIfLlvmFound(pathStr, null);
+ //stop loop if LLVM executable path is found
+ if (null != resultPath) {
+ break;
+ }
+ }
+ }
+ //return found path
+ return resultPath;
+ }
+ return null;
+ }
+
+ /**
+ * Get LLVM executable path.
+ *
+ * @param candidatePath Suggestion for LLVM executable path
+ * @param subPath Additional sub-path for LLVM executable path
+ * @return Full path for LLVM executable if valid, otherwise null
+ */
+ private static String getDirIfLlvmFound(String candidatePath, String subPath) {
+ String llvmPath = null;
+ // If there is a trailing / or \, remove it
+ if (candidatePath.endsWith(Separators.getFileSeparator()) && candidatePath.length() > 1) {
+ llvmPath = candidatePath.substring(0, candidatePath.length() - 1);
+ }
+ //if subPath exists and is not empty -> append it to candidatePath
+ if ((null != subPath) && (subPath.length()!=0)) {
+ //form full path
+ llvmPath = candidatePath + Separators.getFileSeparator() + subPath;
+ }
+ //return a full path for LLVM executable if it's valid, otherwise null
+ return getBinDirIfLlvm_ar(llvmPath);
+ }
+
+ /**
+ * Get the full path for llvm executable if the bin path given
+ * as a parameter is found and executable exists in that path.
+ *
+ * @param binPathTemp User provided bin directory path
+ * @return bin path where llvm-ar is located if executable exists
+ */
+ private static String getBinDirIfLlvm_ar(String binPathTemp) {
+ //if given directory is found
+ if (new Path(binPathTemp).toFile().isDirectory()) {
+ String llvm_executable = "llvm-ar"; //$NON-NLS-1$
+ File arFileFullPath = null;
+ //if OS is Windows -> add .exe to the executable name
+ if (System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) { //$NON-NLS-1$//$NON-NLS-2$
+ llvm_executable = llvm_executable + ".exe"; //$NON-NLS-1$
+ }
+ //form full executable path
+ arFileFullPath = new File(binPathTemp + Separators.getFileSeparator()
+ + llvm_executable);
+ //check if file exists -> proper LLVM installation exists
+ if (arFileFullPath.isFile()) {
+ //return path where llvm-ar exists
+ return binPathTemp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get stdc++ library path located in MinGW installation.
+ *
+ * @return stdc++ library path for MinGW
+ */
+ public static String getMinGWStdLib() {
+ //get mingw bin path
+ IPath mingwBinPath = MingwEnvironmentVariableSupplier.getBinDir();
+ StringBuilder sB = new StringBuilder(mingwBinPath.toOSString());
+ //drop bin
+ sB.delete(sB.length()-3, sB.length());
+ //append mingw lib subdir
+ sB.append("lib\\gcc\\mingw32\\"); //$NON-NLS-1$
+ //get all files in the directory
+ File f = new File(sB.toString());
+ //append the first dir
+ sB.append(f.list()[0]);
+ return sB.toString();
+ }
+
+ /**
+ *
+ * Get LLVM environment variable.
+ *
+ * @param envName Name of the environment variable
+ */
+ public static LlvmBuildEnvironmentVariable getLlvmEnvironmentVariable(String envName) {
+ return llvmEnvironmentVariables.get(envName);
+ }
+
+ /**
+ * Set LLVM environment variable.
+ *
+ * @param name Name for the environment variable
+ * @param path Path for the environment variable
+ */
+ private static void setLlvmEnvironmentVariable(String name, String path) {
+ //appends a new path in front of the the old path in HashMap that contains
+ //the specific LLVM environment variable
+ llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable(
+ name, path, IBuildEnvironmentVariable.ENVVAR_APPEND));
+ }
+
+ /**
+ * Set LLVM environment variable by replacing the existing paths.
+ *
+ * @param name Name for the environment variable
+ * @param path Path for the environment variable
+ */
+ public static void setLlvmEnvironmentVariableReplace(String name, String path) {
+ //replaces the old path in HashMap that contains the specific LLVM environment variable
+ llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable(
+ name, path, IBuildEnvironmentVariable.ENVVAR_REPLACE));
+ }
+
+ /**
+ * Append a new LLVM environment variable to existing list.
+ *
+ * @param name Name of the preference
+ * @param oldPath Old paths/preference values
+ * @param path New path to be added to the environment variable
+ */
+ public static void appendLlvmEnvironmentVariable(String name, String oldPath, String path) {
+ String newPath = null;
+ boolean ok = false;
+ //if oldPath exists
+ if (oldPath!=null) {
+ //if the oldPath isn't empty
+ if((oldPath.trim()).length()!=0) {
+ StringBuffer sB = new StringBuffer();
+ //append old path
+ sB.append(oldPath);
+ //append a path separator
+ sB.append(Separators.getPathSeparator());
+ //append the new path
+ sB.append(path);
+ //construct a new full path
+ newPath = sB.toString();
+ ok=true;
+ }
+ }
+ if (!ok) {
+ newPath=path;
+ }
+ //set new path to the HashMap that contains
+ //the specific LLVM environment variable
+ //if newPath exists
+ if (newPath!=null) {
+ //if the newPath isn't empty
+ if((newPath.trim()).length()!=0) {
+ //add new values to the LLVM environment variable
+ llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable(
+ name, newPath, IBuildEnvironmentVariable.ENVVAR_APPEND));
+ }
+ }
+ }
+
+ /**
+ * Returns a system environment variable path
+ *
+ * @param envName Environment variable name
+ * @return system environment variable path
+ */
+ private static String getSysEnvPath(String envName) {
+ String path = System.getenv(envName);
+ if(path != null) {
+ return path;
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.managedbuilder.envvar.
+ * IConfigurationEnvironmentVariableSupplier#getVariable(java.lang.String,
+ * org.eclipse.cdt.managedbuilder.core.IConfiguration,
+ * org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider)
+ */
+ public IBuildEnvironmentVariable getVariable(String variableName,
+ IConfiguration configuration, IEnvironmentVariableProvider provider) {
+ return llvmEnvironmentVariables.get(variableName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.managedbuilder.envvar.
+ * IConfigurationEnvironmentVariableSupplier
+ * #getVariables(org.eclipse.cdt.managedbuilder.core.IConfiguration,
+ * org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider)
+ */
+ public IBuildEnvironmentVariable[] getVariables(
+ IConfiguration configuration, IEnvironmentVariableProvider provider) {
+ return llvmEnvironmentVariables.values().toArray(
+ new IBuildEnvironmentVariable[0]);
+ }
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmIsToolChainSupported.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmIsToolChainSupported.java
new file mode 100755
index 00000000000..96c642d90e6
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmIsToolChainSupported.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Leo Hippelainen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui;
+
+import org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.osgi.framework.Version;
+
+/**
+ * Based on MingwIsToolChainSupported.
+ *
+ */
+public class LlvmIsToolChainSupported implements IManagedIsToolChainSupported {
+
+ private final boolean supported;
+
+ /**
+ * Constructor.
+ * LLVM Toolchain is supported if binary path for LLVM Tools can be found.
+ */
+ public LlvmIsToolChainSupported() {
+ // Only supported if we can find the llvm tools.
+ this.supported = LlvmEnvironmentVariableSupplier.getBinPath() != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported#isSupported(org.eclipse.cdt.managedbuilder.core.IToolChain,
+ * org.osgi.framework.Version, java.lang.String)
+ */
+ /**
+ * Return a boolean value that informs if the LLVM Toolchain is supported.
+ */
+ public boolean isSupported(IToolChain toolChain,
+ /*
+ * Version is supported from CDT 7.1.0.
+ * Use org.osgi.framework.PluginVersionIdentifier with older CDT versions.
+ */
+ Version version, String instance) {
+ return this.supported;
+ }
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmProjectNature.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmProjectNature.java
new file mode 100755
index 00000000000..71c00b46205
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmProjectNature.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * Implements project nature for LLVM projects.
+ *
+ */
+public class LlvmProjectNature implements IProjectNature {
+
+ private IProject project;
+
+ /**
+ * Configure the project which have this project nature.
+ */
+ public void configure() throws CoreException {
+ // Add nature-specific information
+ // for the project, such as adding a builder
+ // to a project's build spec.
+ }
+
+ /**
+ * Deconfigure those projects which have this project nature.
+ */
+ public void deconfigure() throws CoreException {
+ // Remove the nature-specific information.
+ }
+
+ /**
+ * Return the project.
+ *
+ * @return IProject
+ */
+ public IProject getProject() {
+ return this.project;
+ }
+
+ /**
+ * Set the project.
+ *
+ * @param proj IProject
+ */
+ public void setProject(IProject proj) {
+ this.project = proj;
+ }
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmUIPlugin.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmUIPlugin.java
new file mode 100755
index 00000000000..fd6a073fe47
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmUIPlugin.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Leo Hippelainen - Initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui;
+
+import java.io.IOException;
+import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.managedbuilder.llvm.util.LlvmResourceListener;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ * The main plugin class to be used in the desktop.
+ *
+ * @noextend This class is not intended to be subclassed by clients.
+ * @noimplement This class is not intended to be instantiated by clients.
+ */
+public class LlvmUIPlugin extends AbstractUIPlugin {
+
+ //The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.cdt.managedbuilder.llvm.ui"; //$NON-NLS-1$
+
+ //The shared instance
+ private static LlvmUIPlugin plugin;
+
+ //Resource bundle
+ private ResourceBundle resourceBundle;
+
+ //Name for the properties file
+ private final static String PROPERTIES = "plugin.properties"; //$NON-NLS-1$
+
+ //Property Resource bundle
+ private PropertyResourceBundle properties;
+
+ //Resource listeners
+ private IResourceChangeListener listener = new LlvmResourceListener();
+ private IResourceChangeListener listener2 = new LlvmResourceListener();
+
+ /**
+ * Constructor.
+ */
+ public LlvmUIPlugin() {
+ super();
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+// LlvmEnvironmentVariableSupplier.initializePaths();
+ //add resource change listeners to the workspace
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(
+ this.listener, IResourceChangeEvent.PRE_BUILD);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(
+ this.listener2, IResourceChangeEvent.POST_BUILD);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ this.resourceBundle = null;
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static LlvmUIPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle,
+ * or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = LlvmUIPlugin.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString(key) : key;
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ try {
+ if (this.resourceBundle == null)
+ this.resourceBundle = ResourceBundle.getBundle(this.getClass().getName()+ "Resources"); //$NON-NLS-1$
+ } catch (MissingResourceException x) {
+ this.resourceBundle = null;
+ }
+ return this.resourceBundle;
+ }
+
+ /**
+ * Log error.
+ *
+ * @param e
+ */
+ public void log(Throwable e) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Error", e)); //$NON-NLS-1$
+ }
+
+ /**
+ * Log status.
+ *
+ * @param status
+ */
+ public void log(IStatus status) {
+ getLog().log(status);
+ }
+
+ /**
+ * Get plugin.properties
+ *
+ * @return PropertyResourceBundle
+ */
+ public PropertyResourceBundle getProperties(){
+ if (this.properties == null){
+ try {
+ this.properties = new PropertyResourceBundle(
+ FileLocator.openStream(this.getBundle(),
+ new Path(PROPERTIES),false));
+ } catch (IOException e) {
+ //log error
+ e.getMessage();
+ }
+ }
+ return this.properties;
+ }
+
+ /**
+ * Get String from the plugin.properties file
+ *
+ * @param var Variable name wanted as a String e.g. "ToolName.assembler.llvm"
+ * @return String e.g. LLVM assembler
+ */
+ public static String getPropertyString(String var) {
+ PropertyResourceBundle properties = LlvmUIPlugin.getDefault().getProperties();
+ return properties.getString(var);
+ }
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/IncludePathListEditor.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/IncludePathListEditor.java
new file mode 100755
index 00000000000..dfc668e9d3f
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/IncludePathListEditor.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui.preferences;
+
+import org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier;
+import org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * New implementation of LlvmListEditor.
+ * Used to select an include path from the dialog.
+ *
+ */
+public class IncludePathListEditor extends LlvmListEditor {
+
+ /**
+ * Constructor.
+ *
+ * @param name the name of the preference this field editor works on
+ * @param labelText the label text of the field editor
+ * @param parent the parent of the field editor's control
+ */
+ IncludePathListEditor(String name, String labelText, Composite parent) {
+ super(name, labelText, parent);
+ }
+
+ @Override
+ /**
+ * Functionality for New button.
+ * Shows a browser dialog to select a directory and returns that directory path.
+ */
+ protected String getNewInputObject() {
+ DirectoryDialog dlg = new DirectoryDialog(getShell());
+ final Text text = new Text(getShell(), SWT.BORDER);
+ dlg.setFilterPath(text.getText());
+ dlg.setText(Messages.IncludePathListEditor_0);
+ dlg.setMessage(Messages.IncludePathListEditor_1);
+ String dir = dlg.open();
+ if(dir == null) {
+ return null;
+ }
+ //remove white spaces
+ dir = dir.trim();
+ if (dir.length()!=0) {
+ //get all existing items in the list
+ String[] existingItems = getList().getItems();
+ //check that the list doesn't already contain the added item
+ if (existingItems.length>0) {
+ //return null if duplicate item found
+ for (String item : existingItems) {
+ if (item.equalsIgnoreCase(dir)) {
+ return null;
+ }
+ }
+ }
+ //add a new include path to LLVM preference store
+ LlvmPreferenceStore.appendIncludePath(dir);
+ //add a new include path to LLVM assembler's option
+ LlvmToolOptionPathUtil.addLlvmIncludePath(dir);
+ //inform LLVM environment variable supplier that there has been a change
+ LlvmEnvironmentVariableSupplier.notifyPreferenceChange();
+ return dir;
+ }
+ return null;
+ }
+
+ @Override
+ /**
+ * Removes the path from the list as well as from the Tool's Option.
+ */
+ protected void removePressed() {
+ List incList = getList();
+ setPresentsDefaultValue(false);
+ String[] selected = incList.getSelection();
+ for (String s : selected) {
+ //remove an include path from the LLVM preference store
+ LlvmPreferenceStore.removeIncludePath(s);
+ //remove an include path from the LLVM assembler's option
+ LlvmToolOptionPathUtil.removeLlvmIncludePath(s);
+ //inform LLVM environment variable supplier that there has been a change
+ LlvmEnvironmentVariableSupplier.notifyPreferenceChange();
+ incList.remove(s);
+ selectionChanged();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryListEditor.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryListEditor.java
new file mode 100755
index 00000000000..935168cb86e
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryListEditor.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui.preferences;
+
+import org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier;
+import org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * New implementation of LlvmListEditor.
+ * Used to select a library file from the dialog.
+ *
+ */
+public class LibraryListEditor extends LlvmListEditor {
+
+ /**
+ * Constructor.
+ *
+ * @param name
+ * @param labelText
+ * @param parent
+ */
+ LibraryListEditor(String name, String labelText, Composite parent) {
+ super(name, labelText, parent);
+ }
+
+ @Override
+ /**
+ * Functionality for New button.
+ * Shows a browser dialog to select a file and returns that file.
+ */
+ protected String getNewInputObject() {
+ FileDialog dlg = new FileDialog(getShell());
+ final Text text = new Text(getShell(), SWT.BORDER);
+ dlg.setFilterPath(text.getText());
+ dlg.setText(Messages.LibraryListEditor_0);
+ dlg.open();
+ String file = dlg.getFileName();
+ if(file == null) {
+ return null;
+ }
+ //remove white spaces
+ file = file.trim();
+ if (file.length()!=0) {
+ //get all existing items in the list
+ String[] existingItems = getList().getItems();
+ //return null if duplicate item found
+ for (String item : existingItems) {
+ if (item.equalsIgnoreCase(file)) {
+ return null;
+ }
+ }
+ //add a new library to LLVM preference store
+ LlvmPreferenceStore.appendLibrary(file);
+ //add a new library to LLVM linker's option
+ LlvmToolOptionPathUtil.addLlvmLib(file);
+ //inform LLVM environment variable supplier that there has been a change
+ LlvmEnvironmentVariableSupplier.notifyPreferenceChange();
+ return file;
+ }
+ return null;
+ }
+
+ @Override
+ /**
+ * Removes the path from the list as well as from the Tool's Option.
+ */
+ protected void removePressed() {
+ List libList = getList();
+ setPresentsDefaultValue(false);
+ String[] selected = libList.getSelection();
+ for (String s : selected) {
+ //remove a library from the LLVM preference store
+ LlvmPreferenceStore.removeLibrary(s);
+ //remove a library from LLVM linker's option
+ LlvmToolOptionPathUtil.removeLlvmLib(s);
+ //inform LLVM environment variable supplier that there has been a change
+ LlvmEnvironmentVariableSupplier.notifyPreferenceChange();
+ libList.remove(s);
+ selectionChanged();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryPathListEditor.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryPathListEditor.java
new file mode 100755
index 00000000000..6869c398e56
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryPathListEditor.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui.preferences;
+
+import org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier;
+import org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * New implementation of LlvmListEditor.
+ * Used to select a library path from the dialog.
+ *
+ */
+public class LibraryPathListEditor extends LlvmListEditor {
+
+ /**
+ * Constructor.
+ *
+ * @param name the name of the preference this field editor works on
+ * @param labelText the label text of the field editor
+ * @param parent the parent of the field editor's control
+ */
+ LibraryPathListEditor(String name, String labelText, Composite parent) {
+ super(name, labelText, parent);
+ }
+
+ @Override
+ /**
+ * Functionality for New button.
+ * Shows a browser dialog to select a directory and returns that directory path.
+ */
+ protected String getNewInputObject() {
+ DirectoryDialog dlg = new DirectoryDialog(getShell());
+ final Text text = new Text(getShell(), SWT.BORDER);
+ dlg.setFilterPath(text.getText());
+ dlg.setText(Messages.LibraryPathListEditor_0);
+ dlg.setMessage(Messages.LibraryPathListEditor_1);
+ String dir = dlg.open();
+ if(dir == null) {
+ return null;
+ }
+ //remove white spaces
+ dir = dir.trim();
+ if (dir.length()!=0) {
+ //get all existing items in the list
+ String[] existingItems = getList().getItems();
+ //check that the list doesn't already contain the added item
+ if (existingItems.length>0) {
+ //return null if duplicate item found
+ for (String item : existingItems) {
+ if (item.equalsIgnoreCase(dir)) {
+ return null;
+ }
+ }
+ }
+ //add a new library search path to LLVM preference store
+ LlvmPreferenceStore.appendLibraryPath(dir);
+ //add a new library path to LLVM linker's option
+ LlvmToolOptionPathUtil.addLlvmLibraryPath(dir);
+ //inform LLVM environment variable supplier that there has been a change
+ LlvmEnvironmentVariableSupplier.notifyPreferenceChange();
+ return dir;
+ }
+ return null;
+ }
+
+ @Override
+ /**
+ * Removes the path from the list as well as from the Tool's Option.
+ */
+ protected void removePressed() {
+ List libPathList = getList();
+ setPresentsDefaultValue(false);
+ String[] selected = libPathList.getSelection();
+ for (String s : selected) {
+ //remove a library path from the LLVM preference store
+ LlvmPreferenceStore.removeLibraryPath(s);
+ //remove a library path from LLVM linker's option
+ LlvmToolOptionPathUtil.removeLlvmLibraryPath(s);
+ //inform LLVM environment variable supplier that there has been a change
+ LlvmEnvironmentVariableSupplier.notifyPreferenceChange();
+ libPathList.remove(s);
+ selectionChanged();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmListEditor.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmListEditor.java
new file mode 100755
index 00000000000..ce24a6ef7f4
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmListEditor.java
@@ -0,0 +1,338 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui.preferences;
+
+import java.util.regex.Pattern;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.preference.ListEditor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.cdt.managedbuilder.llvm.util.Separators;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * An abstract list editor that manages a list of input values.
+ * The editor displays a list containing the values, buttons for adding and removing
+ * values, and Up and Down buttons to adjust the order of elements in the list.
+ *
+ */
+public abstract class LlvmListEditor extends ListEditor {
+
+ /**
+ * The list widget; null if none
+ * (before creation or after disposal).
+ */
+ List list;
+
+ /**
+ * The button box containing the Add, Remove, Up, and Down buttons;
+ * null if none (before creation or after disposal).
+ */
+ Composite buttonBox;
+
+ /**
+ * The Add button.
+ */
+ Button addButton;
+
+ /**
+ * The Remove button.
+ */
+ Button removeButton;
+
+ /**
+ * The Up button.
+ */
+ Button upButton;
+
+ /**
+ * The Down button.
+ */
+ Button downButton;
+
+ /**
+ * The selection listener.
+ */
+ private SelectionListener selectionListener;
+
+ /**
+ * Creates a list field editor.
+ *
+ * @param name the name of the preference this field editor works on
+ * @param labelText the label text of the field editor
+ * @param parent the parent of the field editor's control
+ */
+ protected LlvmListEditor(String name, String labelText, Composite parent) {
+ super(name, labelText, parent);
+ }
+
+ @Override
+ /**
+ * Combines the given list of items into a single String.
+ * This method is the converse of parseString.
+ */
+ protected String createList(String[] items) {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (String item : items) {
+ if (stringBuilder.length() > 0) {
+ stringBuilder.append(Separators.getPathSeparator());
+ }
+ stringBuilder.append(item);
+ }
+ return stringBuilder.toString();
+ }
+
+ @Override
+ /** Splits the given String into a list of Strings.
+ * This method is the converse of createList.
+ */
+ protected String[] parseString(String stringList) {
+ if (stringList != null && stringList.length() > 0) {
+ return stringList.split(Pattern.quote(Separators.getPathSeparator()));
+ }
+ return new String[0];
+ }
+
+ /**
+ * Creates the Add, Remove, Up, and Down button in the given button box.
+ *
+ * @param box the box for the buttons
+ */
+ private void createButtons(Composite box) {
+ this.addButton = createPushButton(box, "ListEditor.add");//$NON-NLS-1$
+ this.removeButton = createPushButton(box, "ListEditor.remove");//$NON-NLS-1$
+ this.upButton = createPushButton(box, "ListEditor.up");//$NON-NLS-1$
+ this.downButton = createPushButton(box, "ListEditor.down");//$NON-NLS-1$
+ }
+
+ /**
+ * Helper method to create a push button.
+ *
+ * @param parent the parent control
+ * @param key the resource name used to supply the button's label text
+ * @return Button
+ */
+ private Button createPushButton(Composite parent, String key) {
+ Button button = new Button(parent, SWT.PUSH);
+ button.setText(JFaceResources.getString(key));
+ button.setFont(parent.getFont());
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ int widthHint = convertHorizontalDLUsToPixels(button,
+ IDialogConstants.BUTTON_WIDTH);
+ data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT,
+ SWT.DEFAULT, true).x);
+ button.setLayoutData(data);
+ button.addSelectionListener(getSelectionListener());
+ return button;
+ }
+
+ /**
+ * Creates a selection listener.
+ */
+ @Override
+ public void createSelectionListener() {
+ this.selectionListener = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ Widget widget = event.widget;
+ if (widget == LlvmListEditor.this.addButton) {
+ addPressed();
+ } else if (widget == LlvmListEditor.this.removeButton) {
+ removePressed();
+ } else if (widget == LlvmListEditor.this.upButton) {
+ upPressed();
+ } else if (widget == LlvmListEditor.this.downButton) {
+ downPressed();
+ } else if (widget == LlvmListEditor.this.list) {
+ selectionChanged();
+ }
+ }
+ };
+ }
+
+ /**
+ * Returns this field editor's button box containing the Add, Remove,
+ * Up, and Down button.
+ *
+ * @param parent the parent control
+ * @return the button box
+ */
+ @Override
+ public Composite getButtonBoxControl(Composite parent) {
+ if (this.buttonBox == null) {
+ this.buttonBox = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ this.buttonBox.setLayout(layout);
+ createButtons(this.buttonBox);
+ this.buttonBox.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent event) {
+ LlvmListEditor.this.addButton = null;
+ LlvmListEditor.this.removeButton = null;
+ LlvmListEditor.this.upButton = null;
+ LlvmListEditor.this.downButton = null;
+ LlvmListEditor.this.buttonBox = null;
+ }
+ });
+
+ } else {
+ checkParent(this.buttonBox, parent);
+ }
+
+ selectionChanged();
+ return this.buttonBox;
+ }
+
+ /**
+ * Returns this field editor's list control.
+ *
+ * @param parent the parent control
+ * @return the list control
+ */
+ @Override
+ public List getListControl(Composite parent) {
+ if (this.list == null) {
+ this.list = new List(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL
+ | SWT.H_SCROLL);
+ this.list.setFont(parent.getFont());
+ this.list.addSelectionListener(getSelectionListener());
+ this.list.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent event) {
+ LlvmListEditor.this.list = null;
+ }
+ });
+ } else {
+ checkParent(this.list, parent);
+ }
+ return this.list;
+ }
+
+ /**
+ * Returns this field editor's selection listener. The listener is created if nessessary.
+ * @return the selection listener
+ */
+ private SelectionListener getSelectionListener() {
+ if (this.selectionListener == null) {
+ createSelectionListener();
+ }
+ return this.selectionListener;
+ }
+
+ /**
+ * Invoked when the selection in the list has changed.
+ *
+ *
+ * The default implementation of this method utilizes the selection index
+ * and the size of the list to toggle the enablement of the up, down and
+ * remove buttons.
+ *
+ *
+ */
+ @Override
+ protected void selectionChanged() {
+ int index = this.list.getSelectionIndex();
+ int size = this.list.getItemCount();
+
+ this.removeButton.setEnabled(index >= 0);
+ this.upButton.setEnabled(size > 1 && index > 0);
+ this.downButton.setEnabled(size > 1 && index >= 0 && index < size - 1);
+ }
+
+ /**
+ * Moves the currently selected item up or down.
+ *
+ * @param up true if the item should move up,
+ * and false if it should move down
+ */
+ private void swap(boolean up) {
+ setPresentsDefaultValue(false);
+ int index = this.list.getSelectionIndex();
+ int target = up ? index - 1 : index + 1;
+
+ if (index >= 0) {
+ String[] selection = this.list.getSelection();
+ Assert.isTrue(selection.length == 1);
+ this.list.remove(index);
+ this.list.add(selection[0], target);
+ this.list.setSelection(target);
+ }
+ selectionChanged();
+ }
+
+ /**
+ * Returns this field editor's shell.
+ *
+ * This method is internal to the framework; subclasses should not call
+ * this method.
+ *
+ *
+ * @return the shell
+ */
+ @Override
+ protected Shell getShell() {
+ if (this.addButton == null) {
+ return null;
+ }
+ return this.addButton.getShell();
+ }
+
+ /**
+ * Notifies that the Add button has been pressed.
+ */
+ void addPressed() {
+ setPresentsDefaultValue(false);
+ String input = getNewInputObject();
+
+ if (input != null) {
+ int index = this.list.getSelectionIndex();
+ if (index >= 0) {
+ this.list.add(input, index + 1);
+ } else {
+ this.list.add(input, 0);
+ }
+ selectionChanged();
+ }
+ }
+
+ /**
+ * Notifies that the Remove button has been pressed.
+ */
+ protected abstract void removePressed();
+
+ /**
+ * Notifies that the Up button has been pressed.
+ */
+ void upPressed() {
+ swap(true);
+ }
+
+ /**
+ * Notifies that the Down button has been pressed.
+ */
+ void downPressed() {
+ swap(false);
+ }
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferencePage.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferencePage.java
new file mode 100755
index 00000000000..370f4c5d87f
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferencePage.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Leo Hippelainen - Initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui.preferences;
+
+import org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin;
+import org.eclipse.jface.preference.*;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.IWorkbench;
+
+/**
+ * This class represents a preference page that
+ * is contributed to the Preferences dialog. By
+ * subclassing FieldEditorPreferencePage, we
+ * can use the field support built into JFace that allows
+ * us to create a page that is small and knows how to
+ * save, restore and apply itself.
+ *
+ * This page is used to modify preferences only. They
+ * are stored in the preference store that belongs to
+ * the main plug-in class. That way, preferences can
+ * be accessed directly via the preference store.
+ *
+ */
+public class LlvmPreferencePage
+ extends FieldEditorPreferencePage
+ implements IWorkbenchPreferencePage {
+
+ /**
+ * Constructor.
+ * Set preference page to use the LLVM preference store.
+ */
+ public LlvmPreferencePage() {
+ setPreferenceStore(LlvmUIPlugin.getDefault().getPreferenceStore());
+ setDescription(Messages.LlvmPreferencePage_0);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+ @Override
+ /**
+ * Get Description name.
+ * @param String Description
+ */
+ public String getDescription() {
+ return null;
+ }
+
+// @Override
+// public boolean performOk() {
+// //rebuilt the index of all projects
+// IProject[] projects = LlvmToolOptionPathUtil.getProjectsInWorkspace();
+// for (IProject proj : projects) {
+// ProjectIndex.rebuiltIndex(proj);
+// }
+// return true;
+// }
+
+ @Override
+ /**
+ * Creates field editors for the preference page.
+ */
+ protected void createFieldEditors() {
+ //field for installation path
+ addField(new DirectoryFieldEditor(PreferenceConstants.P_LLVM_PATH,
+ Messages.LlvmPreferencePage_1, getFieldEditorParent()));
+ //list editor for include paths
+ IncludePathListEditor includePathListEditor = new IncludePathListEditor(
+ PreferenceConstants.P_LLVM_INCLUDE_PATH, Messages.LlvmPreferencePage_2,
+ getFieldEditorParent());
+ addField(includePathListEditor);
+ //list editor for libraries
+ LibraryListEditor libraryListEditor = new LibraryListEditor(
+ PreferenceConstants.P_LLVM_LIBRARIES, Messages.LlvmPreferencePage_3,
+ getFieldEditorParent());
+ addField(libraryListEditor);
+ //list editor for library paths
+ LibraryPathListEditor libraryPathListEditor = new LibraryPathListEditor(
+ PreferenceConstants.P_LLVM_LIBRARY_PATH, Messages.LlvmPreferencePage_4,
+ getFieldEditorParent());
+ addField(libraryPathListEditor);
+ }
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferenceStore.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferenceStore.java
new file mode 100755
index 00000000000..35f90fd75b6
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferenceStore.java
@@ -0,0 +1,324 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui.preferences;
+
+import org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier;
+import org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin;
+import org.eclipse.cdt.managedbuilder.llvm.util.FindStdLibPath;
+import org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil;
+import org.eclipse.cdt.managedbuilder.llvm.util.Separators;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+
+/**
+ * Class used to access the LLVM Preference store values.
+ *
+ * This class is not intended to be subclassed by clients.
+ */
+public class LlvmPreferenceStore {
+
+ /**
+ * Get the LLVM Preference store.
+ *
+ * @return LLVM Preference store.
+ */
+ public static IEclipsePreferences getPreferenceStore() {
+ IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(LlvmUIPlugin.PLUGIN_ID);
+ return prefs;
+ }
+
+ /**
+ * Get a value from the LLVM Preference store.
+ *
+ * @param name the name of the preference
+ * @return the string-valued preference
+ */
+ public static String getPreferenceStoreValue(String name) {
+ return getPreferenceStore().get(name, ""); //$NON-NLS-1$
+ }
+
+ /**
+ * Get the LLVM bin path value from the LLVM Preference store.
+ *
+ * @return the LLVM bin path value.
+ */
+ public static String getBinPath() {
+ return getPreferenceStoreValue(PreferenceConstants.P_LLVM_PATH);
+ }
+
+ /**
+ * Get the LLVM include path value from the LLVM Preference store.
+ *
+ * @return the LLVM include path value.
+ */
+ public static String getIncludePath() {
+ return getPreferenceStoreValue(PreferenceConstants.P_LLVM_INCLUDE_PATH);
+ }
+
+ /**
+ * Get the LLVM library path value from the LLVM Preference Store.
+ *
+ * @return the LLVM library path value.
+ */
+ public static String getLibraryPath() {
+ return getPreferenceStoreValue(PreferenceConstants.P_LLVM_LIBRARY_PATH);
+ }
+
+ /**
+ * Get the LLVM library from the LLVM Preference store.
+ *
+ * @return the LLVM library value.
+ */
+ public static String getLibraries() {
+ return getPreferenceStoreValue(PreferenceConstants.P_LLVM_LIBRARIES);
+ }
+
+ /**
+ * Get values from the LLVM Preference store as a String array.
+ * Used to get Preference store values which consist of multiple paths
+ * separated by a path separator.
+ *
+ * @param name the name of the preference
+ * @return A String array containing all Preference store values
+ */
+ public static String[] getPreferenceStoreValueAsArray(String name) {
+ return LlvmToolOptionPathUtil.stringToArray(name);
+ }
+
+ /**
+ * Set LLVM Preference store value.
+ *
+ * @param name the name of the preference
+ * @param value the string-valued preference
+ */
+ public static void setPreferenceStoreValue(String name, String value) {
+ getPreferenceStore().put(name, value);
+ }
+
+ /**
+ * Set LLVM bin path to the LLVM Preference store.
+ *
+ * @param path the path to the LLVM bin path.
+ */
+ public static void setBinPath(String path) {
+ setPreferenceStoreValue(PreferenceConstants.P_LLVM_PATH, path);
+ }
+
+ /**
+ * Set LLVM include path to the LLVM Preference store.
+ *
+ * @param path LLVM include path.
+ */
+ public static void setIncludePath(String path) {
+ setPreferenceStoreValue(PreferenceConstants.P_LLVM_INCLUDE_PATH, path);
+ }
+
+ /**
+ * Set LLVM library path to the LLVM Preference store.
+ *
+ * @param path LLVM library path.
+ */
+ public static void setLibraryPath(String path) {
+ setPreferenceStoreValue(PreferenceConstants.P_LLVM_LIBRARY_PATH, path);
+ }
+
+ /**
+ * Set LLVM library to the LLVM Preference store.
+ *
+ * @param lib LLVM library.
+ */
+ public static void setLibrary(String lib) {
+ setPreferenceStoreValue(PreferenceConstants.P_LLVM_LIBRARIES, lib);
+ }
+
+ /**
+ * Get existing paths from the Preference store.
+ *
+ * @param name the name of the preference
+ * @return paths
+ */
+ private static String getExistingPaths(String name) {
+ String paths = ""; //$NON-NLS-1$
+ if (name.equals(PreferenceConstants.P_LLVM_INCLUDE_PATH)) {
+ paths = getIncludePath();
+ } else if (name.equals(PreferenceConstants.P_LLVM_LIBRARY_PATH)) {
+ paths = getLibraryPath();
+ } else if (name.equals(PreferenceConstants.P_LLVM_LIBRARIES)) {
+ paths = getLibraries();
+ }
+ return paths;
+ }
+
+ /**
+ * Append a new value to the Preference store if it doesn't already exists.
+ *
+ * @param name the name of the preference
+ * @param value the string-valued preference
+ */
+ public static void appendValue(String name, String value) {
+ StringBuffer sB = new StringBuffer();
+ String paths = null;
+ //get existing paths
+ paths = getExistingPaths(name);
+ //if values exist
+ if (paths.length()!=0) {
+ //if the value is reasonable
+ if (!value.equalsIgnoreCase("") && value.length()!=0) { //$NON-NLS-1$
+ //if the paths doesn't contain the new value
+ if (!paths.contains(value)) {
+ //append existing paths to the string buffer
+ sB.append(paths);
+ //add a path separator in the end if it doesn't exists
+ if (paths.charAt(paths.length()-1)!=Separators.getPathSeparator().charAt(0)) {
+ sB.append(Separators.getPathSeparator());
+ }
+ //append the new value to end of the list
+ sB.append(value);
+ }
+ }
+ } else { //no existing values
+ //if the value is reasonable
+ if (!value.equalsIgnoreCase("") && value.length()!=0) { //$NON-NLS-1$
+ //append a new path to the string buffer
+ sB.append(value);
+ }
+ }
+ String newValues = sB.toString();
+ if (newValues.length()!=0) {
+ //set the new preference store value
+ setPreferenceStoreValue(name, newValues);
+ }
+ }
+
+ /**
+ * Append an include path to the LLVM Preference store.
+ *
+ * @param path the LLVM include path.
+ */
+ public static void appendIncludePath(String path) {
+ appendValue(PreferenceConstants.P_LLVM_INCLUDE_PATH, path);
+ }
+
+ /**
+ * Append a library path to the LLVM Preference store.
+ *
+ * @param path the LLVM library path.
+ */
+ public static void appendLibraryPath(String path) {
+ appendValue(PreferenceConstants.P_LLVM_LIBRARY_PATH, path);
+ }
+
+ /**
+ * Append a library to the LLVM Preference store.
+ *
+ * @param lib the LLVM library.
+ */
+ public static void appendLibrary(String lib) {
+ appendValue(PreferenceConstants.P_LLVM_LIBRARIES, lib);
+ }
+
+ /**
+ * Remove a value from the LLVM preference store.
+ *
+ * @param name Name of the preference
+ * @param value Value to remove from the preference store
+ */
+ public static void removeValue(String name, String value) {
+ StringBuffer sB = new StringBuffer();
+ String existingValues = null;
+ String newValue = null;
+ //get existing values
+ existingValues = getExistingPaths(name);
+ //if the String contains the value
+ if (existingValues.contains(value)) {
+ //if many values i.e. contains path separator
+ if (existingValues.contains(Separators.getPathSeparator())) {
+ //separate String of values to an array
+ String[] exValArray = existingValues.split(Separators.getPathSeparator());
+ //if more than one value
+ if (exValArray.length > 1) {
+ //remove the value from the array
+ exValArray = LlvmToolOptionPathUtil.removePathFromExistingPathList(exValArray, value);
+ //if the array isn't empty
+ if (exValArray.length > 0) {
+ //append all values to the StringBuffer excluding the removed one
+ for (String val : exValArray) {
+ //append a value
+ sB.append(val);
+ //append a path separator
+ sB.append(Separators.getPathSeparator());
+ }
+ //form a String
+ newValue = sB.toString();
+ }
+ } else { //only one value with a path separator at the end
+ newValue = ""; //$NON-NLS-1$
+ }
+
+ } else { //only value without a path separator at the end
+ newValue = ""; //$NON-NLS-1$
+ }
+ //set the new preference store value
+ setPreferenceStoreValue(name, newValue);
+ }
+ }
+
+ /**
+ * Remove a include path from the LLVM preference store.
+ *
+ * @param path The include path to be removed from the LLVM preference store.
+ */
+ public static void removeIncludePath(String path) {
+ removeValue(PreferenceConstants.P_LLVM_INCLUDE_PATH, path);
+ }
+
+ /**
+ * Remove a library path from the LLVM preference store.
+ *
+ * @param path The library path to be removed from the LLVM preference store.
+ */
+ public static void removeLibraryPath(String path) {
+ removeValue(PreferenceConstants.P_LLVM_LIBRARY_PATH, path);
+ }
+
+ /**
+ * Remove a library from the LLVM preference store.
+ *
+ * @param lib The library to be removed from the LLVM preference store.
+ */
+ public static void removeLibrary(String lib) {
+ removeValue(PreferenceConstants.P_LLVM_LIBRARIES, lib);
+ }
+
+ public static void addMinGWStdLib() {
+ String path = LlvmEnvironmentVariableSupplier.getMinGWStdLib();
+ String lib = "stdc++"; //$NON-NLS-1$
+ if (path != null) {
+ //add to preference store
+ appendLibraryPath(path);
+// ProjectIndex.rebuiltIndex(proj);
+ appendLibrary(lib);
+ }
+ }
+
+ public static void addStdLibUnix() {
+ String path = FindStdLibPath.find();
+ String lib = "stdc++"; //$NON-NLS-1$
+ if (path != null) {
+ //add to preference store
+ appendLibraryPath(path);
+// ProjectIndex.rebuiltIndex(proj);
+ appendLibrary(lib);
+ }
+ }
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/Messages.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/Messages.java
new file mode 100644
index 00000000000..dc6a4b8df30
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/Messages.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.managedbuilder.llvm.ui.preferences.messages"; //$NON-NLS-1$
+ public static String IncludePathListEditor_0;
+ public static String IncludePathListEditor_1;
+ public static String LibraryListEditor_0;
+ public static String LibraryPathListEditor_0;
+ public static String LibraryPathListEditor_1;
+ public static String LlvmPreferencePage_0;
+ public static String LlvmPreferencePage_1;
+ public static String LlvmPreferencePage_2;
+ public static String LlvmPreferencePage_3;
+ public static String LlvmPreferencePage_4;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceConstants.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceConstants.java
new file mode 100755
index 00000000000..ef4882af3a3
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceConstants.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Leo Hippelainen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui.preferences;
+
+/**
+ * Constant definitions for plug-in preferences
+ *
+ */
+public class PreferenceConstants {
+
+ public static final String P_LLVM_PATH = "LLVM installation folder"; //$NON-NLS-1$
+ public static final String P_LLVM_INCLUDE_PATH = "Include path used in LLVM compilations"; //$NON-NLS-1$
+ public static final String P_LLVM_LIBRARY_PATH = "Library path used in LLVM builds"; //$NON-NLS-1$
+ public static final String P_LLVM_LIBRARIES = "Libraries used in LLVM builds"; //$NON-NLS-1$
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceInitializer.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceInitializer.java
new file mode 100755
index 00000000000..179da64604d
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceInitializer.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Leo Hippelainen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.ui.preferences;
+
+import org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+
+/**
+ * Class used to initialize the default preference values.
+ *
+ */
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ IEclipsePreferences store = DefaultScope.INSTANCE.getNode(LlvmUIPlugin.PLUGIN_ID);
+ store.put(PreferenceConstants.P_LLVM_PATH, ""); //$NON-NLS-1$
+ store.put(PreferenceConstants.P_LLVM_INCLUDE_PATH, ""); //$NON-NLS-1$
+ store.put(PreferenceConstants.P_LLVM_LIBRARY_PATH, ""); //$NON-NLS-1$
+ store.put(PreferenceConstants.P_LLVM_LIBRARIES, ""); //$NON-NLS-1$
+ }
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/messages.properties b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/messages.properties
new file mode 100644
index 00000000000..a60f392c598
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/messages.properties
@@ -0,0 +1,10 @@
+IncludePathListEditor_0=Browse a directory path
+IncludePathListEditor_1=Select a directory
+LibraryListEditor_0=Browse a directory path
+LibraryPathListEditor_0=Browse a directory path
+LibraryPathListEditor_1=Select a directory
+LlvmPreferencePage_0=Preferences for LLVM tool chain.
+LlvmPreferencePage_1=LLVM &Installation folder:
+LlvmPreferencePage_2=Include directories
+LlvmPreferencePage_3=Libraries
+LlvmPreferencePage_4=Library search path directories
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/FileUtil.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/FileUtil.java
new file mode 100644
index 00000000000..f42694fbf97
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/FileUtil.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2011-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.util;
+
+import java.io.File;
+
+public class FileUtil {
+
+ /**
+ * Searches cpp and cc file types recursively and returns true if
+ * the directory tree contains at least one instance of them.
+ *
+ * @param directory
+ * @param filter
+ * @return
+ */
+ public static boolean containsCppFile(File directory) {
+ File[] entries = directory.listFiles();
+ String path = null;
+ for (File entry : entries) {
+ path = entry.getAbsolutePath();
+ if (path!=null) {
+ if (path.contains(".cpp") || path.contains(".cc")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return true;
+ }
+ }
+
+ if (entry.isDirectory()) {
+ containsCppFile(entry);
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/FindStdLibPath.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/FindStdLibPath.java
new file mode 100644
index 00000000000..8d0b6e7c08c
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/FindStdLibPath.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2011-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.util;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.ProcessBuilder;
+
+/**
+ * The purpose is to find a path where stdc++ library is located.
+ * Currently the shell script is only for Linux.
+ *
+ * TODO: It might not be able to execute scripts therefore place the command into a variable.
+ */
+public class FindStdLibPath {
+
+ private static final String WIN_SCRIPT = "scripts/find_path.bat"; //$NON-NLS-1$
+ private static final String STD_LIB = "libstdc++.a"; //$NON-NLS-1$
+ private static final String UNIX_SCRIPT = " echo `locate libstdc++.a | sort -r | head -1 | sed \"s/libstdc++.a$//\"` "; //$NON-NLS-1$
+ private static final String MAC_SCRIPT = " echo `locate libstdc++.dylib | sort -r | head -1 | sed \"s/libstdc++.dylib$//\"` "; //$NON-NLS-1$
+
+ /**
+ * Find stdc++ library path.
+ *
+ * @return Stdc++ library path.
+ */
+ public static String find() {
+ ProcessBuilder pb = null;
+ String os = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
+ if (os.indexOf("win") >= 0) { //$NON-NLS-1$
+ pb = new ProcessBuilder("cmd", "/c", WIN_SCRIPT + " " + STD_LIB); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ } else if (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0) { //$NON-NLS-1$ //$NON-NLS-2$
+ pb = new ProcessBuilder("bash", "-c", UNIX_SCRIPT); //$NON-NLS-1$//$NON-NLS-2$
+ } else if (os.indexOf( "mac" ) >= 0) { //$NON-NLS-1$
+ pb = new ProcessBuilder("bash", "-c", MAC_SCRIPT); //$NON-NLS-1$//$NON-NLS-2$
+ } else {
+ return null;
+ }
+ try {
+ Process p = pb.start();
+ String line;
+ BufferedReader input = new BufferedReader
+ (new InputStreamReader(p.getInputStream()));
+ line = input.readLine();
+ input.close();
+ if (line != null) {
+ return line;
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+}
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/LlvmResourceListener.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/LlvmResourceListener.java
new file mode 100644
index 00000000000..348fdca4ca3
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/LlvmResourceListener.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.util;
+
+import org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * Implements Resource listener.
+ */
+public class LlvmResourceListener implements IResourceChangeListener {
+
+ /**
+ * Defines what happens when resources have changed.
+ *
+ * @param event IResourceChangeEvent
+ */
+ public void resourceChanged(IResourceChangeEvent event) {
+
+ if (event.getType() == IResourceChangeEvent.POST_BUILD) { //refresh every project after build
+ //get all projects
+ IProject[] projects = LlvmToolOptionPathUtil.getProjectsInWorkspace();
+
+ //refresh the projects
+ for (IProject proj : projects) {
+ try {
+ proj.refreshLocal(IResource.DEPTH_INFINITE, null);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ } else if (event.getType() == IResourceChangeEvent.PRE_BUILD) {
+ String os = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
+ if (os.indexOf("win") >= 0) { //$NON-NLS-1$
+ LlvmPreferenceStore.addMinGWStdLib();
+// LlvmToolOptionPathUtil.addMissingCppIncludesForMingw(); //TODO: Remove when Scanner Discovery has been fixed
+ } else if (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0 /*|| os.indexOf( "mac") >=0 */) { //$NON-NLS-1$ //$NON-NLS-2$
+ LlvmPreferenceStore.addStdLibUnix();
+ }
+
+ /*
+ * try to add values (include and library paths and libraries) to
+ * projects's build configurations to ensure that newly added projects
+ * have necessary paths.
+ */
+ LlvmToolOptionPathUtil.addAllIncludesToBuildConf();
+ LlvmToolOptionPathUtil.addAllLibsToBuildConf();
+ LlvmToolOptionPathUtil.addAllLibPathsToBuildConf();
+ } else {
+ return;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/LlvmToolOptionPathUtil.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/LlvmToolOptionPathUtil.java
new file mode 100755
index 00000000000..66de4516223
--- /dev/null
+++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/LlvmToolOptionPathUtil.java
@@ -0,0 +1,980 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia Siemens Networks - initial implementation
+ * Petri Tuononen - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.llvm.util;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.resources.RefreshScopeManager;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
+import org.eclipse.cdt.managedbuilder.core.BuildException;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.IOption;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
+import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
+import org.eclipse.cdt.managedbuilder.gnu.mingw.MingwEnvironmentVariableSupplier;
+import org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier;
+import org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+/**
+ * The main purpose of this class is to add include paths and libraries and library search paths
+ * for LLVM compiler and linker Tools which are added in Preferences->LLVM to all projects
+ * and build configurations that use LLVM ToolChain. Values added in Preferences->LLVM will
+ * show in Project->Properties->C/C++ General->Paths and Symbols tabs.
+ *
+ */
+public class LlvmToolOptionPathUtil {
+
+ //tool input extensions
+ private static final String linkerInputType = "bc"; //$NON-NLS-1$
+ private static final String[] inputTypes = {"cpp", "c"}; //$NON-NLS-1$ //$NON-NLS-2$
+ //tool option values
+ public static final int INCLUDE = 1;
+ public static final int LIB = 2;
+ public static final int LIB_PATH = 3;
+
+ /**
+ * Adds new include path to LLVM front-end's Include path option for every project
+ * in the workspace that uses LLVM Toolchain and for for every build configuration.
+ *
+ * @param includePath Include path for LLVM front-end's Include Option
+ */
+ public static void addLlvmIncludePath(String includePath) {
+ addPathToToolOption(includePath, INCLUDE);
+ }
+
+ /**
+ * Removes an include path from LLVM front-end's Include path option for every project
+ * in the workspace that uses LLVM Toolchain and for for every build configuration.
+ *
+ * @param includePath Include path for LLVM front-end's Include Option
+ */
+ public static void removeLlvmIncludePath(String includePath) {
+ removePathFromToolOption(includePath, INCLUDE);
+ }
+
+ /**
+ * Adds a new Library to LLVM linker's Libraries Option for every project
+ * in the workspace that use LLVM Toolchain and for for every build configuration.
+ *
+ * @param lib Library name for the LLVM linker's Libraries Option
+ */
+ public static void addLlvmLib(String lib) {
+ addPathToToolOption(lib, LIB);
+ }
+
+ /**
+ * Removes a Library to LLVM linker's Libraries Option for every project
+ * in the workspace that use LLVM Toolchain and for for every build configuration.
+ *
+ * @param lib Library name for the LLVM linker's Libraries Option
+ */
+ public static void removeLlvmLib(String lib) {
+ removePathFromToolOption(lib, LIB);
+ }
+
+ /**
+ * Adds a new Library search path directory to LLVM linker's Library search path Option
+ * for every project in the workspace that use LLVM Toolchain and for for every
+ * build configuration.
+ *
+ * @param libDir Library search path directory for LLVM linker's Library search path Option
+ */
+ public static void addLlvmLibraryPath(String libDir) {
+ addPathToToolOption(libDir, LIB_PATH);
+ }
+
+ /**
+ * Removes a Library search path directory from LLVM linker's Library search path Option
+ * for every project in the workspace that use LLVM Toolchain and for for every
+ * build configuration.
+ *
+ * @param libDir Library search path directory for LLVM linker's Library search path Option
+ */
+ public static void removeLlvmLibraryPath(String libDir) {
+ removePathFromToolOption(libDir, LIB_PATH);
+ }
+
+ /**
+ * Adds a path to Tool option.
+ *
+ * @param path Path to add to Tool option
+ * @param var Tool option's value
+ */
+ private static void addPathToToolOption(String path, int var) {
+ //check if the given path exists
+ if (path.length()>0 && (pathExists(path) || var==LIB)) {
+ boolean success = false;
+ //get all projects in the workspace
+ IProject[] projects = getProjectsInWorkspace();
+ IConfiguration[] configs;
+ for (IProject proj : projects) {
+
+ //get all build configurations of the IProject
+ configs = getAllBuildConfigs(proj);
+ //if build configurations found
+ if (configs.length>0) {
+ for (IConfiguration cf : configs) {
+ //Add path for the Tool's option
+ if (addPathToSelectedToolOptionBuildConf(cf, path, var)) {
+ success = true;
+ } else {
+ success = false;
+ }
+ }
+ //if the path was added successfully
+ if (success) {
+ //save project build info
+ ManagedBuildManager.saveBuildInfo(proj, true);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Adds a path to Tool option. Only for C++ projects.
+ *
+ * @param path Path to add to Tool option
+ * @param var Tool option's value
+ */
+ private static void addPathToToolOptionCppProjects(String path, int var) {
+ //check if the given path exists
+ if (path.length()>0 && (pathExists(path) || var==LIB)) {
+ boolean success = false;
+ //get all projects in the workspace
+ IProject[] projects = getProjectsInWorkspace();
+ IConfiguration[] configs;
+ String projectPath = null;
+ for (IProject proj : projects) {
+ projectPath = proj.getLocation().toOSString();
+ if (projectPath!=null) {
+ //only apply to C++ projects
+ if (FileUtil.containsCppFile(new File(projectPath))) {
+ //get all build configurations of the IProject
+ configs = getAllBuildConfigs(proj);
+ //if build configurations found
+ if (configs.length>0) {
+ for (IConfiguration cf : configs) {
+ //Add path for the Tool's option
+ if (addPathToSelectedToolOptionBuildConf(cf, path, var)) {
+ success = true;
+ } else {
+ success = false;
+ }
+ }
+ //if the path was added successfully
+ if (success) {
+ //save project build info
+ ManagedBuildManager.saveBuildInfo(proj, true);
+ ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(proj);
+ try {
+ CoreModel.getDefault().setProjectDescription(proj, projectDescription);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ //use refresh scope manager to refresh
+ RefreshScopeManager manager = RefreshScopeManager.getInstance();
+ IWorkspaceRunnable runnable = manager.getRefreshRunnable(proj);
+ try {
+ ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, new NullProgressMonitor());
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ //rebuilt the project index
+ ProjectIndex.rebuiltIndex(proj);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Removes a path from Tool option.
+ *
+ * @param path Path to remove from Tool option
+ * @param var Tool option's value
+ */
+ private static void removePathFromToolOption(String path, int var) {
+ //check if the given path exists
+ if (path.length()>0 && pathExists(path) || var==LIB) {
+ boolean success = false;
+ //get all projects in the workspace
+ IProject[] projects = getProjectsInWorkspace();
+ IConfiguration[] configs;
+ for (IProject proj : projects) {
+ //get all build configurations of the IProject
+ configs = getAllBuildConfigs(proj);
+ //if build configurations found
+ if (configs.length>0) {
+ for (IConfiguration cf : configs) {
+ //remove a path from the Tool's option
+ if (removePathFromSelectedToolOptionBuildConf(cf, path, var)) {
+ success = true;
+ } else {
+ success = false;
+ }
+ }
+ //if the path was removed successfully
+ if (success) {
+ //save project build info
+ ManagedBuildManager.saveBuildInfo(proj, true);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Add a path to specific build configuration's Tool option.
+ *
+ * @param cf Build configuration
+ * @param path Path or file name to add
+ * @param var Value of the option type
+ * @return boolean True if path was added successfully
+ */
+ private static boolean addPathToSelectedToolOptionBuildConf(IConfiguration cf, String path, int var) {
+ switch (var) {
+ case INCLUDE:
+ return addLlvmIncludePathToToolOption(cf, path);
+ case LIB:
+ return addLlvmLibToToolOption(cf, path);
+ case LIB_PATH:
+ return addLlvmLibSearchPathToToolOption(cf, path);
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Removes a path from specific build configuration's Tool option.
+ *
+ * @param cf Build configuration
+ * @param path Path or file name to remove
+ * @param var Value of the option type
+ * @return boolean True if path was removed successfully
+ */
+ private static boolean removePathFromSelectedToolOptionBuildConf(IConfiguration cf, String path, int var) {
+ switch (var) {
+ case INCLUDE:
+ return removeLlvmIncludePathFromToolOption(cf, path);
+ case LIB:
+ return removeLlvmLibFromToolOption(cf, path);
+ case LIB_PATH:
+ return removeLlvmLibSearchPathFromToolOption(cf, path);
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Returns all projects in the workspace.
+ *
+ * @return IProject[]
+ */
+ public static IProject[] getProjectsInWorkspace() {
+ //get workspace
+ IWorkspace root = ResourcesPlugin.getWorkspace();
+ //get all projects in the workspace
+ return root.getRoot().getProjects();
+ }
+
+ /**
+ * Returns all build configurations of the project.
+ *
+ * @param proj IProject Project
+ * @return IConfiguration[] Build configurations
+ */
+ private static IConfiguration[] getAllBuildConfigs(IProject proj) {
+ IConfiguration[] configurations = new IConfiguration[] {};
+ IManagedBuildInfo info = null;
+ //try to get Managed build info
+ try {
+ info = ManagedBuildManager.getBuildInfo(proj); //null if doesn't exists
+ } catch (Exception e) { //if not a managed build project
+ //print error
+ e.printStackTrace();
+ return configurations;
+ }
+ //info can be null for projects without build info. For example, when creating a project
+ //from Import >�C/C++ Executable
+ if(info == null) {
+ return configurations;
+ }
+ //get ManagedProject associated with build info
+ IManagedProject mProj = info.getManagedProject();
+
+ //get all build configurations of the project
+ configurations = mProj.getConfigurations();
+ return configurations;
+ }
+
+ /**
+ * Adds an include path to LLVM front-end's include path option.
+ *
+ * @param cf IConfiguration Build configuration
+ * @param newIncludePath Include path to be added to LLVM front-end's Include path option
+ */
+ private static boolean addLlvmIncludePathToToolOption(IConfiguration cf, String newIncludePath) {
+ //get LLVM front-end
+ ITool llvmFrontEnd = getLlvmFrontEnd(cf);
+ //If the LLVM front-end is found from the given build configuration
+ if (llvmFrontEnd != null) {
+ //get LLVM front-end Include paths option.
+ IOption llvmFrontEndIncPathOption = getLlvmFrontEndIncludePathOption(cf);
+ //add a new include path to front-end's Include paths option.
+ boolean val = addIncludePathToToolOption(cf, llvmFrontEnd, llvmFrontEndIncPathOption, newIncludePath);
+ return val;
+ }
+ return false;
+ }
+
+ /**
+ * Removes an include path from LLVM front-end's include path option.
+ *
+ * @param cf IConfiguration Build configuration
+ * @param removeIncludePath Include path to be removed from LLVM front-end's Include path option
+ */
+ private static boolean removeLlvmIncludePathFromToolOption(IConfiguration cf, String removeIncludePath) {
+ //get LLVM front-end
+ ITool llvmFrontEnd = getLlvmFrontEnd(cf);
+ //If the LLVM front-end is found from the given build configuration
+ if (llvmFrontEnd != null) {
+ //get LLVM front-end Include paths option.
+ IOption llvmFrontEndIncPathOption = getLlvmFrontEndIncludePathOption(cf);
+ //remove an include path from front-end's Include paths option.
+ removeIncludePathFromToolOption(cf, llvmFrontEnd, llvmFrontEndIncPathOption, removeIncludePath);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Adds a Library to LLVM linker's Libraries Option.
+ *
+ * @param cf IConfiguration Build configuration
+ * @param lib Library name
+ * @return boolean Returns true if Library Option was added successfully for the LLVM Linker.
+ */
+ private static boolean addLlvmLibToToolOption(IConfiguration cf, String lib) {
+ //get LLVM linker
+ ITool llvmLinker = getLlvmLinker(cf);
+ //If the LLVM linker is found from the given build configuration
+ if (llvmLinker != null) {
+ //get LLVM Linker Libraries option
+ IOption librariesOption = getLlvmLinkerLibrariesOption(cf);
+ //add library to LLVM linker's Libraries Option type
+ boolean val = addLibraryToToolOption(cf, llvmLinker, librariesOption, lib);
+ return val;
+ }
+ //adding the library failed
+ return false;
+ }
+
+ /**
+ * Removes a Library from LLVM linker's Libraries Option.
+ *
+ * @param cf IConfiguration Build configuration
+ * @param removeLib Library name
+ * @return boolean Returns true if Library Option was removed successfully from the LLVM Linker.
+ */
+ private static boolean removeLlvmLibFromToolOption(IConfiguration cf, String removeLib) {
+ //get LLVM linker
+ ITool llvmLinker = getLlvmLinker(cf);
+ //If the LLVM linker is found from the given build configuration
+ if (llvmLinker != null) {
+ //get LLVM Linker Libraries option
+ IOption librariesOption = getLlvmLinkerLibrariesOption(cf);
+ //remove a library from LLVM linker's Libraries Option type
+ removeLibraryFromToolOption(cf, llvmLinker, librariesOption, removeLib);
+ return true;
+ }
+ //removing the library failed
+ return false;
+ }
+
+ /**
+ * Adds a Library search path to LLVM linker's Library search path Option.
+ *
+ * @param cf IConfiguration Build configuration
+ * @param libDir Library search path
+ * @return boolean Returns true if Library search path Option was added successfully for the LLVM Linker.
+ */
+ private static boolean addLlvmLibSearchPathToToolOption(IConfiguration cf, String libDir) {
+ //get LLVM linker
+ ITool llvmLinker = getLlvmLinker(cf);
+ //If the LLVM linker is found from the given build configuration
+ if (llvmLinker != null) {
+ //get LLVM Linker Library search path option
+ IOption libDirOption = getLlvmLinkerLibrarySearchPathOption(cf);
+ //add library search path to LLVM linker's Library Search Path Option type
+ boolean val = addLibrarySearchPathToToolOption(cf, llvmLinker, libDirOption, libDir);
+ return val;
+ }
+ //adding library failed
+ return false;
+ }
+
+ /**
+ * Removes a Library search path from LLVM linker's Library search path Option.
+ *
+ * @param cf IConfiguration Build configuration
+ * @param removeLibDir Library search path
+ * @return boolean Returns true if Library search path Option was removed successfully from the LLVM Linker.
+ */
+ private static boolean removeLlvmLibSearchPathFromToolOption(IConfiguration cf, String removeLibDir) {
+ //get LLVM linker
+ ITool llvmLinker = getLlvmLinker(cf);
+ //If the LLVM linker is found from the given build configuration
+ if (llvmLinker != null) {
+ //get LLVM Linker Library search path option
+ IOption libDirOption = getLlvmLinkerLibrarySearchPathOption(cf);
+ //remove a library search path from LLVM linker's Library Search Path Option type
+ removeLibrarySearchPathFromToolOption(cf, llvmLinker, libDirOption, removeLibDir);
+ return true;
+ }
+ //removing the library search path failed
+ return false;
+ }
+
+ /**
+ * Adds include path for given Build configuration's Tool's Include path Option.
+ *
+ * @param cf IConfiguration Build configuration
+ * @param cfTool ITool Tool
+ * @param option Tool Option type
+ * @param newIncludePath Include path to be added to Tool's Include path option
+ */
+ private static boolean addIncludePathToToolOption(IConfiguration cf, ITool cfTool, IOption option, String newIncludePath) {
+ try {
+ //add path only if it does not exists
+ String[] incPaths = option.getIncludePaths();
+ for (String inc : incPaths) {
+ if (inc.equalsIgnoreCase(newIncludePath)) {
+ return false;
+ }
+ }
+ //add a new include path to linker's Include paths option.
+ addInputToToolOption(cf, cfTool, option, newIncludePath, incPaths);
+ } catch (BuildException e) {
+ //show error
+ e.printStackTrace();
+ }
+ return true;
+ }
+
+ /**
+ * Removes an include path from given Build configuration's Tool's Include path Option.
+ *
+ * @param cf IConfiguration Build configuration
+ * @param cfTool ITool Tool
+ * @param option Tool Option type
+ * @param removeIncludePath Include path to be removed from Tool's Include path option
+ */
+ private static void removeIncludePathFromToolOption(IConfiguration cf, ITool cfTool, IOption option, String removeIncludePath) {
+ try {
+ //remove an include path from linker's Include paths option.
+ removeInputFromToolOption(cf, cfTool, option, removeIncludePath, option.getIncludePaths());
+ } catch (BuildException e) {
+ //show error
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Adds new Library for the Linker's Libraries Option.
+ *
+ * @param cf IConfiguration Build configuration
+ * @param cfTool ITool Tool
+ * @param option Tool Option type
+ * @param newLibrary Library
+ */
+ private static boolean addLibraryToToolOption(IConfiguration cf, ITool cfTool, IOption option, String newLibrary) {
+ try {
+ if(option != null) {
+ //add library only if it does not exists
+ String[] libraries = option.getLibraries();
+ for (String lib : libraries) {
+ if (lib.equalsIgnoreCase(newLibrary)) {
+ return false;
+ }
+ }
+ //add a new library to linker's Libraries option.
+ addInputToToolOption(cf, cfTool, option, newLibrary, libraries);
+ }
+ } catch (BuildException e) {
+ //show error
+ e.printStackTrace();
+ }
+ return true;
+ }
+
+ /**
+ * Removes a new Library from the Linker's Libraries Option.
+ *
+ * @param cf IConfiguration Build configuration
+ * @param cfTool ITool Tool
+ * @param option Tool Option type
+ * @param removeLibrary Library
+ */
+ private static void removeLibraryFromToolOption(IConfiguration cf, ITool cfTool, IOption option, String removeLibrary) {
+ try {
+ //remove a library from linker's Libraries option.
+ removeInputFromToolOption(cf, cfTool, option, removeLibrary, option.getLibraries());
+ } catch (BuildException e) {
+ //show error
+ e.printStackTrace();
+ }
+ }
+
+ //Works only if Eclipse Bugzilla Bug 321040 fix is applied
+ /**
+ * Adds new Library search path for the Linker's Library search path Option.
+ *
+ * @param cf IConfiguration Build configuration
+ * @param cfTool ITool Tool
+ * @param option Tool Option type
+ * @param newLibraryPath Library search path
+ */
+ private static boolean addLibrarySearchPathToToolOption(IConfiguration cf, ITool cfTool, IOption option, String newLibraryPath) {
+ try {
+ if(option != null) {
+ //add path only if it does not exists
+ String[] libPaths = option.getLibraryPaths();
+ for (String libPath : libPaths) {
+ if (libPath.equalsIgnoreCase(newLibraryPath)) {
+ return false;
+ }
+ }
+ //add a new library path to linker's Library search path option.
+ addInputToToolOption(cf, cfTool, option, newLibraryPath, libPaths);
+ }
+ } catch (BuildException e) {
+ //show error
+ e.printStackTrace();
+ }
+ return true;
+ }
+
+ /**
+ * Removes a Library search path from the Linker's Library search path Option.
+ * Since CDT 8.0 (Bugzilla Bug 321040)
+ *
+ * @param cf IConfiguration Build configuration
+ * @param cfTool ITool Tool
+ * @param option Tool Option type
+ * @param removeSearchPath Library search path
+ */
+ private static void removeLibrarySearchPathFromToolOption(IConfiguration cf, ITool cfTool, IOption option, String removeSearchPath) {
+ try {
+ //remove a library path from linker's Library search path option.
+ removeInputFromToolOption(cf, cfTool, option, removeSearchPath, option.getLibraryPaths());
+ } catch (BuildException e) {
+ //show error
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Adds a new value to specific Option.
+ *
+ * @param cf IConfiguration Build configuration
+ * @param cfTool ITool Tool
+ * @param option Tool Option type
+ * @param newValue New value to be added to the Option type
+ * @param existingValues Existing Option type values
+ */
+ private static void addInputToToolOption(IConfiguration cf, ITool cfTool, IOption option, String newValue, String[] existingValues) {
+ //if Option type is found
+ if (option != null) {
+ //append new value with existing values
+ String[] newValues = addNewPathToExistingPathList(existingValues, newValue);
+ //set new values array for the option for the given build configuration
+ ManagedBuildManager.setOption(cf, cfTool, option, newValues);
+ }
+ else{
+ //log error
+ }
+ }
+
+ /**
+ * Removes a value from a specific Option.
+ *
+ * @param cf IConfiguration Build configuration
+ * @param cfTool ITool Tool
+ * @param option Tool Option type
+ * @param removeValue Value to be removed from the Option type
+ * @param existingValues Existing Option type values
+ */
+ private static void removeInputFromToolOption(IConfiguration cf, ITool cfTool, IOption option, String removeValue, String[] existingValues) {
+ //if Option type is found
+ if (option != null) {
+ //check that list has values
+ if(existingValues.length>0) {
+ //remove value from existing values
+ String[] newValues = removePathFromExistingPathList(existingValues, removeValue);
+ //set new values array for the option for the given build configuration
+ ManagedBuildManager.setOption(cf, cfTool, option, newValues);
+ }
+ }
+ else{
+ //log error
+ }
+ }
+
+ /**
+ * Return LLVM front-end according to the input type.
+ * @param cf IConfiguration Build configuration
+ * @return ITool LLVM front-end
+ */
+ private static ITool getLlvmFrontEnd(IConfiguration cf) {
+ //get LLVM front-end according to the input type
+ for(int i=0; i newPathList = new ArrayList();
+ String path;
+ //adds existing paths to new paths list
+ for (int i = 0; i < existingPaths.length; i++) {
+ path = existingPaths[i];
+ newPathList.add(path);
+ }
+ //separates new path if it has multiple paths separated by a path separator
+ String[] newPathArray = newPath.split(pathSep);
+ for (int i = 0; i < newPathArray.length; i++) {
+ path = newPathArray[i];
+ newPathList.add(path);
+ }
+ //creates a new list that includes all existing paths as well as new paths
+ String[] newArray = newPathList.toArray(new String[0]);
+ return newArray;
+ }
+
+ /**
+ * Removes one path from the list of paths.
+ *
+ * @param existingPaths Existing list of paths to remove from
+ * @param removePath Path to be removed.
+ * @return String[] List that includes existing paths without the path that was removed.
+ */
+ public static String[] removePathFromExistingPathList(String[] existingPaths, String removePath) {
+ List newPathList = new ArrayList();
+ String path;
+ //adds existing paths to new paths list
+ for (int i = 0; i < existingPaths.length; i++) {
+ path = existingPaths[i];
+ newPathList.add(path);
+ }
+ newPathList.remove(removePath);
+ //creates a new list that includes all existing paths except the removed path
+ String[] newArray = newPathList.toArray(new String[0]);
+ return newArray;
+ }
+
+ /**
+ * Split paths to a String array.
+ *
+ * @param str String of paths separated by a path separator.
+ * @return String array containing multiple paths.
+ */
+ public static String[] stringToArray(String str) {
+ return str.split(System.getProperty("path.separator")); //$NON-NLS-1$
+ }
+
+ /**
+ * Append an array of Strings to a String separated by a path separator.
+ *
+ * @param array An array of Strings.
+ * @return string which contains all indexes of
+ * a String array separated by a path separator.
+ */
+ public static String arrayToString(String[] array) {
+ StringBuffer sB = new StringBuffer();
+ //if array isn't empty and doesn't contain an empty String
+ if (array.length>0 /*&& !array[0].equals("")*/) {
+ for (String i : array) {
+ sB.append(i);
+ sB.append(System.getProperty("path.separator")); //$NON-NLS-1$
+ }
+ }
+ return sB.toString();
+ }
+
+ /**
+ * Checks if a file path exists.
+ *
+ * @return boolean True if the file exists.
+ */
+ private static boolean pathExists(String path) {
+ //return true if path exists.
+ return new File(path).exists();
+ }
+
+ /**
+ * Get all include paths in a String array.
+ *
+ * @return String[] A String array of include paths
+ */
+ private static String[] getAllIncludePaths() {
+ //get all include paths
+ String includePathList = LlvmPreferenceStore.getIncludePath();
+ //split paths to String array
+ String[] incPaths = includePathList.split(Separators.getPathSeparator());
+ return incPaths;
+ }
+
+ /**
+ * Get all libraries in a String array.
+ *
+ * @return String[] A String array of libraries
+ */
+ private static String[] getAllLibraries() {
+ //get all libraries
+ String libList = LlvmPreferenceStore.getLibraries();
+ //split values to String array
+ String[] libs = libList.split(Separators.getPathSeparator());
+ return libs;
+ }
+
+ /**
+ * Get all library paths in a String array.
+ *
+ * @return String[] A String array of library paths
+ */
+ private static String[] getAllLibraryPaths() {
+ //get all library paths
+ String libPathList = LlvmPreferenceStore.getLibraryPath();
+ //split paths to String array
+ String[] libPaths = libPathList.split(Separators.getPathSeparator());
+ return libPaths;
+ }
+
+ /**
+ * Add all include paths found in LLVM preference page to
+ * every project's build configurations.
+ */
+ public static void addAllIncludesToBuildConf() {
+ String[] includes = getAllIncludePaths();
+ for(String inc : includes) {
+ addLlvmIncludePath(inc);
+ }
+ }
+
+ /**
+ * Add all libraries found in LLVM preference page to
+ * every project's build configurations.
+ */
+ public static void addAllLibsToBuildConf() {
+ String[] libs = getAllLibraries();
+ for(String lib : libs) {
+// if (!lib.equalsIgnoreCase("stdc++")) { //$NON-NLS-1$ //C++ specific
+ addLlvmLib(lib);
+// }
+ }
+ }
+
+ /**
+ * Add all library paths found in LLVM preference page to
+ * every project's build configurations.
+ */
+ public static void addAllLibPathsToBuildConf() {
+ String[] libPaths = getAllLibraryPaths();
+ for(String libPath : libPaths) {
+// if (!libPath.equalsIgnoreCase(LlvmEnvironmentVariableSupplier.getMinGWStdLib())) { //C++ specific
+ addLlvmLibraryPath(libPath);
+// }
+ }
+ }
+
+ //temporary hack until scanner discovery works
+ public static void addMissingCppIncludesForMingw() {
+ //try to find mingw path from MingwEnvironmentVariableSupplier
+ IConfigurationEnvironmentVariableSupplier mingwEnvironmentVariables =
+ new MingwEnvironmentVariableSupplier();
+ IBuildEnvironmentVariable mingwPath = mingwEnvironmentVariables.getVariable(
+ "PATH", null, null); //$NON-NLS-1$
+ //may contain multiple paths therefore must be separated
+ String[] mingwPaths = mingwPath.getValue().split(Separators.getPathSeparator());
+ //bin folder is appended so it must be removed
+ for(int i=0; i