1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Build Output Concolse parser added for ManagedGCC discpvery profiles

This commit is contained in:
Mikhail Sennikovsky 2007-08-09 12:38:52 +00:00
parent f089bbf2b4
commit c11d44bf9e
5 changed files with 138 additions and 9 deletions

View file

@ -530,4 +530,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
this.project = context.getProject();
}
public InfoContext getContext(){
return this.context;
}
}

View file

@ -79,6 +79,10 @@
<scannerInfoCollector
class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
scope="project"/>
<buildOutputProvider>
<open/>
<scannerInfoConsoleParser class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedGCCScannerInfoConsoleParser"/>
</buildOutputProvider>
<scannerInfoProvider providerId="specsFile">
<run
arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}"
@ -94,6 +98,10 @@
<scannerInfoCollector
class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
scope="project"/>
<buildOutputProvider>
<open/>
<scannerInfoConsoleParser class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedGCCScannerInfoConsoleParser"/>
</buildOutputProvider>
<scannerInfoProvider providerId="specsFile">
<run
arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp"
@ -109,6 +117,10 @@
<scannerInfoCollector
class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
scope="project"/>
<buildOutputProvider>
<open/>
<scannerInfoConsoleParser class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedGCCScannerInfoConsoleParser"/>
</buildOutputProvider>
<scannerInfoProvider providerId="specsFile">
<run
arguments="-E -P -v -dD ${plugin_state_location}/specs.c"
@ -124,6 +136,10 @@
<scannerInfoCollector
class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector"
scope="project"/>
<buildOutputProvider>
<open/>
<scannerInfoConsoleParser class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedGCCScannerInfoConsoleParser"/>
</buildOutputProvider>
<scannerInfoProvider providerId="specsFile">
<run
arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}"
@ -139,6 +155,10 @@
<scannerInfoCollector
class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector"
scope="project"/>
<buildOutputProvider>
<open/>
<scannerInfoConsoleParser class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedGCCScannerInfoConsoleParser"/>
</buildOutputProvider>
<scannerInfoProvider providerId="specsFile">
<run
arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp"
@ -154,6 +174,10 @@
<scannerInfoCollector
class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector"
scope="project"/>
<buildOutputProvider>
<open/>
<scannerInfoConsoleParser class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedGCCScannerInfoConsoleParser"/>
</buildOutputProvider>
<scannerInfoProvider providerId="specsFile">
<run
arguments="-E -P -v -dD ${plugin_state_location}/specs.c"

View file

@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.cdt.build.core.scannerconfig;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
@ -17,6 +19,7 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.core.resources.IProject;
@ -91,8 +94,8 @@ public final class CfgInfoContext{
}
return fContext;
}
public static CfgInfoContext fromInfoContext(IConfiguration cfg, InfoContext context) {
public static CfgInfoContext fromInfoContext(ICProjectDescription des, InfoContext context) {
IProject project = context.getProject();
if(project == null)
return null;
@ -103,9 +106,19 @@ public final class CfgInfoContext{
String[] ids = CDataUtil.stringToArray(instanceId, DELIMITER);
String cfgId = ids[0];
if(!cfgId.equals(cfg.getId()))
ICConfigurationDescription cfgDes = des.getConfigurationById(cfgId);
if(cfgDes == null)
return null;
IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgDes);
if(cfg == null)
return null;
return doCreate(cfg, ids, context);
}
private static CfgInfoContext doCreate(IConfiguration cfg, String[] ids, InfoContext context){
String rcInfoId = null, toolId = null, inTypeId = null;
IResourceInfo rcInfo = null;
ITool tool = null;
@ -142,6 +155,24 @@ public final class CfgInfoContext{
if(rcInfo != null)
return new CfgInfoContext(rcInfo, tool, inType, context);
return new CfgInfoContext(cfg, context);
}
public static CfgInfoContext fromInfoContext(IConfiguration cfg, InfoContext context) {
IProject project = context.getProject();
if(project == null)
return null;
String instanceId = context.getInstanceId();
if(instanceId.length() == 0)
return null;
String[] ids = CDataUtil.stringToArray(instanceId, DELIMITER);
String cfgId = ids[0];
if(!cfgId.equals(cfg.getId()))
return null;
return doCreate(cfg, ids, context);
}
private static IBuildObject find(IBuildObject objs[], String id){

View file

@ -0,0 +1,70 @@
/*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.scannerconfig;
import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerInfoConsoleParser;
import org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.core.resources.IProject;
public class ManagedGCCScannerInfoConsoleParser extends
GCCScannerInfoConsoleParser {
Boolean fManagedBuildOnState;
public boolean processLine(String line) {
if(isManagedBuildOn())
return false;
return super.processLine(line);
}
public void shutdown() {
if(!isManagedBuildOn()){
super.shutdown();
}
fManagedBuildOnState = null;
}
public void startup(IProject project, IScannerInfoCollector collector) {
if(isManagedBuildOn())
return;
super.startup(project, collector);
}
protected boolean isManagedBuildOn(){
if(fManagedBuildOnState == null)
fManagedBuildOnState = Boolean.valueOf(doCalcManagedBuildOnState());
return fManagedBuildOnState.booleanValue();
}
protected boolean doCalcManagedBuildOnState(){
IScannerInfoCollector cr = getCollector();
InfoContext c;
if(cr instanceof PerProjectSICollector){
c = ((PerProjectSICollector)cr).getContext();
} else {
return false;
}
IProject project = c.getProject();
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(project, false);
CfgInfoContext cc = CfgInfoContext.fromInfoContext(des, c);
if(cc != null){
IConfiguration cfg = cc.getConfiguration();
return cfg.isManagedBuildOn();
}
return false;
}
}

View file

@ -644,27 +644,27 @@
<extension
point="org.eclipse.cdt.make.ui.DiscoveryProfilePage">
<profilePage
class="org.eclipse.cdt.make.ui.dialogs.MBSPerProjectSCDProfilePage"
class="org.eclipse.cdt.make.ui.dialogs.GCCPerProjectSCDProfilePage"
name="%MBSPerProjectProfile.name"
profileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"/>
<profilePage
class="org.eclipse.cdt.make.ui.dialogs.MBSPerProjectSCDProfilePage"
class="org.eclipse.cdt.make.ui.dialogs.GCCPerProjectSCDProfilePage"
name="%MBSPerProjectProfile.name"
profileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profilePage
class="org.eclipse.cdt.make.ui.dialogs.MBSPerProjectSCDProfilePage"
class="org.eclipse.cdt.make.ui.dialogs.GCCPerProjectSCDProfilePage"
name="%MBSPerProjectProfile.name"
profileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
<profilePage
class="org.eclipse.cdt.make.ui.dialogs.MBSPerProjectSCDProfilePage"
class="org.eclipse.cdt.make.ui.dialogs.GCCPerProjectSCDProfilePage"
name="%MBSPerProjectProfile.name"
profileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"/>
<profilePage
class="org.eclipse.cdt.make.ui.dialogs.MBSPerProjectSCDProfilePage"
class="org.eclipse.cdt.make.ui.dialogs.GCCPerProjectSCDProfilePage"
name="%MBSPerProjectProfile.name"
profileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
<profilePage
class="org.eclipse.cdt.make.ui.dialogs.MBSPerProjectSCDProfilePage"
class="org.eclipse.cdt.make.ui.dialogs.GCCPerProjectSCDProfilePage"
name="%MBSPerProjectProfile.name"
profileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"/>
</extension>