builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java
changeset 275 4ed3a3aba373
parent 91 2010205bb971
child 285 a7b7fa512cdc
equal deleted inserted replaced
274:ac3db0995346 275:4ed3a3aba373
    41     private static final String CLEAN_CMD = "CLEAN"; //$NON-NLS-1$
    41     private static final String CLEAN_CMD = "CLEAN"; //$NON-NLS-1$
    42     private static final String FREEZE_CMD = "FREEZE"; //$NON-NLS-1$
    42     private static final String FREEZE_CMD = "FREEZE"; //$NON-NLS-1$
    43     private static final String REALLYCLEAN_CMD = "REALLYCLEAN"; //$NON-NLS-1$
    43     private static final String REALLYCLEAN_CMD = "REALLYCLEAN"; //$NON-NLS-1$
    44 
    44 
    45     private static final String COMPONENT_ARG = "-p"; //$NON-NLS-1$
    45     private static final String COMPONENT_ARG = "-p"; //$NON-NLS-1$
       
    46     private static final String COMPILE_ARG = "-c"; //$NON-NLS-1$
       
    47     
       
    48     private static final IPath SBS_BAT = new Path("sbs.bat"); //$NON-NLS-1$
       
    49     
    46     
    50     
    47     public boolean buildAllComponents(ICarbideBuildConfiguration buildConfig, List<IPath> normalMakMakePaths, List<IPath> testMakMakePaths, CarbideCommandLauncher launcher, IProgressMonitor monitor) {
    51     public boolean buildAllComponents(ICarbideBuildConfiguration buildConfig, List<IPath> normalMakMakePaths, List<IPath> testMakMakePaths, CarbideCommandLauncher launcher, IProgressMonitor monitor) {
    48 		
    52 		
    49 		SubMonitor progress = SubMonitor.convert(monitor, 3);
    53 		SubMonitor progress = SubMonitor.convert(monitor, 3);
    50 		progress.setTaskName("Building " + buildConfig.getDisplayString());
    54 		progress.setTaskName("Building " + buildConfig.getDisplayString());
   560 
   564 
   561 	public void preCleanStep(ICarbideBuildConfiguration buildConfig) {
   565 	public void preCleanStep(ICarbideBuildConfiguration buildConfig) {
   562 	}
   566 	}
   563 
   567 
   564 	public void compileFile(IPath file, ICarbideBuildConfiguration buildConfig, IPath fullMMPPath, CarbideCommandLauncher launcher, IProgressMonitor monitor) throws CoreException {
   568 	public void compileFile(IPath file, ICarbideBuildConfiguration buildConfig, IPath fullMMPPath, CarbideCommandLauncher launcher, IProgressMonitor monitor) throws CoreException {
   565 		//TODO there's no way to do this with SBSV2 at this time.  The location of the object code
   569 		ICarbideProjectInfo cpi = buildConfig.getCarbideProject();
   566 		// is dependent on the xml config files so it could change from target to target and over
   570 		IPath workingDirectory = cpi.getINFWorkingDirectory();
   567 		// time.  Symbian will look at adding this feature in the future.  For now we'll disable
   571 		
   568 		// the compile command for SBSv2 projects.
   572 		String buildTarget = buildConfig.getPlatformString().toLowerCase() + "_" + buildConfig.getTargetString().toLowerCase();
   569 		// see http://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=7659 for more details.
   573 		
       
   574 		String[] sbsArgs = new String[] {"--source-target=\"" + file.toOSString() + "\"", COMPILE_ARG, buildTarget, COMPONENT_ARG, fullMMPPath.toFile().getName()};
       
   575 		launcher.setErrorParserManager(buildConfig.getCarbideProject().getINFWorkingDirectory(), buildConfig.getErrorParserList());
       
   576 		
       
   577 		int retVal = launcher.executeCommand(SBS_BAT, sbsArgs, getResolvedEnvVars(buildConfig), workingDirectory);
       
   578 		if (retVal != 0) {
       
   579 			launcher.writeToConsole("\n=== make failed with error code " + retVal + " ===");
       
   580 			launcher.writeToConsole("\n***Stopping. Check the Problems view or Console output for errors.\n");
       
   581    			CarbideBuilderPlugin.createCarbideProjectMarker(cpi.getProject(), IMarker.SEVERITY_ERROR,  "make returned with exit value = " + retVal, IMarker.PRIORITY_LOW);
       
   582 			return;
       
   583 		}
       
   584 
       
   585 		monitor.worked(1);
       
   586 		if (monitor.isCanceled()) {
       
   587 			return;
       
   588 		}
   570 	}
   589 	}
   571 }
   590 }