Fix bug 11022. Get rid of dependency on SBS_HOME.
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/HostOS.java Fri Apr 16 15:31:49 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/HostOS.java Mon Apr 19 11:38:03 2010 -0500
@@ -47,8 +47,8 @@
/**
* Scan the PATH variable and see if the given binary is visible on
* the PATH that will be used at runtime (with the default environment and overrides).
- * @param pathValue the expected Path
- * @param program
+ * @param program - program name to find on the path
+ * @param pathValue the value of the path in the system to search on
* @return IPath if program is on PATH, else <code>null</code>
*/
public static IPath findProgramOnPath(String program, String pathValue) {
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java Fri Apr 16 15:31:49 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java Mon Apr 19 11:38:03 2010 -0500
@@ -14,6 +14,7 @@
import java.io.File;
import java.io.FileFilter;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -52,27 +53,27 @@
private static final String SBSV2_FILTERED_CONFIGS_STORE = "sbsv2FilteredConfigs"; //$NON-NLS-1$
private static final String SBSV2_FILTERED_CONFIGS_DELIMETER = ";"; //$NON-NLS-1$
- protected static String sbsHome;
+ /** Path, to and including the SBS script */
protected static IPath sbsPath;
private static boolean scannedSbsState = false;
private static final String sbsScriptName = "sbs.bat";
- protected static final String SBS_HOME = "SBS_HOME";
/** Map of usable Raptor alias for -c parameter and base platform: <alias, base plat> */
private static Map<String, String> unfilteredSBSv2ConfigNames;
/**
- * Get the path to the SBSv2 bin directory. This is based on the SBS_HOME environment variable
- * and may or may not actually exist.
- * @return absolute path to the bin directory, or null if SBS_HOME is not set
+ * Get the path to the SBSv2 bin directory. not including the sbs executable.
+ * May or may not actually exist.
+ * @return absolute path to the bin directory, or null if sbs is not set
*/
public static IPath getSBSBinDirectory() {
- String sbsHome = EnvironmentReader.getEnvVar("SBS_HOME"); //$NON-NLS-1$
- if (sbsHome != null) {
- return new Path(sbsHome).append("bin"); //$NON-NLS-1$
+ String pathValue = EnvironmentReader.getEnvVar("PATH"); //$NON-NLS-1$
+ IPath sbs = HostOS.findProgramOnPath(sbsScriptName, pathValue);
+ if (sbs != null){
+ sbs = sbs.removeLastSegments(1);
}
- return null;
+ return sbs;
}
/**
@@ -82,10 +83,10 @@
*/
public static Map<String, String> getUnfilteredSBSv2BuildConfigurations(boolean refreshList) {
- if (unfilteredSBSv2ConfigNames == null || refreshList) {
+ if (unfilteredSBSv2ConfigNames == null || refreshList || unfilteredSBSv2ConfigNames.size() == 0) {
unfilteredSBSv2ConfigNames = new HashMap<String, String>();
- // parse the xml files in SBS_HOME/lib/config/ to get SBSv2 configs
+ // parse the xml files in <sbs-install>/lib/config/ to get SBSv2 configs
try {
IPath configPath = getSBSBinDirectory();
@@ -301,18 +302,24 @@
**/
public static String scanSBSv2() {
// do some basic checks
- sbsHome = System.getenv(SBS_HOME);
- if (sbsHome == null) {
- return "Please define the SBS_HOME environment (e.g. /path/to/raptor) and add $SBS_HOME/bin to your PATH before running Carbide.";
- }
-
- sbsPath = HostOS.findProgramOnPath(sbsScriptName, null);
- if (sbsPath == null) {
- return "Please add $SBS_HOME/bin to your PATH before running Carbide.";
- }
-
+ if (sbsPath != null){
+ return null;
+ }
+ IPath expectedPath = getSBSBinDirectory();
+ if (expectedPath != null) {
+ expectedPath = expectedPath.append(sbsScriptName);
+ if (expectedPath.toFile().exists()) {
+ sbsPath = expectedPath;
+ }
+ }
+ if (sbsPath == null) {
+ return MessageFormat.format(Messages
+ .getString("SBSv2Utils.CannotFindSBSScriptError"), //$NON-NLS-1$
+ sbsScriptName);
+ }
+
return null;
- }
+ }
/**
* Get the path to SBSv2 (sbs.bat or sbs)
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/messages.properties Fri Apr 16 15:31:49 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/messages.properties Mon Apr 19 11:38:03 2010 -0500
@@ -4,3 +4,4 @@
SBVCatalog.SBVLoadError=Error loading/parsing VAR file: {0}
SBVCatalog.MissingCustomizedPlatform=Variant platform ''{0}'' customizes platform ''{1}'' which cannot be located or parsed.
+SBSv2Utils.CannotFindSBSScriptError=Cannot find {0} on the PATH. Please verify your SBSv2 installation.
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java Fri Apr 16 15:31:49 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java Mon Apr 19 11:38:03 2010 -0500
@@ -231,6 +231,10 @@
// tell others about it
fireInstalledSdkChanged(SDKChangeEventType.eSDKScanned);
scanCarbideSDKCache();
+ String message = SBSv2Utils.scanSBSv2();
+ if (message != null){
+ logError(message, null);
+ }
}
private void ensureScannedSDKs() {
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java Fri Apr 16 15:31:49 2010 -0500
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java Mon Apr 19 11:38:03 2010 -0500
@@ -88,14 +88,8 @@
IPath sbsBinPath = SBSv2Utils.getSBSBinDirectory();
- // if SBSv2 is selected, make sure SBS_HOME is defined
if (SBSv2Utils.getSBSBinDirectory() == null){
- status = new Status(Status.ERROR, ProjectUIPlugin.PLUGIN_ID, "SBS_HOME environment variable is not defined. Carbide needs this variable to find the base SBS install.");
- }
-
- // check to see if SBS_HOME directory really exists
- else if (!sbsBinPath.toFile().exists()){
- status = new Status(Status.ERROR, ProjectUIPlugin.PLUGIN_ID, "SBS_HOME environment variable path does not exist: " + sbsBinPath.toOSString());
+ status = new Status(Status.ERROR, ProjectUIPlugin.PLUGIN_ID, "The Symbian Build System (sbs) cannot be found on the PATH. Carbide needs a valid SBS installation on the PATH to use the SBSv2 builder.");
}
// check the raptor version
else if (SDKCorePlugin.getSDKManager().getSBSv2Version(false).getMajor() == 0){