# HG changeset patch # User timkelly # Date 1239656556 18000 # Node ID 032594a9a391665ff9aa9c87c5ab763ec55fde7f # Parent c606acbe8b76bd9ebabcdec512c37a8ed65bb54b fix bug 7351, improve performance when cancelling a 'Build All COnfigurations' diff -r c606acbe8b76 -r 032594a9a391 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCPPBuilder.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCPPBuilder.java Mon Apr 13 14:53:58 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCPPBuilder.java Mon Apr 13 16:02:36 2009 -0500 @@ -892,8 +892,8 @@ * @param launcher the Carbide launcher * @return false if any makefile generation was necessary but failed, true otherwise */ - public static boolean generateAbldMakefilesIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher) { - return generateAbldMakefilesIfNecessary(config, launcher, true); + public static boolean generateAbldMakefilesIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, IProgressMonitor progress) { + return generateAbldMakefilesIfNecessary(config, launcher, true, progress); } /** @@ -911,7 +911,7 @@ * @return false if any makefile generation was necessary but failed, true otherwise * @since 2.0 */ - public static boolean generateAbldMakefilesIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, boolean calculateComponentLists) { + public static boolean generateAbldMakefilesIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, boolean calculateComponentLists, IProgressMonitor progress) { if (calculateComponentLists) { calculateComponentLists(config, launcher); @@ -919,13 +919,13 @@ // generate the makefiles if necessary for (IPath path : normalMakMakePaths) { - if (!generateAbldMakefileIfNecessary(config, launcher, path, false)) { + if (!generateAbldMakefileIfNecessary(config, launcher, path, false, progress)) { return false; } } for (IPath path : testMakMakePaths) { - if (!generateAbldMakefileIfNecessary(config, launcher, path, true)) { + if (!generateAbldMakefileIfNecessary(config, launcher, path, true, progress)) { return false; } } @@ -947,8 +947,8 @@ * @param isTest true for test components, false otherwise * @return false if any makefile generation was necessary but failed, true otherwise */ - protected static boolean generateAbldMakefileIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, IPath componentPath, boolean isTest) { - return getBuilder(config.getCarbideProject().getProject()).generateAbldMakefileIfNecessary(config, launcher, componentPath, isTest); + protected static boolean generateAbldMakefileIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, IPath componentPath, boolean isTest, IProgressMonitor progress) { + return getBuilder(config.getCarbideProject().getProject()).generateAbldMakefileIfNecessary(config, launcher, componentPath, isTest, progress); } /** diff -r c606acbe8b76 -r 032594a9a391 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java Mon Apr 13 14:53:58 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java Mon Apr 13 16:02:36 2009 -0500 @@ -189,7 +189,7 @@ } // run abld makefile platform for each component to be built if needed - if (!generateAbldMakefileIfNecessary(buildConfig, launcher, componentPath, isTest)) { + if (!generateAbldMakefileIfNecessary(buildConfig, launcher, componentPath, isTest, progress)) { return false; } @@ -337,7 +337,7 @@ progress.setTaskName("Cleaning " + componentName); // run abld makefile platform for each component to be built if needed - if (!generateAbldMakefileIfNecessary(buildConfig, launcher, componentPath, isTest)) { + if (!generateAbldMakefileIfNecessary(buildConfig, launcher, componentPath, isTest, progress)) { return false; } @@ -390,7 +390,7 @@ String componentName = componentPath.removeFileExtension().lastSegment(); // run abld makefile platform for each component to be built if needed - if (!generateAbldMakefileIfNecessary(buildConfig, launcher, componentPath, isTest)) { + if (!generateAbldMakefileIfNecessary(buildConfig, launcher, componentPath, isTest, monitor)) { return false; } @@ -483,7 +483,7 @@ return; } - if (!generateAbldMakefileIfNecessary(buildConfig, launcher, fullMMPPath, isTest)) { + if (!generateAbldMakefileIfNecessary(buildConfig, launcher, fullMMPPath, isTest, monitor)) { return; } @@ -936,7 +936,7 @@ } // run abld makefile platform for each component to be built if needed - if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher, false)) { + if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher, false, progress)) { return false; } @@ -1251,7 +1251,7 @@ } // run abld makefile platform for each component to be built if needed - if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher, false)) { + if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher, false, progress)) { return false; } @@ -1477,7 +1477,7 @@ return; } - if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher, false)) { + if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher, false, progress)) { return; } @@ -1575,7 +1575,7 @@ return; } - if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher, false)) { + if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher, false, progress)) { return; } @@ -1679,7 +1679,7 @@ return; } - if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher, false)) { + if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher, false, progress)) { return; } @@ -1748,7 +1748,7 @@ return; } - if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher, false)) { + if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher, false, progress)) { return; } @@ -2199,7 +2199,7 @@ } } - public boolean generateAbldMakefileIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, IPath componentPath, boolean isTest) { + public boolean generateAbldMakefileIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, IPath componentPath, boolean isTest, IProgressMonitor progress) { // generate the makefile if necessary if (needsAbldMakefileGeneration(config, componentPath)) { @@ -2249,7 +2249,7 @@ // now make our changes to the generated makefile if (areWeManagingTheMakeFiles) { try { - updateMakefile(config, componentPath); + updateMakefile(config, componentPath, progress); } catch (CoreException e) { CarbideBuilderPlugin.log(e); e.printStackTrace(); @@ -2434,12 +2434,16 @@ return makefilePath.toFile(); } - protected void updateMakefile(ICarbideBuildConfiguration config, IPath componentPath) throws CoreException { + protected void updateMakefile(ICarbideBuildConfiguration config, IPath componentPath, IProgressMonitor progress) throws CoreException { // ignore extension makefiles. if (isExtensionMakefile(componentPath)) { return; } + if (progress.isCanceled()) { + return; + } + File makefile = getMakefileForMMP(config, componentPath); if (!makefile.exists()) { throw new CoreException(new Status(IStatus.ERROR, CarbideBuilderPlugin.PLUGIN_ID, 0, "Makefile " + makefile.getAbsolutePath() + " doesn't exist.", null)); //$NON-NLS-1$ diff -r c606acbe8b76 -r 032594a9a391 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java Mon Apr 13 14:53:58 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java Mon Apr 13 16:02:36 2009 -0500 @@ -450,7 +450,7 @@ } } - public boolean generateAbldMakefileIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, IPath componentPath, boolean isTest) { + public boolean generateAbldMakefileIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, IPath componentPath, boolean isTest, IProgressMonitor progress) { return true; } diff -r c606acbe8b76 -r 032594a9a391 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ICarbideBuilder.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ICarbideBuilder.java Mon Apr 13 14:53:58 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ICarbideBuilder.java Mon Apr 13 16:02:36 2009 -0500 @@ -59,7 +59,7 @@ public boolean needsBldmakeMakefileGeneration(ICarbideBuildConfiguration config); - public boolean generateAbldMakefileIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, IPath componentPath, boolean isTest); + public boolean generateAbldMakefileIfNecessary(ICarbideBuildConfiguration config, CarbideCommandLauncher launcher, IPath componentPath, boolean isTest, IProgressMonitor progress); public IPath getMakefileDirectory(ICarbideBuildConfiguration config); } diff -r c606acbe8b76 -r 032594a9a391 builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ABLDCommandHandler.java --- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ABLDCommandHandler.java Mon Apr 13 14:53:58 2009 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ABLDCommandHandler.java Mon Apr 13 16:02:36 2009 -0500 @@ -102,7 +102,7 @@ return new Status(IStatus.ERROR, "Carbide.c++ builder utils plugin", IStatus.ERROR, "Failed to generate bldmake makefiles", null); } - if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher)) { + if (!CarbideCPPBuilder.generateAbldMakefilesIfNecessary(buildConfig, launcher, new NullProgressMonitor())) { return new Status(IStatus.ERROR, "Carbide.c++ builder utils plugin", IStatus.ERROR, "Failed to generate mmp makefiles", null); } diff -r c606acbe8b76 -r 032594a9a391 builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ProjectCommandHandler.java --- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ProjectCommandHandler.java Mon Apr 13 14:53:58 2009 -0500 +++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/ProjectCommandHandler.java Mon Apr 13 16:02:36 2009 -0500 @@ -27,6 +27,7 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; @@ -177,7 +178,9 @@ for (final ICarbideBuildConfiguration currConfig : buildConfigList) { launcher.setErrorParserManager(cpi.getINFWorkingDirectory(), CarbideCPPBuilder.getParserIdArray(currConfig.getErrorParserId())); - + if (monitor.isCanceled()) { + return new Status(IStatus.CANCEL, "Carbide.c++ builder utils plugin", IStatus.CANCEL, "Build Cancelled", null); + } // kick off a build for each configuration... CarbideCPPBuilder.invokeBuild(currConfig, launcher, subMonitor.newChild(1), false);