Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gvozdev2012-04-12 01:01:23 -0400
committerAndrew Gvozdev2012-04-12 01:01:23 -0400
commitb1b320f94e5081bcd17089efa202205900f0cbf1 (patch)
treeb1150a44a428f01d1a5220987d94d8e350a241dc /build/org.eclipse.cdt.make.core
parent1a0bdf2d5d4f59a1afb73b772fcb459eea9c9ff0 (diff)
downloadorg.eclipse.cdt-b1b320f94e5081bcd17089efa202205900f0cbf1.tar.gz
org.eclipse.cdt-b1b320f94e5081bcd17089efa202205900f0cbf1.tar.xz
org.eclipse.cdt-b1b320f94e5081bcd17089efa202205900f0cbf1.zip
bug 371797: [sd90] Implement language settings providers in build
plugins
Diffstat (limited to 'build/org.eclipse.cdt.make.core')
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java45
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigBuilder.java66
2 files changed, 80 insertions, 31 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java
index 7275c8e80f..9a6eb5609c 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java
@@ -26,8 +26,17 @@ import org.eclipse.cdt.core.CommandLauncher;
import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.ICommandLauncher;
import org.eclipse.cdt.core.IConsoleParser;
+import org.eclipse.cdt.core.language.settings.providers.ICBuildOutputParser;
+import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
+import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
+import org.eclipse.cdt.core.language.settings.providers.IWorkingDirectoryTracker;
+import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
+import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
+import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.resources.ACBuilder;
import org.eclipse.cdt.core.resources.IConsole;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.internal.core.BuildRunnerHelper;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
import org.eclipse.cdt.make.internal.core.MakeMessages;
@@ -175,6 +184,7 @@ public class MakeBuilder extends ACBuilder {
String[] targets = getTargets(kind, info);
if (targets.length != 0 && targets[targets.length - 1].equals(info.getCleanBuildTarget()))
isClean = true;
+ boolean isOnlyClean = isClean && (targets.length == 1);
String[] args = getCommandArguments(info, targets);
@@ -187,8 +197,17 @@ public class MakeBuilder extends ACBuilder {
ErrorParserManager epm = new ErrorParserManager(getProject(), workingDirectoryURI, this, errorParsers);
List<IConsoleParser> parsers = new ArrayList<IConsoleParser>();
- IScannerInfoConsoleParser parserSD = ScannerInfoConsoleParserFactory.getScannerInfoConsoleParser(project, workingDirectoryURI, this);
- parsers.add(parserSD);
+ if (!isOnlyClean) {
+ ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project);
+ if (prjDescription != null) {
+ ICConfigurationDescription cfgDescription = prjDescription.getActiveConfiguration();
+ collectLanguageSettingsConsoleParsers(cfgDescription, epm, parsers);
+ }
+ if (ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(project)) {
+ IScannerInfoConsoleParser parserSD = ScannerInfoConsoleParserFactory.getScannerInfoConsoleParser(project, workingDirectoryURI, this);
+ parsers.add(parserSD);
+ }
+ }
buildRunnerHelper.setLaunchParameters(launcher, buildCommand, args, workingDirectoryURI, envp);
buildRunnerHelper.prepareStreams(epm, parsers, console, new SubProgressMonitor(monitor, TICKS_STREAM_PROGRESS_MONITOR, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
@@ -307,4 +326,26 @@ public class MakeBuilder extends ACBuilder {
private String[] makeArray(String string) {
return CommandLineUtil.argumentsToArray(string);
}
+
+ private static void collectLanguageSettingsConsoleParsers(ICConfigurationDescription cfgDescription, IWorkingDirectoryTracker cwdTracker, List<IConsoleParser> parsers) {
+ if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
+ List<ILanguageSettingsProvider> lsProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
+ for (ILanguageSettingsProvider lsProvider : lsProviders) {
+ ILanguageSettingsProvider rawProvider = LanguageSettingsManager.getRawProvider(lsProvider);
+ if (rawProvider instanceof ICBuildOutputParser) {
+ ICBuildOutputParser consoleParser = (ICBuildOutputParser) rawProvider;
+ try {
+ consoleParser.startup(cfgDescription, cwdTracker);
+ parsers.add(consoleParser);
+ } catch (CoreException e) {
+ MakeCorePlugin.log(new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID,
+ "Language Settings Provider failed to start up", e)); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ }
+
+
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigBuilder.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigBuilder.java
index 304a6c78e1..9a256489cd 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigBuilder.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigBuilder.java
@@ -13,6 +13,8 @@ package org.eclipse.cdt.make.core.scannerconfig;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
+import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.resources.ACBuilder;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
@@ -30,12 +32,12 @@ import org.eclipse.core.runtime.SubProgressMonitor;
/**
* Runs after standard make builder.
* Consolidates discovered scanner configuration and updates project's scanner configuration.
- *
+ *
* @deprecated as of CDT 4.0. Used by legacy CDT 3.X projects.
* Replaced by ScannerConfigBuilder in org.eclipse.cdt.managedbuilder.core.
- *
+ *
* @see IncrementalProjectBuilder
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
@@ -60,34 +62,39 @@ public class ScannerConfigBuilder extends ACBuilder {
// boolean autodiscoveryEnabled;
if(buildNewStyle(getProject(), monitor))
return getProject().getReferencedProjects();
+
+ if (!ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(getProject())) {
+ return getProject().getReferencedProjects();
+ }
+
boolean autodiscoveryEnabled2;
IScannerConfigBuilderInfo2 buildInfo2 = null;
try {
// IScannerConfigBuilderInfo buildInfo = MakeCorePlugin.createScannerConfigBuildInfo(getProject(), BUILDER_ID);
// autodiscoveryEnabled = buildInfo.isAutoDiscoveryEnabled();
-//
+//
// if (autodiscoveryEnabled) {
// monitor.beginTask("ScannerConfigBuilder.Invoking_Builder", 100); //$NON-NLS-1$
-// monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
+// monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
// getProject().getName());
// ScannerInfoCollector.getInstance().updateScannerConfiguration(getProject(), new SubProgressMonitor(monitor, 100));
// }
-
+
buildInfo2 = ScannerConfigProfileManager.createScannerConfigBuildInfo2(getProject());
autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
if (autodiscoveryEnabled2) {
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
- monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
+ monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
getProject().getName());
-
+
// get scanner info from all external providers
SCJobsUtil.getProviderScannerInfo(getProject(), buildInfo2, new SubProgressMonitor(monitor, 70));
// update and persist scanner configuration
SCJobsUtil.updateScannerConfiguration(getProject(), buildInfo2, new SubProgressMonitor(monitor, 30));
}
- }
+ }
catch (CoreException e) {
// builder not installed or disabled
// autodiscoveryEnabled = false;
@@ -96,12 +103,12 @@ public class ScannerConfigBuilder extends ACBuilder {
}
return getProject().getReferencedProjects();
}
-
+
protected boolean buildNewStyle(IProject project, IProgressMonitor monitor) throws CoreException{
ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project, false);
if(!CCorePlugin.getDefault().isNewStyleProject(des))
return false;
-
+
ICConfigurationDescription[] cfgs = des.getConfigurations();
IScannerConfigBuilderInfo2Set container = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(project);
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.0"), cfgs.length + 1); //$NON-NLS-1$
@@ -119,32 +126,33 @@ public class ScannerConfigBuilder extends ACBuilder {
if(build(project, context, info, new SubProgressMonitor(monitor, 1)))
wasbuilt = true;
}
-
+
if(wasbuilt)
CCorePlugin.getDefault().updateProjectDescriptions(new IProject[]{project}, new SubProgressMonitor(monitor, 1));
-
+
monitor.done();
return true;
}
-
+
protected boolean build(IProject project, InfoContext context, IScannerConfigBuilderInfo2 buildInfo2, IProgressMonitor monitor){
- boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
+ if (ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(getProject())) {
+ boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
+ if (autodiscoveryEnabled2) {
+ monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
+ monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
+ getProject().getName());
- if (autodiscoveryEnabled2) {
- monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
- monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
- getProject().getName());
-
- // get scanner info from all external providers
- SCJobsUtil.getProviderScannerInfo(getProject(), context, buildInfo2, new SubProgressMonitor(monitor, 70));
+ // get scanner info from all external providers
+ SCJobsUtil.getProviderScannerInfo(getProject(), context, buildInfo2, new SubProgressMonitor(monitor, 70));
- // update and persist scanner configuration
- SCJobsUtil.updateScannerConfiguration(getProject(), context, buildInfo2, new SubProgressMonitor(monitor, 30));
- return true;
- }
- return false;
+ // update and persist scanner configuration
+ SCJobsUtil.updateScannerConfiguration(getProject(), context, buildInfo2, new SubProgressMonitor(monitor, 30));
+ return true;
+ }
+ }
+ return false;
}
-
-
+
+
}

Back to the top