mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 16:56:04 +02:00
bug 219337 - option to change how referenced projects are build
This commit is contained in:
parent
cbdea1288c
commit
b3f4a2c33c
5 changed files with 79 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Intel Corporation and others.
|
||||
* Copyright (c) 2007, 2008 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
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.core;
|
||||
|
||||
|
@ -559,7 +560,7 @@ public class CommonBuilder extends ACBuilder {
|
|||
updateOtherConfigs(info, builders, kind);
|
||||
|
||||
monitor.done();
|
||||
return project.getReferencedProjects();
|
||||
return refProjects;
|
||||
}
|
||||
|
||||
private Set<IProject> buildReferencedConfigs(IConfiguration[] cfgs, IProgressMonitor monitor){
|
||||
|
@ -574,6 +575,21 @@ public class CommonBuilder extends ACBuilder {
|
|||
IConfiguration cfg = cfgs[i];
|
||||
IBuilder builder = cfg.getEditableBuilder();
|
||||
// CfgBuildInfo bInfo = new CfgBuildInfo(builder, false);
|
||||
|
||||
//bug 219337
|
||||
if (buildRefConfig()){
|
||||
IProject currProject = cfg.getOwner().getProject(); //get the project of the current referenced configuration
|
||||
IBuilder[] builders = new IBuilder[]{builder};
|
||||
IConfiguration[] refConfigs = getReferencedConfigs(builders); //referenced configurations of the current project
|
||||
if (refConfigs.length <=0) { //if this is not a dependent project, then we don't build unless there's a change within the workspace
|
||||
IResourceDelta delta = getDelta(currProject);
|
||||
if (delta != null && delta.getAffectedChildren().length <= 0) { //do not build when there are no changes since last build
|
||||
projSet.addAll(Arrays.asList(currProject.getReferencedProjects()));
|
||||
return projSet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(VERBOSE)
|
||||
outputTrace(cfg.getOwner().getProject().getName(), ">>>>building reference cfg " + cfg.getName()); //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.resources;
|
||||
|
||||
|
@ -24,6 +25,7 @@ import org.eclipse.core.runtime.Preferences;
|
|||
public abstract class ACBuilder extends IncrementalProjectBuilder implements IMarkerGenerator {
|
||||
|
||||
private static final String PREF_BUILD_ALL_CONFIGS = "build.all.configs.enabled"; //$NON-NLS-1$
|
||||
private static final String PREF_BUILD_REFERENCED_CONFIGS = "build.proj.ref.configs.enabled"; //$NON-NLS-1$
|
||||
private static final Preferences prefs = CCorePlugin.getDefault().getPluginPreferences();
|
||||
|
||||
/**
|
||||
|
@ -102,4 +104,26 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
|||
prefs.setValue(PREF_BUILD_ALL_CONFIGS, enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preference for building referenced projects only when there are changes within Eclipse.
|
||||
* Dependent projects will be built regardless.
|
||||
* @return true if referenced projects will be build when changes within the project in Eclipse
|
||||
* false otherwise
|
||||
* @since 5.1
|
||||
*/
|
||||
public static boolean buildRefConfig() {
|
||||
//bug 219337
|
||||
return prefs.getBoolean(PREF_BUILD_REFERENCED_CONFIGS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preference for building referenced projects only when there are changes within Eclipse.
|
||||
* Dependent projects will be built regardless.
|
||||
* @param enable
|
||||
* @since 5.1
|
||||
*/
|
||||
public static void setBuildRefConfig(boolean enable) {
|
||||
prefs.setValue(PREF_BUILD_REFERENCED_CONFIGS, enable);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
|
|||
private static final String USE_STRUCTURAL_PARSE_MODE_LABEL= PreferencesMessages.CPluginPreferencePage_structuralParseMode_label;
|
||||
private static final int GROUP_VINDENT = 5;
|
||||
private static final int GROUP_HINDENT = 20;
|
||||
private Button b1, b2;
|
||||
private Button b1, b2, b3;
|
||||
|
||||
public CPluginPreferencePage() {
|
||||
super(GRID);
|
||||
|
@ -123,7 +123,31 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
|
|||
gd.verticalIndent = GROUP_VINDENT;
|
||||
noteControl.setLayoutData(gd);
|
||||
|
||||
// Building project dependencies
|
||||
Group gr2 = new Group(parent, SWT.NONE);
|
||||
gr2.setText(PreferencesMessages.CPluginPreferencePage_5);
|
||||
GridData gd2 = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd2.verticalIndent = GROUP_VINDENT;
|
||||
gr2.setLayoutData(gd2);
|
||||
gr2.setLayout(new GridLayout());
|
||||
|
||||
boolean b2 = ACBuilder.buildRefConfig();
|
||||
|
||||
b3 = new Button(gr2, SWT.CHECK);
|
||||
b3.setText(PreferencesMessages.CPluginPreferencePage_7);
|
||||
gd2 = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd2.verticalIndent = GROUP_VINDENT;
|
||||
b3.setLayoutData(gd2);
|
||||
b3.setSelection(b2);
|
||||
|
||||
noteControl= createNoteComposite(
|
||||
JFaceResources.getDialogFont(),
|
||||
gr2,
|
||||
PreferencesMessages.CPluginPreferencePage_note,
|
||||
PreferencesMessages.CPluginPreferencePage_6);
|
||||
gd2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
|
||||
gd2.verticalIndent = GROUP_VINDENT;
|
||||
noteControl.setLayoutData(gd2);
|
||||
}
|
||||
@Override
|
||||
protected Composite createNoteComposite(Font font, Composite composite,
|
||||
|
@ -177,6 +201,7 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
|
|||
prefs.setDefault(PreferenceConstants.PREF_LINK_TO_EDITOR, false);
|
||||
prefs.setDefault(PreferenceConstants.PREF_USE_STRUCTURAL_PARSE_MODE, false);
|
||||
ACBuilder.setAllConfigBuild(false);
|
||||
ACBuilder.setBuildRefConfig(false);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -189,6 +214,7 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
|
|||
// tell the Core Plugin about this preference
|
||||
CCorePlugin.getDefault().setStructuralParseMode(useStructuralParseMode());
|
||||
ACBuilder.setAllConfigBuild(b2.getSelection());
|
||||
ACBuilder.setBuildRefConfig(b3.getSelection());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -196,7 +222,9 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
|
|||
protected void performDefaults() {
|
||||
super.performDefaults();
|
||||
ACBuilder.setAllConfigBuild(false);
|
||||
ACBuilder.setBuildRefConfig(false);
|
||||
b1.setSelection(true);
|
||||
b2.setSelection(false);
|
||||
b3.setSelection(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -294,6 +294,9 @@ public final class PreferencesMessages extends NLS {
|
|||
public static String CPluginPreferencePage_2;
|
||||
public static String CPluginPreferencePage_3;
|
||||
public static String CPluginPreferencePage_4;
|
||||
public static String CPluginPreferencePage_5;
|
||||
public static String CPluginPreferencePage_6;
|
||||
public static String CPluginPreferencePage_7;
|
||||
public static String CPluginPreferencePage_caption;
|
||||
public static String CPluginPreferencePage_structuralParseMode_label;
|
||||
public static String CPluginPreferencePage_note;
|
||||
|
|
|
@ -332,11 +332,16 @@ CPluginPreferencePage_1=Commands 'Build project', 'Build All', 'Build Working Se
|
|||
CPluginPreferencePage_2=Build a&ctive configuration in each project
|
||||
CPluginPreferencePage_3=Build a&ll configurations in each project
|
||||
CPluginPreferencePage_4=This feature is applicable only to projects that support separate configurations.
|
||||
CPluginPreferencePage_5=Building project dependencies
|
||||
CPluginPreferencePage_6=Projects with dependencies will still be build regardless
|
||||
CPluginPreferencePage_7=Build referenced projects only when there are Eclipse qresource changes within the projects
|
||||
CPluginPreferencePage_caption= General settings for C/C++ Development:
|
||||
CPluginPreferencePage_structuralParseMode_label= &Follow unindexed header files when producing the outline view
|
||||
CPluginPreferencePage_note= Note:
|
||||
CPluginPreferencePage_performanceHint= Enabling this preference may have negative impact on performance.
|
||||
|
||||
|
||||
|
||||
PropertyAndPreferencePage_useworkspacesettings_change=Configure Workspace Settings...
|
||||
PropertyAndPreferencePage_showprojectspecificsettings_label=Configure Project Specific Settings...
|
||||
PropertyAndPreferencePage_useprojectsettings_label=Enable pr&oject specific settings
|
||||
|
|
Loading…
Add table
Reference in a new issue