# HG changeset patch # User timkelly # Date 1271693161 18000 # Node ID 668d819e9f597868e9ae6712ea952829ee67d91d # Parent eaea5f2cf3c304dc726ffaef719336d11172f3e7 Fix bug 11022. Get rid of dependency on SBS_HOME. diff -r eaea5f2cf3c3 -r 668d819e9f59 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java Fri Apr 16 14:47:44 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java Mon Apr 19 11:06:01 2010 -0500 @@ -61,24 +61,24 @@ */ private static Map unfilteredSBSv2ConfigNames; - protected static final String SBS_HOME = "SBS_HOME"; - 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 = HostOS.IS_WIN32 ? "sbs.bat" : "sbs"; /** - * 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 found */ 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; } /** @@ -88,10 +88,10 @@ */ public static Map getUnfilteredSBSv2BuildConfigurations(boolean refreshList) { - if (unfilteredSBSv2ConfigNames == null || refreshList) { + if (unfilteredSBSv2ConfigNames == null || refreshList || unfilteredSBSv2ConfigNames.size() == 0) { unfilteredSBSv2ConfigNames = new HashMap(); - // parse the xml files in SBS_HOME/lib/config/ to get SBSv2 configs + // parse the xml files in /lib/config/ to get SBSv2 configs try { IPath configPath = getSBSBinDirectory(); @@ -333,22 +333,22 @@ * @return message if error, else null */ public static String scanSBSv2() { + if (sbsPath != null){ + return null; + } // do some basic checks - sbsHome = System.getenv(SBS_HOME); - if (sbsHome == null) { - return Messages.getString("SBSv2Utils.DefineSBS_HOMEMessage"); //$NON-NLS-1$ - } + IPath expectedPath = getSBSBinDirectory(); + if (expectedPath != null) { + expectedPath = expectedPath.append(sbsScriptName); + if (expectedPath.toFile().exists()) { + sbsPath = expectedPath; + } + } - IPath expectedPath = new Path(sbsHome).append("bin").append(sbsScriptName); - if (expectedPath.toFile().exists()) { - sbsPath = expectedPath; - } else { - sbsPath = HostOS.findProgramOnPath(sbsScriptName, null); - if (sbsPath == null) { - return MessageFormat.format( - Messages.getString("SBSv2Utils.CannotFindSBSScriptError"), //$NON-NLS-1$ - sbsScriptName); - } + if (sbsPath == null) { + return MessageFormat.format(Messages + .getString("SBSv2Utils.CannotFindSBSScriptError"), //$NON-NLS-1$ + sbsScriptName); } return null; diff -r eaea5f2cf3c3 -r 668d819e9f59 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/messages.properties --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/messages.properties Fri Apr 16 14:47:44 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/messages.properties Mon Apr 19 11:06:01 2010 -0500 @@ -8,7 +8,6 @@ \#undef SBSV2\n\ \n -SBSv2Utils.CannotFindSBSScriptError=Cannot find {0} on the PATH or under $SBS_HOME/bin. Please verify your SBSv2 installation. -SBSv2Utils.DefineSBS_HOMEMessage=Please define the SBS_HOME environment (e.g. /path/to/raptor) and add $SBS_HOME/bin to your PATH before running Carbide. +SBSv2Utils.CannotFindSBSScriptError=Cannot find {0} on the PATH. Please verify your SBSv2 installation. SBVCatalog.SBVLoadError=Error loading/parsing VAR file: {0} SBVCatalog.MissingCustomizedPlatform=Variant platform ''{0}'' customizes platform ''{1}'' which cannot be located or parsed. diff -r eaea5f2cf3c3 -r 668d819e9f59 core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/HostOS.java --- a/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/HostOS.java Fri Apr 16 14:47:44 2010 -0500 +++ b/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/HostOS.java Mon Apr 19 11:06:01 2010 -0500 @@ -56,8 +56,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 null */ public static IPath findProgramOnPath(String program, String pathValue) { diff -r eaea5f2cf3c3 -r 668d819e9f59 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/sharedui/BuilderSelectionComposite.java Fri Apr 16 14:47:44 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:06:01 2010 -0500 @@ -85,14 +85,9 @@ IPath sbsBinPath = SBSv2Utils.getSBSBinDirectory(); - // if SBSv2 is selected, make sure SBS_HOME is defined + // if SBSv2 is selected, make sure SBS bin directory exists 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