Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml14
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/1.2/test12.zipbin0 -> 1862 bytes
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.0/test20.zipbin0 -> 40872 bytes
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/CTestPlugin.java48
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ManagedBuildTestHelper.java121
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java7
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java1106
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedCommandLineGeneratorTest.java104
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedProjectUpdateTests.java169
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/TestManagedConfigProvider.java13
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/plugin.xml4
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd1478
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd939
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java159
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java268
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfigurationV2.java178
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java147
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedCommandLineGenerator.java28
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedCommandLineInfo.java61
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedProject.java147
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java173
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOptionCategory.java30
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IProjectType.java131
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IResourceConfiguration.java171
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java43
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITargetPlatform.java130
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java232
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolChain.java251
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolReference.java39
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java1075
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java7
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java526
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java1288
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ConfigurationV2.java710
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java29
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java586
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedCommandLineGenerator.java109
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedCommandLineInfo.java94
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java357
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java1248
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java272
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java178
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java336
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java618
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java269
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java531
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java1420
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java960
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java231
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/scannerconfig/ManagedBuildCPathEntryContainer.java61
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java151
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/ConverterMessages.java52
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/PluginResources.properties42
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject12.java (renamed from build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/actions/UpdateManagedProjectAction.java)445
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java428
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProjectManager.java295
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/plugin.properties4
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/plugin.xml2845
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildSettingsBlock.java497
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ErrorParserBlock.java80
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuildOptionBlock.java271
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedMakeStartup.java52
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedProjectOptionBlock.java27
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties63
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ToolsSettingsBlock.java639
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionComboFieldEditor.java19
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsPage.java270
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java880
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildSettingsPage.java56
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java389
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java197
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ManageConfigDialog.java252
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ManagedBuilderPropertyPage.java174
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/NewConfigurationDialog.java30
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ResourceBuildPropertyPage.java487
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListContentProvider.java35
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListLabelProvider.java7
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java107
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConfigurationContentProvider.java9
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java20
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java93
81 files changed, 20241 insertions, 5771 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml b/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml
index d06a3d86224..00c2156cd2f 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml
@@ -4,7 +4,8 @@
id="org.eclipse.cdt.managedbuilder.core.tests"
name="Tests"
version="2.1.0"
- provider-name="Eclipse.org">
+ provider-name="Eclipse.org"
+ class="org.eclipse.cdt.managedbuilder.testplugin.CTestPlugin">
<requires>
<import plugin="org.eclipse.core.runtime"/>
@@ -13,6 +14,8 @@
<import plugin="org.eclipse.cdt.core"/>
<import plugin="org.eclipse.cdt.make.core"/>
<import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.ui.ide"/>
</requires>
@@ -364,6 +367,12 @@
id="test.forward.parent.category">
</optionCategory>
</tool>
+ <configuration
+ name="Who Cares"
+ id="test.forward.parent.config">
+ <toolReference
+ id="test.forward.tool"/>
+ </configuration>
</target>
<target
isTest="true"
@@ -381,6 +390,9 @@
command="EP"
id="error.parsers.tool">
</tool>
+ <configuration
+ name="EP Config"
+ id="ep.config"/>
</target>
</extension>
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/1.2/test12.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/1.2/test12.zip
new file mode 100644
index 00000000000..8a12bbf6887
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/1.2/test12.zip
Binary files differ
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.0/test20.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.0/test20.zip
new file mode 100644
index 00000000000..46411a915f8
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.0/test20.zip
Binary files differ
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/CTestPlugin.java b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/CTestPlugin.java
new file mode 100644
index 00000000000..39a4455f553
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/CTestPlugin.java
@@ -0,0 +1,48 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.testplugin;
+
+import java.io.File;
+import java.net.URL;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+
+public class CTestPlugin extends Plugin {
+
+ private static CTestPlugin fgDefault;
+
+ public CTestPlugin() {
+ fgDefault= this;
+ }
+
+ public static CTestPlugin getDefault() {
+ return fgDefault;
+ }
+
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ public static File getFileInPlugin(IPath path) {
+ try {
+ URL url = getDefault().find(path,null);
+ url= Platform.asLocalURL(url);
+ return new File(url.getFile());
+
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ManagedBuildTestHelper.java b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ManagedBuildTestHelper.java
new file mode 100644
index 00000000000..b867f1f4163
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ManagedBuildTestHelper.java
@@ -0,0 +1,121 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.testplugin;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.zip.ZipFile;
+
+import junit.framework.Assert;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.ui.dialogs.IOverwriteQuery;
+import org.eclipse.ui.wizards.datatransfer.ImportOperation;
+import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
+
+public class ManagedBuildTestHelper {
+ /* (non-Javadoc)
+ * Create a new project named <code>name</code> or return the project in
+ * the workspace of the same name if it exists.
+ *
+ * @param name The name of the project to create or retrieve.
+ * @return
+ * @throws CoreException
+ */
+ static public IProject createProject(String name) throws CoreException {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IProject newProjectHandle = root.getProject(name);
+ IProject project = null;
+
+ if (!newProjectHandle.exists()) {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription workspaceDesc = workspace.getDescription();
+ workspaceDesc.setAutoBuilding(false);
+ workspace.setDescription(workspaceDesc);
+ IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
+ //description.setLocation(root.getLocation());
+ project = CCorePlugin.getDefault().createCProject(description, newProjectHandle, new NullProgressMonitor(), MakeCorePlugin.MAKE_PROJECT_ID);
+ } else {
+ newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, null);
+ project = newProjectHandle;
+ }
+
+ // Open the project if we have to
+ if (!project.isOpen()) {
+ project.open(new NullProgressMonitor());
+ }
+
+ return project;
+ }
+
+ /**
+ * Remove the <code>IProject</code> with the name specified in the argument from the
+ * receiver's workspace.
+ *
+ * @param name
+ */
+ static public void removeProject(String name) {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IProject project = root.getProject(name);
+ if (project.exists()) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ } finally {
+ try {
+ System.gc();
+ System.runFinalization();
+ project.delete(true, true, null);
+ } catch (CoreException e2) {
+ Assert.assertTrue(false);
+ }
+ }
+ }
+ }
+
+ static public IProject createProject(String projectName, File zip) throws CoreException, InvocationTargetException, IOException {
+ IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
+ IProject project= root.getProject(projectName);
+ if (project.exists())
+ removeProject(projectName);
+
+ importFilesFromZip(new ZipFile(zip),project.getFullPath(),null);
+
+ return createProject(projectName);
+ }
+
+ static public void importFilesFromZip(ZipFile srcZipFile, IPath destPath, IProgressMonitor monitor) throws InvocationTargetException {
+ ZipFileStructureProvider structureProvider= new ZipFileStructureProvider(srcZipFile);
+ try {
+ ImportOperation op= new ImportOperation(destPath, structureProvider.getRoot(), structureProvider, new IOverwriteQuery() {
+ public String queryOverwrite(String file) {
+ return ALL;
+ }
+ });
+ op.run(monitor);
+ } catch (InterruptedException e) {
+ // should not happen
+ }
+ }
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java
index ca7e287cf62..8bc3cfa5a68 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java
@@ -10,7 +10,10 @@
**********************************************************************/
package org.eclipse.cdt.managedbuilder.tests.suite;
+import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.managedbuild.core.tests.ManagedBuildCoreTests;
+import org.eclipse.cdt.managedbuild.core.tests.ManagedCommandLineGeneratorTest;
+import org.eclipse.cdt.managedbuild.core.tests.ManagedProjectUpdateTests;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -20,13 +23,17 @@ import junit.framework.TestSuite;
*/
public class AllManagedBuildTests {
public static void main(String[] args) {
+ CCorePlugin.getDefault().getCoreModel().getIndexManager().reset();
junit.textui.TestRunner.run(AllManagedBuildTests.suite());
}
public static Test suite() {
TestSuite suite = new TestSuite(
"Test for org.eclipse.cdt.managedbuild.core.tests");
//$JUnit-BEGIN$
+// TODO uncoment this
suite.addTest(ManagedBuildCoreTests.suite());
+ suite.addTest(ManagedProjectUpdateTests.suite());
+ suite.addTest( ManagedCommandLineGeneratorTest.suite() );
//$JUnit-END$
return suite;
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java
index 9772909426a..7ad5f9478f3 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java
@@ -12,7 +12,6 @@ package org.eclipse.cdt.managedbuild.core.tests;
import java.io.ByteArrayInputStream;
import java.util.Arrays;
-import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -36,18 +35,18 @@ import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.managedbuilder.core.IToolReference;
+import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
import org.eclipse.cdt.managedbuilder.internal.core.Option;
-import org.eclipse.cdt.managedbuilder.internal.core.OptionReference;
-import org.eclipse.cdt.managedbuilder.internal.core.ToolReference;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -91,7 +90,7 @@ public class ManagedBuildCoreTests extends TestCase {
suite.addTest(new ManagedBuildCoreTests("testProjectCreation"));
suite.addTest(new ManagedBuildCoreTests("testConfigurations"));
suite.addTest(new ManagedBuildCoreTests("testConfigurationReset"));
- suite.addTest(new ManagedBuildCoreTests("testTargetBuildArtifact"));
+ suite.addTest(new ManagedBuildCoreTests("testConfigBuildArtifact"));
suite.addTest(new ManagedBuildCoreTests("testMakeCommandManipulation"));
suite.addTest(new ManagedBuildCoreTests("testScannerInfoInterface"));
suite.addTest(new ManagedBuildCoreTests("testBug43450"));
@@ -107,50 +106,50 @@ public class ManagedBuildCoreTests extends TestCase {
* defined in this plugin
*/
public void testExtensions() throws Exception {
- ITarget testRoot = null;
- ITarget testSub = null;
- ITarget testSubSub = null;
- ITarget testForwardChild = null;
- ITarget testForwardParent = null;
- ITarget testForwardGrandchild = null;
- int numProviderTargets = 0;
+ IProjectType testRoot = null;
+ IProjectType testSub = null;
+ IProjectType testSubSub = null;
+ IProjectType testForwardChild = null;
+ IProjectType testForwardParent = null;
+ IProjectType testForwardGrandchild = null;
+ int numTypes = 0;
// Note secret null parameter which means just extensions
- ITarget[] targets = ManagedBuildManager.getDefinedTargets(null);
+ IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
- for (int i = 0; i < targets.length; ++i) {
- ITarget target = targets[i];
+ for (int i = 0; i < projTypes.length; ++i) {
+ IProjectType type = projTypes[i];
- if (target.getName().equals("Test Root")) {
- testRoot = target;
- checkRootTarget(testRoot);
- } else if (target.getName().equals("Test Sub")) {
- testSub = target;
- checkSubTarget(testSub);
- } else if (target.getName().equals("Test Sub Sub")) {
- testSubSub = target;
- checkSubSubTarget(testSubSub);
- } else if (target.getName().equals("Forward Child")) {
- testForwardChild = target;
- } else if (target.getName().equals("Forward Parent")) {
- testForwardParent = target;
- } else if (target.getName().equals("Forward Grandchild")) {
- testForwardGrandchild = target;
- } else if (target.getId().startsWith("test.provider.Test_")) {
- numProviderTargets++;
- checkProviderTarget(target);
+ if (type.getName().equals("Test Root")) {
+ testRoot = type;
+ checkRootProjectType(testRoot);
+ } else if (type.getName().equals("Test Sub")) {
+ testSub = type;
+ checkSubProjectType(testSub);
+ } else if (type.getName().equals("Test Sub Sub")) {
+ testSubSub = type;
+ checkSubSubProjectType(testSubSub);
+ } else if (type.getName().equals("Forward Child")) {
+ testForwardChild = type;
+ } else if (type.getName().equals("Forward Parent")) {
+ testForwardParent = type;
+ } else if (type.getName().equals("Forward Grandchild")) {
+ testForwardGrandchild = type;
+ } else if (type.getId().startsWith("test.provider.Test_")) {
+ numTypes++;
+ checkProviderProjectType(type);
}
}
// check that the forward references are properly resolved.
assertNotNull(testForwardChild);
assertNotNull(testForwardParent);
assertNotNull(testForwardGrandchild);
- checkForwardTargets(testForwardParent, testForwardChild, testForwardGrandchild);
+ checkForwardProjectTypes(testForwardParent, testForwardChild, testForwardGrandchild);
- // check that the proper number of target were dynamically provided
- assertEquals(3, numProviderTargets);
+ // check that the proper number of projectTypes were dynamically provided
+ assertEquals(3, numTypes);
- // All these targets are defines in the plugin files, so none
+ // All these project types are defines in the plugin files, so none
// of them should be null at this point
assertNotNull(testRoot);
assertNotNull(testSub);
@@ -158,7 +157,7 @@ public class ManagedBuildCoreTests extends TestCase {
}
/**
- * This test exercises the interface the <code>ITarget</code> exposes to manipulate
+ * This test exercises the interface the <code>IConfiguration</code> exposes to manipulate
* its make command.
*/
public void testMakeCommandManipulation () {
@@ -179,23 +178,27 @@ public class ManagedBuildCoreTests extends TestCase {
}
assertNotNull(project);
- // Now open the root target
- ITarget[] targets = ManagedBuildManager.getTargets(project);
- assertEquals(1, targets.length);
+ // Now get the default configuration
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ assertNotNull(info);
+ IManagedProject managedProj = info.getManagedProject();
+ assertNotNull(managedProj);
+ IConfiguration defaultConfig = info.getDefaultConfiguration();
+ assertNotNull(defaultConfig);
- // Does it have a default make command
- assertFalse(targets[0].hasOverridenMakeCommand());
- assertEquals(oldMakeCmd, targets[0].getMakeCommand());
+ // Does it have a default build command
+ assertFalse(defaultConfig.hasOverriddenBuildCommand());
+ assertEquals(oldMakeCmd, defaultConfig.getBuildCommand());
// Change it
- targets[0].setMakeCommand(newMakeCmd);
- assertEquals(newMakeCmd, targets[0].getMakeCommand());
- assertTrue(targets[0].hasOverridenMakeCommand());
+ defaultConfig.setBuildCommand(newMakeCmd);
+ assertEquals(newMakeCmd, defaultConfig.getBuildCommand());
+ assertTrue(defaultConfig.hasOverriddenBuildCommand());
// Reset it
- targets[0].resetMakeCommand();
- assertFalse(targets[0].hasOverridenMakeCommand());
- assertEquals(oldMakeCmd, targets[0].getMakeCommand());
+ defaultConfig.setBuildCommand(null);
+ assertFalse(defaultConfig.hasOverriddenBuildCommand());
+ assertEquals(oldMakeCmd, defaultConfig.getBuildCommand());
ManagedBuildManager.saveBuildInfo(project, false);
}
@@ -203,7 +206,7 @@ public class ManagedBuildCoreTests extends TestCase {
/**
* The purpose of this test is to exercise the build path info interface.
- * To get to that point, a new target/config has to be created in the test
+ * To get to that point, a new project/config has to be created in the test
* project and the default configuration changed.
*
* @throws CoreException
@@ -232,31 +235,46 @@ public class ManagedBuildCoreTests extends TestCase {
expectedPaths[3] = (new Path("C:\\home\\tester/include")).toOSString();
expectedPaths[4] = project.getLocation().append( "Sub Config\\\"..\\includes\"" ).toOSString();
- // Create a new target in the project based on the sub target
- ITarget baseTarget = ManagedBuildManager.getTarget(project, "test.sub");
- assertNotNull(baseTarget);
- ITarget newTarget = null;
+ // Create a new managed project based on the sub project type
+ IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.sub");
+ assertNotNull(projType);
+
+ // Create the managed-project (.cdtbuild) for our project
+ IManagedProject newProject = null;
try {
- newTarget = ManagedBuildManager.createTarget(project, baseTarget);
+ newProject = ManagedBuildManager.createManagedProject(project, projType);
} catch (BuildException e) {
- fail("Failed adding new target to project: " + e.getLocalizedMessage());
+ fail("Failed creating new project: " + e.getLocalizedMessage());
}
- assertNotNull(newTarget);
-
+ assertNotNull(newProject);
+ ManagedBuildManager.setNewProjectVersion(project);
+
// Copy over the configs
- IConfiguration[] baseConfigs = baseTarget.getConfigurations();
+ IConfiguration[] baseConfigs = projType.getConfigurations();
for (int i = 0; i < baseConfigs.length; ++i) {
- newTarget.createConfiguration(baseConfigs[i], baseConfigs[i].getId() + "." + i);
+ newProject.createConfiguration(baseConfigs[i], baseConfigs[i].getId() + "." + i);
}
// Change the default configuration to the sub config
- IConfiguration[] configs = newTarget.getConfigurations();
+ IConfiguration[] configs = newProject.getConfigurations();
assertEquals(4, configs.length);
IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
- buildInfo.setDefaultConfiguration(newTarget.getConfiguration(configs[0].getId()));
+ buildInfo.setDefaultConfiguration(newProject.getConfiguration(configs[0].getId()));
- // Save the build info
- ManagedBuildManager.saveBuildInfo(project, false);
+ // Save, close, reopen
+ ManagedBuildManager.saveBuildInfo(project, true);
+ ManagedBuildManager.removeBuildInfo(project);
+ try {
+ project.close(null);
+ } catch (CoreException e) {
+ fail("Failed on project close: " + e.getLocalizedMessage());
+ }
+ try {
+ project.open(null);
+ } catch (CoreException e) {
+ fail("Failed on project open: " + e.getLocalizedMessage());
+ }
+ buildInfo = ManagedBuildManager.getBuildInfo(project);
// Use the plugin mechanism to discover the supplier of the path information
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID + ".ScannerInfoProvider");
@@ -299,12 +317,12 @@ public class ManagedBuildCoreTests extends TestCase {
// Add some defined symbols programmatically
String[] expectedSymbols = {"DEBUG", "GNOME = ME "};
- IConfiguration defaultConfig = buildInfo.getDefaultConfiguration(newTarget);
+ IConfiguration defaultConfig = buildInfo.getDefaultConfiguration();
ITool[] tools = defaultConfig.getTools();
ITool subTool = null;
for (int i = 0; i < tools.length; i++) {
ITool tool = tools[i];
- if("tool.sub".equalsIgnoreCase(tool.getId())) {
+ if("tool.sub".equalsIgnoreCase(tool.getSuperClass().getId())) {
subTool = tool;
break;
}
@@ -314,15 +332,19 @@ public class ManagedBuildCoreTests extends TestCase {
IOption[] opts = subTool.getOptions();
for (int i = 0; i < opts.length; i++) {
IOption option = opts[i];
- if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
- symbolOpt = option;
- break;
+ try {
+ if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
+ symbolOpt = option;
+ break;
+ }
+ } catch (BuildException e) {
+ fail("Failed getting option value-type: " + e.getLocalizedMessage());
}
}
assertNotNull(symbolOpt);
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
assertFalse(info.isDirty());
- ManagedBuildManager.setOption(defaultConfig, symbolOpt, expectedSymbols);
+ ManagedBuildManager.setOption(defaultConfig, subTool, symbolOpt, expectedSymbols);
assertTrue(info.isDirty());
info.setDirty(false);
assertFalse(info.isDirty());
@@ -353,11 +375,10 @@ public class ManagedBuildCoreTests extends TestCase {
assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
}
- // Make sure there is one and only one target with 3 configs
- ITarget[] definedTargets = ManagedBuildManager.getTargets(project);
- assertEquals(1, definedTargets.length);
- ITarget rootTarget = definedTargets[0];
- IConfiguration[] definedConfigs = rootTarget.getConfigurations();
+ // Make sure there is a ManagedProject with 3 configs
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ IManagedProject managedProj = info.getManagedProject();
+ IConfiguration[] definedConfigs = managedProj.getConfigurations();
assertEquals(3, definedConfigs.length);
IConfiguration baseConfig = definedConfigs[0];
assertEquals(definedConfigs[0].getName(), rootName);
@@ -365,8 +386,8 @@ public class ManagedBuildCoreTests extends TestCase {
assertEquals(definedConfigs[2].getName(), completeOverrideName);
// Create a new configuration and test the rename function
- IConfiguration newConfig = rootTarget.createConfiguration(baseConfig, testConfigId);
- assertEquals(4, rootTarget.getConfigurations().length);
+ IConfiguration newConfig = managedProj.createConfigurationClone(baseConfig, testConfigId);
+ assertEquals(4, managedProj.getConfigurations().length);
newConfig.setName(testConfigName);
assertEquals(newConfig.getId(), testConfigId);
assertEquals(newConfig.getName(), testConfigName);
@@ -384,37 +405,49 @@ public class ManagedBuildCoreTests extends TestCase {
// Override options in the new configuration
IOptionCategory topCategory = rootTool.getTopOptionCategory();
assertEquals("Root Tool", topCategory.getName());
- IOption[] options = topCategory.getOptions(null);
- assertEquals(2, options.length);
- ManagedBuildManager.setOption(newConfig, options[0], listVal);
- ManagedBuildManager.setOption(newConfig, options[1], boolVal);
+ Object[][] options = topCategory.getOptions(newConfig);
+ int i;
+ for (i=0; i<options.length; i++)
+ if (options[i][0] == null) break;
+ assertEquals(2, i);
+ ITool tool = (ITool)options[0][0];
+ IOption option = (IOption)options[0][1];
+ ManagedBuildManager.setOption(newConfig, tool, option, listVal);
+ option = (IOption)options[1][1];
+ ManagedBuildManager.setOption(newConfig, tool, option, boolVal);
IOptionCategory[] categories = topCategory.getChildCategories();
assertEquals(1, categories.length);
- options = categories[0].getOptions(null);
- assertEquals(4, options.length);
- ManagedBuildManager.setOption(newConfig, options[0], stringVal);
- ManagedBuildManager.setOption(newConfig, options[1], anotherStringVal);
- ManagedBuildManager.setOption(newConfig, options[2], enumVal);
- ManagedBuildManager.setOption(newConfig, options[3], "False");
+ options = categories[0].getOptions(newConfig);
+ for (i=0; i<options.length; i++)
+ if (options[i][0] == null) break;
+ assertEquals(4, i);
+ tool = (ITool)options[0][0];
+ option = (IOption)options[0][1];
+ ManagedBuildManager.setOption(newConfig, tool, option, stringVal);
+ option = (IOption)options[1][1];
+ ManagedBuildManager.setOption(newConfig, tool, option, anotherStringVal);
+ option = (IOption)options[2][1];
+ ManagedBuildManager.setOption(newConfig, tool, option, enumVal);
+ option = (IOption)options[3][1];
+ ManagedBuildManager.setOption(newConfig, tool, option, "False");
// Save, close, reopen and test again
ManagedBuildManager.saveBuildInfo(project, false);
- project.close(null);
ManagedBuildManager.removeBuildInfo(project);
+ project.close(null);
project.open(null);
// Test the values in the new configuration
checkOptionReferences(project);
- // Now delete the new configuration and test the target
- definedTargets = ManagedBuildManager.getTargets(project);
- assertEquals(1, definedTargets.length);
- rootTarget = definedTargets[0];
- definedConfigs = rootTarget.getConfigurations();
+ // Now delete the new configuration and test the managed project
+ info = ManagedBuildManager.getBuildInfo(project);
+ managedProj = info.getManagedProject();
+ definedConfigs = managedProj.getConfigurations();
assertEquals(4, definedConfigs.length);
- rootTarget.removeConfiguration(testConfigId);
- definedConfigs = rootTarget.getConfigurations();
+ managedProj.removeConfiguration(testConfigId);
+ definedConfigs = managedProj.getConfigurations();
assertEquals(3, definedConfigs.length);
assertEquals(definedConfigs[0].getName(), rootName);
assertEquals(definedConfigs[1].getName(), overrideName);
@@ -438,25 +471,25 @@ public class ManagedBuildCoreTests extends TestCase {
// Get the default configuration
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
assertNotNull(info);
- ITarget defaultTarget = info.getDefaultTarget();
- assertNotNull(defaultTarget);
- IConfiguration defaultConfig = info.getDefaultConfiguration(defaultTarget);
+ IManagedProject managedProj = info.getManagedProject();
+ assertNotNull(managedProj);
+ IConfiguration defaultConfig = info.getDefaultConfiguration();
assertNotNull(defaultConfig);
// See if it still contains the overridden values (see testProjectCreation())
try {
- checkRootTarget(defaultTarget);
+ checkRootManagedProject(managedProj, "z");
} catch (BuildException e1) {
- fail("Overridden root target check failed: " + e1.getLocalizedMessage());
+ fail("Overridden root managed project check failed: " + e1.getLocalizedMessage());
}
// Reset the config and retest
ManagedBuildManager.resetConfiguration(project, defaultConfig);
ManagedBuildManager.saveBuildInfo(project, false);
try {
- checkRootTarget(defaultTarget);
+ checkRootManagedProject(managedProj, "x");
} catch (BuildException e2) {
- fail("Reset root target check failed: " + e2.getLocalizedMessage());
+ fail("Reset root managed project check failed: " + e2.getLocalizedMessage());
}
}
@@ -480,38 +513,33 @@ public class ManagedBuildCoreTests extends TestCase {
} catch (CoreException e) {
fail("Test failed on project creation: " + e.getLocalizedMessage());
}
- // There should not be any targets defined for this project yet
- assertEquals(0, ManagedBuildManager.getTargets(project).length);
-
- // Find the base target definition
- ITarget targetDef = ManagedBuildManager.getTarget(project, "test.root");
- assertNotNull(targetDef);
-
- // Create the target for our project that builds a dummy executable
- ITarget newTarget = ManagedBuildManager.createTarget(project, targetDef);
- assertEquals(newTarget.getName(), targetDef.getName());
- assertFalse(newTarget.equals(targetDef));
- String buildArtifactName = projectName;
- newTarget.setArtifactName(buildArtifactName);
- newTarget.setArtifactExtension(newExt);
- ITarget[] targets = ManagedBuildManager.getTargets(project);
- assertEquals(1, targets.length);
- ITarget target = targets[0];
- assertEquals(target, newTarget);
- assertFalse(target.equals(targetDef));
+
+ // Find the base project type definition
+ IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.root");
+ assertNotNull(projType);
+
+ // Create the managed-project (.cdtbuild) for our project that builds a dummy executable
+ IManagedProject newProject = ManagedBuildManager.createManagedProject(project, projType);
+ assertEquals(newProject.getName(), projType.getName());
+ assertFalse(newProject.equals(projType));
+ ManagedBuildManager.setNewProjectVersion(project);
// Copy over the configs
IConfiguration defaultConfig = null;
- IConfiguration[] configs = targetDef.getConfigurations();
+ IConfiguration[] configs = projType.getConfigurations();
for (int i = 0; i < configs.length; ++i) {
// Make the first configuration the default
if (i == 0) {
- defaultConfig = target.createConfiguration(configs[i], target.getId() + "." + i);
+ defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i);
} else {
- target.createConfiguration(configs[i], target.getId() + "." + i);
+ newProject.createConfiguration(configs[i], projType.getId() + "." + i);
}
}
ManagedBuildManager.setDefaultConfiguration(project, defaultConfig);
+
+ String buildArtifactName = projectName;
+ defaultConfig.setArtifactName(buildArtifactName);
+ defaultConfig.setArtifactExtension(newExt);
// Initialize the path entry container
IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project);
@@ -520,28 +548,34 @@ public class ManagedBuildCoreTests extends TestCase {
}
// Now test the results out
- checkRootTarget(target);
+ checkRootManagedProject(newProject, "x");
// Override the "String Option in Category" option value
- configs = target.getConfigurations();
+ configs = newProject.getConfigurations();
ITool[] tools = configs[0].getTools();
IOptionCategory topCategory = tools[0].getTopOptionCategory();
IOptionCategory[] categories = topCategory.getChildCategories();
- IOption[] options = categories[0].getOptions(configs[0]);
- configs[0].setOption(options[0], "z");
- options = categories[0].getOptions(null);
- assertEquals("x", options[0].getStringValue());
+ Object[][] options = categories[0].getOptions(configs[0]);
+ ITool tool = (ITool)options[0][0];
+ IOption option = (IOption)options[0][1];
+ configs[0].setOption(tool, option, "z");
+ options = categories[0].getOptions((IConfiguration)null);
+ tool = (ITool)options[0][0];
+ option = (IOption)options[0][1];
+ assertEquals("x", option.getStringValue());
options = categories[0].getOptions(configs[0]);
- assertEquals("z", options[0].getStringValue());
+ tool = (ITool)options[0][0];
+ option = (IOption)options[0][1];
+ assertEquals("z", option.getStringValue());
// Save, close, reopen and test again
ManagedBuildManager.saveBuildInfo(project, true);
+ ManagedBuildManager.removeBuildInfo(project);
try {
project.close(null);
} catch (CoreException e) {
fail("Failed on project close: " + e.getLocalizedMessage());
}
- ManagedBuildManager.removeBuildInfo(project);
try {
project.open(null);
} catch (CoreException e) {
@@ -550,15 +584,10 @@ public class ManagedBuildCoreTests extends TestCase {
// Test that the default config was remembered
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
- assertEquals(defaultConfig.getId(), info.getDefaultConfiguration(target).getId());
+ assertEquals(defaultConfig.getId(), info.getDefaultConfiguration().getId());
- // Get the targets
- targets = ManagedBuildManager.getTargets(project);
- assertEquals(1, targets.length);
- // See if the artifact name is remembered
- assertEquals(targets[0].getArtifactName(), buildArtifactName);
// Check the rest of the default information
- checkRootTarget(targets[0]);
+ checkRootManagedProject(newProject, "z");
// Now test the information the makefile builder needs
checkBuildTestSettings(info);
@@ -619,13 +648,12 @@ public class ManagedBuildCoreTests extends TestCase {
fail("Failed to open renamed project: " + e.getLocalizedMessage());
}
- // By now there should be 2 targets with 3 configs
- ITarget[] definedTargets = ManagedBuildManager.getTargets(project);
- assertEquals(2, definedTargets.length);
- ITarget rootTarget = definedTargets[0];
- IConfiguration[] definedConfigs = rootTarget.getConfigurations();
- assertEquals(3, definedConfigs.length);
- IConfiguration baseConfig = definedConfigs[0];
+ // By now the project should have 3 configs
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ IManagedProject managedProj = info.getManagedProject();
+ IConfiguration[] definedConfigs = managedProj.getConfigurations();
+ assertEquals(4, definedConfigs.length);
+ IConfiguration baseConfig = definedConfigs[1];
// There is only one tool
ITool[] definedTools = baseConfig.getTools();
@@ -635,12 +663,17 @@ public class ManagedBuildCoreTests extends TestCase {
// Get the options (2) in top category and (4) in its child
IOptionCategory topCategory = rootTool.getTopOptionCategory();
assertEquals("Root Tool", topCategory.getName());
- IOption[] options = topCategory.getOptions(null);
- assertEquals(2, options.length);
+ Object[][] options = topCategory.getOptions(baseConfig);
+ int i;
+ for (i=0; i<options.length; i++)
+ if (options[i][0] == null) break;
+ assertEquals(2, i);
IOptionCategory[] categories = topCategory.getChildCategories();
assertEquals(1, categories.length);
- options = categories[0].getOptions(null);
- assertEquals(4, options.length);
+ options = categories[0].getOptions(baseConfig);
+ for (i=0; i<options.length; i++)
+ if (options[i][0] == null) break;
+ assertEquals(4, i);
// Set the name back
newResource = workspaceRoot.findMember(projectName);
@@ -674,23 +707,26 @@ public class ManagedBuildCoreTests extends TestCase {
}
// Do it all again
- definedTargets = ManagedBuildManager.getTargets(project);
- assertEquals(2, definedTargets.length);
- rootTarget = definedTargets[0];
- definedConfigs = rootTarget.getConfigurations();
- assertEquals(3, definedConfigs.length);
- baseConfig = definedConfigs[0];
+ info = ManagedBuildManager.getBuildInfo(project);
+ managedProj = info.getManagedProject();
+ definedConfigs = managedProj.getConfigurations();
+ assertEquals(4, definedConfigs.length);
+ baseConfig = definedConfigs[1];
definedTools = baseConfig.getTools();
assertEquals(1, definedTools.length);
rootTool = definedTools[0];
topCategory = rootTool.getTopOptionCategory();
assertEquals("Root Tool", topCategory.getName());
- options = topCategory.getOptions(null);
- assertEquals(2, options.length);
+ options = topCategory.getOptions(baseConfig);
+ for (i=0; i<options.length; i++)
+ if (options[i][0] == null) break;
+ assertEquals(2, i);
categories = topCategory.getChildCategories();
assertEquals(1, categories.length);
- options = categories[0].getOptions(null);
- assertEquals(4, options.length);
+ options = categories[0].getOptions(baseConfig);
+ for (i=0; i<options.length; i++)
+ if (options[i][0] == null) break;
+ assertEquals(4, i);
}
private void addManagedBuildNature (IProject project) {
@@ -737,16 +773,10 @@ public class ManagedBuildCoreTests extends TestCase {
assertEquals(info.getBuildArtifactName(), projectName);
// There should be a default configuration defined for the project
- ITarget buildTarget = info.getDefaultTarget();
- assertNotNull(buildTarget);
- IConfiguration buildConfig = info.getDefaultConfiguration(buildTarget);
+ IManagedProject managedProj = info.getManagedProject();
+ assertNotNull(managedProj);
+ IConfiguration buildConfig = info.getDefaultConfiguration();
assertNotNull(buildConfig);
-
- // The default target should be the same as the one-and-only target in the project
- List targets = info.getTargets();
- assertEquals(targets.size(), 1);
- ITarget target = (ITarget) targets.get(0);
- assertEquals(target, buildTarget);
// Check that tool handles resources with extensions foo and bar by building a baz
assertEquals(info.getOutputExtension(ext1), expectedOutput);
@@ -759,13 +789,13 @@ public class ManagedBuildCoreTests extends TestCase {
assertEquals(info.getToolForSource(ext1), expectedCmd);
assertEquals(info.getToolForSource(ext2), expectedCmd);
// Make sure that there is no tool to build files of type foo and bar
- assertNull(info.getToolForTarget(ext1));
- assertNull(info.getToolForTarget(ext2));
+ assertNull(info.getToolForConfiguration(ext1));
+ assertNull(info.getToolForConfiguration(ext2));
- // There is no target that builds toor
+ // There is no tool that builds toor
assertNull(info.getToolForSource(expectedOutput));
// but there is one that produces it
- assertEquals(info.getToolForTarget(expectedOutput), expectedCmd);
+ assertEquals(info.getToolForConfiguration(expectedOutput), expectedCmd);
// Now check the build flags
assertEquals(info.getFlagsForSource(ext1), "-La -Lb z -e1 -nob");
@@ -781,15 +811,12 @@ public class ManagedBuildCoreTests extends TestCase {
* @throws BuildException
*/
private void checkOptionReferences(IProject project) throws BuildException {
- // Get the targets out of the project
- ITarget[] definedTargets = ManagedBuildManager.getTargets(project);
- assertEquals(1, definedTargets.length);
- ITarget rootTarget = definedTargets[0];
-
- // Now get the configs
- IConfiguration[] definedConfigs = rootTarget.getConfigurations();
+ // Get the configs
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ IManagedProject managedProj = info.getManagedProject();
+ IConfiguration[] definedConfigs = managedProj.getConfigurations();
assertEquals(4, definedConfigs.length);
- IConfiguration newConfig = rootTarget.getConfiguration(testConfigId);
+ IConfiguration newConfig = managedProj.getConfiguration(testConfigId);
assertNotNull(newConfig);
// Now get the tool options and make sure the values are correct
@@ -841,31 +868,34 @@ public class ManagedBuildCoreTests extends TestCase {
}
/*
- * Do a full sanity check on the root target.
+ * Do a full sanity check on the root project type.
*/
- private void checkRootTarget(ITarget target) throws BuildException {
- // Target stuff
+ private void checkRootProjectType(IProjectType type) throws BuildException {
+ // Project stuff
String expectedCleanCmd = "del /myworld";
String expectedParserId = "org.eclipse.cdt.core.PE";
String[] expectedOSList = {"win32"};
String[] expectedArchList = {"all"};
- assertTrue(target.isTestTarget());
- if (target.getArtifactName().equals("ManagedBuildTest")) {
- assertEquals(target.getArtifactExtension(), newExt);
+ assertTrue(type.isTestProjectType());
+ IConfiguration[] configs = type.getConfigurations();
+ if (configs[0].getArtifactName().equals("ManagedBuildTest")) {
+ assertEquals(configs[0].getArtifactExtension(), newExt);
} else {
- assertEquals(target.getArtifactExtension(), rootExt);
+ assertEquals(configs[0].getArtifactExtension(), rootExt);
}
- assertEquals(expectedCleanCmd, target.getCleanCommand());
- assertEquals("make", target.getMakeCommand());
- assertEquals(expectedParserId, target.getBinaryParserId());
- assertTrue(Arrays.equals(expectedOSList, target.getTargetOSList()));
- assertTrue(Arrays.equals(expectedArchList, target.getTargetArchList()));
- // This target defines no errors parsers.
- assertNull(target.getErrorParserIds());
- assertTrue(Arrays.equals(target.getErrorParserList(), CCorePlugin.getDefault().getAllErrorParsersIDs()));
+ assertEquals(expectedCleanCmd, configs[0].getCleanCommand());
+ assertEquals("make", configs[0].getBuildCommand());
+ IToolChain toolChain = configs[0].getToolChain();
+ ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
+ assertEquals(expectedParserId, targetPlatform.getBinaryParserId());
+ assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
+ assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
+ // This configuration defines no errors parsers.
+ assertNull(configs[0].getErrorParserIds());
+ assertTrue(Arrays.equals(configs[0].getErrorParserList(), CCorePlugin.getDefault().getAllErrorParsersIDs()));
// Tools
- ITool[] tools = target.getTools();
+ ITool[] tools = toolChain.getTools();
// Root Tool
ITool rootTool = tools[0];
assertEquals("Root Tool", rootTool.getName());
@@ -915,28 +945,33 @@ public class ManagedBuildCoreTests extends TestCase {
assertEquals("Boolean Option in Category", options[5].getName());
assertEquals(IOption.BOOLEAN, options[5].getValueType());
assertEquals(false, options[5].getBooleanValue());
- assertNull(options[5].getCommand());
+ assertEquals("", options[5].getCommand());
assertEquals("-nob", options[5].getCommandFalse());
// Option Categories
IOptionCategory topCategory = rootTool.getTopOptionCategory();
assertEquals("Root Tool", topCategory.getName());
- options = topCategory.getOptions(null);
- assertEquals(2, options.length);
- assertEquals("List Option in Top", options[0].getName());
- assertEquals("Boolean Option in Top", options[1].getName());
+ Object[][] catoptions = topCategory.getOptions(configs[0]);
+ int i;
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(2, i);
+ assertEquals("List Option in Top", ((IOption)catoptions[0][1]).getName());
+ assertEquals("Boolean Option in Top", ((IOption)catoptions[1][1]).getName());
IOptionCategory[] categories = topCategory.getChildCategories();
assertEquals(1, categories.length);
assertEquals("Category", categories[0].getName());
- options = categories[0].getOptions(null);
- assertEquals(4, options.length);
- assertEquals("String Option in Category", options[0].getName());
- assertEquals("Another String Option in Category", options[1].getName());
- assertEquals("Enumerated Option in Category", options[2].getName());
- assertEquals("Boolean Option in Category", options[3].getName());
+ catoptions = categories[0].getOptions(configs[0]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(4, i);
+ assertEquals("String Option in Category", ((IOption)catoptions[0][1]).getName());
+ assertEquals("Another String Option in Category", ((IOption)catoptions[1][1]).getName());
+ assertEquals("Enumerated Option in Category", ((IOption)catoptions[2][1]).getName());
+ assertEquals("Boolean Option in Category", ((IOption)catoptions[3][1]).getName());
// There should be 3 defined configs
- IConfiguration[] configs = target.getConfigurations();
+ configs = type.getConfigurations();
assertEquals(3, configs.length);
// Root Config
@@ -962,37 +997,40 @@ public class ManagedBuildCoreTests extends TestCase {
assertEquals("Root Override Config", configs[1].getName());
tools = configs[1].getTools();
assertEquals(1, tools.length);
- assertTrue(tools[0] instanceof IToolReference);
assertEquals("Root Tool", tools[0].getName());
topCategory = tools[0].getTopOptionCategory();
- options = topCategory.getOptions(configs[1]);
- assertEquals(2, options.length);
- assertEquals("List Option in Top", options[0].getName());
- valueList = options[0].getStringListValue();
+ catoptions = topCategory.getOptions(configs[1]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(2, i);
+ assertEquals("List Option in Top", ((IOption)catoptions[0][1]).getName());
+ valueList = ((IOption)catoptions[0][1]).getStringListValue();
assertEquals("a", valueList[0]);
assertEquals("b", valueList[1]);
- assertEquals("Boolean Option in Top", options[1].getName());
- assertEquals(true, options[1].getBooleanValue());
- assertEquals("-b", options[1].getCommand());
+ assertEquals("Boolean Option in Top", ((IOption)catoptions[1][1]).getName());
+ assertEquals(true, ((IOption)catoptions[1][1]).getBooleanValue());
+ assertEquals("-b", ((IOption)catoptions[1][1]).getCommand());
categories = topCategory.getChildCategories();
- options = categories[0].getOptions(configs[1]);
- assertEquals(4, options.length);
- assertEquals("String Option in Category", options[0].getName());
- assertEquals("y", options[0].getStringValue());
- assertEquals("Another String Option in Category", options[1].getName());
- assertEquals("", options[1].getStringValue());
- assertEquals("Enumerated Option in Category", options[2].getName());
- valueList = options[2].getApplicableValues();
+ catoptions = categories[0].getOptions(configs[1]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(4, i);
+ assertEquals("String Option in Category", ((IOption)catoptions[0][1]).getName());
+ assertEquals("y", ((IOption)catoptions[0][1]).getStringValue());
+ assertEquals("Another String Option in Category", ((IOption)catoptions[1][1]).getName());
+ assertEquals("", ((IOption)catoptions[1][1]).getStringValue());
+ assertEquals("Enumerated Option in Category", ((IOption)catoptions[2][1]).getName());
+ valueList = ((IOption)catoptions[2][1]).getApplicableValues();
assertEquals(2, valueList.length);
assertEquals("Default Enum", valueList[0]);
assertEquals("Another Enum", valueList[1]);
- assertEquals("-e1", options[2].getEnumCommand(valueList[0]));
- assertEquals("-e2", options[2].getEnumCommand(valueList[1]));
+ assertEquals("-e1", ((IOption)catoptions[2][1]).getEnumCommand(valueList[0]));
+ assertEquals("-e2", ((IOption)catoptions[2][1]).getEnumCommand(valueList[1]));
assertEquals(1, tools.length);
- assertEquals("Boolean Option in Category", options[3].getName());
- assertEquals(false, options[3].getBooleanValue());
- assertNull(options[3].getCommand());
- assertEquals("-nob", options[3].getCommandFalse());
+ assertEquals("Boolean Option in Category", ((IOption)catoptions[3][1]).getName());
+ assertEquals(false, ((IOption)catoptions[3][1]).getBooleanValue());
+ assertEquals("", ((IOption)catoptions[3][1]).getCommand());
+ assertEquals("-nob", ((IOption)catoptions[3][1]).getCommandFalse());
assertEquals(1, tools.length);
ITool tool = tools[0];
assertNotNull(tool);
@@ -1009,63 +1047,301 @@ public class ManagedBuildCoreTests extends TestCase {
assertEquals("Complete Override Config", configs[2].getName());
tools = configs[2].getTools();
assertEquals(1, tools.length);
- assertTrue(tools[0] instanceof IToolReference);
assertEquals("Root Tool", tools[0].getName());
topCategory = tools[0].getTopOptionCategory();
- options = topCategory.getOptions(configs[2]);
- assertEquals(2, options.length);
+ catoptions = topCategory.getOptions(configs[2]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(2, i);
// Check that there's an string list with totally new values
- assertTrue(options[0] instanceof OptionReference);
- assertEquals("List Option in Top", options[0].getName());
- assertEquals(IOption.STRING_LIST, options[0].getValueType());
- valueList = options[0].getStringListValue();
+ assertEquals("List Option in Top", ((IOption)catoptions[0][1]).getName());
+ assertEquals(IOption.STRING_LIST, ((IOption)catoptions[0][1]).getValueType());
+ valueList = ((IOption)catoptions[0][1]).getStringListValue();
assertTrue(valueList.length == 3);
assertEquals("d", valueList[0]);
assertEquals("e", valueList[1]);
assertEquals("f", valueList[2]);
- assertEquals("-L", options[0].getCommand());
+ assertEquals("-L", ((IOption)catoptions[0][1]).getCommand());
// and a true boolean (commands should not have changed)
- assertEquals("Boolean Option in Top", options[1].getName());
- assertTrue(options[1] instanceof OptionReference);
+ assertEquals("Boolean Option in Top", ((IOption)catoptions[1][1]).getName());
+ assertEquals(IOption.BOOLEAN, ((IOption)catoptions[1][1]).getValueType());
+ assertEquals(true, ((IOption)catoptions[1][1]).getBooleanValue());
+ assertEquals("-b", ((IOption)catoptions[1][1]).getCommand());
+ // Check that there's an overridden enumeration and string
+ categories = topCategory.getChildCategories();
+ catoptions = categories[0].getOptions(configs[2]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(4, i);
+ assertEquals("String Option in Category", ((IOption)catoptions[0][1]).getName());
+ assertEquals(IOption.STRING, ((IOption)catoptions[0][1]).getValueType());
+ assertEquals("overridden", ((IOption)catoptions[0][1]).getStringValue());
+ assertEquals("Another String Option in Category", ((IOption)catoptions[1][1]).getName());
+ assertEquals(IOption.STRING, ((IOption)catoptions[1][1]).getValueType());
+ assertEquals("alsooverridden", ((IOption)catoptions[1][1]).getStringValue());
+ assertEquals("Enumerated Option in Category", ((IOption)catoptions[2][1]).getName());
+ assertEquals(IOption.ENUMERATED, ((IOption)catoptions[2][1]).getValueType());
+ assertEquals("another.enum.option", ((IOption)catoptions[2][1]).getSelectedEnum());
+ assertEquals("Boolean Option in Category", ((IOption)catoptions[3][1]).getName());
+ assertEquals(IOption.BOOLEAN, ((IOption)catoptions[3][1]).getValueType());
+ assertEquals(true, ((IOption)catoptions[3][1]).getBooleanValue());
+ tool = tools[0];
+ assertEquals("-Ld -Le -Lf -b overridden -stralsooverridden -e2", tool.getToolFlags());
+
+ // Make sure that the build manager returns the default makefile generator (not null)
+ assertNotNull(ManagedBuildManager.getBuildfileGenerator(configs[0]));
+ }
+
+ /*
+ * Do a full sanity check on the root managed project.
+ */
+ private void checkRootManagedProject(IManagedProject managedProj, String testValue) throws BuildException {
+ String expectedCleanCmd = "del /myworld";
+ String expectedParserId = "org.eclipse.cdt.core.PE";
+ String[] expectedOSList = {"win32"};
+ String[] expectedArchList = {"all"};
+ assertTrue(managedProj.getProjectType().isTestProjectType());
+ IConfiguration[] configs = managedProj.getConfigurations();
+ if (configs[0].getArtifactName().equals("ManagedBuildTest")) {
+ assertEquals(configs[0].getArtifactExtension(), newExt);
+ } else {
+ assertEquals(configs[0].getArtifactExtension(), rootExt);
+ }
+ assertEquals(expectedCleanCmd, configs[0].getCleanCommand());
+ assertEquals("make", configs[0].getBuildCommand());
+ IToolChain toolChain = configs[0].getToolChain();
+ ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
+ assertEquals(expectedParserId, targetPlatform.getBinaryParserId());
+ assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
+ assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
+ // This configuration defines no errors parsers.
+ assertNull(configs[0].getErrorParserIds());
+ assertTrue(Arrays.equals(configs[0].getErrorParserList(), CCorePlugin.getDefault().getAllErrorParsersIDs()));
+
+ // Tools
+ ITool[] tools = configs[0].getTools();
+ // Root Tool
+ ITool rootTool = tools[0];
+ assertEquals("Root Tool", rootTool.getName());
+ // 6 Options are defined in the root tool
+ IOption[] options = rootTool.getOptions();
+ assertEquals(6, options.length);
+ // First option is a 3-element list with 1 built-in
+ assertEquals("List Option in Top", options[0].getName());
+ assertEquals(IOption.STRING_LIST, options[0].getValueType());
+ String[] valueList = options[0].getStringListValue();
+ assertEquals(2, valueList.length);
+ assertEquals("a", valueList[0]);
+ assertEquals("b", valueList[1]);
+ String[] builtInList = options[0].getBuiltIns();
+ assertEquals(1, builtInList.length);
+ assertEquals("c", builtInList[0]);
+ assertEquals(options[0].getCommand(), "-L");
+ // Next option is a boolean in top
assertEquals("Boolean Option in Top", options[1].getName());
assertEquals(IOption.BOOLEAN, options[1].getValueType());
- assertEquals(true, options[1].getBooleanValue());
+ assertEquals(false, options[1].getBooleanValue());
assertEquals("-b", options[1].getCommand());
+ // Next option is a string category
+ assertEquals("String Option in Category", options[2].getName());
+ assertEquals(IOption.STRING, options[2].getValueType());
+ assertEquals(testValue, options[2].getStringValue());
+ // Next option is another string category
+ assertEquals("Another String Option in Category", options[3].getName());
+ assertEquals(IOption.STRING, options[3].getValueType());
+ assertEquals("", options[3].getStringValue());
+ assertEquals("-str", options[3].getCommand());
+ // Next option is an enumerated
+ assertEquals("Enumerated Option in Category", options[4].getName());
+ assertEquals(IOption.ENUMERATED, options[4].getValueType());
+ // Post-2.0 enums store the ID, not the string value
+ assertEquals("default.enum.option", options[4].getSelectedEnum());
+ assertEquals("-e1", options[4].getEnumCommand("default.enum.option"));
+ // Need this methof to populate the UI selection widget
+ valueList = options[4].getApplicableValues();
+ assertEquals(2, valueList.length);
+ assertEquals("Default Enum", valueList[0]);
+ assertEquals("Another Enum", valueList[1]);
+ // Test compatability with 1.2 scheme of getting the command from the name
+ assertEquals("-e1", options[4].getEnumCommand(valueList[0]));
+ assertEquals("-e2", options[4].getEnumCommand(valueList[1]));
+ // Final option is another boolean
+ assertEquals("Boolean Option in Category", options[5].getName());
+ assertEquals(IOption.BOOLEAN, options[5].getValueType());
+ assertEquals(false, options[5].getBooleanValue());
+ assertEquals("", options[5].getCommand());
+ assertEquals("-nob", options[5].getCommandFalse());
+
+ // Option Categories
+ IOptionCategory topCategory = rootTool.getTopOptionCategory();
+ assertEquals("Root Tool", topCategory.getName());
+ Object[][] catoptions = topCategory.getOptions(configs[0]);
+ int i;
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(2, i);
+ IOption catOption = (IOption)catoptions[0][1];
+ assertEquals("List Option in Top", catOption.getName());
+ catOption = (IOption)catoptions[1][1];
+ assertEquals("Boolean Option in Top", catOption.getName());
+ IOptionCategory[] categories = topCategory.getChildCategories();
+ assertEquals(1, categories.length);
+ assertEquals("Category", categories[0].getName());
+ catoptions = categories[0].getOptions(configs[0]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(4, i);
+ catOption = (IOption)catoptions[0][1];
+ assertEquals("String Option in Category", catOption.getName());
+ catOption = (IOption)catoptions[1][1];
+ assertEquals("Another String Option in Category", catOption.getName());
+ catOption = (IOption)catoptions[2][1];
+ assertEquals("Enumerated Option in Category", catOption.getName());
+ catOption = (IOption)catoptions[3][1];
+ assertEquals("Boolean Option in Category", catOption.getName());
+
+ // There should be 3 defined configs
+ assertEquals(3, configs.length);
+
+ // Root Config
+ IConfiguration rootConfig = configs[0];
+ assertEquals("Root Config", rootConfig.getName());
+
+ // Tool elements
+ tools = rootConfig.getTools();
+ assertEquals(1, tools.length);
+ assertEquals("Root Tool", tools[0].getName());
+ assertEquals("-r", tools[0].getOutputFlag());
+ assertTrue(tools[0].buildsFileType("foo"));
+ assertTrue(tools[0].buildsFileType("bar"));
+ assertTrue(tools[0].producesFileType("toor"));
+ assertEquals("doIt", tools[0].getToolCommand());
+ assertEquals("", tools[0].getOutputPrefix());
+ // The root tool defines one valid header file extension
+ assertTrue(rootTool.isHeaderFile("baz"));
+ assertTrue(tools[0].isHeaderFile("baz"));
+ assertEquals(ITool.FILTER_C, rootTool.getNatureFilter());
+
+ // Partially Overriden Configuration
+ assertEquals("Root Override Config", configs[1].getName());
+ tools = configs[1].getTools();
+ assertEquals(1, tools.length);
+ assertEquals("Root Tool", tools[0].getName());
+ topCategory = tools[0].getTopOptionCategory();
+ catoptions = topCategory.getOptions(configs[1]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(2, i);
+ catOption = (IOption)catoptions[0][1];
+ assertEquals("List Option in Top", catOption.getName());
+ valueList = catOption.getStringListValue();
+ assertEquals("a", valueList[0]);
+ assertEquals("b", valueList[1]);
+ catOption = (IOption)catoptions[1][1];
+ assertEquals("Boolean Option in Top", catOption.getName());
+ assertEquals(true, catOption.getBooleanValue());
+ assertEquals("-b", catOption.getCommand());
+ categories = topCategory.getChildCategories();
+ catoptions = categories[0].getOptions(configs[1]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(4, i);
+ catOption = (IOption)catoptions[0][1];
+ assertEquals("String Option in Category", catOption.getName());
+ assertEquals("y", catOption.getStringValue());
+ catOption = (IOption)catoptions[1][1];
+ assertEquals("Another String Option in Category", catOption.getName());
+ assertEquals("", catOption.getStringValue());
+ catOption = (IOption)catoptions[2][1];
+ assertEquals("Enumerated Option in Category", catOption.getName());
+ valueList = catOption.getApplicableValues();
+ assertEquals(2, valueList.length);
+ assertEquals("Default Enum", valueList[0]);
+ assertEquals("Another Enum", valueList[1]);
+ catOption = (IOption)catoptions[2][1];
+ assertEquals("-e1", catOption.getEnumCommand(valueList[0]));
+ assertEquals("-e2", catOption.getEnumCommand(valueList[1]));
+ assertEquals(1, tools.length);
+ catOption = (IOption)catoptions[3][1];
+ assertEquals("Boolean Option in Category", catOption.getName());
+ assertEquals(false, catOption.getBooleanValue());
+ assertEquals("", catOption.getCommand());
+ assertEquals("-nob", catOption.getCommandFalse());
+ assertEquals(1, tools.length);
+ ITool tool = tools[0];
+ assertNotNull(tool);
+ assertEquals("Root Tool", tool.getName());
+ assertEquals("-r", tool.getOutputFlag());
+ assertTrue(tool.buildsFileType("foo"));
+ assertTrue(tool.buildsFileType("bar"));
+ assertTrue(tool.producesFileType("toor"));
+ assertTrue(tool.isHeaderFile("baz"));
+ assertEquals("doIt", tool.getToolCommand());
+ assertEquals("-La -Lb -b y -e1 -nob", tool.getToolFlags());
+
+ // Completely Overridden configuration
+ assertEquals("Complete Override Config", configs[2].getName());
+ tools = configs[2].getTools();
+ assertEquals(1, tools.length);
+ assertEquals("Root Tool", tools[0].getName());
+ topCategory = tools[0].getTopOptionCategory();
+ catoptions = topCategory.getOptions(configs[2]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(2, i);
+ // Check that there's an string list with totally new values
+ catOption = (IOption)catoptions[0][1];
+ assertEquals("List Option in Top", catOption.getName());
+ assertEquals(IOption.STRING_LIST, catOption.getValueType());
+ valueList = catOption.getStringListValue();
+ assertTrue(valueList.length == 3);
+ assertEquals("d", valueList[0]);
+ assertEquals("e", valueList[1]);
+ assertEquals("f", valueList[2]);
+ assertEquals("-L", catOption.getCommand());
+ // and a true boolean (commands should not have changed)
+ catOption = (IOption)catoptions[1][1];
+ assertEquals("Boolean Option in Top", catOption.getName());
+ assertEquals(IOption.BOOLEAN, catOption.getValueType());
+ assertEquals(true, catOption.getBooleanValue());
+ assertEquals("-b", catOption.getCommand());
// Check that there's an overridden enumeration and string
categories = topCategory.getChildCategories();
- options = categories[0].getOptions(configs[2]);
- assertEquals(4, options.length);
- assertTrue(options[0] instanceof OptionReference);
- assertEquals("String Option in Category", options[0].getName());
- assertEquals(IOption.STRING, options[0].getValueType());
- assertEquals("overridden", options[0].getStringValue());
- assertTrue(options[1] instanceof OptionReference);
- assertEquals("Another String Option in Category", options[1].getName());
- assertEquals(IOption.STRING, options[1].getValueType());
- assertEquals("alsooverridden", options[1].getStringValue());
- assertTrue(options[2] instanceof OptionReference);
- assertEquals("Enumerated Option in Category", options[2].getName());
- assertEquals(IOption.ENUMERATED, options[2].getValueType());
- assertEquals("another.enum.option", options[2].getSelectedEnum());
- assertTrue(options[3] instanceof OptionReference);
- assertEquals("Boolean Option in Category", options[3].getName());
- assertEquals(IOption.BOOLEAN, options[3].getValueType());
- assertEquals(true, options[3].getBooleanValue());
+ catoptions = categories[0].getOptions(configs[2]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(4, i);
+ catOption = (IOption)catoptions[0][1];
+ assertEquals("String Option in Category", catOption.getName());
+ assertEquals(IOption.STRING, catOption.getValueType());
+ assertEquals("overridden", catOption.getStringValue());
+ catOption = (IOption)catoptions[1][1];
+ assertEquals("Another String Option in Category", catOption.getName());
+ assertEquals(IOption.STRING, catOption.getValueType());
+ assertEquals("alsooverridden", catOption.getStringValue());
+ catOption = (IOption)catoptions[2][1];
+ assertEquals("Enumerated Option in Category", catOption.getName());
+ assertEquals(IOption.ENUMERATED, catOption.getValueType());
+ assertEquals("another.enum.option", catOption.getSelectedEnum());
+ catOption = (IOption)catoptions[3][1];
+ assertEquals("Boolean Option in Category", catOption.getName());
+ assertEquals(IOption.BOOLEAN, catOption.getValueType());
+ assertEquals(true, catOption.getBooleanValue());
tool = tools[0];
assertEquals("-Ld -Le -Lf -b overridden -stralsooverridden -e2", tool.getToolFlags());
// Make sure that the build manager returns the default makefile generator (not null)
- assertNotNull(ManagedBuildManager.getMakefileGenerator(target.getId()));
+ assertNotNull(ManagedBuildManager.getBuildfileGenerator(configs[0]));
}
/*
- * The Sub Sub target has a reference to a tool that is defined
- * independently from the target itself. This is a common pattern
- * for tools that are shared between many targets.
+ * The Sub Sub project type has a reference to a tool that is defined
+ * independently from the project type itself. This is a common pattern
+ * for tools that are shared between many project types.
*
* The tool itself is defined as having two option categories, with
* one option in each category. To test that the reference is properly
- * inheritted, the target overrides the default value of the boolean
+ * inheritted, the project type overrides the default value of the boolean
* option.
*
* The test confirms that the basic settings are inheritted through the
@@ -1075,11 +1351,11 @@ public class ManagedBuildCoreTests extends TestCase {
*
* Finally, the string option in the configuration is overridden and the
* test confirms that it contains both the overridden boolean that the
- * target provides, and the overridden string that it provides.
+ * project type provides, and the overridden string that it provides.
*
* @param testSubSub
*/
- private void checkSubSubTarget(ITarget target) {
+ private void checkSubSubProjectType(IProjectType projType) {
final String indyToolName = "Target Independent Tool";
final String indyToolCommand = "RC.EXE";
final String indyToolInputExt = "rc";
@@ -1095,30 +1371,29 @@ public class ManagedBuildCoreTests extends TestCase {
final String newCmd = "Let the Wookie win";
final String stringOverride = "The future language of slaves";
+ IConfiguration[] configs = projType.getConfigurations();
// Check the inherited clean command
- assertEquals("rm -yourworld", target.getCleanCommand());
+ assertEquals("rm -yourworld", configs[0].getCleanCommand());
// Check that the make command is overridden from parent
- assertEquals("nmake", target.getMakeCommand());
+ assertEquals("nmake", configs[0].getBuildCommand());
// Make sure we get the proper binary parser
- assertEquals("org.eclipse.cdt.core.ELF", target.getBinaryParserId());
+ IToolChain toolChain = configs[0].getToolChain();
+ ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
+ assertEquals("org.eclipse.cdt.core.ELF", targetPlatform.getBinaryParserId());
// Make sure the os list is inherited
String[] expectedOSList = {"win32","linux","solaris"};
- assertTrue(Arrays.equals(expectedOSList, target.getTargetOSList()));
+ assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
// Make sure the arch list is inherited
String[] expectedArchList = {"x86", "ppc"};
- assertTrue(Arrays.equals(expectedArchList, target.getTargetArchList()));
+ assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
// Get the 5 configurations (3 from test, 1 from test sub and 1 from this)
- IConfiguration[] configs = target.getConfigurations();
assertEquals(5, configs.length);
// Check the tools. We should have 3 (1 from each parent and the one referenced).
- ITool[] tools = target.getTools();
+ ITool[] tools = configs[0].getTools();
assertEquals(3, tools.length);
- ITool toolRef = tools[2];
-
- // Make sure the 3rd tool is a tool reference
- assertTrue(toolRef instanceof IToolReference);
+ ITool toolRef = tools[0];
// Make sure we get all the tool settings
assertEquals(toolRef.getName(), indyToolName);
@@ -1139,70 +1414,81 @@ public class ManagedBuildCoreTests extends TestCase {
assertEquals(1, subCategories.length);
assertEquals(subCategories[0].getName(), indyCatTwo);
// Make sure the option in the top category is correct
- IOption[] optsInCat = categories[0].getOptions(null);
- assertEquals(1, optsInCat.length);
- assertEquals(freeOptName, optsInCat[0].getName());
- assertEquals(IOption.STRING, optsInCat[0].getValueType());
+ Object[][] optsInCat = categories[0].getOptions(configs[0]);
+ int i;
+ for (i=0; i<optsInCat.length; i++)
+ if (optsInCat[i][0] == null) break;
+ assertEquals(1, i);
+ IOption optCat = (IOption)optsInCat[0][1];
+ assertEquals(freeOptName, optCat.getName());
try {
// We get the option categories and options from the tool itself, but the
// tool reference will have a set of 0 to n option references that contain
// overridden settings. In this case, the string is inheritted and should
// not be reference
- IOption stringOpt = toolRef.getOptionById(optsInCat[0].getId());
+ assertEquals(IOption.STRING, optCat.getValueType());
+ IOption stringOpt = toolRef.getOptionById(optCat.getId());
assertTrue(stringOpt instanceof Option);
assertEquals(freeOptValue, stringOpt.getStringValue());
} catch (BuildException e1) {
- fail("Failed getting string value in subsubtarget :" + e1.getLocalizedMessage());
+ fail("Failed getting string value in subsub :" + e1.getLocalizedMessage());
}
// Do the same for the options in the child cat
- IOption[] optsInSubCat = subCategories[0].getOptions(null);
- assertEquals(1, optsInSubCat.length);
- IOption booleanRef = toolRef.getOptionById(optsInSubCat[0].getId());
- assertTrue(booleanRef instanceof OptionReference);
+ Object[][] optsInSubCat = subCategories[0].getOptions(configs[0]);
+ for (i=0; i<optsInSubCat.length; i++)
+ if (optsInSubCat[i][0] == null) break;
+ assertEquals(1, i);
+ IOption booleanRef = toolRef.getOptionById(((IOption)optsInSubCat[0][1]).getId());
assertEquals(chainedOptName, booleanRef.getName());
- assertEquals(IOption.BOOLEAN, booleanRef.getValueType());
try {
+ assertEquals(IOption.BOOLEAN, booleanRef.getValueType());
assertTrue(booleanRef.getBooleanValue());
} catch (BuildException e) {
- fail("Failure getting boolean value in subsubtarget: " + e.getLocalizedMessage());
+ fail("Failure getting boolean value in subsub: " + e.getLocalizedMessage());
}
// Test that the tool command can be changed through the reference
- ((IToolReference)toolRef).setToolCommand(newCmd);
+ toolRef.setToolCommand(newCmd);
assertEquals(toolRef.getToolCommand(), newCmd);
// Muck about with the options in the local config
- IConfiguration subSubConfig = target.getConfiguration("sub.sub.config");
+ IConfiguration subSubConfig = projType.getConfiguration("sub.sub.config");
assertNotNull(subSubConfig);
ITool[] configTools = subSubConfig.getTools();
// This tool ref is inherited from parent, so it does not belong to the config
- ITool configToolRef = configTools[2];
+ ITool configToolRef = configTools[0];
assertNotNull(configToolRef);
- assertFalse(((ToolReference)configToolRef).ownedByConfiguration(subSubConfig));
- IOption configStringOpt = configToolRef.getOptionById(optsInCat[0].getId());
+ optCat = (IOption)optsInCat[0][1];
+ IOption configStringOpt = configToolRef.getOptionById(optCat.getId());
assertNotNull(configStringOpt);
// Override the string option
try {
- subSubConfig.setOption(configStringOpt, stringOverride);
+ subSubConfig.setOption(configToolRef, configStringOpt, stringOverride);
} catch (BuildException e) {
fail("Failure setting string value in subsubconfiguration: " + e.getLocalizedMessage());
}
// Now the config should have a tool ref to the independent tool
configTools = subSubConfig.getTools();
- configToolRef = configTools[2];
+ configToolRef = configTools[0];
assertNotNull(configToolRef);
- assertTrue(((ToolReference)configToolRef).ownedByConfiguration(subSubConfig));
// Test that the string option is overridden in the configuration
- configStringOpt = configToolRef.getOptionById(optsInCat[0].getId());
+ optsInCat = categories[0].getOptions(configs[0]);
+ for (i=0; i<optsInCat.length; i++)
+ if (optsInCat[i][0] == null) break;
+ assertEquals(1, i);
+ optCat = (IOption)optsInCat[0][1];
+ assertEquals(freeOptName, optCat.getName());
+ configStringOpt = configToolRef.getOptionById(optCat.getId());
try {
assertEquals(stringOverride, configStringOpt.getStringValue());
} catch (BuildException e) {
fail("Failure getting string value in subsubconfiguration: " + e.getLocalizedMessage());
}
// The tool should also contain the boolean option set to true
- IOption configBoolOpt = configToolRef.getOptionById(optsInSubCat[0].getId());
+ IOption optSubCat = (IOption)optsInSubCat[0][1];
+ IOption configBoolOpt = configToolRef.getOptionById(optSubCat.getId());
assertNotNull(configBoolOpt);
try {
assertTrue(configBoolOpt.getBooleanValue());
@@ -1212,11 +1498,16 @@ public class ManagedBuildCoreTests extends TestCase {
// Override it in config and retest
try {
- subSubConfig.setOption(configBoolOpt, false);
+ subSubConfig.setOption(configToolRef, configBoolOpt, false);
} catch (BuildException e) {
fail("Failure setting boolean value in subsubconfiguration: " + e.getLocalizedMessage());
}
- configBoolOpt = configToolRef.getOptionById(optsInSubCat[0].getId());
+ optsInSubCat = subCategories[0].getOptions(configs[0]);
+ for (i=0; i<optsInSubCat.length; i++)
+ if (optsInSubCat[i][0] == null) break;
+ assertEquals(1, i);
+ configBoolOpt = configToolRef.getOptionById(((IOption)optsInSubCat[0][1]).getId());
+ assertEquals(chainedOptName, booleanRef.getName());
try {
assertFalse(configBoolOpt.getBooleanValue());
} catch (BuildException e) {
@@ -1225,38 +1516,41 @@ public class ManagedBuildCoreTests extends TestCase {
}
/*
- * Do a sanity check on the values in the sub-target. Most of the
+ * Do a sanity check on the values in the sub-project type. Most of the
* sanity on the how build model entries are read is performed in
- * the root target check, so these tests just verify that the the sub
- * target properly inherits from its parent. For the new options
- * in the sub target, the test does a sanity check just to be complete.
+ * the root project type check, so these tests just verify that the the sub
+ * project type properly inherits from its parent. For the new options
+ * in the sub project type, the test does a sanity check just to be complete.
*/
- private void checkSubTarget(ITarget target) throws BuildException {
+ private void checkSubProjectType(IProjectType projType) throws BuildException {
final String expectedFlags = "-I/usr/include -I/opt/gnome/include -IC:\\home\\tester/include -I\"../includes\" x y z";
+ IConfiguration[] configs = projType.getConfigurations();
// Check the overridden clean command
- assertEquals("rm -yourworld", target.getCleanCommand());
- // Make sure the target inherits the make command
- assertEquals("make", target.getMakeCommand());
+ assertEquals("rm -yourworld", configs[0].getCleanCommand());
+ // Make sure the projType inherits the make command
+ assertEquals("make", configs[0].getBuildCommand());
// Make sure the binary parser is hard-coded and available
- assertEquals("org.eclipse.cdt.core.PE", target.getBinaryParserId());
+ IToolChain toolChain = configs[0].getToolChain();
+ ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
+ assertEquals("org.eclipse.cdt.core.PE", targetPlatform.getBinaryParserId());
String[] expectedOSList = {"win32","linux","solaris"};
- assertTrue(Arrays.equals(expectedOSList, target.getTargetOSList()));
+ assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
// Make sure the list is overridden
String[] expectedArchList = {"x86", "ppc"};
- assertTrue(Arrays.equals(expectedArchList, target.getTargetArchList()));
+ assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
- // Make sure this is a test target
- assertTrue(target.isTestTarget());
+ // Make sure this is a test projType
+ assertTrue(projType.isTestProjectType());
// Make sure the build artifact extension is there
- assertEquals(target.getArtifactExtension(), subExt);
+ assertEquals(configs[0].getArtifactExtension(), subExt);
- // Get the tools for this target
- ITool[] tools = target.getTools();
+ // Get the tools for this projType
+ ITool[] tools = configs[0].getTools();
// Do we inherit properly from parent
ITool rootTool = tools[0];
assertEquals("Root Tool", rootTool.getName());
- // Now get the tool defined for this target
+ // Now get the tool defined for this projType
ITool subTool = tools[1];
assertEquals("Sub Tool", subTool.getName());
// Confirm that it has four options
@@ -1313,7 +1607,7 @@ public class ManagedBuildCoreTests extends TestCase {
assertEquals("obj1.o", objs[0]);
assertEquals("obj2.o", objs[1]);
assertEquals(IOption.BROWSE_FILE, subOpts[3].getBrowseType());
- assertNull(subOpts[3].getCommand());
+ assertEquals("", subOpts[3].getCommand());
// There should be a string list with no command
assertEquals("No Command StringList", subOpts[4].getName());
@@ -1322,8 +1616,7 @@ public class ManagedBuildCoreTests extends TestCase {
// Make sure the tool flags look right
assertEquals(subTool.getToolFlags(), expectedFlags);
- // Get the configs for this target; it should inherit all the configs defined for the parent
- IConfiguration[] configs = target.getConfigurations();
+ // Get the configs for this projType; it should inherit all the configs defined for the parent
assertEquals(4, configs.length);
assertEquals("Sub Config", configs[0].getName());
assertEquals("Root Config", configs[1].getName());
@@ -1331,13 +1624,14 @@ public class ManagedBuildCoreTests extends TestCase {
assertEquals("Complete Override Config", configs[3].getName());
}
- private void checkForwardTargets(ITarget parent, ITarget child, ITarget grandchild) {
- // check that the target parent reference has been resolved.
- assertEquals(parent, child.getParent());
- assertEquals(child, grandchild.getParent());
+ private void checkForwardProjectTypes(IProjectType parent, IProjectType child, IProjectType grandchild) {
+ // check that the projType parent reference has been resolved.
+ assertEquals(parent, child.getSuperClass());
+ assertEquals(child, grandchild.getSuperClass());
// get the parent tool
- ITool[] parentTools = parent.getTools();
+ IConfiguration[] parentConfigs = parent.getConfigurations();
+ ITool[] parentTools = parentConfigs[0].getTools();
assertEquals(1, parentTools.length);
ITool parentTool = parentTools[0];
assertNotNull(parentTool);
@@ -1351,46 +1645,47 @@ public class ManagedBuildCoreTests extends TestCase {
IOptionCategory[] secondLevel = firstLevel[0].getChildCategories();
assertEquals(1, secondLevel.length);
assertEquals(0, secondLevel[0].getChildCategories().length);
- IOption[] optList = secondLevel[0].getOptions(null);
- assertEquals(1, optList.length);
- assertEquals(option, optList[0]);
+ Object[][] optList = secondLevel[0].getOptions(parentConfigs[0]);
+ int i;
+ for (i=0; i<optList.length; i++)
+ if (optList[i][0] == null) break;
+ assertEquals(1, i);
+ assertEquals(option, optList[0][1]);
// get the tool reference from the child
- ITool[] childTools = child.getTools();
- assertEquals(2, childTools.length);
- IToolReference childToolRef = (IToolReference)childTools[1];
- assertEquals(parentTool, childToolRef.getTool());
+ IConfiguration[] childConfigs = child.getConfigurations();
+ ITool[] childTools = childConfigs[0].getTools();
+ assertEquals(1, childTools.length);
+ ITool childToolRef = childTools[0];
+ assertEquals(parentTool.getSuperClass(), childToolRef.getSuperClass());
// get and check the option reference
- OptionReference optRef = (OptionReference)
- childToolRef.getOptionById("test.forward.option");
- assertEquals(option, optRef.getOption());
+ IOption optRef = childToolRef.getOptionById("test.forward.option");
+ assertEquals(option, optRef);
// get the tool reference from the grandchild
- ITool[] grandTools = grandchild.getTools();
- assertEquals(3, grandTools.length);
- IToolReference grandToolRef = (IToolReference)grandTools[2];
- assertEquals(parentTool, grandToolRef.getTool());
+ IConfiguration[] grandConfigs = grandchild.getConfigurations();
+ ITool[] grandTools = grandConfigs[0].getTools();
+ assertEquals(1, grandTools.length);
+ ITool grandToolRef = grandTools[0];
+ assertEquals(parentTool.getSuperClass(), grandToolRef.getSuperClass());
}
- public void checkProviderTarget(ITarget target) throws Exception {
+ public void checkProviderProjectType(IProjectType projType) throws Exception {
Properties props = new Properties();
props.load(getClass().getResourceAsStream("test_commands"));
- // check that this target is in the file
- String command = props.getProperty(target.getId());
+ // check that this projType is in the file
+ String command = props.getProperty(projType.getId());
assertNotNull(command);
- ITarget parent = target.getParent();
+ IProjectType parent = projType.getSuperClass();
assertNotNull(parent);
assertEquals("test.forward.parent.target", parent.getId());
- ITool[] tools = target.getTools();
- assertEquals(2, tools.length);
- ITool toolRef = tools[1];
- assertTrue(toolRef instanceof IToolReference);
- assertEquals(toolRef.getId(), "test.forward.tool");
+ IConfiguration[] configs = projType.getConfigurations();
+ ITool toolRef = configs[0].getFilteredTools()[0];
assertEquals(command, toolRef.getToolCommand());
}
@@ -1447,9 +1742,16 @@ public class ManagedBuildCoreTests extends TestCase {
IProject project = root.getProject(name);
if (project.exists()) {
try {
- project.delete(true, true, null);
- } catch (CoreException e) {
- assertTrue(false);
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ } finally {
+ try {
+ System.gc();
+ System.runFinalization();
+ project.delete(true, true, null);
+ } catch (CoreException e2) {
+ assertTrue(false);
+ }
}
}
}
@@ -1473,25 +1775,14 @@ public class ManagedBuildCoreTests extends TestCase {
fail("Test failed on error parser project creation: " + e.getLocalizedMessage());
}
- // There should not be any targets defined for this project yet
- assertEquals(0, ManagedBuildManager.getTargets(project).length);
-
- // Find the base target definition
- ITarget targetDef = ManagedBuildManager.getTarget(project, "test.error.parsers");
- assertNotNull(targetDef);
+ // Find the base project Type definition
+ IProjectType projType = ManagedBuildManager.getProjectType("test.error.parsers");
+ assertNotNull(projType);
// Create the target for our project that builds a dummy executable
- ITarget newTarget = ManagedBuildManager.createTarget(project, targetDef);
- assertEquals(newTarget.getName(), targetDef.getName());
- assertFalse(newTarget.equals(targetDef));
- String buildArtifactName = projectName2;
- newTarget.setArtifactName(buildArtifactName);
- newTarget.setArtifactExtension(newExt);
- ITarget[] targets = ManagedBuildManager.getTargets(project);
- assertEquals(1, targets.length);
- ITarget target = targets[0];
- assertEquals(target, newTarget);
- assertFalse(target.equals(targetDef));
+ IManagedProject newProj = ManagedBuildManager.createManagedProject(project, projType);
+ assertEquals(newProj.getName(), projType.getName());
+ ManagedBuildManager.setNewProjectVersion(project);
// Initialize the path entry container
IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project);
@@ -1499,17 +1790,23 @@ public class ManagedBuildCoreTests extends TestCase {
fail("Initializing build information failed for: " + project.getName() + " because: " + initResult.getMessage());
}
+ // Copy over the configs
+ IConfiguration[] baseConfigs = projType.getConfigurations();
+ for (int i = 0; i < baseConfigs.length; ++i) {
+ newProj.createConfiguration(baseConfigs[i], baseConfigs[i].getId() + "." + i);
+ }
+
// Test this out
- checkErrorParsersTarget(target);
+ checkErrorParsersProject(newProj);
// Save, close, reopen and test again
ManagedBuildManager.saveBuildInfo(project, true);
+ ManagedBuildManager.removeBuildInfo(project);
try {
project.close(null);
} catch (CoreException e) {
fail("Failed on error parser project close: " + e.getLocalizedMessage());
}
- ManagedBuildManager.removeBuildInfo(project);
try {
project.open(null);
} catch (CoreException e) {
@@ -1519,29 +1816,27 @@ public class ManagedBuildCoreTests extends TestCase {
// Test that the default config was remembered
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
- // Get the targets
- targets = ManagedBuildManager.getTargets(project);
- assertEquals(1, targets.length);
- // See if the artifact name is remembered
- assertEquals(targets[0].getArtifactName(), buildArtifactName);
// Check the rest of the default information
- checkErrorParsersTarget(targets[0]);
+ checkErrorParsersProject(info.getManagedProject());
ManagedBuildManager.removeBuildInfo(project);
}
/*
* Do a sanity check on the error parsers target.
*/
- private void checkErrorParsersTarget(ITarget target) throws BuildException {
+ private void checkErrorParsersProject(IManagedProject proj) throws BuildException {
// Target stuff
String expectedBinParserId = "org.eclipse.cdt.core.PE";
- assertEquals(expectedBinParserId, target.getBinaryParserId());
+ IConfiguration[] configs = proj.getConfigurations();
+ IToolChain toolChain = configs[0].getToolChain();
+ ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
+ assertEquals(expectedBinParserId, targetPlatform.getBinaryParserId());
// This target defines errors parsers. Check that the error parsers
// have been assigned.
- assertEquals("org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser", target.getErrorParserIds());
+ assertEquals("org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser", configs[0].getErrorParserIds());
// Tool
- ITool[] tools = target.getTools();
+ ITool[] tools = configs[0].getTools();
ITool rootTool = tools[0];
assertEquals(1, tools.length);
assertEquals("EP Tool", tools[0].getName());
@@ -1552,40 +1847,43 @@ public class ManagedBuildCoreTests extends TestCase {
assertEquals("EP", tools[0].getToolCommand());
assertEquals(ITool.FILTER_C, rootTool.getNatureFilter());
- // There should be no defined configs
- IConfiguration[] configs = target.getConfigurations();
- assertEquals(0, configs.length);
+ // There should be one defined configs
+ assertEquals(1, configs.length);
}
/**
* Test that the build artifact of a <code>ITarget</code> can be modified
* programmatically.
*/
- public void testTargetBuildArtifact () throws CoreException {
+ public void testConfigBuildArtifact () throws CoreException {
// Open the test project
IProject project = createProject(projectName);
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ assertNotNull(info);
+ IManagedProject managedProj = info.getManagedProject();
+ assertNotNull(managedProj);
+ IConfiguration defaultConfig = info.getDefaultConfiguration();
+ assertNotNull(defaultConfig);
- // Make sure there is one and only one target
- ITarget[] definedTargets = ManagedBuildManager.getTargets(project);
- assertEquals(1, definedTargets.length);
- ITarget rootTarget = definedTargets[0];
-
- // Set the build artifact of the target
- String ext = rootTarget.getArtifactExtension();
+ // Set the build artifact of the configuration
+ String ext = defaultConfig.getArtifactExtension();
String name = project.getName() + "." + ext;
- rootTarget.setArtifactName(name);
+ defaultConfig.setArtifactName(name);
// Save, close, reopen and test again
ManagedBuildManager.saveBuildInfo(project, false);
- project.close(null);
ManagedBuildManager.removeBuildInfo(project);
+ project.close(null);
project.open(null);
- // Make sure there is one and only one target
- definedTargets = ManagedBuildManager.getTargets(project);
- assertEquals(1, definedTargets.length);
- rootTarget = definedTargets[0];
- assertEquals(name, rootTarget.getArtifactName());
+ // Check the artifact name
+ info = ManagedBuildManager.getBuildInfo(project);
+ assertNotNull(info);
+ managedProj = info.getManagedProject();
+ assertNotNull(managedProj);
+ defaultConfig = info.getDefaultConfiguration();
+ assertNotNull(defaultConfig);
+ assertEquals(name, defaultConfig.getArtifactName());
}
public void testThatAlwaysFails() {
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedCommandLineGeneratorTest.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedCommandLineGeneratorTest.java
new file mode 100644
index 00000000000..0efe218738b
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedCommandLineGeneratorTest.java
@@ -0,0 +1,104 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuild.core.tests;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
+import org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineGenerator;
+
+public class ManagedCommandLineGeneratorTest extends TestCase {
+
+ private static String[] testCommandLinePatterns = {null, "${COMMAND}", "${COMMAND} ${FLAGS}", "${COMMAND} ${FLAGS} ${OUTPUT_FLAG}",
+ "${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}", "${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT}",
+ "${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}",
+ "${command} ${flags} ${output_flag}${output_prefix}${output} ${WRONG_VAR_NAME}"};
+ private static String COMMAND_VAL = "[command]";
+ private static String FLAGS_VAL = "[flags]";
+ private static String[] FLAGS_ARRAY_VAL = FLAGS_VAL.split( "\\s" );
+ private static String OUTPUT_FLAG_VAL = "[outputFlag]";
+ private static String OUTPUT_PREFIX_VAL = "[outputPrefix]";
+ private static String OUTPUT_VAL = "[output]";
+ private static String INPUTS_VAL = "[inputs]";
+ private static String[] INPUTS_ARRAY_VAL = INPUTS_VAL.split( "\\s" );
+ private static String[] commandLineEtalonesForPatterns = {
+ COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL + OUTPUT_VAL + " " + INPUTS_VAL,
+ COMMAND_VAL, COMMAND_VAL + " " + FLAGS_VAL, COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL,
+ COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL,
+ COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL + OUTPUT_VAL,
+ COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL + OUTPUT_VAL + " " + INPUTS_VAL,
+ COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL + OUTPUT_VAL + " " + "${WRONG_VAR_NAME}" };
+ private static String[] commandLineEtalonesForParameters = {
+ FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL + OUTPUT_VAL + " " + INPUTS_VAL,
+ COMMAND_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL + OUTPUT_VAL + " " + INPUTS_VAL,
+ COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_PREFIX_VAL + OUTPUT_VAL + " " + INPUTS_VAL,
+ COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_VAL + " " + INPUTS_VAL,
+ COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL + " " + INPUTS_VAL,
+ COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL + OUTPUT_VAL + " ",
+ };
+
+ public ManagedCommandLineGeneratorTest( String name ) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite( ManagedCommandLineGeneratorTest.class.getName() );
+ suite.addTest( new ManagedCommandLineGeneratorTest( "testGetCommandLineGenerator" ) );
+ suite.addTest( new ManagedCommandLineGeneratorTest( "testGenerateCommandLineInfoPatterns" ) );
+ // TODO: The parameters set to NULL in these tests are not currently allowed to be null
+ //suite.addTest( new ManagedCommandLineGeneratorTest( "testGenerateCommandLineInfoParameters" ) );
+ return suite;
+ }
+
+ public final void testGetCommandLineGenerator() {
+ IManagedCommandLineGenerator gen = ManagedCommandLineGenerator.getCommandLineGenerator();
+ assertNotNull( gen );
+ }
+
+ public final void testGenerateCommandLineInfoPatterns() {
+ IManagedCommandLineGenerator gen = ManagedCommandLineGenerator.getCommandLineGenerator();
+ IManagedCommandLineInfo info = null;
+ for( int i = 0; i < testCommandLinePatterns.length; i++ ) {
+ info = gen.generateCommandLineInfo( null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL, OUTPUT_VAL, INPUTS_ARRAY_VAL,
+ testCommandLinePatterns[i] );
+ assertNotNull( info );
+ if( i < commandLineEtalonesForPatterns.length ) {
+ assertEquals( info.getCommandLine(), commandLineEtalonesForPatterns[i] );
+ }
+ }
+ }
+
+ public final void testGenerateCommandLineInfoParameters() {
+ IManagedCommandLineGenerator gen = ManagedCommandLineGenerator.getCommandLineGenerator();
+ IManagedCommandLineInfo info = gen.generateCommandLineInfo( null, null, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL, OUTPUT_VAL, INPUTS_ARRAY_VAL, null );
+ assertNotNull( info );
+ assertEquals( info.getCommandLine(), commandLineEtalonesForParameters[0] );
+ info = gen.generateCommandLineInfo( null, COMMAND_VAL, null, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL, OUTPUT_VAL, INPUTS_ARRAY_VAL, null );
+ assertNotNull( info );
+ assertEquals( info.getCommandLine(), commandLineEtalonesForParameters[1] );
+ info = gen.generateCommandLineInfo( null, COMMAND_VAL, FLAGS_ARRAY_VAL, null, OUTPUT_PREFIX_VAL, OUTPUT_VAL, INPUTS_ARRAY_VAL, null );
+ assertNotNull( info );
+ assertEquals( info.getCommandLine(), commandLineEtalonesForParameters[2] );
+ info = gen.generateCommandLineInfo( null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, null, OUTPUT_VAL, INPUTS_ARRAY_VAL, null );
+ assertNotNull( info );
+ assertEquals( info.getCommandLine(), commandLineEtalonesForParameters[3] );
+ info = gen.generateCommandLineInfo( null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL, null, INPUTS_ARRAY_VAL, null );
+ assertNotNull( info );
+ assertEquals( info.getCommandLine(), commandLineEtalonesForParameters[4] );
+ info = gen.generateCommandLineInfo( null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL, OUTPUT_VAL, null, null );
+ assertNotNull( info );
+ assertEquals( info.getCommandLine().trim(), commandLineEtalonesForParameters[5].trim() );
+ }
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedProjectUpdateTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedProjectUpdateTests.java
new file mode 100644
index 00000000000..e56e8d6120d
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedProjectUpdateTests.java
@@ -0,0 +1,169 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuild.core.tests;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.projectconverter.UpdateManagedProjectManager;
+import org.eclipse.cdt.managedbuilder.testplugin.CTestPlugin;
+import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.ui.dialogs.IOverwriteQuery;
+
+public class ManagedProjectUpdateTests extends TestCase {
+ public ManagedProjectUpdateTests(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(ManagedProjectUpdateTests.class.getName());
+
+ suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate12_Update"));
+ suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate20_Update"));
+ suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate12_NoUpdate"));
+ suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate20_NoUpdate"));
+
+ return suite;
+ }
+
+ private File getVersionProjectsDir(String version){
+ return CTestPlugin.getFileInPlugin(new Path("resources/oldTypeProjects/"+version));
+ }
+
+ private IProject[] createVersionProjects(String version){
+ File file = getVersionProjectsDir(version);
+ if(file == null)
+ return null;
+
+ File projectZips[] = file.listFiles(new FileFilter(){
+ public boolean accept(File pathname){
+ if(pathname.isDirectory())
+ return false;
+ return true;
+ }
+ });
+
+ ArrayList projectList = new ArrayList(projectZips.length);
+ for(int i = 0; i < projectZips.length; i++){
+ try{
+ String projectName = projectZips[i].getName();
+ if(!projectName.endsWith(".zip"))
+ continue;
+
+ projectName = projectName.substring(0,projectName.length()-".zip".length());
+ if(projectName.length() == 0)
+ continue;
+ IProject project = ManagedBuildTestHelper.createProject(projectName,projectZips[i]);
+ if(project != null)
+ projectList.add(project);
+ }
+ catch(Exception e){
+ }
+ }
+ if(projectList.size() == 0)
+ return null;
+ return (IProject[])projectList.toArray(new IProject[projectList.size()]);
+ }
+
+ private void doTestProjectUpdate(String version, boolean updateProject, boolean overwriteBackupFiles){
+ IOverwriteQuery queryALL = new IOverwriteQuery(){
+ public String queryOverwrite(String file) {
+ return ALL;
+ }};
+ IOverwriteQuery queryNOALL = new IOverwriteQuery(){
+ public String queryOverwrite(String file) {
+ return NO_ALL;
+ }};
+
+ UpdateManagedProjectManager.setBackupFileOverwriteQuery(updateProject ? queryALL : queryNOALL);
+ UpdateManagedProjectManager.setUpdateProjectQuery(overwriteBackupFiles ? queryALL : queryNOALL);
+
+ IProject projects[] = createVersionProjects(version);
+ if(projects == null || projects.length == 0)
+ return;
+ for(int i = 0; i < projects.length; i++){
+ IProject curProject = projects[i];
+
+ //the project conversion occures the first time
+ //ManagedBuildManager.getBuildInfo gets called
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(curProject);
+
+ //check whether the managed build info is converted
+ boolean isCompatible = UpdateManagedProjectManager.isCompatibleProject(info);
+ assertTrue(isCompatible);
+
+ if(isCompatible){
+ //check for correct update
+ if(!updateProject){
+ //TODO: if the user has chosen not to update the project the .cdtbuild file should not change
+ }
+
+ //check whether the project builds without errors
+ try{
+ curProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD,null);
+ }
+ catch(CoreException e){
+ fail(e.getStatus().getMessage());
+ }
+ catch(OperationCanceledException e){
+ fail("the project \"" + curProject.getName() + "\" build was cancelled, exception message: " + e.getMessage());
+ }
+ }
+ }
+
+ for(int i = 0; i < projects.length; i++)
+ ManagedBuildTestHelper.removeProject(projects[i].getName());
+ }
+
+ /* (non-Javadoc)
+ * tests project v1.2 update
+ * in case when user chooses to update the project
+ */
+ public void testProjectUpdate12_Update(){
+ doTestProjectUpdate("1.2",true,true);
+ }
+
+ /* (non-Javadoc)
+ * tests project v2.0 update
+ * in case when user chooses to update the project
+ */
+ public void testProjectUpdate20_Update(){
+ doTestProjectUpdate("2.0",true,true);
+ }
+
+ /* (non-Javadoc)
+ * tests project v1.2 update
+ * in case when user chooses not to update the project
+ */
+ public void testProjectUpdate12_NoUpdate(){
+ doTestProjectUpdate("1.2",false,true);
+ }
+
+ /* (non-Javadoc)
+ * tests project v2.0 update
+ * in case when user chooses not to update the project
+ */
+ public void testProjectUpdate20_NoUpdate(){
+ doTestProjectUpdate("2.0",false,true);
+ }
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/TestManagedConfigProvider.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/TestManagedConfigProvider.java
index 80d5ab1bfab..48483bfed1a 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/TestManagedConfigProvider.java
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/TestManagedConfigProvider.java
@@ -13,7 +13,7 @@ package org.eclipse.cdt.managedbuild.core.tests;
import java.util.Iterator;
import java.util.Properties;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IConfigurationV2;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElementProvider;
import org.eclipse.cdt.managedbuilder.core.ITarget;
@@ -45,11 +45,18 @@ public class TestManagedConfigProvider implements IManagedConfigElementProvider
private IManagedConfigElement createTarget(String targetId, String command) {
IManagedConfigElement toolRef = new TestConfigElement(
- IConfiguration.TOOLREF_ELEMENT_NAME,
+ IConfigurationV2.TOOLREF_ELEMENT_NAME,
new String[][] {
{ITool.ID, "test.forward.tool"},
{ITool.COMMAND, command}},
new IManagedConfigElement[0]);
+
+ IManagedConfigElement config = new TestConfigElement(
+ IConfigurationV2.CONFIGURATION_ELEMENT_NAME,
+ new String[][] {
+ {IConfigurationV2.ID, targetId + ".config"},
+ {IConfigurationV2.NAME, "test.forward.config"}},
+ new IManagedConfigElement[] {toolRef});
IManagedConfigElement target = new TestConfigElement(
ITarget.TARGET_ELEMENT_NAME,
@@ -60,7 +67,7 @@ public class TestManagedConfigProvider implements IManagedConfigElementProvider
{ITarget.PARENT, "test.forward.parent.target"},
{ITarget.IS_TEST, "true"},
{ITarget.OS_LIST, "win32,linux,solaris"}},
- new IManagedConfigElement[] {toolRef});
+ new IManagedConfigElement[] {config});
return target;
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/plugin.xml b/build/org.eclipse.cdt.managedbuilder.core/plugin.xml
index 4489e9b4c06..390b05c593c 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/plugin.xml
+++ b/build/org.eclipse.cdt.managedbuilder.core/plugin.xml
@@ -17,10 +17,12 @@
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.cdt.make.core"/>
+ <import plugin="org.eclipse.ui"/>
</requires>
- <extension-point id="ManagedBuildInfo" name="Managed Build Tools" schema="schema/ManagedBuildTools.exsd"/>
+ <extension-point id="ManagedBuildInfo" name="Managed Build Tools 2.0 (Deprecated)" schema="schema/ManagedBuildTools.exsd"/>
+ <extension-point id="buildDefinitions" name="Managed Build Definitions" schema="schema/buildDefinitions.exsd"/>
<!-- =================================================================================== -->
<!-- Extension Point: IScannerInfoProvider for the managed Builder -->
diff --git a/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd b/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd
index ebda6aa564e..0c4c31fdd9c 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd
+++ b/build/org.eclipse.cdt.managedbuilder.core/schema/ManagedBuildTools.exsd
@@ -1,739 +1,739 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.cdt.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.cdt.core" id="ManagedBuildTools" name="Managed Build Tools"/>
- </appInfo>
- <documentation>
- The managed build information model describes targets, configurations, and toolchains for the build system.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="target"/>
- <element ref="tool"/>
- <element ref="configuration"/>
- <element ref="dynamicElementProvider"/>
- <element ref="managedBuildRevision"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="tool">
- <annotation>
- <documentation>
- Defines a tool used in the build process.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="option"/>
- <element ref="optionCategory"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- A unique identifier for the tool that will be used by the build model.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- Human-readable name for the tool to be used in the UI.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="sources" type="string">
- <annotation>
- <documentation>
- A comma-separated list of file extensions that the tool will produce output for.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="outputs" type="string">
- <annotation>
- <documentation>
- The extension that the tool will produce from a given input.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="command" type="string">
- <annotation>
- <documentation>
- The command that invokes the tool. For example, gcc for the Gnu C compiler, or g++ for the Gnu C++ compiler.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="outputFlag" type="string">
- <annotation>
- <documentation>
- An optional flag for tools that allow users to specify a name for the artifact of the tool. For example, the GCC compiler and linker tools typically allow the user to specify the name of the output with the &apos;-o&apos; flag, whereas the archiver that creates libraries does not.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="outputPrefix" type="string">
- <annotation>
- <documentation>
- Some tools produce files with a special prefix that must be specified. For example, a librarian on POSIX systems expects the output to be lib&lt;target&gt;.a, so &apos;lib&apos; would be the prefix.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="dependencyCalculator" type="string">
- <annotation>
- <documentation>
- This is an optional field that specifies the class that provides the source file dependency calculation for a given tool. You can replace the default calculator with a class that implements the &lt;code&gt;IManagedDependencyGenerator&lt;/code&gt; interface.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="headerExtensions" type="string">
- <annotation>
- <documentation>
- A comma-separated list of file extensions that are used for header files. Since many other files depend on the interfaces defined in header files, the build system needs to be able to determine that a header file has changed to properly rebuild its dependents.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="natureFilter" use="required">
- <annotation>
- <documentation>
- Filter the display (and use) of the tool by the nature of the project. Selecting a value of &apos;cnature&apos; insures that the tool will be displayed IFF there is a cnature associated with the project. A ccnature will filter this tool out. If &apos;ccnature&apos; is selected, the tool will only be available for C++ projects. If &apos;both&apos; is selected, the tool will be displayed when either nature is present.
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="cnature">
- </enumeration>
- <enumeration value="ccnature">
- </enumeration>
- <enumeration value="both">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- </complexType>
- </element>
-
- <element name="option">
- <annotation>
- <documentation>
- An option is associated with a tool. Options can contain boolean values, a simple text string, a selection from an enumerated list, or a list of values. Options also map the value they contain to a command-line flag, such as &apos;-g&apos; in the case of debugging symbol information for compilers.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="enumeratedOptionValue"/>
- <element ref="listOptionValue"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- A unique identifier for the option.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- A descriptive name for the option.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="valueType" use="default" value="string">
- <annotation>
- <documentation>
- General options can be one of the following types; &apos;string&apos; for catch-all entries for options that cannot be easily defined any other way, &apos;string list&apos; for entries that consist of a list of values such as defined symbols or paths, &apos;boolean&apos; for options that have two values, and &apos;enumerated&apos; for options that are one-of a list of values.
-
-Additional special types exist to flag options of special relevance to the build model; &apos;include&apos;, &apos;libs&apos;, &apos;userObjs&apos; and &apos;definedSymbols&apos;. You can pre-populate with optionValues, and they will display in the UI the same way the &apos;stringList&apos; options do. The build model will look specifically for these value types when clients query for include paths and preprocessor defines. The makefile generator will treat the libs and userObjs entries differently than other stringLists.
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="string">
- </enumeration>
- <enumeration value="stringList">
- </enumeration>
- <enumeration value="boolean">
- </enumeration>
- <enumeration value="enumerated">
- </enumeration>
- <enumeration value="includePath">
- </enumeration>
- <enumeration value="definedSymbols">
- </enumeration>
- <enumeration value="libs">
- </enumeration>
- <enumeration value="userObjs">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="category" type="string">
- <annotation>
- <documentation>
- This is the id of the option category for this option. The id can be the id of the tool which is also a category.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="defaultValue" type="string">
- <annotation>
- <documentation>
- Specifies the default value for the option if the &apos;value&apos; field is blank. For enumerated options the optionEnums will be searched for the default. For string list options, all defined optionValues will be treated as defaults. For boolean values, specify truth using the string &apos;true&apos;. All other strings will be treated as false.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="command" type="string">
- <annotation>
- <documentation>
- An optional value that specifies the actual command that will be passed to the tool on the command line.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="commandFalse" type="string">
- <annotation>
- <documentation>
- An optional value, used only with options of type Boolean, that specifies the actual command that will be passed to the tool on the command line when the value of the Boolean option is False.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="browseType">
- <annotation>
- <documentation>
- This value is used for list (and related) options only. If you need a list option to prompt the user to browse for a file or directory when adding a new value, set the value of the attribute accordingly. By default the value is treated as no browsing needed.
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="none">
- </enumeration>
- <enumeration value="file">
- </enumeration>
- <enumeration value="directory">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="helpSupplier" type="string">
- <annotation>
- <documentation>
- This field is unused in 2.0
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="tip" type="string">
- <annotation>
- <documentation>
- Specifies a &quot;tip&quot; that can be displayed in hover help or on the property page. Not implemented in 2.0.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="enumeratedOptionValue">
- <annotation>
- <documentation>
- Defines a single value of an enumerated option.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- Unique identifier for the option enumeration.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- A descriptive name for the enumeration.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="isDefault" type="boolean">
- <annotation>
- <documentation>
- Flags this enumerated value as the default to apply to the option if the user has not changed the setting.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="command" type="string">
- <annotation>
- <documentation>
- The command that the enumerated value translates to on the command line.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="configuration">
- <annotation>
- <documentation>
- A configuration is used to gather together certain default tools and options to build target a certain way. For example, a &quot;Debug&quot; configuration might supply tools with the options set to build with debugging symbols, whereas a &quot;Release&quot; configuration would supply tools with options set to create the best performance.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="toolReference"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- Unique identifier for the configuration.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- A descriptive name for the configuration to be used in the UI.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="toolReference">
- <annotation>
- <documentation>
- This is reserved for future use. It currently gets instantiated for saving tool settings.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="optionReference"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- The unique ID of the tool that the reference is for.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="command" type="string">
- <annotation>
- <documentation>
- The overridden command for the tool the reference is for.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="outputs" type="string">
- <annotation>
- <documentation>
- A comma-separated list of extensions that this tool reference will create. This completely overrides the the output extension in the tool the reference is for.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="outputPrefix" type="string">
- <annotation>
- <documentation>
- The prefix that will be applied to the output of the tool. This completely overrides the output defined in the referenced tool.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="outputFlag" type="string">
- <annotation>
- <documentation>
- Overrides the output flag of the referenced tool.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="optionReference">
- <annotation>
- <documentation>
- Option references hold onto information the user has changed through the UI. Not all fields will be populated, depending on the option type the reference overrides. For example, the &apos;name&apos; field is used by enumerated options only.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="listOptionValue"/>
- <element ref="enumeratedOptionValue"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- The unique ID of the option the reference is for.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="defaultValue" type="string">
- <annotation>
- <documentation>
- This field is used to record the value of the option that the user has set in the build settings file. For example, if the user has set the verbose flag to true, the project&apos;s build settings file will contain an option reference for the verbose option, with the defaultvalue set to true.
-&lt;p&gt;The attribute is also used to override the default option setting for a configuration in a toolchain. For example, a &apos;Debug&apos; configuration may setthe value of a debug flag differently than the default value defined in the tool.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="command" type="string">
- <annotation>
- <documentation>
- This field is unused in 2.0
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="target">
- <annotation>
- <documentation>
- Represents a type of resource that is the target of the build process, for example, a Linux static library. A target contains a sequence of tool definitions and configurations. Targets are arranged in an inheritance hierarchy where a target inherits the list of tools from it&apos;s parent and can add to or override tools in this list.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="tool"/>
- <element ref="configuration"/>
- <element ref="toolReference"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- Used by the build model to uniquely identify the target.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- A human-readable target name, such as &apos;Executable&apos;. This will be the name the user sees displayed in the UI.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="isAbstract" type="boolean" use="default" value="false">
- <annotation>
- <documentation>
- This is a UI property. If set to true, users should not be able to create project configurations targeted at this target.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="parent" type="string">
- <annotation>
- <documentation>
- The id of a target that this tool inherits from.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="artifactName" type="string">
- <annotation>
- <documentation>
- This is the name of the final build artifact associated with the target. The user will specify this is the UI, so there is no need to supply a default value.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="defaultExtension" type="string">
- <annotation>
- <documentation>
- This is the extensionthat will be applied to any build artifact created by the target.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="isTest" type="boolean">
- <annotation>
- <documentation>
- A an optional field that flags a target as a test-only target. If true, the target will not appear in the UI.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="cleanCommand" type="string">
- <annotation>
- <documentation>
- This attribute maintains the command that removes files for a particular target. For example, on POSIX targets like Linuc, Solaris, or Cygwin, the command would be &lt;code&gt;rm -rf&lt;/code&gt; whereas on Win32 platforms it would be &lt;code&gt;del /F /S /Q&lt;/code&gt;
- </documentation>
- </annotation>
- </attribute>
- <attribute name="makeCommand" type="string">
- <annotation>
- <documentation>
- Specifies the default command to start the build utility for your toolchain. If the user changes this through the UI, the overriden value will be stored in the project build file. The build model will default to this value if the user ever resets a change.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="makeArguments" type="string">
- <annotation>
- <documentation>
- Specifies the additional, default arguments that will be passed to the build utility when it is called by the builder. If the user changes the flags through the UI, the overriden value will be stored in the project build settings file. The build model will default to this value if the user ever resets a change.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="binaryParser" type="string">
- <annotation>
- <documentation>
- Set this to the ID of the binary parser for the output format of your target. Currently there are only 2 choices: org.eclipse.cdt.core.ELF for *nix targets, and &quot;org.eclipse.cdt.core.PE&quot; for targets that build for Windows, like Cygwin.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="osList" type="string">
- <annotation>
- <documentation>
- This field is used by the managed build system to decide when to show the user the target. The value should be a comma-separated list. Current values are &quot;win32&quot;, &quot;linux&quot;, &quot;solaris&quot;, &quot;hpux&quot;, &quot;aix&quot; or &quot;any&quot;.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="archList" type="string">
- <annotation>
- <documentation>
- This field is used by the managed build system to decide when to show the user the target. The value should be a comma-separated list. Current values include &quot;x86&quot;, &quot;sparc&quot;, &quot;ppc&quot;; or &quot;all&quot;.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="errorParsers" type="string">
- <annotation>
- <documentation>
- Specifies the default list of error parsers to be used by projects created from this target. It is an ordered, semi-colon separated list of parser IDs. The order specifies the order in which the error parsers are invoked during a build.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="scannerInfoCollector" type="string">
- <annotation>
- <documentation>
- Specifies a class that implements the &lt;code&gt;IManagedScannerInfoCollector&lt;/code&gt; for gathering the built-in compiler settings for a toolchain.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="makefileGenerator" type="string">
- <annotation>
- <documentation>
- Allows you to supply a custom makefile generator that conforms to the &lt;code&gt;IManagedBuilderMakefileGenerator&lt;/code&gt; interface.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="optionCategory">
- <annotation>
- <documentation>
- An optional, but useful, mechanism for grouping options together.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- Used by the build model to uniquely identify the option category.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- A human-readable category name, such as &apos;Preprocessor Options&apos;. This will be the name the user sees displayed in the UI.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="owner" type="string">
- <annotation>
- <documentation>
- Option categories can belong to a tool or be nested inside other option categories. This is the ID of the owner of the category.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="listOptionValue">
- <annotation>
- <documentation>
- A value for defining individual elements of a list option.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
- The contents of the list item.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="builtIn" type="boolean">
- <annotation>
- <documentation>
- This attribute flags the list value as a built-in value as opposed to something the user has entered. Built-ins will not be passed to clients that generate command lines (like the makefile generator). However, clients that need to take these settings into account (like the indexing service), will receive these settings. These values will appear grey in the UI.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="dynamicElementProvider">
- <annotation>
- <documentation>
- An optional element that allows a tool implementor to supply a class that creates one or more dynamic toolchain elements. For example, the class might create a new tool reference based on the contents of a special file, and a new target that uses that reference.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- The class that implements the &lt;code&gt;IManagedConfigElementProvider&lt;/code&gt; interface. The logic of determining the elements is left to the implementer, but they must be correctly formed or the build model will have trouble loading.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.core.IManagedConfigElementProvider"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- A meaningful name for the type of element being provided.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="managedBuildRevision">
- <annotation>
- <documentation>
- &lt;p&gt;
-Version identifier for the managed build extension point. It is a string representation, consisting of three (3) tokens separated by a decimal point. The 3 tokens are positive integer numbers. For example, the following are valid version identifiers:
- &lt;ul&gt;
- &lt;li&gt;&lt;code&gt;0.0.0&lt;/code&gt;&lt;/li&gt;
- &lt;li&gt;&lt;code&gt;1.0.1234&lt;/code&gt;&lt;/li&gt;
- &lt;li&gt;&lt;code&gt;1.9&lt;/code&gt; (interpreted as &lt;code&gt;1.9.0&lt;/code&gt;)&lt;/li&gt;
- &lt;li&gt;&lt;code&gt;3&lt;/code&gt; (interpreted as &lt;code&gt;3.0.0&lt;/code&gt;)&lt;/li&gt;
- &lt;/ul&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
- <complexType>
- <attribute name="fileVersion" type="string" use="required">
- <annotation>
- <documentation>
- The actual string containing the three version tokens.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 1.2
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of the extension point usage:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension
- id=&quot;buildExample&quot;
- name=&quot;Tools for Build Example&quot;
- point=&quot;org.eclipse.cdt.core.ManagedBuildInfo&quot;&gt;
- &lt;target
- makeFlags=&quot;-k&quot;
- isTest=&quot;false&quot;
- cleanCommand=&quot;rm -rf&quot;
- name=&quot;Executable&quot;
- defaultExtension=&quot;.exe&quot;
- isAbstract=&quot;false&quot;
- makeCommand=&quot;make&quot;
- id=&quot;example.target.executable&quot;&gt;
- &lt;tool
- sources=&quot;C&quot;
- name=&quot;Compiler&quot;
- outputFlag=&quot;-o&quot;
- outputs=&quot;exe&quot;
- command=&quot;g++&quot;
- id=&quot;executable.compiler&quot;&gt;
- &lt;optionCategory
- owner=&quot;executable.compiler&quot;
- name=&quot;Flags&quot;
- id=&quot;compiler.category.flags&quot;&gt;
- &lt;/optionCategory&gt;
- &lt;option
- defaultValue=&quot;-c&quot;
- name=&quot;Compiler Flags&quot;
- category=&quot;compiler.category.flags&quot;
- valueType=&quot;string&quot;
- id=&quot;category.flags.comp_flags&quot;&gt;
- &lt;/option&gt;
- &lt;/tool&gt;
- &lt;configuration
- name=&quot;Default&quot;
- id=&quot;example.config.default&quot;&gt;
- &lt;/configuration&gt;
- &lt;/target&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- An implementation of this extension point is supplied in &lt;samp&gt;org.eclipse.cdt.ui&lt;/samp&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2003, 2004 IBM Corporation and others.
-All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available on the &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt; Eclipse&lt;/a&gt; website.
- </documentation>
- </annotation>
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.cdt.core" id="ManagedBuildTools" name="Managed Build Tools 2.0 (deprecated)"/>
+ </appInfo>
+ <documentation>
+ The managed build information model describes targets, configurations, and toolchains for the build system.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="target"/>
+ <element ref="tool"/>
+ <element ref="configuration"/>
+ <element ref="dynamicElementProvider"/>
+ <element ref="managedBuildRevision"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="tool">
+ <annotation>
+ <documentation>
+ Defines a tool used in the build process.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="option"/>
+ <element ref="optionCategory"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique identifier for the tool that will be used by the build model.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ Human-readable name for the tool to be used in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="sources" type="string">
+ <annotation>
+ <documentation>
+ A comma-separated list of file extensions that the tool will produce output for.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="outputs" type="string">
+ <annotation>
+ <documentation>
+ The extension that the tool will produce from a given input.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="command" type="string">
+ <annotation>
+ <documentation>
+ The command that invokes the tool. For example, gcc for the Gnu C compiler, or g++ for the Gnu C++ compiler.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="outputFlag" type="string">
+ <annotation>
+ <documentation>
+ An optional flag for tools that allow users to specify a name for the artifact of the tool. For example, the GCC compiler and linker tools typically allow the user to specify the name of the output with the &apos;-o&apos; flag, whereas the archiver that creates libraries does not.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="outputPrefix" type="string">
+ <annotation>
+ <documentation>
+ Some tools produce files with a special prefix that must be specified. For example, a librarian on POSIX systems expects the output to be lib&lt;target&gt;.a, so &apos;lib&apos; would be the prefix.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="dependencyCalculator" type="string">
+ <annotation>
+ <documentation>
+ This is an optional field that specifies the class that provides the source file dependency calculation for a given tool. You can replace the default calculator with a class that implements the &lt;code&gt;IManagedDependencyGenerator&lt;/code&gt; interface.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="headerExtensions" type="string">
+ <annotation>
+ <documentation>
+ A comma-separated list of file extensions that are used for header files. Since many other files depend on the interfaces defined in header files, the build system needs to be able to determine that a header file has changed to properly rebuild its dependents.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="natureFilter" use="required">
+ <annotation>
+ <documentation>
+ Filter the display (and use) of the tool by the nature of the project. Selecting a value of &apos;cnature&apos; insures that the tool will be displayed IFF there is a cnature associated with the project. A ccnature will filter this tool out. If &apos;ccnature&apos; is selected, the tool will only be available for C++ projects. If &apos;both&apos; is selected, the tool will be displayed when either nature is present.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="cnature">
+ </enumeration>
+ <enumeration value="ccnature">
+ </enumeration>
+ <enumeration value="both">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="option">
+ <annotation>
+ <documentation>
+ An option is associated with a tool. Options can contain boolean values, a simple text string, a selection from an enumerated list, or a list of values. Options also map the value they contain to a command-line flag, such as &apos;-g&apos; in the case of debugging symbol information for compilers.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="enumeratedOptionValue"/>
+ <element ref="listOptionValue"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique identifier for the option.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ A descriptive name for the option.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="valueType" use="default" value="string">
+ <annotation>
+ <documentation>
+ General options can be one of the following types; &apos;string&apos; for catch-all entries for options that cannot be easily defined any other way, &apos;string list&apos; for entries that consist of a list of values such as defined symbols or paths, &apos;boolean&apos; for options that have two values, and &apos;enumerated&apos; for options that are one-of a list of values.
+
+Additional special types exist to flag options of special relevance to the build model; &apos;include&apos;, &apos;libs&apos;, &apos;userObjs&apos; and &apos;definedSymbols&apos;. You can pre-populate with optionValues, and they will display in the UI the same way the &apos;stringList&apos; options do. The build model will look specifically for these value types when clients query for include paths and preprocessor defines. The makefile generator will treat the libs and userObjs entries differently than other stringLists.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="string">
+ </enumeration>
+ <enumeration value="stringList">
+ </enumeration>
+ <enumeration value="boolean">
+ </enumeration>
+ <enumeration value="enumerated">
+ </enumeration>
+ <enumeration value="includePath">
+ </enumeration>
+ <enumeration value="definedSymbols">
+ </enumeration>
+ <enumeration value="libs">
+ </enumeration>
+ <enumeration value="userObjs">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="category" type="string">
+ <annotation>
+ <documentation>
+ This is the id of the option category for this option. The id can be the id of the tool which is also a category.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="defaultValue" type="string">
+ <annotation>
+ <documentation>
+ Specifies the default value for the option if the &apos;value&apos; field is blank. For enumerated options the optionEnums will be searched for the default. For string list options, all defined optionValues will be treated as defaults. For boolean values, specify truth using the string &apos;true&apos;. All other strings will be treated as false.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="command" type="string">
+ <annotation>
+ <documentation>
+ An optional value that specifies the actual command that will be passed to the tool on the command line.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="commandFalse" type="string">
+ <annotation>
+ <documentation>
+ An optional value, used only with options of type Boolean, that specifies the actual command that will be passed to the tool on the command line when the value of the Boolean option is False.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="browseType">
+ <annotation>
+ <documentation>
+ This value is used for list (and related) options only. If you need a list option to prompt the user to browse for a file or directory when adding a new value, set the value of the attribute accordingly. By default the value is treated as no browsing needed.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="none">
+ </enumeration>
+ <enumeration value="file">
+ </enumeration>
+ <enumeration value="directory">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="helpSupplier" type="string">
+ <annotation>
+ <documentation>
+ This field is unused in 2.0
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="tip" type="string">
+ <annotation>
+ <documentation>
+ Specifies a &quot;tip&quot; that can be displayed in hover help or on the property page. Not implemented in 2.0.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="enumeratedOptionValue">
+ <annotation>
+ <documentation>
+ Defines a single value of an enumerated option.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Unique identifier for the option enumeration.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ A descriptive name for the enumeration.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="isDefault" type="boolean">
+ <annotation>
+ <documentation>
+ Flags this enumerated value as the default to apply to the option if the user has not changed the setting.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="command" type="string">
+ <annotation>
+ <documentation>
+ The command that the enumerated value translates to on the command line.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="configuration">
+ <annotation>
+ <documentation>
+ A configuration is used to gather together certain default tools and options to build target a certain way. For example, a &quot;Debug&quot; configuration might supply tools with the options set to build with debugging symbols, whereas a &quot;Release&quot; configuration would supply tools with options set to create the best performance.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="toolReference"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Unique identifier for the configuration.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ A descriptive name for the configuration to be used in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="toolReference">
+ <annotation>
+ <documentation>
+ This is reserved for future use. It currently gets instantiated for saving tool settings.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="optionReference"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique ID of the tool that the reference is for.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="command" type="string">
+ <annotation>
+ <documentation>
+ The overridden command for the tool the reference is for.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="outputs" type="string">
+ <annotation>
+ <documentation>
+ A comma-separated list of extensions that this tool reference will create. This completely overrides the the output extension in the tool the reference is for.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="outputPrefix" type="string">
+ <annotation>
+ <documentation>
+ The prefix that will be applied to the output of the tool. This completely overrides the output defined in the referenced tool.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="outputFlag" type="string">
+ <annotation>
+ <documentation>
+ Overrides the output flag of the referenced tool.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="optionReference">
+ <annotation>
+ <documentation>
+ Option references hold onto information the user has changed through the UI. Not all fields will be populated, depending on the option type the reference overrides. For example, the &apos;name&apos; field is used by enumerated options only.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="listOptionValue"/>
+ <element ref="enumeratedOptionValue"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique ID of the option the reference is for.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="defaultValue" type="string">
+ <annotation>
+ <documentation>
+ This field is used to record the value of the option that the user has set in the build settings file. For example, if the user has set the verbose flag to true, the project&apos;s build settings file will contain an option reference for the verbose option, with the defaultvalue set to true.
+&lt;p&gt;The attribute is also used to override the default option setting for a configuration in a toolchain. For example, a &apos;Debug&apos; configuration may setthe value of a debug flag differently than the default value defined in the tool.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="command" type="string">
+ <annotation>
+ <documentation>
+ This field is unused in 2.0
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="target">
+ <annotation>
+ <documentation>
+ Represents a type of resource that is the target of the build process, for example, a Linux static library. A target contains a sequence of tool definitions and configurations. Targets are arranged in an inheritance hierarchy where a target inherits the list of tools from it&apos;s parent and can add to or override tools in this list.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="tool"/>
+ <element ref="configuration"/>
+ <element ref="toolReference"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Used by the build model to uniquely identify the target.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ A human-readable target name, such as &apos;Executable&apos;. This will be the name the user sees displayed in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="isAbstract" type="boolean" use="default" value="false">
+ <annotation>
+ <documentation>
+ This is a UI property. If set to true, users should not be able to create project configurations targeted at this target.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="parent" type="string">
+ <annotation>
+ <documentation>
+ The id of a target that this tool inherits from.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="artifactName" type="string">
+ <annotation>
+ <documentation>
+ This is the name of the final build artifact associated with the target. The user will specify this is the UI, so there is no need to supply a default value.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="defaultExtension" type="string">
+ <annotation>
+ <documentation>
+ This is the extensionthat will be applied to any build artifact created by the target.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="isTest" type="boolean">
+ <annotation>
+ <documentation>
+ A an optional field that flags a target as a test-only target. If true, the target will not appear in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="cleanCommand" type="string">
+ <annotation>
+ <documentation>
+ This attribute maintains the command that removes files for a particular target. For example, on POSIX targets like Linuc, Solaris, or Cygwin, the command would be &lt;code&gt;rm -rf&lt;/code&gt; whereas on Win32 platforms it would be &lt;code&gt;del /F /S /Q&lt;/code&gt;
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="makeCommand" type="string">
+ <annotation>
+ <documentation>
+ Specifies the default command to start the build utility for your toolchain. If the user changes this through the UI, the overriden value will be stored in the project build file. The build model will default to this value if the user ever resets a change.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="makeArguments" type="string">
+ <annotation>
+ <documentation>
+ Specifies the additional, default arguments that will be passed to the build utility when it is called by the builder. If the user changes the flags through the UI, the overriden value will be stored in the project build settings file. The build model will default to this value if the user ever resets a change.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="binaryParser" type="string">
+ <annotation>
+ <documentation>
+ Set this to the ID of the binary parser for the output format of your target. Currently there are only 2 choices: org.eclipse.cdt.core.ELF for *nix targets, and &quot;org.eclipse.cdt.core.PE&quot; for targets that build for Windows, like Cygwin.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="osList" type="string">
+ <annotation>
+ <documentation>
+ This field is used by the managed build system to decide when to show the user the target. The value should be a comma-separated list. Current values are &quot;win32&quot;, &quot;linux&quot;, &quot;solaris&quot;, &quot;hpux&quot;, &quot;aix&quot; or &quot;any&quot;.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="archList" type="string">
+ <annotation>
+ <documentation>
+ This field is used by the managed build system to decide when to show the user the target. The value should be a comma-separated list. Current values include &quot;x86&quot;, &quot;sparc&quot;, &quot;ppc&quot;; or &quot;all&quot;.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="errorParsers" type="string">
+ <annotation>
+ <documentation>
+ Specifies the default list of error parsers to be used by projects created from this target. It is an ordered, semi-colon separated list of parser IDs. The order specifies the order in which the error parsers are invoked during a build.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="scannerInfoCollector" type="string">
+ <annotation>
+ <documentation>
+ Specifies a class that implements the &lt;code&gt;IManagedScannerInfoCollector&lt;/code&gt; for gathering the built-in compiler settings for a toolchain.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="makefileGenerator" type="string">
+ <annotation>
+ <documentation>
+ Allows you to supply a custom makefile generator that conforms to the &lt;code&gt;IManagedBuilderMakefileGenerator&lt;/code&gt; interface.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="optionCategory">
+ <annotation>
+ <documentation>
+ An optional, but useful, mechanism for grouping options together.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Used by the build model to uniquely identify the option category.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ A human-readable category name, such as &apos;Preprocessor Options&apos;. This will be the name the user sees displayed in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="owner" type="string">
+ <annotation>
+ <documentation>
+ Option categories can belong to a tool or be nested inside other option categories. This is the ID of the owner of the category.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="listOptionValue">
+ <annotation>
+ <documentation>
+ A value for defining individual elements of a list option.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="value" type="string" use="required">
+ <annotation>
+ <documentation>
+ The contents of the list item.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="builtIn" type="boolean">
+ <annotation>
+ <documentation>
+ This attribute flags the list value as a built-in value as opposed to something the user has entered. Built-ins will not be passed to clients that generate command lines (like the makefile generator). However, clients that need to take these settings into account (like the indexing service), will receive these settings. These values will appear grey in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="dynamicElementProvider">
+ <annotation>
+ <documentation>
+ An optional element that allows a tool implementor to supply a class that creates one or more dynamic toolchain elements. For example, the class might create a new tool reference based on the contents of a special file, and a new target that uses that reference.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class that implements the &lt;code&gt;IManagedConfigElementProvider&lt;/code&gt; interface. The logic of determining the elements is left to the implementer, but they must be correctly formed or the build model will have trouble loading.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.core.IManagedConfigElementProvider"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ A meaningful name for the type of element being provided.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="managedBuildRevision">
+ <annotation>
+ <documentation>
+ &lt;p&gt;
+Version identifier for the managed build extension point. It is a string representation, consisting of three (3) tokens separated by a decimal point. The 3 tokens are positive integer numbers. For example, the following are valid version identifiers:
+ &lt;ul&gt;
+ &lt;li&gt;&lt;code&gt;0.0.0&lt;/code&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;code&gt;1.0.1234&lt;/code&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;code&gt;1.9&lt;/code&gt; (interpreted as &lt;code&gt;1.9.0&lt;/code&gt;)&lt;/li&gt;
+ &lt;li&gt;&lt;code&gt;3&lt;/code&gt; (interpreted as &lt;code&gt;3.0.0&lt;/code&gt;)&lt;/li&gt;
+ &lt;/ul&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="fileVersion" type="string" use="required">
+ <annotation>
+ <documentation>
+ The actual string containing the three version tokens.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 1.2
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of the extension point usage:
+&lt;p&gt;
+&lt;pre&gt;
+ &lt;extension
+ id=&quot;buildExample&quot;
+ name=&quot;Tools for Build Example&quot;
+ point=&quot;org.eclipse.cdt.core.ManagedBuildInfo&quot;&gt;
+ &lt;target
+ makeFlags=&quot;-k&quot;
+ isTest=&quot;false&quot;
+ cleanCommand=&quot;rm -rf&quot;
+ name=&quot;Executable&quot;
+ defaultExtension=&quot;.exe&quot;
+ isAbstract=&quot;false&quot;
+ makeCommand=&quot;make&quot;
+ id=&quot;example.target.executable&quot;&gt;
+ &lt;tool
+ sources=&quot;C&quot;
+ name=&quot;Compiler&quot;
+ outputFlag=&quot;-o&quot;
+ outputs=&quot;exe&quot;
+ command=&quot;g++&quot;
+ id=&quot;executable.compiler&quot;&gt;
+ &lt;optionCategory
+ owner=&quot;executable.compiler&quot;
+ name=&quot;Flags&quot;
+ id=&quot;compiler.category.flags&quot;&gt;
+ &lt;/optionCategory&gt;
+ &lt;option
+ defaultValue=&quot;-c&quot;
+ name=&quot;Compiler Flags&quot;
+ category=&quot;compiler.category.flags&quot;
+ valueType=&quot;string&quot;
+ id=&quot;category.flags.comp_flags&quot;&gt;
+ &lt;/option&gt;
+ &lt;/tool&gt;
+ &lt;configuration
+ name=&quot;Default&quot;
+ id=&quot;example.config.default&quot;&gt;
+ &lt;/configuration&gt;
+ &lt;/target&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ An implementation of this extension point is supplied in &lt;samp&gt;org.eclipse.cdt.ui&lt;/samp&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2003, 2004 IBM Corporation and others.
+All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available on the &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt; Eclipse&lt;/a&gt; website.
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd b/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd
new file mode 100644
index 00000000000..307c76cfbc6
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd
@@ -0,0 +1,939 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.managedbuilder.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.cdt.managedbuilder.core" id="buildDefinitions" name="Managed Build Definitions"/>
+ </appInfo>
+ <documentation>
+ The managed build object model describes project-types, configurations, tool-chains, etc. for the managed build system.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="projectType"/>
+ <element ref="configuration"/>
+ <element ref="toolChain"/>
+ <element ref="tool"/>
+ <element ref="targetPlatform"/>
+ <element ref="builder"/>
+ <element ref="dynamicElementProvider"/>
+ <element ref="managedBuildRevision"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="projectType">
+ <annotation>
+ <documentation>
+ Represents a class of project which acts as a template for the projects that the user will create, for example, a Linux static library. A project type contains a sequence of configurations. Project types are arranged in an inheritance hierarchy where a project type inherits the list of configurations from it&apos;s parent and can add to or override configurations in this list.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="configuration"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Used by the build model to uniquely identify the project type.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ A human-readable project type name, such as &apos;Executable&apos;. This will be the name the user sees displayed in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="superClass" type="string">
+ <annotation>
+ <documentation>
+ The id of a projectType that this projectType is derived from.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="isAbstract" type="boolean" use="default" value="false">
+ <annotation>
+ <documentation>
+ An optional field that flags a project type as abstract. If true, the project type will not appear in the UI. The project type is used by other project types as their &quot;superclass&quot;.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="unusedChildren" type="string">
+ <annotation>
+ <documentation>
+ A semi-colon separated list of child IDs of the superclass&apos; children that should not be automatically inherited by this element. Note: This attribute is not yet implemented.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="isTest" type="boolean">
+ <annotation>
+ <documentation>
+ An optional field that flags a project type as test-only. If true, the project type will not appear in the UI. The project type can be manipulated programmatically in JUnit tests, for example.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="project">
+ <annotation>
+ <documentation>
+ The project element is an instance of a projectType element. It appears in the .cdtbuild file, not in an extension definition.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="configuration"/>
+ </sequence>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ The name of the project that the user sees displayed in the UI. This is the name that the user entered in the New Project wizard.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="projectType" type="string" use="required">
+ <annotation>
+ <documentation>
+ The id of the projectType that this project is an instance of.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="configuration">
+ <annotation>
+ <documentation>
+ A configuration is used to gather together certain default tools and options to build project a certain way. For example, a &quot;Debug&quot; configuration might supply tools with the options set to build with debugging symbols, whereas a &quot;Release&quot; configuration would supply tools with options set to create the best performance.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="toolChain"/>
+ <element ref="resourceConfiguration"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Unique identifier for the configuration.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ A descriptive name for the configuration to be used in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="artifactName" type="string">
+ <annotation>
+ <documentation>
+ This is the name of the final build artifact associated with the configuration. The user will specify this is the UI, so there is no need to supply a default value.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="artifactExtension" type="string">
+ <annotation>
+ <documentation>
+ This is the extension that will be applied (if necessary) to any build artifact created by the configuration.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="cleanCommand" type="string">
+ <annotation>
+ <documentation>
+ This attribute maintains the command that removes the intermediate and output files for a particular configuration. For example, on POSIX platforms like Linuc, Solaris, or Cygwin, the command would be &lt;code&gt;rm -rf&lt;/code&gt; whereas on Win32 platforms it would be &lt;code&gt;del /F /S /Q&lt;/code&gt;
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="errorParsers" type="string">
+ <annotation>
+ <documentation>
+ Specifies the default list of error parsers used by the configuration. This attribute overrides the error parsers specified in the toolChain element. It is an ordered, semi-colon separated list of parser IDs. The order specifies the order in which the error parsers are invoked during a build.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="toolChain">
+ <annotation>
+ <documentation>
+ A tool-integrator-defined, ordered set of tools that tranform the project&apos;s resources into the project&apos;s outputs. A tool-chain can be defined as part of a configuration, or as an independent specification that is referenced from a separate configuration via the tool-chain superClass attribute.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="tool"/>
+ <element ref="targetPlatform"/>
+ <element ref="builder"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Unique identifier for the tool-chain.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ A descriptive name for the tool-chain to be used in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="superClass" type="string">
+ <annotation>
+ <documentation>
+ The id of a toolChain that this toolChain is derived from.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="isAbstract" type="boolean" use="default" value="false">
+ <annotation>
+ <documentation>
+ An optional field that flags a tool-chain as abstract. An abstract tool-chain must be defined as a top level object in the model definition and cannot be selected by the user in the UI, but tool-chains derived from this tool-chain will inherit its attributes and children. The default is false.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="unusedChildren" type="string">
+ <annotation>
+ <documentation>
+ A semi-colon separated list of child IDs of the superclass&apos; children that should not be automatically inherited by this element. Note: This attribute is not yet implemented.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="osList" type="string">
+ <annotation>
+ <documentation>
+ This field lists the host operating systems on which the tool-chain runs and is used by the managed build system to decide when the tool-chain is applicable. The value should be a comma-separated list. Current values are &quot;win32&quot;, &quot;linux&quot;, &quot;solaris&quot;, &quot;hpux&quot;, &quot;aix&quot; or &quot;any&quot;.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="archList" type="string">
+ <annotation>
+ <documentation>
+ This field lists the host architectures on which the tool-chain runs and is used by the managed build system to decide when the tool-chain is applicable. The value should be a comma-separated list. Current values are &quot;win32&quot;, &quot;linux&quot;, &quot;solaris&quot;, &quot;hpux&quot;, &quot;aix&quot; or &quot;any&quot;.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="errorParsers" type="string">
+ <annotation>
+ <documentation>
+ Specifies the default list of error parsers used by the tool-chain. Error parsers specified by child tool elements are added to this list. It is an ordered, semi-colon separated list of parser IDs. The order specifies the order in which the error parsers are invoked during a build.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="scannerInfoCollector" type="string">
+ <annotation>
+ <documentation>
+ Specifies a class that implements the &lt;code&gt;IManagedScannerInfoCollector&lt;/code&gt; for gathering the built-in compiler settings for a toolchain.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="resourceConfiguration">
+ <annotation>
+ <documentation>
+ A place to store build attributes of individual resources that are different from the configuration as a whole.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="tool"/>
+ </sequence>
+ <attribute name="resourcePath" type="string" use="required">
+ <annotation>
+ <documentation>
+ The path of the project resource to which this element applies.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="exclude" type="boolean">
+ <annotation>
+ <documentation>
+ Specifies whether the resource is excluded from building in the parent configuration. The default is false.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="tool">
+ <annotation>
+ <documentation>
+ Defines a tool used in the build process.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="option"/>
+ <element ref="optionCategory"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique identifier for the tool that will be used by the build model.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ Human-readable name for the tool to be used in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="superClass" type="string">
+ <annotation>
+ <documentation>
+ The id of a tool that this tool is derived from.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="isAbstract" type="boolean" use="default" value="false">
+ <annotation>
+ <documentation>
+ An optional field that flags a tool as abstract. An abstract tool must be defined as a top level object in the model definition and cannot be selected by the user in the UI, but tools derived from this tool will inherit its attributes and children. The default is false.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="unusedChildren" type="string">
+ <annotation>
+ <documentation>
+ A semi-colon separated list of child IDs of the superclass&apos; children that should not be automatically inherited by this element. Note: This attribute is not yet implemented.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="sources" type="string">
+ <annotation>
+ <documentation>
+ A comma-separated list of file extensions that the tool will produce output for.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="headerExtensions" type="string">
+ <annotation>
+ <documentation>
+ A comma-separated list of file extensions that are used for header files. Since many other files depend on the interfaces defined in header files, the build system needs to be able to determine that a header file has changed to properly rebuild its dependents.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="outputs" type="string">
+ <annotation>
+ <documentation>
+ The extension that the tool will produce from a given input.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="outputFlag" type="string">
+ <annotation>
+ <documentation>
+ An optional flag for tools that allow users to specify a name for the artifact of the tool. For example, the GCC compiler and linker tools typically allow the user to specify the name of the output with the &apos;-o&apos; flag, whereas the archiver that creates libraries does not.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="outputPrefix" type="string">
+ <annotation>
+ <documentation>
+ Some tools produce files with a special prefix that must be specified. For example, a librarian on POSIX systems expects the output to be lib&lt;target&gt;.a, so &apos;lib&apos; would be the prefix.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="natureFilter">
+ <annotation>
+ <documentation>
+ Filter the display (and use) of the tool by the nature of the project. Selecting a value of &apos;cnature&apos; insures that the tool will be displayed IFF there is a cnature associated with the project. A ccnature will filter this tool out. If &apos;ccnature&apos; is selected, the tool will only be available for C++ projects. If &apos;both&apos; is selected, the tool will be displayed when either nature is present. This attribute is required if it is not inherited from its superClass.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="cnature">
+ </enumeration>
+ <enumeration value="ccnature">
+ </enumeration>
+ <enumeration value="both">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="command" type="string">
+ <annotation>
+ <documentation>
+ The command that invokes the tool. For example, gcc for the Gnu C compiler, or g++ for the Gnu C++ compiler.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="commandLinePattern" type="string">
+ <annotation>
+ <documentation>
+ Specifies the command &quot;pattern&quot; that indicates how the parts of the command line are used to create the entire command line. The pattern consists of the replaceable variables command, flags, outputFlag, output, and inputs. The default pattern is ${command} ${flags} ${outputflag}${output} ${inputs} White space and other characters are significant and are copied to the generated command.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="commandLineGenerator" type="string">
+ <annotation>
+ <documentation>
+ Specifies the name of the class that implements IManagedCommandLineGenerator (TBS).
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="dependencyCalculator" type="string">
+ <annotation>
+ <documentation>
+ This is an optional field that specifies the class that provides the source file dependency calculation for a given tool. You can replace the default calculator with a class that implements the &lt;code&gt;IManagedDependencyGenerator&lt;/code&gt; interface.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="errorParsers" type="string">
+ <annotation>
+ <documentation>
+ Specifies the default list of error parsers used by the tool. Error parsers specified by the tool are added to this list specified by the tool-chain when a project resource is defined to use the tool. It is automatically removed when there are no more project resources using the tool. It is an ordered, semi-colon separated list of parser IDs. The order specifies the order in which the error parsers are invoked during a build.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="optionCategory">
+ <annotation>
+ <documentation>
+ An optional, but useful, mechanism for grouping options together.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Used by the build model to uniquely identify the option category.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ A human-readable category name, such as &apos;Preprocessor Options&apos;. This will be the name the user sees displayed in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="owner" type="string">
+ <annotation>
+ <documentation>
+ Option categories can belong to a tool or be nested inside other option categories. This is the ID of the owner of the category.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="option">
+ <annotation>
+ <documentation>
+ An option is associated with a tool. Options can contain boolean values, a simple text string, a selection from an enumerated list, or a list of values. Options also map the value they contain to a command-line flag, such as &apos;-g&apos; in the case of debugging symbol information for compilers.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="enumeratedOptionValue"/>
+ <element ref="listOptionValue"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique identifier for the option.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ A descriptive name for the option.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="superClass" type="string">
+ <annotation>
+ <documentation>
+ The id of an option that this option is derived from.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="isAbstract" type="boolean" use="default" value="false">
+ <annotation>
+ <documentation>
+ An optional field that flags an option as abstract. An abstract option must be defined as a top level object in the model definition and cannot be selected by the user in the UI, but options derived from this option will inherit its attributes and children. The default is false.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="unusedChildren" type="string">
+ <annotation>
+ <documentation>
+ A semi-colon separated list of child IDs of the superclass&apos; children that should not be automatically inherited by this element. Note: This attribute is not yet implemented.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="category" type="string">
+ <annotation>
+ <documentation>
+ This is the id of the option category for this option. The id can be the id of the tool which is also a category.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="resourceFilter">
+ <annotation>
+ <documentation>
+ Filter the display (and use) of the option by the type of the resource (currently Project or File). The value &apos;project&apos; causes the option to be used when applied to a project. The value &apos;file&apos; causes the option to be used when applied to a file. If &apos;all&apos; is selected, the option applies to all types of resources. The default is &quot;all&quot;.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="project">
+ </enumeration>
+ <enumeration value="file">
+ </enumeration>
+ <enumeration value="all">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="valueType" use="default" value="string">
+ <annotation>
+ <documentation>
+ General options can be one of the following types; &apos;string&apos; for catch-all entries for options that cannot be easily defined any other way, &apos;string list&apos; for entries that consist of a list of values such as defined symbols or paths, &apos;boolean&apos; for options that have two values, and &apos;enumerated&apos; for options that are one-of a list of values.
+
+Additional special types exist to flag options of special relevance to the build model; &apos;include&apos;, &apos;libs&apos;, &apos;userObjs&apos; and &apos;definedSymbols&apos;. You can pre-populate with optionValues, and they will display in the UI the same way the &apos;stringList&apos; options do. The build model will look specifically for these value types when clients query for include paths and preprocessor defines. The makefile generator will treat the libs and userObjs entries differently than other stringLists.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="string">
+ </enumeration>
+ <enumeration value="stringList">
+ </enumeration>
+ <enumeration value="boolean">
+ </enumeration>
+ <enumeration value="enumerated">
+ </enumeration>
+ <enumeration value="includePath">
+ </enumeration>
+ <enumeration value="definedSymbols">
+ </enumeration>
+ <enumeration value="libs">
+ </enumeration>
+ <enumeration value="userObjs">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="browseType">
+ <annotation>
+ <documentation>
+ This value is used for list (and related) options only. If you need a list option to prompt the user to browse for a file or directory when adding a new value, set the value of the attribute accordingly. By default the value is treated as no browsing needed.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="none">
+ </enumeration>
+ <enumeration value="file">
+ </enumeration>
+ <enumeration value="directory">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="value" type="string">
+ <annotation>
+ <documentation>
+ Specifies the value assigned to the option by the end user or in a default configuration. For boolean values, specify truth using the string &apos;true&apos;. All other strings will be treated as false.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="defaultValue" type="string">
+ <annotation>
+ <documentation>
+ Specifies the default value for the option if the &apos;value&apos; attribute is blank. For enumerated options the optionEnums will be searched for the default. For string list options, all defined optionValues will be treated as defaults. For boolean values, specify truth using the string &apos;true&apos;. All other strings will be treated as false.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="command" type="string">
+ <annotation>
+ <documentation>
+ An optional value that specifies the actual command that will be passed to the tool on the command line. The attribute value provides a &quot;pattern&quot; for specifying where the option &quot;value&quot; should be placed for options of type string and stringlist. If no ${value} is specified in the command, the option value is appended to the end of the specified command.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="commandFalse" type="string">
+ <annotation>
+ <documentation>
+ An optional value, used only with options of type Boolean, that specifies the actual command that will be passed to the tool on the command line when the value of the Boolean option is False.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="helpSupplier" type="string">
+ <annotation>
+ <documentation>
+ This field is unused in 2.0
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="tip" type="string">
+ <annotation>
+ <documentation>
+ Specifies a &quot;tip&quot; that can be displayed in hover help or on the property page. Not implemented in 2.0.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="enumeratedOptionValue">
+ <annotation>
+ <documentation>
+ Defines a single value of an enumerated option.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Unique identifier for the option enumeration.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ A descriptive name for the enumeration.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="isDefault" type="boolean">
+ <annotation>
+ <documentation>
+ Flags this enumerated value as the default to apply to the option if the user has not changed the setting.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="command" type="string">
+ <annotation>
+ <documentation>
+ The command that the enumerated value translates to on the command line.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="listOptionValue">
+ <annotation>
+ <documentation>
+ A value for defining individual elements of a list option.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="value" type="string" use="required">
+ <annotation>
+ <documentation>
+ The contents of the list item.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="builtIn" type="boolean">
+ <annotation>
+ <documentation>
+ This attribute flags the list value as a built-in value as opposed to something the user has entered. Built-ins will not be passed to clients that generate command lines (like the makefile generator). However, clients that need to take these settings into account (like the indexing service), will receive these settings. These values will appear grey in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="builder">
+ <annotation>
+ <documentation>
+ Represents the utility that drives the build process (typically, but not necessarily, a variant of &quot;make&quot;).
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique identifier for the builder that will be used by the build model.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ Human-readable name for the builder to be used in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="superClass" type="string">
+ <annotation>
+ <documentation>
+ The id of a builder that this builder is derived from.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="isAbstract" type="boolean" use="default" value="false">
+ <annotation>
+ <documentation>
+ An optional field that flags a builder as abstract. An abstract builder must be defined as a top level object in the model definition and cannot be selected by the user in the UI, but builders derived from this builder will inherit its attributes and children. The default is false.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="unusedChildren" type="string">
+ <annotation>
+ <documentation>
+ A semi-colon separated list of child IDs of the superclass&apos; children that should not be automatically inherited by this element. Note: This attribute is not yet implemented.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="command" type="string">
+ <annotation>
+ <documentation>
+ Specifies the default command to start the build utility for your toolchain. If the user changes this through the UI, the overriden value will be stored in the project build file. The build model will default to this value if the user ever resets a change.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="arguments" type="string">
+ <annotation>
+ <documentation>
+ Specifies the additional, default arguments that will be passed to the build utility when it is called by the builder. If the user changes the flags through the UI, the overriden value will be stored in the project build settings file. The build model will default to this value if the user ever resets a change.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="buildfileGenerator" type="string">
+ <annotation>
+ <documentation>
+ Allows you to supply a custom build file generator that conforms to the &lt;code&gt;IManagedBuilderMakefileGenerator&lt;/code&gt; interface.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="errorParsers" type="string">
+ <annotation>
+ <documentation>
+ Specifies the default list of error parsers used by the builder. These error parsers are added to this list specified by the parent tool-chain. It is an ordered, semi-colon separated list of parser IDs. The order specifies the order in which the error parsers are invoked during a build.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="targetPlatform">
+ <annotation>
+ <documentation>
+ Represents the os/architecture combination(s) upon which the outputs of a tool-chain can be deployed.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique identifier for the target platform that will be used by the build model.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ Human-readable name for the target platform to be used in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="superClass" type="string">
+ <annotation>
+ <documentation>
+ The id of a target platform that this target platform is derived from.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="isAbstract" type="boolean" use="default" value="false">
+ <annotation>
+ <documentation>
+ An optional field that flags a target platform as abstract. An abstract target platform must be defined as a top level object in the model definition and cannot be selected by the user in the UI, but target platforms derived from this targetPlatform will inherit its attributes and children. The default is false.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="unusedChildren" type="string">
+ <annotation>
+ <documentation>
+ A semi-colon separated list of child IDs of the superclass&apos; children that should not be automatically inherited by this element. Note: This attribute is not yet implemented.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="osList" type="string">
+ <annotation>
+ <documentation>
+ This field lists the target operating systems on which the outputs of a tool-chain runs. The value should be a comma-separated list. Current values are &quot;win32&quot;, &quot;linux&quot;, &quot;solaris&quot;, &quot;hpux&quot;, &quot;aix&quot; or &quot;any&quot;.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="archList" type="string">
+ <annotation>
+ <documentation>
+ This field lists the target architectures on which the outputs of a tool-chain runs. The value should be a comma-separated list. Current values are &quot;win32&quot;, &quot;linux&quot;, &quot;solaris&quot;, &quot;hpux&quot;, &quot;aix&quot; or &quot;any&quot;.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="binaryParser" type="string">
+ <annotation>
+ <documentation>
+ Set this to the ID of the binary parser for the output format of your configuration. Currently there are only 2 choices: org.eclipse.cdt.core.ELF for *nix executable artifacts, and &quot;org.eclipse.cdt.core.PE&quot; for artifacts that build for Windows, like Cygwin.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="dynamicElementProvider">
+ <annotation>
+ <documentation>
+ An optional element that allows a tool implementor to supply a class that creates one or more dynamic toolchain elements. For example, the class might create a new tool reference based on the contents of a special file, and a new target that uses that reference.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class that implements the &lt;code&gt;IManagedConfigElementProvider&lt;/code&gt; interface. The logic of determining the elements is left to the implementer, but they must be correctly formed or the build model will have trouble loading.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.core.IManagedConfigElementProvider"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ A meaningful name for the type of element being provided.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="managedBuildRevision">
+ <annotation>
+ <documentation>
+ &lt;p&gt;
+Version identifier for the managed build extension point. It is a string representation, consisting of three (3) tokens separated by a decimal point. The 3 tokens are positive integer numbers. For example, the following are valid version identifiers:
+ &lt;ul&gt;
+ &lt;li&gt;&lt;code&gt;0.0.0&lt;/code&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;code&gt;1.0.1234&lt;/code&gt;&lt;/li&gt;
+ &lt;li&gt;&lt;code&gt;1.9&lt;/code&gt; (interpreted as &lt;code&gt;1.9.0&lt;/code&gt;)&lt;/li&gt;
+ &lt;li&gt;&lt;code&gt;3&lt;/code&gt; (interpreted as &lt;code&gt;3.0.0&lt;/code&gt;)&lt;/li&gt;
+ &lt;/ul&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="fileVersion" type="string" use="required">
+ <annotation>
+ <documentation>
+ The actual string containing the three version tokens.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ This extension point was added in CDT 2.1
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of the extension point usage:
+&lt;p&gt;
+&lt;pre&gt;
+ &lt;extension
+ id=&quot;buildExample&quot;
+ name=&quot;Definitions for Build Example&quot;
+ point=&quot;org.eclipse.cdt.managedbuilder.core.buildDefinitions&quot;&gt;
+ etc...
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ An implementation of this extension point is supplied in &lt;samp&gt;org.eclipse.cdt.ui&lt;/samp&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2003, 2004 IBM Corporation and others.
+All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available on the &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt; Eclipse&lt;/a&gt; website.
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java
new file mode 100644
index 00000000000..7728618b7af
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java
@@ -0,0 +1,159 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.core;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+
+/**
+ * This class represents the utility that drives the build process
+ * (typically, but not necessarily, a variant of “make”). It defines
+ * the command needed to invoke the build utility in the command attribute.
+ * Any special flags that need to be passed to the builder are defined
+ * in the arguments attribute. The builder can specify the error parser(s)
+ * to be used to parse its output. The builder also specifies a Java class
+ * that generates the build file.
+ *
+ * @since 2.1
+ */
+public interface IBuilder extends IBuildObject {
+ public static final String ARGUMENTS = "arguments"; //$NON-NLS-1$
+ public static final String BUILDER_ELEMENT_NAME = "builder"; //$NON-NLS-1$
+ public static final String COMMAND = "command"; //$NON-NLS-1$
+
+ /**
+ * Returns the command line arguments to pass to the build/make utility used
+ * to build a configuration.
+ *
+ * @return String
+ */
+ public String getArguments();
+
+ /**
+ * Returns the plugin.xml element of the buildFileGenerator extension or <code>null</code> if none.
+ *
+ * @return IConfigurationElement
+ */
+ public IConfigurationElement getBuildFileGeneratorElement();
+
+ /**
+ * Returns the name of the build/make utility for the configuration.
+ *
+ * @return String
+ */
+ public String getCommand();
+
+ /**
+ * Returns the semicolon separated list of unique IDs of the error parsers associated
+ * with the builder.
+ *
+ * @return String
+ */
+ public String getErrorParserIds();
+
+ /**
+ * Returns the ordered list of unique IDs of the error parsers associated with the
+ * builder.
+ *
+ * @return String[]
+ */
+ public String[] getErrorParserList();
+
+ /**
+ * Returns the tool-chain that is the parent of this builder.
+ *
+ * @return IToolChain
+ */
+ public IToolChain getParent();
+
+ /**
+ * Returns the <code>IBuilder</code> that is the superclass of this
+ * target platform, or <code>null</code> if the attribute was not specified.
+ *
+ * @return IBuilder
+ */
+ public IBuilder getSuperClass();
+
+ /**
+ * Returns a semi-colon delimited list of child Ids of the superclass'
+ * children that should not be automatically inherited by this element.
+ * Returns an empty string if the attribute was not specified.
+ * @return String
+ */
+ public String getUnusedChildren();
+
+ /**
+ * Returns whether this element is abstract. Returns <code>false</code>
+ * if the attribute was not specified.
+ *
+ * @return boolean
+ */
+ public boolean isAbstract();
+
+ /**
+ * Returns <code>true</code> if this element has changes that need to
+ * be saved in the project file, else <code>false</code>.
+ *
+ * @return boolean
+ */
+ public boolean isDirty();
+
+ /**
+ * Returns <code>true</code> if this builder was loaded from a manifest file,
+ * and <code>false</code> if it was loaded from a project (.cdtbuild) file.
+ *
+ * @return boolean
+ */
+ public boolean isExtensionElement();
+
+ /**
+ * Sets the arguments to be passed to the build utility used by the
+ * receiver to produce a build goal.
+ *
+ * @param makeArgs
+ */
+ public void setArguments(String makeArgs);
+
+ /**
+ * Sets the BuildFileGenerator plugin.xml element
+ *
+ * @param element
+ */
+ public void setBuildFileGeneratorElement(IConfigurationElement element);
+
+ /**
+ * Sets the build command for the receiver to the value in the argument.
+ *
+ * @param command
+ */
+ public void setCommand(String command);
+
+ /**
+ * Sets the element's "dirty" (have I been modified?) flag.
+ *
+ * @param isDirty
+ */
+ public void setDirty(boolean isDirty);
+
+ /**
+ * Sets the semicolon separated list of error parser ids
+ *
+ * @param ids
+ */
+ public void setErrorParserIds(String ids);
+
+ /**
+ * Sets the isAbstract attribute of the builder.
+ *
+ * @param b
+ */
+ public void setIsAbstract(boolean b);
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java
index 846291eb556..bc1b2403070 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java
@@ -10,126 +10,333 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.core;
-import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+/**
+ * A tool-integrator defines default configurations as children of the project type.
+ * These provide a template for the configurations added to the user's project,
+ * which are stored in the project's .cdtbuild file.
+ * <p>
+ * The configuration contains one child of type tool-chain. This describes how the
+ * project's resources are transformed into the build artifact. The configuration can
+ * contain one or more children of type resourceConfiguration. These describe build
+ * settings of individual resources that are different from the configuration as a whole.
+ *
+ * @since 2.1
+ */
public interface IConfiguration extends IBuildObject {
+ public static final String ARTIFACT_NAME = "artifactName"; //$NON-NLS-1$
+ public static final String CLEAN_COMMAND = "cleanCommand"; //$NON-NLS-1$
// Schema element names
public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
- public static final String TOOLREF_ELEMENT_NAME = "toolReference"; //$NON-NLS-1$
+ public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
+ public static final String EXTENSION = "artifactExtension"; //$NON-NLS-1$
public static final String PARENT = "parent"; //$NON-NLS-1$
/**
+ * Creates a child resource configuration corresponding to the passed in file.
+ *
+ * @param file
+ * @return IResourceConfiguration
+ */
+ public IResourceConfiguration createResourceConfiguration(IFile file);
+
+ /**
+ * Creates the <code>IToolChain</code> child of this configuration.
+ *
+ * @param ToolChain The superClass, if any
+ * @param String The id for the new tool chain
+ * @param String The name for the new tool chain
+ *
+ * @return IToolChain
+ */
+ public IToolChain createToolChain(IToolChain superClass, String Id, String name, boolean isExtensionElement);
+
+ /**
+ * Returns the extension that should be applied to build artifacts created by
+ * this configuration.
+ *
+ * @return String
+ */
+ public String getArtifactExtension();
+
+ /**
+ * Returns the name of the final build artifact.
+ *
+ * @return String
+ */
+ public String getArtifactName();
+
+ /**
+ * Returns the build arguments from this configuration's builder
+ *
+ * @return String
+ */
+ public String getBuildArguments();
+
+ /**
+ * Returns the build command from this configuration's builder
+ *
+ * @return String
+ */
+ public String getBuildCommand();
+
+ /**
+ * Answers the OS-specific command to remove files created by the build
+ * of this configuration.
+ *
+ * @return String
+ */
+ public String getCleanCommand();
+
+ /**
+ * Answers the semicolon separated list of unique IDs of the error parsers associated
+ * with this configuration.
+ *
+ * @return String
+ */
+ public String getErrorParserIds();
+
+ /**
+ * Answers the ordered list of unique IDs of the error parsers associated
+ * with this configuration.
+ *
+ * @return String[]
+ */
+ public String[] getErrorParserList();
+
+ /**
* Projects have C or CC natures. Tools can specify a filter so they are not
* misapplied to a project. This method allows the caller to retrieve a list
* of tools from a project that are correct for a project's nature.
*
- * @param project the project to filter for
* @return an array of <code>ITools</code> that have compatible filters
- * for the specified project
+ * for this configuration.
+ */
+ ITool[] getFilteredTools();
+
+ /**
+ * Returns the managed-project parent of this configuration, if this is a
+ * project configuration. Otherwise, returns <code>null</code>.
+ *
+ * @return IManagedProject
*/
- ITool[] getFilteredTools(IProject project);
+ public IManagedProject getManagedProject();
/**
- * Returns the resource that owns the target that owns the configuration.
- * @return
+ * Returns the Eclipse project that owns the configuration.
+ *
+ * @return IResource
*/
public IResource getOwner();
/**
- * Answers the configuration that the receiver is based on.
+ * Returns the configuration that this configuration is based on.
*
- * @return
+ * @return IConfiguration
*/
public IConfiguration getParent();
/**
- * Returns the target for this configuration.
+ * Returns the project-type parent of this configuration, if this is an
+ * extension configuration. Otherwise, returns <code>null</code>.
*
- * @return
+ * @return IProjectType
*/
- public ITarget getTarget();
+ public IProjectType getProjectType();
/**
- * Answers the <code>ITool</code> in the receiver with the same
- * id as the argument, or <code>null</code>.
+ * Returns the resource configuration child of this configuration
+ * that is associated with the project resource, or <code>null</code> if none.
+ *
+ * @return IResourceConfiguration
+ */
+ public IResourceConfiguration getResourceConfiguration(String path);
+
+ /**
+ * Returns the resource configuration children of this configuration.
+ *
+ * @return IResourceConfigurations[]
+ */
+ public IResourceConfiguration[] getResourceConfigurations();
+
+ /**
+ * Returns the <code>ITool</code> in this configuration's tool-chain with
+ * the same id as the argument, or <code>null</code>.
*
* @param id unique identifier to search for
- * @return
+ * @return ITool
*/
- public ITool getToolById(String id);
+ public ITool getTool(String id);
/**
- * Returns the tools that are used in this configuration.
+ * Returns the <code>IToolChain</code> child of this configuration.
*
- * @return
+ * @return IToolChain
+ */
+ public IToolChain getToolChain();
+
+ /**
+ * Returns the command-line invocation command for the specified tool.
+ *
+ * @param tool The tool that will have its command retrieved.
+ * @return String The command
+ */
+ public String getToolCommand(ITool tool);
+
+ /**
+ * Returns the tools that are used in this configuration's tool-chain.
+ *
+ * @return ITool[]
*/
public ITool[] getTools();
/**
- * Answers <code>true</code> the receiver has changes that need to be saved
- * in the project file, else <code>false</code>.
+ * Returns <code>true</code> if this configuration has overridden the default build
+ * build command in this configuration, otherwise <code>false</code>.
+ *
+ * @return boolean
+ */
+ public boolean hasOverriddenBuildCommand();
+
+ /**
+ * Returns <code>true</code> if this configuration has changes that need to
+ * be saved in the project file, else <code>false</code>.
+ * Should not be called for an extension configuration.
*
* @return boolean
*/
public boolean isDirty();
+
+ /**
+ * Returns <code>true</code> if this configuration was loaded from a manifest file,
+ * and <code>false</code> if it was loaded from a project (.cdtbuild) file.
+ *
+ * @return boolean
+ */
+ public boolean isExtensionElement();
/**
- * Answers whether the receiver has been changed and requires the
+ * Returns whether this configuration has been changed and requires the
* project to be rebuilt.
*
- * @return <code>true</code> if the receiver contains a change
- * that needs the project to be rebuilt
+ * @return <code>true</code> if the configuration contains a change
+ * that needs the project to be rebuilt.
+ * Should not be called for an extension configuration.
*/
public boolean needsRebuild();
/**
+ * Removes a resource configuration from the configuration's list.
+ *
+ * @param option
+ */
+ public void removeResourceConfiguration(IResourceConfiguration resConfig);
+
+ /**
+ * Set (override) the extension that should be appended to the build artifact
+ * for the receiver.
+ *
+ * @param extension
+ */
+ public void setArtifactExtension(String extension);
+
+ /**
+ * Set the name of the artifact that will be produced when the receiver
+ * is built.
+ *
+ * @param name
+ */
+ public void setArtifactName(String name);
+
+ /**
+ * Sets the arguments to be passed to the build utility used by the
+ * receiver to produce a build goal.
+ *
+ * @param makeArgs
+ */
+ public void setBuildArguments(String makeArgs);
+
+ /**
+ * Sets the build command for the receiver to the value in the argument.
+ *
+ * @param command
+ */
+ public void setBuildCommand(String command);
+
+ /**
+ * Sets the command used to clean the outputs of this configuration.
+ *
+ * @param name
+ */
+ public void setCleanCommand(String command);
+
+ /**
+ * Sets the element's "dirty" (have I been modified?) flag.
+ *
* @param isDirty
*/
public void setDirty(boolean isDirty);
/**
+ * Sets the semicolon separated list of error parser ids
+ *
+ * @param ids
+ */
+ public void setErrorParserIds(String ids);
+
+ /**
* Sets the name of the receiver to the value specified in the argument
*
* @param name
*/
public void setName(String name);
-
+
/**
* Sets the value of a boolean option for this configuration.
*
+ * @param tool The Tool parent of the option.
* @param option The option to change.
* @param value The value to apply to the option.
*
+ * @return IOption The modified option. This can be the same option or a newly created option.
+ *
* @throws BuildException
*/
- public void setOption(IOption option, boolean value)
+ public IOption setOption(ITool tool, IOption option, boolean value)
throws BuildException;
/**
* Sets the value of a string option for this configuration.
*
+ * @param tool The Tool parent of the option.
* @param option The option that will be effected by change.
* @param value The value to apply to the option.
*
+ * @return IOption The modified option. This can be the same option or a newly created option.
+ *
* @throws BuildException
*/
- public void setOption(IOption option, String value)
+ public IOption setOption(ITool tool, IOption option, String value)
throws BuildException;
/**
* Sets the value of a list option for this configuration.
*
+ * @param tool The Tool parent of the option.
* @param option The option to change.
* @param value The values to apply to the option.
*
+ * @return IOption The modified option. This can be the same option or a newly created option.
+ *
* @throws BuildException
*/
- public void setOption(IOption option, String[] value)
+ public IOption setOption(ITool tool, IOption option, String[] value)
throws BuildException;
/**
- * Sets the rebuild state in the receiver.
+ * Sets the rebuild state in this configuration.
*
* @param rebuild <code>true</code> will force a rebuild the next time the project builds
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#setRebuildState(boolean)
@@ -137,11 +344,10 @@ public interface IConfiguration extends IBuildObject {
void setRebuildState(boolean rebuild);
/**
- * Overrides the tool command for a tool defined in the receiver.
+ * Overrides the tool command for a tool defined in this configuration's tool-chain.
*
- * @param tool The tool that will have its command modified
+ * @param tool The tool that will have its command modified.
* @param command The command
*/
public void setToolCommand(ITool tool, String command);
-
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfigurationV2.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfigurationV2.java
new file mode 100644
index 00000000000..4bf14b3c477
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfigurationV2.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+
+/**
+ * This class represents a project configuration in the old (CDT 2.0)
+ * managed build system model.
+ * <p>
+ * The configuration contains one or more children of type tool-reference.
+ *
+ * This class was deprecated in 2.1
+ */
+public interface IConfigurationV2 extends IBuildObject {
+ // Schema element names
+ public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
+ public static final String TOOLREF_ELEMENT_NAME = "toolReference"; //$NON-NLS-1$
+ public static final String PARENT = "parent"; //$NON-NLS-1$
+
+ /**
+ * Projects have C or CC natures. Tools can specify a filter so they are not
+ * misapplied to a project. This method allows the caller to retrieve a list
+ * of tools from a project that are correct for a project's nature.
+ *
+ * @param project the project to filter for
+ * @return an array of <code>ITools</code> that have compatible filters
+ * for the specified project
+ */
+ ITool[] getFilteredTools(IProject project);
+
+ /**
+ * Returns the resource that owns the project that owns the configuration.
+ * @return
+ */
+ public IResource getOwner();
+
+ /**
+ * Answers the configuration that this configuration is based on.
+ *
+ * @return
+ */
+ public IConfigurationV2 getParent();
+
+ /**
+ * Returns the target for this configuration.
+ *
+ * @return
+ */
+ public ITarget getTarget();
+
+ /**
+ * Answers the <code>ITool</code> in the receiver with the same
+ * id as the argument, or <code>null</code>.
+ *
+ * @param id unique identifier to search for
+ * @return ITool
+ */
+ public ITool getToolById(String id);
+
+ /**
+ * Returns the tools that are used in this configuration.
+ *
+ * @return ITool[]
+ */
+ public ITool[] getTools();
+
+ /**
+ * Returns the tool references that are children of this configuration.
+ *
+ * @return
+ */
+ public IToolReference[] getToolReferences();
+
+ /**
+ * Answers <code>true</code> the receiver has changes that need to be saved
+ * in the project file, else <code>false</code>.
+ *
+ * @return boolean
+ */
+ public boolean isDirty();
+
+ /**
+ * Answers whether the receiver has been changed and requires the
+ * project to be rebuilt.
+ *
+ * @return <code>true</code> if the receiver contains a change
+ * that needs the project to be rebuilt
+ */
+ public boolean needsRebuild();
+
+ /**
+ * Sets the element's "dirty" (have I been modified?) flag.
+ *
+ * @param isDirty
+ */
+ public void setDirty(boolean isDirty);
+
+ /**
+ * Sets the name of the receiver to the value specified in the argument
+ *
+ * @param name
+ */
+ public void setName(String name);
+
+ /**
+ * Sets the value of a boolean option for this configuration.
+ *
+ * @param option The option to change.
+ * @param value The value to apply to the option.
+ *
+ * @throws BuildException
+ */
+ public void setOption(IOption option, boolean value)
+ throws BuildException;
+
+ /**
+ * Sets the value of a string option for this configuration.
+ *
+ * @param option The option that will be effected by change.
+ * @param value The value to apply to the option.
+ *
+ * @throws BuildException
+ */
+ public void setOption(IOption option, String value)
+ throws BuildException;
+
+ /**
+ * Sets the value of a list option for this configuration.
+ *
+ * @param option The option to change.
+ * @param value The values to apply to the option.
+ *
+ * @throws BuildException
+ */
+ public void setOption(IOption option, String[] value)
+ throws BuildException;
+
+ /**
+ * Sets the rebuild state in the receiver.
+ *
+ * @param rebuild <code>true</code> will force a rebuild the next time the project builds
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#setRebuildState(boolean)
+ */
+ void setRebuildState(boolean rebuild);
+
+ /**
+ * Overrides the tool command for a tool defined in the receiver.
+ *
+ * @param tool The tool that will have its command modified
+ * @param command The command
+ */
+ public void setToolCommand(ITool tool, String command);
+
+ /**
+ * Sets the configuration that was created from this V2.0 configuration.
+ *
+ * @param config
+ */
+ public void setCreatedConfig(IConfiguration config);
+
+ /**
+ * Returns the configuration that was created from this V2.0 configuration.
+ *
+ * @return IConfiguration
+ */
+ public IConfiguration getCreatedConfig();
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java
index 3ae0c4885bb..050e857054d 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java
@@ -1,5 +1,3 @@
-package org.eclipse.cdt.managedbuilder.core;
-
/**********************************************************************
* Copyright (c) 2003,2004 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -10,15 +8,35 @@ package org.eclipse.cdt.managedbuilder.core;
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
+package org.eclipse.cdt.managedbuilder.core;
import java.util.List;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
+/*
+ * There is a ManagedBuildInfo per CDT managed build project. Here are
+ * some notes on their usage:
+ * o You can look up the managed build info associated with a CDT
+ * project by using ManagedBuildManager.getBuildInfo(IProject).
+ * o Given a ManagedBuildInfo, you can retrieve the associated CDT
+ * managed build system project by using getManagedProject.
+ * o The usage model of a ManagedBuildInfo is:
+ * 1. Call setDefaultConfiguration to set the context
+ * 2. Call other methods (e.g. getBuildArtifactName) which get
+ * information from the default configuration, and the other managed
+ * build system model elements that can be reached from the
+ * configuration.
+ */
public interface IManagedBuildInfo {
public static final String DEFAULT_CONFIGURATION = "defaultConfig"; //$NON-NLS-1$
public static final String DEFAULT_TARGET = "defaultTarget"; //$NON-NLS-1$
+ /*
+ * Note: "Target" routines are only currently applicable when loading a CDT 2.0
+ * or earlier managed build project file (.cdtbuild)
+ */
+
/**
* Add a new target to the build information for the receiver
*
@@ -35,6 +53,28 @@ public interface IManagedBuildInfo {
*/
public boolean buildsFileType(String srcExt);
+ /**
+ * Returns <code>IManagedCommandLineInfo</code> for source with extension
+ * @param sourceExtension - source extension
+ * @param flags - build flags
+ * @param outputFlag - output flag for build tool
+ * @param outputPrefix
+ * @param outputName
+ * @param inputResources
+ * @return IManagedCommandLineInfo
+ */
+ public IManagedCommandLineInfo generateCommandLineInfo( String sourceExtension, String[] flags,
+ String outputFlag, String outputPrefix, String outputName, String[] inputResources );
+
+ /**
+ * Answers a <code>String</code> containing the arguments to be passed to make.
+ * For example, if the user has selected a build that keeps going on error, the
+ * answer would contain {"-k"}.
+ *
+ * @return String
+ */
+ public String getBuildArguments();
+
/**
* Answers the file extension for the receivers build goal without a separator.
@@ -51,6 +91,12 @@ public interface IManagedBuildInfo {
public String getBuildArtifactName();
/**
+ * Answers a <code>String</code> containing the make command invocation
+ * for the default configuration.
+ */
+ public String getBuildCommand();
+
+ /**
* Answers the command needed to remove files on the build machine
*
* @return
@@ -67,7 +113,7 @@ public interface IManagedBuildInfo {
/**
* Answers a <code>String</code> array containing the names of all the configurations
- * defined for the project's current target.
+ * defined for the project.
*
* @return
*/
@@ -78,41 +124,33 @@ public interface IManagedBuildInfo {
*
* @return
*/
- public IConfiguration getDefaultConfiguration(ITarget target);
-
-
- /**
- * Returns the default target in the receiver.
- *
- * @return
- */
- public ITarget getDefaultTarget();
+ public IConfiguration getDefaultConfiguration();
/**
* @param sourceExtension
* @return
*/
public IManagedDependencyGenerator getDependencyGenerator(String sourceExtension);
-
+
/**
* Returns a <code>String</code> containing the flags, including
- * those overridden by the user, for the tool that handles the
- * type of source file defined by the argument.
+ * those overridden by the user, for the tool in the configuration
+ * defined by the argument.
*
* @param extension
* @return
*/
- public String getFlagsForSource(String extension);
-
+ public String getFlagsForConfiguration(String extension);
+
/**
* Returns a <code>String</code> containing the flags, including
* those overridden by the user, for the tool that handles the
- * type of target defined by the argument.
+ * type of source file defined by the argument.
*
* @param extension
* @return
*/
- public String getFlagsForTarget(String extension);
+ public String getFlagsForSource(String extension);
/**
* Answers the libraries the project links in.
@@ -120,22 +158,14 @@ public interface IManagedBuildInfo {
* @param extension
* @return
*/
- public String[] getLibsForTarget(String extension);
+ public String[] getLibsForConfiguration(String extension);
/**
- * Answers a <code>String</code> containing the arguments to be passed to make.
- * For example, if the user has selected a build that keeps going on error, the
- * answer would contain {"-k"}.
+ * Returns the ManagedProject associated with this build info
*
- * @return String
- */
- public String getMakeArguments();
-
- /**
- * Answers a <code>String</code> containing the make command invocation
- * for the default target/configuration.
+ * @return IManagedProject
*/
- public String getMakeCommand();
+ public IManagedProject getManagedProject( );
/**
* Answers the extension that will be built by the current configuration
@@ -168,12 +198,12 @@ public interface IManagedBuildInfo {
public String getOutputPrefix(String outputExtension);
/**
- * Get the currently selected target. This is used while the project
+ * Returns the currently selected configuration. This is used while the project
* property pages are displayed
*
- * @return target
+ * @return IConfiguration
*/
- public ITarget getSelectedTarget();
+ public IConfiguration getSelectedConfiguration();
/**
* Get the target specified in the argument.
@@ -192,21 +222,21 @@ public interface IManagedBuildInfo {
/**
* Returns a <code>String</code> containing the command-line invocation
- * for the tool associated with the source extension.
+ * for the tool associated with the extension.
*
- * @param sourceExtension the file extension of the file to be built
+ * @param extension the file extension of the build goal
* @return a String containing the command line invocation for the tool
*/
- public String getToolForSource(String sourceExtension);
+ public String getToolForConfiguration(String extension);
/**
* Returns a <code>String</code> containing the command-line invocation
- * for the tool associated with the target extension.
+ * for the tool associated with the source extension.
*
- * @param extension the file extension of the build goal
+ * @param sourceExtension the file extension of the file to be built
* @return a String containing the command line invocation for the tool
*/
- public String getToolForTarget(String extension);
+ public String getToolForSource(String sourceExtension);
/**
* Answers a <code>String</code> array containing the contents of the
@@ -215,7 +245,7 @@ public interface IManagedBuildInfo {
* @param extension the file ecxtension of the build target
* @return
*/
- public String[] getUserObjectsForTarget(String extension);
+ public String[] getUserObjectsForConfiguration(String extension);
/**
@@ -234,12 +264,20 @@ public interface IManagedBuildInfo {
/**
* Answers <code>true</code> if the extension matches one of the special
- * file extensions the tools for the target consider to be a header file.
+ * file extensions the tools for the configuration consider to be a header file.
*
* @param ext the file extension of the resource
* @return boolean
*/
public boolean isHeaderFile(String ext);
+
+ /**
+ * gets the read only status of Managed Build Info
+ *
+ * @return <code>true</code> if Managed Build Info is read only
+ * otherwise returns <code>false</code>
+ */
+ public boolean isReadOnly();
/**
@@ -276,18 +314,25 @@ public interface IManagedBuildInfo {
public boolean setDefaultConfiguration(String configName);
/**
- * Set the primary target for the receiver.
+ * Set the dirty flag for the build model to the value of the argument.
*
- * @param target
+ * @param isDirty
*/
- public void setDefaultTarget(ITarget target);
+ public void setDirty(boolean isDirty);
+
+ /**
+ * Sets the ManagedProject associated with this build info
+ *
+ * @param project
+ */
+ public void setManagedProject(IManagedProject project);
/**
- * Set the dirty flag for the build model to the value of the argument.
+ * sets the read only status of Managed Build Info
*
- * @param isDirty
+ * @param readOnly
*/
- public void setDirty(boolean isDirty);
+ public void setReadOnly(boolean readOnly);
/**
* Sets the rebuild state in the receiver to the value of the argument.
@@ -300,10 +345,10 @@ public interface IManagedBuildInfo {
public void setRebuildState(boolean rebuild);
/**
- * Set the currently selected target. This is used while the project
+ * Sets the currently selected configuration. This is used while the project
* property pages are displayed
*
- * @param target the user selection
+ * @param configuration the user selection
*/
- public void setSelectedTarget(ITarget target);
+ public void setSelectedConfiguration(IConfiguration configuration);
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedCommandLineGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedCommandLineGenerator.java
new file mode 100644
index 00000000000..40dc49ab54f
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedCommandLineGenerator.java
@@ -0,0 +1,28 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.core;
+
+public interface IManagedCommandLineGenerator {
+ /**
+ *
+ * @param tool
+ * @param commandNamee
+ * @param flags
+ * @param outputFlag
+ * @param outputPrefix
+ * @param outputName
+ * @param inputResources
+ * @param commandLinePattern
+ * @return
+ */
+ public IManagedCommandLineInfo generateCommandLineInfo( ITool tool, String commandName, String[] flags,
+ String outputFlag, String outputPrefix, String outputName, String[] inputResources, String commandLinePattern );
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedCommandLineInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedCommandLineInfo.java
new file mode 100644
index 00000000000..0b21a64dacd
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedCommandLineInfo.java
@@ -0,0 +1,61 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.core;
+
+public interface IManagedCommandLineInfo {
+ /**
+ * provide fully qualified command line string for tool invokation
+ * @return command line
+ */
+ public String getCommandLine();
+
+ /**
+ * give command line pattern
+ * @return
+ */
+ public String getCommandLinePattern();
+
+ /**
+ * provide tool name
+ * @return
+ */
+ public String getCommandName();
+
+ /**
+ * give command flags
+ * @return
+ */
+ public String getFlags();
+
+ /**
+ * provide list of resources used by tool for transformation
+ * @return
+ */
+ public String getInputs();
+
+ /**
+ * return output file name
+ * @return
+ */
+ public String getOutput();
+
+ /**
+ * give command flag to generate output
+ * @return
+ */
+ public String getOutputFlag();
+
+ /**
+ * return output prefix
+ * @return
+ */
+ public String getOutputPrefix();
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedProject.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedProject.java
new file mode 100644
index 00000000000..1beb1aa3754
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedProject.java
@@ -0,0 +1,147 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.core;
+
+import org.eclipse.core.resources.IResource;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * This class represents a project instance in the managed build system.
+ * Project instances are stored in the .cdtbuild file. Note that there
+ * is no reason to define a project element in a manifest file – it
+ * would never be used.
+ * <p>
+ * The following steps occur when a CDT user creates a new Managed Build
+ * project:
+ * 1. A new project element is created. Its projectType attribute is set
+ * to the projectType that the user selected. Its name attribute is
+ * set to the project name that the user entered.
+ * 2. When the user adds a default configuration, a configuration
+ * element is created as a child of the project element created in
+ * step 1.
+ * 3. Add a tool-chain element that specifies as its superClass the
+ * tool-chain that is the child of the selected configuration element.
+ * 4. For each tool element child of the tool-chain that is the child of
+ * the selected configuration element, create a tool element child of
+ * the cloned configuration’s tool-chain element that specifies the
+ * original tool element as its superClass.
+ * This prepares the new project/configurations for modification by the user.
+ *
+ * @since 2.1
+ */
+public interface IManagedProject extends IBuildObject {
+ public static final String MANAGED_PROJECT_ELEMENT_NAME = "project"; //$NON-NLS-1$
+ public static final String PROJECTTYPE = "projectType"; //$NON-NLS-1$
+
+ /**
+ * Creates a configuration for this project populated with the tools
+ * and options settings from the parent configuration. As options and
+ * tools change in the parent, unoverridden values are updated in the
+ * child configuration as well.
+ * <p>
+ * This method performs steps 3 & 4 described above.
+ *
+ * @param parent The <code>IConfiguration</code> to use as a settings template
+ * @param id The unique id the new configuration will have
+ * @return IConfiguration of the new configuration
+ */
+ public IConfiguration createConfiguration(IConfiguration parent, String id);
+
+ /**
+ * Creates a configuration for this project populated with the tools
+ * and options settings from the parent configuration. As opposed to the
+ * <code>createConfiguration</code> method, this method creates a configuration
+ * from an existing configuration in the project.
+ * <p>
+ * In this case, the new configuration is cloned from the existing configuration,
+ * and does not retain a pointer to the existing configuration.
+ *
+ * @param parent The <code>IConfiguration</code> to clone
+ * @param id The unique id the new configuration will have
+ * @return IConfiguration of the new configuration
+ */
+ public IConfiguration createConfigurationClone(IConfiguration parent, String id);
+
+ /**
+ * Removes the configuration with the ID specified in the argument.
+ *
+ * @param id The unique id of the configuration
+ */
+ public void removeConfiguration(String id);
+
+ /**
+ * Returns all of the configurations defined by this project-type.
+ *
+ * @return IConfiguration[]
+ */
+ public IConfiguration[] getConfigurations();
+
+ /**
+ * Returns the configuration with the given id, or <code>null</code> if not found.
+ *
+ * @param id The unique id of the configuration
+ * @return IConfiguration
+ */
+ public IConfiguration getConfiguration(String id);
+
+ /**
+ * Answers the <code>IProjectType</code> that is the superclass of this
+ * project-type, or <code>null</code> if the attribute was not specified.
+ *
+ * @return IProjectType
+ */
+ public IProjectType getProjectType();
+
+ /**
+ * Returns the owner of the managed project (an IProject).
+ *
+ * @return IResource
+ */
+ public IResource getOwner();
+
+ /**
+ * Sets the owner of the managed project.
+ *
+ * @param resource
+ */
+ public void updateOwner(IResource resource);
+
+ /**
+ * Returns <code>true</code> if this project has changes that need to
+ * be saved in the project file, else <code>false</code>.
+ *
+ * @return boolean
+ */
+ public boolean isDirty();
+
+ /**
+ * Sets the element's "dirty" (have I been modified?) flag.
+ *
+ * @param isDirty
+ */
+ public void setDirty(boolean isDirty);
+
+ /**
+ * Persist the managed project to the project file (.cdtbuild).
+ *
+ * @param doc
+ * @param element
+ */
+ public void serialize(Document doc, Element element);
+
+ /**
+ * Returns the default build artifact name for the project
+ *
+ * @return String
+ */
+ public String getDefaultArtifactName();
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java
index 09605b5352c..1894974e2b9 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java
@@ -31,9 +31,16 @@ public interface IOption extends IBuildObject {
public static final String FILE = "file"; //$NON-NLS-1$
public static final int BROWSE_DIR = 2;
public static final String DIR = "directory"; //$NON-NLS-1$
+
+ // Resource Filter type
+ public static final int FILTER_ALL = 0;
+ public static final String ALL = "all"; //$NON-NLS-1$
+ public static final int FILTER_FILE = 1;
+ public static final int FILTER_PROJECT = 2;
+ public static final String PROJECT = "project"; //$NON-NLS-1$
// Schema attribute names for option elements
- public static final String BROSWE_TYPE = "browseType"; //$NON-NLS-1$
+ public static final String BROWSE_TYPE = "browseType"; //$NON-NLS-1$
public static final String CATEGORY = "category"; //$NON-NLS-1$
public static final String COMMAND = "command"; //$NON-NLS-1$
public static final String COMMAND_FALSE = "commandFalse"; //$NON-NLS-1$
@@ -41,6 +48,7 @@ public interface IOption extends IBuildObject {
public static final String ENUM_VALUE = "enumeratedOptionValue"; //$NON-NLS-1$
public static final String IS_DEFAULT = "isDefault"; //$NON-NLS-1$
public static final String LIST_VALUE = "listOptionValue"; //$NON-NLS-1$
+ public static final String RESOURCE_FILTER = "resourceFilter"; //$NON-NLS-1$
public static final String TYPE_BOOL = "boolean"; //$NON-NLS-1$
public static final String TYPE_ENUM = "enumerated"; //$NON-NLS-1$
public static final String TYPE_INC_PATH = "includePath"; //$NON-NLS-1$
@@ -48,12 +56,28 @@ public interface IOption extends IBuildObject {
public static final String TYPE_STRING = "string"; //$NON-NLS-1$
public static final String TYPE_STR_LIST = "stringList"; //$NON-NLS-1$
public static final String TYPE_USER_OBJS = "userObjs"; //$NON-NLS-1$
+ public static final String TYPE_DEFINED_SYMBOLS = "definedSymbols"; //$NON-NLS-1$
+ public static final String VALUE = "value"; //$NON-NLS-1$
public static final String VALUE_TYPE = "valueType"; //$NON-NLS-1$
// Schema attribute names for listOptionValue elements
public static final String LIST_ITEM_VALUE = "value"; //$NON-NLS-1$
public static final String LIST_ITEM_BUILTIN = "builtIn"; //$NON-NLS-1$
+ /**
+ * Returns the tool defining this option.
+ *
+ * @return ITool
+ */
+ public ITool getParent();
+
+ /**
+ * Returns the <code>IOption</code> that is the superclass of this
+ * option, or <code>null</code> if the attribute was not specified.
+ *
+ * @return IOption
+ */
+ public IOption getSuperClass();
/**
* If this option is defined as an enumeration, this function returns
@@ -74,11 +98,34 @@ public interface IOption extends IBuildObject {
public boolean getBooleanValue() throws BuildException;
/**
- * @return
+ * Returns the setting of the browseType attribute
+ *
+ * @return int
*/
public int getBrowseType();
/**
+ * Sets the browseType attribute.
+ *
+ * @param int
+ */
+ public void setBrowseType(int type);
+
+ /**
+ * Returns the setting of the resourceFilter attribute
+ *
+ * @return int
+ */
+ public int getResourceFilter();
+
+ /**
+ * Sets the resourceFilter attribute.
+ *
+ * @param int
+ */
+ public void setResourceFilter(int filter);
+
+ /**
* Answers an array of strings containing the built-in values
* defined for a stringList, includePaths, definedSymbols, or libs
* option. If none have been defined, the array will be empty but
@@ -96,6 +143,13 @@ public interface IOption extends IBuildObject {
public IOptionCategory getCategory();
/**
+ * Sets the category for this option.
+ *
+ * @param IOptionCategory
+ */
+ public void setCategory(IOptionCategory category);
+
+ /**
* Answers a <code>String</code> containing the actual command line
* option associated with the option
*
@@ -104,11 +158,27 @@ public interface IOption extends IBuildObject {
public String getCommand();
/**
+ * Sets a <code>String</code> containing the actual command line
+ * option associated with the option
+ *
+ * @param String
+ */
+ public void setCommand(String command);
+
+ /**
* Answers a <code>String</code> containing the actual command line
* option associated with a Boolean option when the value is False
* @return String
*/
public String getCommandFalse();
+
+ /**
+ * Sets a <code>String</code> containing the actual command line
+ * option associated with a Boolean option when the value is False
+ *
+ * @param String
+ */
+ public void setCommandFalse(String commandFalse);
/**
* Answers the user-defined preprocessor symbols.
@@ -127,20 +197,20 @@ public interface IOption extends IBuildObject {
*
* @return
*/
- public String getEnumCommand (String id);
+ public String getEnumCommand (String id) throws BuildException;
/**
* Answers the "name" associated with the enumeration id.
*
* @return
*/
- public String getEnumName (String id);
+ public String getEnumName (String id) throws BuildException;
/**
* @param name
* @return
*/
- public String getEnumeratedId(String name);
+ public String getEnumeratedId(String name) throws BuildException;
/**
* Answers an array of <code>String</code> containing the includes paths
@@ -151,7 +221,6 @@ public interface IOption extends IBuildObject {
*/
public String[] getIncludePaths() throws BuildException;
-
/**
* Answers an array or <code>String</code>s containing the libraries
* that must be linked into the project.
@@ -188,15 +257,7 @@ public interface IOption extends IBuildObject {
* @throws BuildException
*/
public String getStringValue() throws BuildException;
-
- /**
- * Returns the tool defining this option.
- *
- * @return ITool
- */
- public ITool getTool();
-
-
+
/**
* Answers all of the user-defined object files that must be linked with
* the final build target.
@@ -207,10 +268,90 @@ public interface IOption extends IBuildObject {
public String [] getUserObjects() throws BuildException;
/**
+ * Returns the raw value of this option.
+ *
+ * @return Object The Object that contains the raw value of the option. The type
+ * of Object is specific to the option type.
+ */
+ public Object getValue();
+
+ /**
+ * Returns the raw default value of this option.
+ *
+ * @return Object The Object that contains the raw default value of the option. The type
+ * of Object is specific to the option type.
+ */
+ public Object getDefaultValue();
+
+ /**
* Get the type for the value of the option.
*
* @return int
*/
- public int getValueType();
+ public int getValueType() throws BuildException;
+
+ /**
+ * Sets the boolean value of the receiver to the value specified in the argument.
+ * If the receiver is not a reference to a boolean option, method will throw an
+ * exception.
+ *
+ * @param value
+ * @throws BuildException
+ */
+ public void setValue(boolean value) throws BuildException;
+ /**
+ * Sets the string value of the receiver to the value specified in the argument.
+ *
+ * @param value
+ * @throws BuildException
+ */
+ public void setValue(String value) throws BuildException;
+
+ /**
+ * Sets the value of the receiver to be an array of strings.
+ *
+ * @param value An array of strings to place in the option reference.
+ * @throws BuildException
+ */
+ public void setValue(String [] value) throws BuildException;
+
+ /**
+ * Sets the raw value of this option.
+ *
+ * @param v The Object that contains the raw value of the option. The type
+ * of Object is specific to the option type.
+ */
+ public void setValue(Object v);
+
+ /**
+ * Sets the default value of this option.
+ *
+ * @param v The Object that contains the default value of the option. The type
+ * of Object is specific to the option type.
+ */
+ public void setDefaultValue(Object v);
+
+ /**
+ * Sets the value-type of this option. Use with care.
+ *
+ * @param type
+ */
+ public void setValueType(int type);
+
+ /**
+ * Returns <code>true</code> if this option was loaded from a manifest file,
+ * and <code>false</code> if it was loaded from a project (.cdtbuild) file.
+ *
+ * @return boolean
+ */
+ public boolean isExtensionElement();
+
+ /**
+ * Returns <code>true</code> if this option only oveerides the value attribute
+ * of its superclass and <code>false</code> if it overrides other attributes.
+ *
+ * @return boolean
+ */
+ public boolean overridesOnlyValue();
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOptionCategory.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOptionCategory.java
index 748f44db220..f8bd5a00b9d 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOptionCategory.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOptionCategory.java
@@ -17,6 +17,13 @@ public interface IOptionCategory extends IBuildObject {
// Schema element names
public static final String OWNER = "owner"; //$NON-NLS-1$
+
+// Resource Filter type
+ public static final int FILTER_ALL = 0;
+ public static final String ALL = "all"; //$NON-NLS-1$
+ public static final int FILTER_FILE = 1;
+ public static final int FILTER_PROJECT = 2;
+ public static final String PROJECT = "project"; //$NON-NLS-1$
/**
* Returns the list of children of this node in the option category tree
@@ -26,12 +33,14 @@ public interface IOptionCategory extends IBuildObject {
public IOptionCategory[] getChildCategories();
/**
- * Returns the options in this category for a given configuration.
+ * Returns an array of ITool/IOption pairs for the options in this category
+ * for a given configuration.
*
* @param tool
- * @return
+ * @return Object[][]
*/
- public IOption[] getOptions(IConfiguration configuration);
+ public Object[][] getOptions(IConfiguration configuration);
+ public Object[][] getOptions(IResourceConfiguration resConfig);
/**
* Returns the category that owns this category, or null if this is the
@@ -47,4 +56,19 @@ public interface IOptionCategory extends IBuildObject {
* @return
*/
public ITool getTool();
+
+ /**
+ * Returns <code>true</code> if this element has changes that need to
+ * be saved in the project file, else <code>false</code>.
+ *
+ * @return boolean
+ */
+ public boolean isDirty();
+
+ /**
+ * Sets the element's "dirty" (have I been modified?) flag.
+ *
+ * @param isDirty
+ */
+ public void setDirty(boolean isDirty);
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IProjectType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IProjectType.java
new file mode 100644
index 00000000000..f139b73d8f9
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IProjectType.java
@@ -0,0 +1,131 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.core;
+
+/**
+ * This class represents project-types in the managed build system.
+ * A project-type is a tool-integrator defined class of project which
+ * acts as a template for the projects that a user will create.
+ * The project-type contains one or more children of type configuration.
+ * These are the default configurations that the user can choose from.
+ * Note that there is no reason to define a project-type element in a
+ * .cdtbuild file. It would never be used since project-type elements
+ * are used to primarily populate the "New Project" dialog boxes.
+ * Project types can be arranged into hierarchies to promote the efficient
+ * sharing of configurations. If you have defined a project type that
+ * should not be selected by the user, but is a root for other project
+ * types, it may be declared abstract by setting the isAbstract attribute
+ * to ‘true’. Abstract project types do not appear in the UI. You must
+ * provide a unique identifier for the project type in the id attribute.
+ * Children of the abstract project type will have the same configurations
+ * that the abstract project type has, unless they are explicitly named
+ * in the unusedChildren attribute of the child project. For these
+ * children to function properly, their superClass attribute must contain
+ * the unique identifier of the super class project type.
+ * A concrete project type must have at least one configuration defined
+ * for it. A project type must also define (or inherit) a set of tool-chain
+ * definitions that work together to produce the build goal as an output.
+ * You must also provide a meaningful name that will be displayed to the
+ * user in the UI and New Project wizards.
+ *
+ * @since 2.1
+ */
+public interface IProjectType extends IBuildObject {
+ public static final String PROJECTTYPE_ELEMENT_NAME = "projectType"; //$NON-NLS-1$
+ public static final String SUPERCLASS = "superClass"; //$NON-NLS-1$
+ public static final String IS_ABSTRACT = "isAbstract"; //$NON-NLS-1$
+ public static final String UNUSED_CHILDREN = "unusedChildren"; //$NON-NLS-1$
+ public static final String IS_TEST = "isTest"; //$NON-NLS-1$
+
+ /**
+ * Creates a configuration for this project-type populated with the tools
+ * and options settings from the parent configuration. As options and
+ * tools change in the parent, unoverridden values are updated in the
+ * child configuration as well.
+ * <p>
+ * NOTE: This routine affects the in-memory representation of the
+ * project-type, but since project-types are never written to the
+ * .cdtbuild file, the manifest definition does not change.
+ *
+ * @param parent The <code>IConfiguration</code> to use as a settings template
+ * @param id The unique id the new configuration will have
+ * @param name The name the new configuration will have
+ * @return IConfiguration of the new configuration
+ */
+ public IConfiguration createConfiguration(IConfiguration parent, String id, String name);
+
+ /**
+ * Removes the configuration with the ID specified in the argument.
+ * <p>
+ * NOTE: This routine affects the in-memory representation of the
+ * project-type, but since project-types are never written to the
+ * .cdtbuild file, the manifest definition does not change.
+ *
+ * @param id The unique id of the configuration
+ */
+ public void removeConfiguration(String id);
+
+ /**
+ * Returns all of the configurations defined by this project-type.
+ *
+ * @return IConfiguration[]
+ */
+ public IConfiguration[] getConfigurations();
+
+ /**
+ * Returns the configuration with the given id, or <code>null</code> if not found.
+ *
+ * @param id The unique id of the configuration
+ * @return IConfiguration
+ */
+ public IConfiguration getConfiguration(String id);
+
+ /**
+ * Returns the <code>IProjectType</code> that is the superclass of this
+ * project-type, or <code>null</code> if the attribute was not specified.
+ *
+ * @return IProjectType
+ */
+ public IProjectType getSuperClass();
+
+ /**
+ * Returns whether this element is abstract. Returns <code>false</code>
+ * if the attribute was not specified.
+ * @return boolean
+ */
+ public boolean isAbstract();
+
+ /**
+ * Sets the isAbstract attribute of the tool-chain.
+ *
+ * @param b
+ */
+ public void setIsAbstract(boolean b);
+
+ /**
+ * Returns a semi-colon delimited list of child Ids of the superclass'
+ * children that should not be automatically inherited by this element.
+ * Returns an empty string if the attribute was not specified.
+ * @return String
+ */
+ public String getUnusedChildren();
+
+ /**
+ * Returns <code>true</code> if the project-type is defined
+ * for testing purposes only, else <code>false</code>. A test project-type will
+ * not be shown in the UI but can still be manipulated programmatically.
+ * Returns <code>false</code> if the attribute was not specified.
+ *
+ * @return boolean
+ */
+ public boolean isTestProjectType();
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IResourceConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IResourceConfiguration.java
new file mode 100644
index 00000000000..431a5af65ec
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IResourceConfiguration.java
@@ -0,0 +1,171 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.core;
+
+import org.eclipse.core.resources.IResource;
+
+/**
+ * This class is a place to define build attributes of individual
+ * resources that are different from the configuration as a whole. The
+ * resourceConfiguration element can have multiple tool children. They
+ * define the tool(s) to be used to build the specified resource. The
+ * tool(s) can execute before, after, or instead of the default tool for
+ * the resources (see the toolOrder attribute in the tool element).
+ *
+ * @since 2.1
+ */
+public interface IResourceConfiguration extends IBuildObject {
+ public static final String RESOURCE_CONFIGURATION_ELEMENT_NAME = "resourceConfiguration"; //$NON-NLS-1$
+ public static final String RESOURCE_PATH = "resourcePath"; //$NON-NLS-1$
+ public static final String EXCLUDE = "exclude"; //$NON-NLS-1$
+
+ //TODO: Set name and ID in the constructors to be
+ // configuration-name#resource-path
+
+ /**
+ * Returns the configuration that is the parent of this resource configuration.
+ *
+ * @return IConfiguration
+ */
+ public IConfiguration getParent();
+
+ /**
+ * Returns whether the resource referenced by this element should be excluded
+ * from builds of the parent configuration.
+ * Returns <code>false</code> if the attribute was not specified.
+ *
+ * @return boolean
+ */
+ public boolean isExcluded();
+
+ /**
+ * Returns the path of the project resource that this element references.
+ * TODO: What is the format of the path? Absolute? Relative? Canonical?
+ *
+ * @return String
+ */
+ public String getResourcePath();
+
+ /**
+ * Sets the "excluded" flag for the resource.
+ * If <code>true</code>, the project resource identified by the resoursePath
+ * attribute is excluded from the build of the parent configuration.
+ *
+ * @param boolean
+ */
+ public void setExclude(boolean excluded);
+
+ /**
+ * Sets the resource path to which this resource configuration applies.
+ */
+ public void setResourcePath(String path);
+
+ /**
+ * Returns <code>true</code> if this element has changes that need to
+ * be saved in the project file, else <code>false</code>.
+ *
+ * @return boolean
+ */
+ public boolean isDirty();
+
+ /**
+ * Sets the element's "dirty" (have I been modified?) flag.
+ *
+ * @param isDirty
+ */
+ public void setDirty(boolean isDirty);
+
+ /**
+ * Returns the list of tools associated with this resource configuration.
+ *
+ * @return ITool[]
+ */
+ public ITool[] getTools();
+
+ /**
+ * Returns the tool in this resource configuration with the ID specified
+ * in the argument, or <code>null</code>
+ *
+ * @param id The ID of the requested tool
+ * @return ITool
+ */
+ public ITool getTool(String id);
+
+ /**
+ * Creates a <code>Tool</code> child for this resource configuration.
+ *
+ * @param ITool The superClass, if any
+ * @param String The id for the new tool chain
+ * @param String The name for the new tool chain
+ * @param boolean Indicates whether this is an extension element or a managed project element
+ *
+ * @return ITool
+ */
+ public ITool createTool(ITool superClass, String Id, String name, boolean isExtensionElement);
+
+ /**
+ * Overrides the tool command for a tool defined in this resource configuration's tool.
+ *
+ * @param tool The tool that will have its command modified
+ * @param command The command
+ */
+ public void setToolCommand(ITool tool, String command);
+ /**
+ * Sets the value of a boolean option for this resource configuration.
+ *
+ * @param tool The Tool parent of the option.
+ * @param option The option to change.
+ * @param value The value to apply to the option.
+ *
+ * @return IOption The modified option. This can be the same option or a newly created option.
+ *
+ * @throws BuildException
+ */
+ public IOption setOption(ITool tool, IOption option, boolean value)
+ throws BuildException;
+
+ /**
+ * Sets the value of a string option for this resource configuration.
+ *
+ * @param tool The Tool parent of the option.
+ * @param option The option that will be effected by change.
+ * @param value The value to apply to the option.
+ *
+ * @return IOption The modified option. This can be the same option or a newly created option.
+ *
+ * @throws BuildException
+ */
+ public IOption setOption(ITool tool, IOption option, String value)
+ throws BuildException;
+
+ /**
+ * Sets the value of a list option for this resource configuration.
+ *
+ * @param tool The Tool parent of the option.
+ * @param option The option to change.
+ * @param value The values to apply to the option.
+ *
+ * @return IOption The modified option. This can be the same option or a newly created option.
+ *
+ * @throws BuildException
+ */
+ public IOption setOption(ITool tool, IOption option, String[] value)
+ throws BuildException;
+
+
+ /**
+ * Returns the Eclipse project that owns the resource configuration.
+ *
+ * @return IResource
+ */
+ public IResource getOwner();
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java
index e1fad3621c8..c6156e20b56 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java
@@ -10,12 +10,15 @@
**********************************************************************/
package org.eclipse.cdt.managedbuilder.core;
+import org.eclipse.cdt.managedbuilder.internal.core.ProjectType;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
import org.eclipse.core.resources.IResource;
/**
* This class represents targets for the managed build process. A target
* is some type of resource built using a given collection of tools.
+ *
+ * Note: This class was deprecated in 2.1
*/
public interface ITarget extends IBuildObject {
public static final String TARGET_ELEMENT_NAME = "target"; //$NON-NLS-1$
@@ -39,20 +42,20 @@ public interface ITarget extends IBuildObject {
* change in the parent, unoverridden values are updated in the child
* config as well.
*
- * @param parent The <code>IConfiguration</code> to use as a settings template
+ * @param parent The <code>IConfigurationV2</code> to use as a settings template
* @param id The unique id the new configuration will have
- * @return IConfiguration
+ * @return IConfigurationV2
*/
- public IConfiguration createConfiguration(IConfiguration parent, String id);
+ public IConfigurationV2 createConfiguration(IConfigurationV2 parent, String id);
/**
* Creates a new configuration for the target. It is populated with
* the tools defined for that target and options set at their defaults.
*
* @param id id for this configuration.
- * @return IConfiguration
+ * @return IConfigurationV2
*/
- public IConfiguration createConfiguration(String id);
+ public IConfigurationV2 createConfiguration(String id);
/**
* Answers the extension that should be applied to build artifacts created by
@@ -105,9 +108,9 @@ public interface ITarget extends IBuildObject {
/**
* Returns all of the configurations defined by this target.
*
- * @return IConfiguration[]
+ * @return IConfigurationV2[]
*/
- public IConfiguration[] getConfigurations();
+ public IConfigurationV2[] getConfigurations();
/**
* Get the default extension that should be applied to build artifacts
@@ -149,9 +152,9 @@ public interface ITarget extends IBuildObject {
* Returns the configuration with the given id, or <code>null</code> if not found.
*
* @param id
- * @return IConfiguration
+ * @return IConfigurationV2
*/
- public IConfiguration getConfiguration(String id);
+ public IConfigurationV2 getConfiguration(String id);
/**
* Gets the resource that this target is applied to.
@@ -246,13 +249,6 @@ public interface ITarget extends IBuildObject {
public void removeConfiguration(String id);
/**
- * Resets the make command in the receiver to the value specified in
- * its parent.
- *
- */
- public void resetMakeCommand();
-
- /**
* Set (override) the extension that should be appended to the build artifact
* for the receiver.
*
@@ -283,7 +279,6 @@ public interface ITarget extends IBuildObject {
*/
public void setMakeCommand(String command);
-
/**
* Sets the semicolon separated list of error parser ids
*
@@ -306,4 +301,18 @@ public interface ITarget extends IBuildObject {
*/
public void updateOwner(IResource resource);
+ /**
+ * Converts a CDT V2.0 target into a ProjectType + Configuration + Toolchain +
+ * Builder + TargetPlatform.
+ *
+ */
+ public void convertToProjectType();
+
+ /**
+ * Returns the <code>ProjectType</code> that this Target has been converted to,
+ * or <code>null</code> if it has not been converted.
+ *
+ * @return ProjectType
+ */
+ public ProjectType getCreatedProjectType();
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITargetPlatform.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITargetPlatform.java
new file mode 100644
index 00000000000..8b8ffa30c46
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITargetPlatform.java
@@ -0,0 +1,130 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.core;
+
+/**
+ * This class defines the os/architecture combination upon which the
+ * outputs of a tool-chain can be deployed. The osList and archList
+ * attributes contain the Eclipse names of the operating systems and
+ * architectures described by this element.
+ *
+ * @since 2.1
+ */
+public interface ITargetPlatform extends IBuildObject {
+ public static final String TARGET_PLATFORM_ELEMENT_NAME = "targetPlatform"; //$NON-NLS-1$
+ public static final String BINARY_PARSER = "binaryParser"; //$NON-NLS-1$
+ public static final String OS_LIST = "osList"; //$NON-NLS-1$
+ public static final String ARCH_LIST = "archList"; //$NON-NLS-1$
+
+ /**
+ * Returns the tool-chain that is the parent of this target platform.
+ *
+ * @return IToolChain
+ */
+ public IToolChain getParent();
+
+ /**
+ * Returns the <code>ITargetPlatform</code> that is the superclass of this
+ * target platform, or <code>null</code> if the attribute was not specified.
+ *
+ * @return ITargetPlatform
+ */
+ public ITargetPlatform getSuperClass();
+
+ /**
+ * Returns whether this element is abstract. Returns <code>false</code>
+ * if the attribute was not specified.
+ *
+ * @return boolean
+ */
+ public boolean isAbstract();
+
+ /**
+ * Sets the isAbstract attribute of the target paltform.
+ *
+ * @param b
+ */
+ public void setIsAbstract(boolean b);
+
+ /**
+ * Returns a semi-colon delimited list of child Ids of the superclass'
+ * children that should not be automatically inherited by this element.
+ * Returns an empty string if the attribute was not specified.
+ * @return String
+ */
+ public String getUnusedChildren();
+
+ /**
+ * Returns an array of operating systems this target platform represents.
+ *
+ * @return String[]
+ */
+ public String[] getOSList();
+
+ /**
+ * Sets the OS list.
+ *
+ * @param String[] The list of OS names
+ */
+ public void setOSList(String[] OSs);
+
+ /**
+ * Returns an array of architectures this target platform represents.
+ *
+ * @return String[]
+ */
+ public String[] getArchList();
+
+ /**
+ * Sets the architecture list.
+ *
+ * @param String[] The list of architecture names
+ */
+ public void setArchList(String[] archs);
+
+ /**
+ * Returns the unique ID of the binary parser associated with the target platform.
+ *
+ * @return String
+ */
+ public String getBinaryParserId();
+
+ /**
+ * Sets the string id of the binary parser for this target platform.
+ *
+ * @param id
+ */
+ public void setBinaryParserId(String id);
+
+ /**
+ * Returns <code>true</code> if this element has changes that need to
+ * be saved in the project file, else <code>false</code>.
+ *
+ * @return boolean
+ */
+ public boolean isDirty();
+
+ /**
+ * Sets the element's "dirty" (have I been modified?) flag.
+ *
+ * @param isDirty
+ */
+ public void setDirty(boolean isDirty);
+
+ /**
+ * Returns <code>true</code> if this target platform was loaded from a manifest file,
+ * and <code>false</code> if it was loaded from a project (.cdtbuild) file.
+ *
+ * @return boolean
+ */
+ public boolean isExtensionElement();
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java
index 61c35a33dbc..c5dca6321eb 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java
@@ -13,11 +13,15 @@ package org.eclipse.cdt.managedbuilder.core;
import java.util.List;
/**
- *
+ * This class represents a utility of some sort that is used in the build process.
+ * A tool will generally process one or more resources to produce output resources.
+ * Most tools have a set of options that can be used to modify the behavior of the tool.
*/
public interface ITool extends IBuildObject {
// Schema element names
public static final String COMMAND = "command"; //$NON-NLS-1$
+ public static final String COMMAND_LINE_PATTERN = "commandLinePattern"; //$NON-NLS-1$
+ public static final String COMMAND_LINE_GENERATOR = "commandLineGenerator"; //$NON-NLS-1$
public static final String INTERFACE_EXTS = "headerExtensions"; //$NON-NLS-1$
public static final String NATURE = "natureFilter"; //$NON-NLS-1$
public static final String OPTION = "option"; //$NON-NLS-1$
@@ -35,40 +39,30 @@ public interface ITool extends IBuildObject {
public static final int FILTER_BOTH = 2;
/**
- * Return <code>true</code> if the receiver builds files with the
- * specified extension, else <code>false</code>.
+ * Returns the tool-chain or resource configuration that is the parent of this tool.
*
- * @param extension file extension of the source
- * @return boolean
+ * @return IBuildObject
*/
- public boolean buildsFileType(String extension);
-
+ public IBuildObject getParent();
+
/**
- * Answers the list of valid source extensions the receiver know how to build.
- * The list may be empty but will never be <code>null</code>.
+ * Creates a child Option for this tool.
*
- * @return List
+ * @param Option The superClass, if any
+ * @param String The id for the new option
+ * @param String The name for the new option
+ * @param boolean Indicates whether this is an extension element or a managed project element
+ *
+ * @return IOption
*/
- public List getInputExtensions();
+ public IOption createOption(IOption superClass, String Id, String name, boolean isExtensionElement);
/**
- * Answers a constant corresponding to the project nature the tool should be used
- * for. Possible answers are:
- *
- * <dl>
- * <dt>ITool.FILTER_C
- * <dd>The tool should only be displayed for C projects. <i>Notes:</i> even
- * though a C++ project has a C nature, this flag will mask the tool for C++
- * projects.
- * <dt>ITool.FILTER_CC
- * <dd>The tool should only be displayed for C++ projects.
- * <dt>ITool.FILTER_BOTH
- * <dd>The tool should be displayed for projects with both natures.
- * </dl>
+ * Removes an option from the tool's list.
*
- * @return int
+ * @param option
*/
- public int getNatureFilter();
+ public void removeOption(IOption option);
/**
* This is a deprecated method for retrieving an <code>IOption</code> from
@@ -101,6 +95,94 @@ public interface ITool extends IBuildObject {
* @return IOption[]
*/
public IOption[] getOptions();
+
+ /**
+ * Returns the <code>ITool</code> that is the superclass of this
+ * tool, or <code>null</code> if the attribute was not specified.
+ *
+ * @return ITool
+ */
+ public ITool getSuperClass();
+
+ /**
+ * Returns whether this element is abstract. Returns <code>false</code>
+ * if the attribute was not specified.
+ * @return boolean
+ */
+ public boolean isAbstract();
+
+ /**
+ * Sets the isAbstract attribute of the tool-chain.
+ *
+ * @param b
+ */
+ public void setIsAbstract(boolean b);
+
+ /**
+ * Returns a semi-colon delimited list of child Ids of the superclass'
+ * children that should not be automatically inherited by this element.
+ * Returns an empty string if the attribute was not specified.
+ * @return String
+ */
+ public String getUnusedChildren();
+
+ /**
+ * Returns the semicolon separated list of unique IDs of the error parsers associated
+ * with the tool.
+ *
+ * @return String
+ */
+ public String getErrorParserIds();
+
+ /**
+ * Returns the ordered list of unique IDs of the error parsers associated with the
+ * tool.
+ *
+ * @return String[]
+ */
+ public String[] getErrorParserList();
+
+ /**
+ * Sets the semicolon separated list of error parser ids
+ *
+ * @param ids
+ */
+ public void setErrorParserIds(String ids);
+
+ /**
+ * Returns the list of valid source extensions this tool knows how to build.
+ * The list may be empty but will never be <code>null</code>.
+ *
+ * @return List
+ */
+ public List getInputExtensions();
+
+ /**
+ * Returns the list of valid header extensions for this tool.
+ * The list may be empty but will never be <code>null</code>.
+ *
+ * @return List
+ */
+ public List getInterfaceExtensions();
+
+ /**
+ * Answers a constant corresponding to the project nature the tool should be used
+ * for. Possible answers are:
+ *
+ * <dl>
+ * <dt>ITool.FILTER_C
+ * <dd>The tool should only be displayed for C projects. <i>Notes:</i> even
+ * though a C++ project has a C nature, this flag will mask the tool for C++
+ * projects.
+ * <dt>ITool.FILTER_CC
+ * <dd>The tool should only be displayed for C++ projects.
+ * <dt>ITool.FILTER_BOTH
+ * <dd>The tool should be displayed for projects with both natures.
+ * </dl>
+ *
+ * @return int
+ */
+ public int getNatureFilter();
/**
* Answers all of the output extensions that the receiver can build.
@@ -119,6 +201,13 @@ public interface ITool extends IBuildObject {
public String getOutputExtension(String inputExtension);
/**
+ * Sets all of the output extensions that the receiver can build.
+ *
+ * @param String
+ */
+ public void setOutputExtensions(String extensions);
+
+ /**
* Answers the argument that must be passed to a specific tool in order to
* control the name of the output artifact. For example, the GCC compile and
* linker use '-o', while the archiver does not.
@@ -126,6 +215,15 @@ public interface ITool extends IBuildObject {
* @return String
*/
public String getOutputFlag();
+
+ /**
+ * Sets the argument that must be passed to a specific tool in order to
+ * control the name of the output artifact. For example, the GCC compile and
+ * linker use '-o', while the archiver does not.
+ *
+ * @param String
+ */
+ public void setOutputFlag(String flag);
/**
* Answers the prefix that the tool should prepend to the name of the build artifact.
@@ -135,10 +233,11 @@ public interface ITool extends IBuildObject {
public String getOutputPrefix();
/**
- * Return the target that defines this tool, if applicable
- * @return ITarget
- */
-// public ITarget getTarget();
+ * Sets the prefix that the tool should prepend to the name of the build artifact.
+ * For example, a librarian usually prepends 'lib' to the target.a
+ * @param String
+ */
+ public void setOutputPrefix(String prefix);
/**
* Answers the command-line invocation defined for the receiver.
@@ -148,6 +247,41 @@ public interface ITool extends IBuildObject {
public String getToolCommand();
/**
+ * Sets the command-line invocation command defined for this tool.
+ *
+ * @param String
+ *
+ * @return boolean if <code>true</code>, then the tool command was modified
+ */
+ public boolean setToolCommand(String command);
+
+ /**
+ * Returns command line pattern for this tool
+ * @return String
+ */
+ public String getCommandLinePattern();
+
+ /**
+ * Sets the command line pattern for this tool
+ * @param String
+ */
+ public void setCommandLinePattern(String pattern);
+
+ /**
+ * Returns command line generator specified for this tool
+ * @return IManagedCommandLineGenerator
+ */
+ public IManagedCommandLineGenerator getCommandLineGenerator();
+
+ /**
+ * Returns an array of command line arguments that have been specified for
+ * the tool.
+ * @return String[]
+ * @throws BuildException
+ */
+ public String[] getCommandFlags() throws BuildException;
+
+ /**
* Answers the additional command line arguments the user has specified for
* the tool.
*
@@ -163,6 +297,22 @@ public interface ITool extends IBuildObject {
* @return IOptionCategory
*/
public IOptionCategory getTopOptionCategory();
+
+ /**
+ * Returns the option category children of this tool.
+ *
+ * @return IOptionCategory[]
+ */
+ public IOptionCategory[] getChildCategories();
+
+ /**
+ * Return <code>true</code> if the receiver builds files with the
+ * specified extension, else <code>false</code>.
+ *
+ * @param extension file extension of the source
+ * @return boolean
+ */
+ public boolean buildsFileType(String extension);
/**
* Answers <code>true</code> if the tool considers the file extension to be
@@ -182,4 +332,26 @@ public interface ITool extends IBuildObject {
*/
public boolean producesFileType(String outputExtension);
+ /**
+ * Returns <code>true</code> if this tool has changes that need to
+ * be saved in the project file, else <code>false</code>.
+ *
+ * @return boolean
+ */
+ public boolean isDirty();
+
+ /**
+ * Sets the element's "dirty" (have I been modified?) flag.
+ *
+ * @param isDirty
+ */
+ public void setDirty(boolean isDirty);
+
+ /**
+ * Returns <code>true</code> if this tool was loaded from a manifest file,
+ * and <code>false</code> if it was loaded from a project (.cdtbuild) file.
+ *
+ * @return boolean
+ */
+ public boolean isExtensionElement();
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolChain.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolChain.java
new file mode 100644
index 00000000000..20887343228
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolChain.java
@@ -0,0 +1,251 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.core;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+
+/**
+ * This class represents a tool-integrator-defined, ordered set of tools
+ * that transform the project’s input into the project’s outputs. A
+ * tool-chain can be defined as part of a configuration, or as an
+ * independent specification that is referenced in a separate configuration
+ * via the toolChain superclass attribute.
+ * <p>
+ * The toolChain contains one or more children of type tool. These define
+ * the tools used in the tool-chain. The toolChain contains one child of
+ * type targetPlatform. This defines the architecture/os combination where
+ * the outputs of the project can be deployed. The toolChain contains one
+ * child of type builder. This defines the “build” or “make” utility that
+ * is used to drive the transformation of the inputs into outputs.
+ *
+ * @since 2.1
+ */
+public interface IToolChain extends IBuildObject {
+ public static final String TOOL_CHAIN_ELEMENT_NAME = "toolChain"; //$NON-NLS-1$
+ public static final String OS_LIST = "osList"; //$NON-NLS-1$
+ public static final String ARCH_LIST = "archList"; //$NON-NLS-1$
+ public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
+ // The attribute name for the scanner info collector
+ public static final String SCANNER_INFO_ID = "scannerInfoCollector"; //$NON-NLS-1$
+
+ /**
+ * Returns the configuration that is the parent of this tool-chain.
+ *
+ * @return IConfiguration
+ */
+ public IConfiguration getParent();
+
+ /**
+ * Creates the <code>TargetPlatform</code> child of this tool-chain.
+ *
+ * @param ITargetPlatform The superClass, if any
+ * @param String The id for the new tool chain
+ * @param String The name for the new tool chain
+ * @param boolean Indicates whether this is an extension element or a managed project element
+ *
+ * @return ITargetPlatform
+ */
+ public ITargetPlatform createTargetPlatform(ITargetPlatform superClass, String Id, String name, boolean isExtensionElement);
+
+ /**
+ * Returns the target-platform child of this tool-chain
+ *
+ * @return ITargetPlatform
+ */
+ public ITargetPlatform getTargetPlatform();
+
+ /**
+ * If the tool chain is not an extension element, and it has its own TargetPlatform child,
+ * remove the TargetPlatform so that the tool chain uses its superclass' TargetPlatform
+ */
+ public void removeLocalTargetPlatform();
+
+ /**
+ * Creates the <code>Builder</code> child of this tool-chain.
+ *
+ * @param IBuilder The superClass, if any
+ * @param String The id for the new tool chain
+ * @param String The name for the new tool chain
+ * @param boolean Indicates whether this is an extension element or a managed project element
+ *
+ * @return IBuilder
+ */
+ public IBuilder createBuilder(IBuilder superClass, String Id, String name, boolean isExtensionElement);
+
+ /**
+ * If the tool chain is not an extension element, and it has its own Builder child,
+ * remove the builder so that the tool chain uses its superclass' Builder
+ */
+ public void removeLocalBuilder();
+
+ /**
+ * Returns the builder child of this tool-chain.
+ *
+ * @return IBuilder
+ */
+ public IBuilder getBuilder();
+
+ /**
+ * Creates a <code>Tool</code> child of this tool-chain.
+ *
+ * @param ITool The superClass, if any
+ * @param String The id for the new tool chain
+ * @param String The name for the new tool chain
+ * @param boolean Indicates whether this is an extension element or a managed project element
+ *
+ * @return ITool
+ */
+ public ITool createTool(ITool superClass, String Id, String name, boolean isExtensionElement);
+
+ /**
+ * Returns an array of tool children of this tool-chain
+ *
+ * @return ITool[]
+ */
+ public ITool[] getTools();
+
+ /**
+ * Returns the tool in this tool-chain with the ID specified in the argument,
+ * or <code>null</code>
+ *
+ * @param id The ID of the requested tool
+ * @return ITool
+ */
+ public ITool getTool(String id);
+
+ /**
+ * Returns the <code>IToolChain</code> that is the superclass of this
+ * tool-chain, or <code>null</code> if the attribute was not specified.
+ *
+ * @return IToolChain
+ */
+ public IToolChain getSuperClass();
+
+ /**
+ * Returns whether this element is abstract. Returns <code>false</code>
+ * if the attribute was not specified.
+ * @return boolean
+ */
+ public boolean isAbstract();
+
+ /**
+ * Sets the isAbstract attribute of the tool-chain.
+ *
+ * @param b
+ */
+ public void setIsAbstract(boolean b);
+
+ /**
+ * Returns a semi-colon delimited list of child Ids of the superclass'
+ * children that should not be automatically inherited by this element.
+ * Returns an empty string if the attribute was not specified.
+ * @return String
+ */
+ public String getUnusedChildren();
+
+ /**
+ * Returns an array of operating systems the tool-chain outputs can run on.
+ *
+ * @return String[]
+ */
+ public String[] getOSList();
+
+ /**
+ * Sets the OS list.
+ *
+ * @param String[] The list of OS names
+ */
+ public void setOSList(String[] OSs);
+
+ /**
+ * Returns an array of architectures the tool-chain outputs can run on.
+ *
+ * @return String[]
+ */
+ public String[] getArchList();
+
+ /**
+ * Sets the architecture list.
+ *
+ * @param String[] The list of architecture names
+ */
+ public void setArchList(String[] archs);
+
+ /**
+ * Returns the semicolon separated list of unique IDs of the error parsers associated
+ * with the tool-chain.
+ *
+ * @return String
+ */
+ public String getErrorParserIds();
+
+ /**
+ * Returns the semicolon separated list of unique IDs of the error parsers associated
+ * with the tool-chain, filtered for the specified configuration.
+ *
+ * @param config
+ * @return String
+ */
+ public String getErrorParserIds(IConfiguration config);
+
+ /**
+ * Returns the ordered list of unique IDs of the error parsers associated with the
+ * tool-chain.
+ *
+ * @return String[]
+ */
+ public String[] getErrorParserList();
+
+ /**
+ * Sets the semicolon separated list of error parser ids.
+ *
+ * @param ids
+ */
+ public void setErrorParserIds(String ids);
+
+ /**
+ * Returns the plugin.xml element of the scannerInfoCollector extension or <code>null</code> if none.
+ *
+ * @return IConfigurationElement
+ */
+ public IConfigurationElement getScannerInfoCollectorElement();
+
+ /**
+ * Sets the ScannerInfoCollector plugin.xml element
+ *
+ * @param element
+ */
+ public void setScannerInfoCollectorElement(IConfigurationElement element);
+
+ /**
+ * Returns <code>true</code> if this tool-chain has changes that need to
+ * be saved in the project file, else <code>false</code>.
+ *
+ * @return boolean
+ */
+ public boolean isDirty();
+
+ /**
+ * Sets the element's "dirty" (have I been modified?) flag.
+ *
+ * @param isDirty
+ */
+ public void setDirty(boolean isDirty);
+
+ /**
+ * Returns <code>true</code> if this tool-chain was loaded from a manifest file,
+ * and <code>false</code> if it was loaded from a project (.cdtbuild) file.
+ *
+ * @return boolean
+ */
+ public boolean isExtensionElement();
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolReference.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolReference.java
index 7d69183d4ba..960570585d7 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolReference.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolReference.java
@@ -15,6 +15,9 @@ import java.util.List;
import org.eclipse.cdt.managedbuilder.internal.core.OptionReference;
+/*
+ * Note: This class was deprecated in 2.1
+ */
public interface IToolReference extends ITool {
/**
@@ -69,4 +72,40 @@ public interface IToolReference extends ITool {
*/
public boolean setToolCommand(String cmd);
+ /*
+ * The following methods are added to allow the converter from ToolReference -> Tool
+ * to retrieve the actual value of attributes. These routines do not go to the
+ * referenced Tool for a value if the ToolReference does not have a value.
+ */
+
+ /**
+ * Answers all of the output extensions that the receiver can build.
+ *
+ * @return String
+ */
+ public String getRawOutputExtensions();
+
+ /**
+ * Answers the argument that must be passed to a specific tool in order to
+ * control the name of the output artifact. For example, the GCC compile and
+ * linker use '-o', while the archiver does not.
+ *
+ * @return String
+ */
+ public String getRawOutputFlag();
+
+ /**
+ * Answers the prefix that the tool should prepend to the name of the build artifact.
+ * For example, a librarian usually prepends 'lib' to the target.a
+ * @return String
+ */
+ public String getRawOutputPrefix();
+
+ /**
+ * Answers the command-line invocation defined for the receiver.
+ *
+ * @return String
+ */
+ public String getRawToolCommand();
+
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
index 6df1ead75f8..e634db1efbe 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
@@ -21,6 +21,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
+import java.util.Random;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -41,19 +42,32 @@ import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
+import org.eclipse.cdt.managedbuilder.internal.core.Builder;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.cdt.managedbuilder.internal.core.DefaultManagedConfigElement;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineGenerator;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
+import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
+import org.eclipse.cdt.managedbuilder.internal.core.Option;
+import org.eclipse.cdt.managedbuilder.internal.core.OptionCategory;
+import org.eclipse.cdt.managedbuilder.internal.core.ProjectType;
+import org.eclipse.cdt.managedbuilder.internal.core.ResourceConfiguration;
import org.eclipse.cdt.managedbuilder.internal.core.Target;
+import org.eclipse.cdt.managedbuilder.internal.core.TargetPlatform;
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
+import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
import org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator;
+import org.eclipse.cdt.managedbuilder.projectconverter.UpdateManagedProjectManager;
import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector;
+import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
@@ -65,6 +79,8 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobManager;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -82,33 +98,79 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
public static final String SETTINGS_FILE_NAME = ".cdtbuild"; //$NON-NLS-1$
private static final ITarget[] emptyTargets = new ITarget[0];
public static final String INTERFACE_IDENTITY = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".ManagedBuildManager"; //$NON-NLS-1$
- public static final String EXTENSION_POINT_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".ManagedBuildInfo"; //$NON-NLS-1$
+ public static final String EXTENSION_POINT_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".buildDefinitions"; //$NON-NLS-1$
+ public static final String EXTENSION_POINT_ID_V2 = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".ManagedBuildInfo"; //$NON-NLS-1$
private static final String REVISION_ELEMENT_NAME = "managedBuildRevision"; //$NON-NLS-1$
private static final String VERSION_ELEMENT_NAME = "fileVersion"; //$NON-NLS-1$
private static final String MANIFEST_VERSION_ERROR ="ManagedBuildManager.error.manifest.version.error"; //$NON-NLS-1$
private static final String PROJECT_VERSION_ERROR ="ManagedBuildManager.error.project.version.error"; //$NON-NLS-1$
// This is the version of the manifest and project files that
- private static final PluginVersionIdentifier buildInfoVersion = new PluginVersionIdentifier(2, 0, 0);
+ private static final PluginVersionIdentifier buildInfoVersion = new PluginVersionIdentifier(2, 1, 0);
private static Map depCalculatorsMap;
- private static boolean extensionTargetsLoaded = false;
- private static Map extensionTargetMap;
- private static List extensionTargets;
+ private static boolean projectTypesLoaded = false;
+ // Project types defined in the manifest files
+ private static Map projectTypeMap;
+ private static List projectTypes;
+ // Configurations defined in the manifest files
+ private static Map extensionConfigurationMap;
+ // Resource configurations defined in the manifest files
+ private static Map extensionResourceConfigurationMap;
+ // Tool-chains defined in the manifest files
+ private static Map extensionToolChainMap;
+ // Tools defined in the manifest files
private static Map extensionToolMap;
+ // Target Platforms defined in the manifest files
+ private static Map extensionTargetPlatformMap;
+ // Builders defined in the manifest files
+ private static Map extensionBuilderMap;
+ // Options defined in the manifest files
+ private static Map extensionOptionMap;
+ // Option Categories defined in the manifest files
+ private static Map extensionOptionCategoryMap;
+ // Targets defined in the manifest files (CDT V2.0 object model)
+ private static Map extensionTargetMap;
+ // "Selected configuraton" elements defined in the manifest files.
+ // These are configuration elements that map to objects in the internal
+ // representation of the manifest files. For example, ListOptionValues
+ // and enumeratedOptionValues are NOT included.
+ // Note that these "configuration elements" are not related to the
+ // managed build system "configurations".
+ // From the PDE Guide:
+ // A configuration element, with its attributes and children, directly
+ // reflects the content and structure of the extension section within the
+ // declaring plug-in's manifest (plugin.xml) file.
private static Map configElementMap;
-
-
// Listeners interested in build model changes
private static Map buildModelListeners;
+ // Random number for derived object model elements
+ private static Random randomNumber;
/**
- * Returns the list of targets that are defined by this project,
+ * Returns the next random number.
+ *
+ * @return int A positive integer
+ */
+ public static int getRandomNumber() {
+ if (randomNumber == null) {
+ // Set the random number seed
+ randomNumber = new Random();
+ randomNumber.setSeed(System.currentTimeMillis());
+ }
+ int i = randomNumber.nextInt();
+ if (i < 0) {
+ i *= -1;
+ }
+ return i;
+ }
+
+ /**
+ * Returns the list of project types that are defined by this project,
* projects referenced by this project, and by the extensions.
*
- * @param project
- * @return
+ * @return IProjectType[]
*/
- public static ITarget[] getDefinedTargets(IProject project) {
+ public static IProjectType[] getDefinedProjectTypes() {
try {
// Make sure the extensions are loaded
loadExtensions();
@@ -117,28 +179,38 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
e.printStackTrace();
}
- // Get the targets for this project and all referenced projects
- List definedTargets = null;
+ // Get the project types for this project and all referenced projects
+ List definedTypes = null;
// To Do
// Create the array and copy the elements over
- int size = extensionTargets != null ?
- extensionTargets.size() + (definedTargets != null ? definedTargets.size() : 0) :
+ int size = projectTypes != null ?
+ projectTypes.size() + (definedTypes != null ? definedTypes.size() : 0) :
0;
- ITarget[] targets = new ITarget[size];
+ IProjectType[] types = new IProjectType[size];
int n = 0;
- for (int i = 0; i < extensionTargets.size(); ++i)
- targets[n++] = (ITarget)extensionTargets.get(i);
+ for (int i = 0; i < projectTypes.size(); ++i)
+ types[n++] = (IProjectType)projectTypes.get(i);
- if (definedTargets != null)
- for (int i = 0; i < definedTargets.size(); ++i)
- targets[n++] = (ITarget)definedTargets.get(i);
+ if (definedTypes != null)
+ for (int i = 0; i < definedTypes.size(); ++i)
+ types[n++] = (IProjectType)definedTypes.get(i);
- return targets;
+ return types;
}
-
+
+ /**
+ * Returns the project type with the passed in ID
+ *
+ * @param String
+ * @return IProjectType
+ */
+ public static IProjectType getProjectType(String id) {
+ return (IProjectType)getExtensionProjectTypeMap().get(id);
+ }
+
/**
* Answers an instance of a class that implements the
* <code>IManagedDependencyGenerator</code> interface to generate
@@ -163,6 +235,13 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
if (extension != null) {
// There could be many of these
IExtension[] extensions = extension.getExtensions();
+ // Get the "configuraton elements" defined in the plugin.xml file.
+ // Note that these "configuration elements" are not related to the
+ // managed build system "configurations".
+ // From the PDE Guide:
+ // A configuration element, with its attributes and children, directly
+ // reflects the content and structure of the extension section within the
+ // declaring plug-in's manifest (plugin.xml) file.
for (int i = 0; i < extensions.length; i++) {
IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
for (int j = 0; j < configElements.length; j++) {
@@ -202,21 +281,57 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
}
/* (non-Javadoc)
- * Safe accessor for the map of IDs to Targets
+ * Safe accessor for the map of IDs to ProjectTypes
*
- * @return
+ * @return Map
*/
- protected static Map getExtensionTargetMap() {
- if (extensionTargetMap == null) {
- extensionTargetMap = new HashMap();
+ protected static Map getExtensionProjectTypeMap() {
+ if (projectTypeMap == null) {
+ projectTypeMap = new HashMap();
}
- return extensionTargetMap;
+ return projectTypeMap;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the map of IDs to Configurations
+ *
+ * @return Map
+ */
+ protected static Map getExtensionConfigurationMap() {
+ if (extensionConfigurationMap == null) {
+ extensionConfigurationMap = new HashMap();
+ }
+ return extensionConfigurationMap;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the map of IDs to Resource Configurations
+ *
+ * @return Map
+ */
+ protected static Map getExtensionResourceConfigurationMap() {
+ if (extensionResourceConfigurationMap == null) {
+ extensionResourceConfigurationMap = new HashMap();
+ }
+ return extensionResourceConfigurationMap;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the map of IDs to ToolChains
+ *
+ * @return Map
+ */
+ protected static Map getExtensionToolChainMap() {
+ if (extensionToolChainMap == null) {
+ extensionToolChainMap = new HashMap();
+ }
+ return extensionToolChainMap;
}
/* (non-Javadoc)
* Safe accessor for the map of IDs to Tools
*
- * @return
+ * @return Map
*/
protected static Map getExtensionToolMap() {
if (extensionToolMap == null) {
@@ -225,6 +340,66 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
return extensionToolMap;
}
+ /* (non-Javadoc)
+ * Safe accessor for the map of IDs to TargetPlatforms
+ *
+ * @return Map
+ */
+ protected static Map getExtensionTargetPlatformMap() {
+ if (extensionTargetPlatformMap == null) {
+ extensionTargetPlatformMap = new HashMap();
+ }
+ return extensionTargetPlatformMap;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the map of IDs to Builders
+ *
+ * @return Map
+ */
+ protected static Map getExtensionBuilderMap() {
+ if (extensionBuilderMap == null) {
+ extensionBuilderMap = new HashMap();
+ }
+ return extensionBuilderMap;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the map of IDs to Options
+ *
+ * @return Map
+ */
+ protected static Map getExtensionOptionMap() {
+ if (extensionOptionMap == null) {
+ extensionOptionMap = new HashMap();
+ }
+ return extensionOptionMap;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the map of IDs to Option Categories
+ *
+ * @return Map
+ */
+ protected static Map getExtensionOptionCategoryMap() {
+ if (extensionOptionCategoryMap == null) {
+ extensionOptionCategoryMap = new HashMap();
+ }
+ return extensionOptionCategoryMap;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the map of IDs to Targets (CDT V2.0 object model)
+ *
+ * @return Map
+ */
+ protected static Map getExtensionTargetMap() {
+ if (extensionTargetMap == null) {
+ extensionTargetMap = new HashMap();
+ }
+ return extensionTargetMap;
+ }
+
/**
* Returns the targets owned by this project. If none are owned,
* an empty array is returned.
@@ -244,14 +419,103 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
}
/**
- * Answers the tool with the ID specified in the argument or <code>null</code>.
+ * Returns the project type from the manifest with the ID specified in the argument
+ * or <code>null</code>.
*
* @param id
- * @return
+ * @return IProjectType
+ */
+ public static IProjectType getExtensionProjectType(String id) {
+ return (IProjectType) getExtensionProjectTypeMap().get(id);
+ }
+
+ /**
+ * Returns the configuration from the manifest with the ID specified in the argument
+ * or <code>null</code>.
+ *
+ * @param id
+ * @return IConfiguration
+ */
+ public static IConfiguration getExtensionConfiguration(String id) {
+ return (IConfiguration) getExtensionConfigurationMap().get(id);
+ }
+
+ /**
+ * Returns the resource configuration from the manifest with the ID specified in the argument
+ * or <code>null</code>.
+ *
+ * @param id
+ * @return IResourceConfiguration
+ */
+ public static IResourceConfiguration getExtensionResourceConfiguration(String id) {
+ return (IResourceConfiguration) getExtensionResourceConfigurationMap().get(id);
+ }
+
+ /**
+ * Returns the tool-chain from the manifest with the ID specified in the argument
+ * or <code>null</code>.
+ *
+ * @param id
+ * @return IToolChain
*/
- public static ITool getTool(String id) {
+ public static IToolChain getExtensionToolChain(String id) {
+ return (IToolChain) getExtensionToolChainMap().get(id);
+ }
+
+ /**
+ * Returns the tool from the manifest with the ID specified in the argument
+ * or <code>null</code>.
+ *
+ * @param id
+ * @return ITool
+ */
+ public static ITool getExtensionTool(String id) {
return (ITool) getExtensionToolMap().get(id);
}
+
+ /**
+ * Returns the target platform from the manifest with the ID specified in the argument
+ * or <code>null</code>.
+ *
+ * @param id
+ * @return ITargetPlatform
+ */
+ public static ITargetPlatform getExtensionTargetPlatform(String id) {
+ return (ITargetPlatform) getExtensionTargetPlatformMap().get(id);
+ }
+
+ /**
+ * Returns the builder from the manifest with the ID specified in the argument
+ * or <code>null</code>.
+ *
+ * @param id
+ * @return IBuilder
+ */
+ public static IBuilder getExtensionBuilder(String id) {
+ return (IBuilder) getExtensionBuilderMap().get(id);
+ }
+
+ /**
+ * Returns the option from the manifest with the ID specified in the argument
+ * or <code>null</code>.
+ *
+ * @param id
+ * @return IOption
+ */
+ public static IOption getExtensionOption(String id) {
+ return (IOption) getExtensionOptionMap().get(id);
+ }
+
+ /**
+ * Returns the target from the manifest with the ID specified in the argument
+ * or <code>null</code> - CDT V2.0 object model.
+ *
+ * @param id
+ * @return ITarget
+ */
+ public static ITarget getExtensionTarget(String id) {
+ return (ITarget) getExtensionTargetMap().get(id);
+ }
/**
* Answers the result of a best-effort search to find a target with the
@@ -295,20 +559,20 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
}
/**
- * Sets the currently selected target. This is used while the project
+ * Sets the currently selected configuration. This is used while the project
* property pages are displayed
*
* @param project
* @param target
*/
- public static void setSelectedTarget(IProject project, ITarget target) {
- if (project == null || target == null) {
+ public static void setSelectedConfiguration(IProject project, IConfiguration config) {
+ if (project == null) {
return;
}
// Set the default in build information for the project
IManagedBuildInfo info = getBuildInfo(project);
if (info != null) {
- info.setSelectedTarget(target);
+ info.setSelectedConfiguration(config);
}
}
@@ -316,7 +580,36 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
* @param targetId
* @return
*/
- public static IManagedBuilderMakefileGenerator getMakefileGenerator(String targetId) {
+ public static IManagedBuilderMakefileGenerator getBuildfileGenerator(IConfiguration config) {
+ try {
+ IToolChain toolChain = config.getToolChain();
+ IBuilder builder = toolChain.getBuilder();
+ IConfigurationElement element = builder.getBuildFileGeneratorElement();
+ if (element != null) {
+ if (element.getName().equalsIgnoreCase("target")) { //$NON-NLS-1$
+ if (element.getAttribute(ManagedBuilderCorePlugin.MAKEGEN_ID) != null) {
+ return (IManagedBuilderMakefileGenerator) element.createExecutableExtension(ManagedBuilderCorePlugin.MAKEGEN_ID);
+ }
+ } else {
+ if (element.getAttribute(ManagedBuilderCorePlugin.BUILDFILEGEN_ID) != null) {
+ return (IManagedBuilderMakefileGenerator) element.createExecutableExtension(ManagedBuilderCorePlugin.BUILDFILEGEN_ID);
+ }
+ }
+ }
+ }
+ catch (CoreException e) {
+ // Probably not defined
+ }
+ // If no generator is defined, return the default GNU generator
+ return new GnuMakefileGenerator();
+ }
+
+ /**
+ * load tool provider defined or default (if not found) command line generator special for selected tool
+ * @param toolId - id selected id
+ * @return IManagedCommandLineGenerator
+ */
+ public static IManagedCommandLineGenerator getCommandLineGenerator( String toolId ) {
try {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extension = registry.getExtensionPoint(EXTENSION_POINT_ID);
@@ -327,51 +620,37 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
for (int j = 0; j < configElements.length; j++) {
IConfigurationElement element = configElements[j];
- if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME)) {
- if (element.getAttribute(ITarget.ID).equals(targetId)) {
- if (element.getAttribute(ManagedBuilderCorePlugin.MAKEGEN_ID) != null) {
- return (IManagedBuilderMakefileGenerator) element.createExecutableExtension(ManagedBuilderCorePlugin.MAKEGEN_ID);
+ if (element.getName().equals(ITool.COMMAND_LINE_GENERATOR)) {
+ if (element.getAttribute(ITool.ID).equals(toolId)) {
+ if (element.getAttribute(ManagedBuilderCorePlugin.COMMANDLINEGEN_ID) != null) {
+ return (IManagedCommandLineGenerator) element.createExecutableExtension(ManagedBuilderCorePlugin.COMMANDLINEGEN_ID);
}
}
}
}
}
}
- }
- catch (CoreException e) {
- // Probably not defined
+ } catch( CoreException ex ) {
+
}
- // If no generator is defined, return the default GNU generator
- return new GnuMakefileGenerator();
+ return ManagedCommandLineGenerator.getCommandLineGenerator();
}
/**
* Targets may have a scanner collector defined that knows how to discover
* built-in compiler defines and includes search paths. Find the scanner
- * collector implentation for the target specified.
+ * collector implementation for the target specified.
*
* @param string the unique id of the target to search for
* @return an implementation of <code>IManagedScannerInfoCollector</code>
*/
- public static IManagedScannerInfoCollector getScannerInfoCollector(String targetId) {
+ public static IManagedScannerInfoCollector getScannerInfoCollector(IConfiguration config) {
try {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint extension = registry.getExtensionPoint(EXTENSION_POINT_ID);
- if (extension != null) {
- // There could be many of these
- IExtension[] extensions = extension.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- IConfigurationElement element = configElements[j];
- if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME)) {
- if (element.getAttribute(ITarget.ID).equals(targetId)) {
- if (element.getAttribute(ManagedBuilderCorePlugin.SCANNER_INFO_ID) != null) {
- return (IManagedScannerInfoCollector) element.createExecutableExtension(ManagedBuilderCorePlugin.SCANNER_INFO_ID);
- }
- }
- }
- }
+ IToolChain toolChain = config.getToolChain();
+ IConfigurationElement element = toolChain.getScannerInfoCollectorElement();
+ if (element != null) {
+ if (element.getAttribute(IToolChain.SCANNER_INFO_ID) != null) {
+ return (IManagedScannerInfoCollector) element.createExecutableExtension(IToolChain.SCANNER_INFO_ID);
}
}
}
@@ -388,14 +667,14 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
* @param project
* @return target
*/
- public static ITarget getSelectedTarget(IProject project) {
+ public static IConfiguration getSelectedConfiguration(IProject project) {
if (project == null) {
return null;
}
// Set the default in build information for the project
IManagedBuildInfo info = getBuildInfo(project);
if (info != null) {
- return info.getSelectedTarget();
+ return info.getSelectedConfiguration();
}
return null;
}
@@ -407,12 +686,36 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
*/
private static void notifyListeners(IConfiguration config, IOption option) {
// Continue if change is something that effect the scanner
- if (!(option.getValueType() == IOption.INCLUDE_PATH
- || option.getValueType() == IOption.PREPROCESSOR_SYMBOLS)) {
+ try {
+ if (!(option.getValueType() == IOption.INCLUDE_PATH
+ || option.getValueType() == IOption.PREPROCESSOR_SYMBOLS)) {
+ return;
+ }
+ } catch (BuildException e) {return;}
+
+ // Figure out if there is a listener for this change
+ IResource resource = config.getOwner();
+ List listeners = (List) getBuildModelListeners().get(resource);
+ if (listeners == null) {
return;
}
+ ListIterator iter = listeners.listIterator();
+ while (iter.hasNext()) {
+ ((IScannerInfoChangeListener)iter.next()).changeNotification(resource, (IScannerInfo)getBuildInfo(resource));
+ }
+ }
+
+ private static void notifyListeners(IResourceConfiguration resConfig, IOption option) {
+ // Continue if change is something that effect the scanreser
+ try {
+ if (!(option.getValueType() == IOption.INCLUDE_PATH
+ || option.getValueType() == IOption.PREPROCESSOR_SYMBOLS)) {
+ return;
+ }
+ } catch (BuildException e) {return;}
+
// Figure out if there is a listener for this change
- IResource resource = config.getOwner();
+ IResource resource = resConfig.getOwner();
List listeners = (List) getBuildModelListeners().get(resource);
if (listeners == null) {
return;
@@ -441,47 +744,109 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
* @param config The configuration the option belongs to.
* @param option The option to set the value for.
* @param value The boolean that the option should contain after the change.
+ *
+ * @return IOption The modified option. This can be the same option or a newly created option.
*/
- public static void setOption(IConfiguration config, IOption option, boolean value) {
+ public static IOption setOption(IConfiguration config, ITool tool, IOption option, boolean value) {
+ IOption retOpt;
try {
// Request a value change and set dirty if real change results
- config.setOption(option, value);
+ retOpt = config.setOption(tool, option, value);
notifyListeners(config, option);
} catch (BuildException e) {
- return;
+ return null;
}
+ return retOpt;
}
+ public static IOption setOption(IResourceConfiguration resConfig, ITool tool, IOption option, boolean value) {
+ IOption retOpt;
+ try {
+ // Request a value change and set dirty if real change results
+ retOpt = resConfig.setOption(tool, option, value);
+ notifyListeners(resConfig, option);
+ } catch (BuildException e) {
+ return null;
+ }
+ return retOpt;
+ }
/**
* Set the string value for an option for a given config.
*
* @param config The configuration the option belongs to.
* @param option The option to set the value for.
* @param value The value that the option should contain after the change.
+ *
+ * @return IOption The modified option. This can be the same option or a newly created option.
*/
- public static void setOption(IConfiguration config, IOption option, String value) {
+ public static IOption setOption(IConfiguration config, ITool tool, IOption option, String value) {
+ IOption retOpt;
try {
- config.setOption(option, value);
+ retOpt = config.setOption(tool, option, value);
notifyListeners(config, option);
} catch (BuildException e) {
- return;
+ return null;
}
+ return retOpt;
}
/**
+ * Set the string value for an option for a given resource config.
+ *
+ * @param resConfig The resource configuration the option belongs to.
+ * @param option The option to set the value for.
+ * @param value The value that the option should contain after the change.
+ *
+ * @return IOption The modified option. This can be the same option or a newly created option.
+ */
+ public static IOption setOption(IResourceConfiguration resConfig, ITool tool, IOption option, String value) {
+ IOption retOpt;
+ try {
+ retOpt = resConfig.setOption(tool, option, value);
+ notifyListeners(resConfig, option);
+ } catch (BuildException e) {
+ return null;
+ }
+ return retOpt;
+ }
+/**
* Set the string array value for an option for a given config.
*
* @param config The configuration the option belongs to.
* @param option The option to set the value for.
* @param value The values the option should contain after the change.
+ *
+ * @return IOption The modified option. This can be the same option or a newly created option.
*/
- public static void setOption(IConfiguration config, IOption option, String[] value) {
+ public static IOption setOption(IConfiguration config, ITool tool, IOption option, String[] value) {
+ IOption retOpt;
try {
- config.setOption(option, value);
+ retOpt = config.setOption(tool, option, value);
notifyListeners(config, option);
} catch (BuildException e) {
- return;
+ return null;
}
+ return retOpt;
+ }
+
+ /**
+ * Set the string array value for an option for a given resource config.
+ *
+ * @param resConfig The resource configuration the option belongs to.
+ * @param option The option to set the value for.
+ * @param value The values the option should contain after the change.
+ *
+ * @return IOption The modified option. This can be the same option or a newly created option.
+ */
+ public static IOption setOption(IResourceConfiguration resConfig, ITool tool, IOption option, String[] value) {
+ IOption retOpt;
+ try {
+ retOpt = resConfig.setOption(tool, option, value);
+ notifyListeners(resConfig, option);
+ } catch (BuildException e) {
+ return null;
+ }
+ return retOpt;
}
/**
@@ -499,7 +864,15 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
}
}
-
+ public static void setToolCommand(IResourceConfiguration resConfig, ITool tool, String command) {
+ // The tool may be a reference.
+ if (tool instanceof IToolReference) {
+ // If so, just set the command in the reference
+ ((IToolReference)tool).setToolCommand(command);
+ } else {
+ resConfig.setToolCommand(tool, command);
+ }
+ }
/**
* Saves the build information associated with a project and all resources
* in the project to the build info file.
@@ -517,7 +890,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
ManagedBuildInfo buildInfo = (ManagedBuildInfo) getBuildInfo(project);
// Save the build info
- if (buildInfo != null && (force == true || buildInfo.isDirty())) {
+ if (buildInfo != null && !buildInfo.isReadOnly() && (force == true || buildInfo.isDirty())) {
// For post-2.0 projects, there will be a version
String projectVersion = buildInfo.getVersion();
if (projectVersion != null) {
@@ -543,9 +916,9 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
String utfString = stream.toString("UTF8"); //$NON-NLS-1$
if (projectFile.exists()) {
- projectFile.setContents(new ByteArrayInputStream(utfString.getBytes("UTF8")), IResource.FORCE, new NullProgressMonitor());
+ projectFile.setContents(new ByteArrayInputStream(utfString.getBytes("UTF8")), IResource.FORCE, new NullProgressMonitor()); //$NON-NLS-1$
} else {
- projectFile.create(new ByteArrayInputStream(utfString.getBytes("UTF8")), IResource.FORCE, new NullProgressMonitor());
+ projectFile.create(new ByteArrayInputStream(utfString.getBytes("UTF8")), IResource.FORCE, new NullProgressMonitor()); //$NON-NLS-1$
}
// Close the streams
@@ -593,35 +966,61 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
* @param configuration
*/
public static void resetConfiguration(IProject project, IConfiguration configuration) {
- // Make sure the extensions are loaded
- try {
- loadExtensions();
- } catch (BuildException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- // Find out the parent of the configuration
- IConfiguration parentConfig = configuration.getParent();
-
- // Get the config element for the parent from the map
- IManagedConfigElement configElement = getConfigElement(parentConfig);
-
// reset the configuration
- ((Configuration)configuration).reset(configElement);
+ ((Configuration)configuration).reset();
}
-
+ public static void resetResourceConfiguration(IProject project, IResourceConfiguration resConfig) {
+ // reset the configuration
+ ((ResourceConfiguration) resConfig).reset();
+ }
/**
- * @param target
+ * Adds a ProjectType that is is specified in the manifest to the
+ * build system. It is available to any element that
+ * has a reference to it as part of its description.
+ *
+ * @param projectType
*/
- public static void addExtensionTarget(Target target) {
- if (extensionTargets == null) {
- extensionTargets = new ArrayList();
+ public static void addExtensionProjectType(ProjectType projectType) {
+ if (projectTypes == null) {
+ projectTypes = new ArrayList();
}
- extensionTargets.add(target);
- getExtensionTargetMap().put(target.getId(), target);
+ projectTypes.add(projectType);
+ getExtensionProjectTypeMap().put(projectType.getId(), projectType);
+ }
+
+ /**
+ * Adds a Configuration that is is specified in the manifest to the
+ * build system. It is available to any element that
+ * has a reference to it as part of its description.
+ *
+ * @param configuration
+ */
+ public static void addExtensionConfiguration(Configuration configuration) {
+ getExtensionConfigurationMap().put(configuration.getId(), configuration);
+ }
+
+ /**
+ * Adds a Resource Configuration that is is specified in the manifest to the
+ * build system. It is available to any element that
+ * has a reference to it as part of its description.
+ *
+ * @param resourceConfiguration
+ */
+ public static void addExtensionResourceConfiguration(ResourceConfiguration resourceConfiguration) {
+ getExtensionResourceConfigurationMap().put(resourceConfiguration.getId(), resourceConfiguration);
+ }
+
+ /**
+ * Adds a ToolChain that is is specified in the manifest to the
+ * build system. It is available to any element that
+ * has a reference to it as part of its description.
+ *
+ * @param toolChain
+ */
+ public static void addExtensionToolChain(ToolChain toolChain) {
+ getExtensionToolChainMap().put(toolChain.getId(), toolChain);
}
/**
@@ -639,6 +1038,75 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
}
/**
+ * Adds a TargetPlatform that is is specified in the manifest to the
+ * build system. It is available to any element that
+ * has a reference to it as part of its description.
+ *
+ * @param targetPlatform
+ */
+ public static void addExtensionTargetPlatform(TargetPlatform targetPlatform) {
+ getExtensionTargetPlatformMap().put(targetPlatform.getId(), targetPlatform);
+ }
+
+ /**
+ * Adds a Builder that is is specified in the manifest to the
+ * build system. It is available to any element that
+ * has a reference to it as part of its description.
+ *
+ * @param Builder
+ */
+ public static void addExtensionBuilder(Builder builder) {
+ getExtensionBuilderMap().put(builder.getId(), builder);
+ }
+
+ /**
+ * Adds a Option that is is specified in the manifest to the
+ * build system. It is available to any element that
+ * has a reference to it as part of its description.
+ *
+ * @param option
+ */
+ public static void addExtensionOption(Option option) {
+ getExtensionOptionMap().put(option.getId(), option);
+ }
+
+ /**
+ * Adds a OptionCategory that is is specified in the manifest to the
+ * build system. It is available to any element that
+ * has a reference to it as part of its description.
+ *
+ * @param optionCategory
+ */
+ public static void addExtensionOptionCategory(OptionCategory optionCategory) {
+ getExtensionOptionCategoryMap().put(optionCategory.getId(), optionCategory);
+ }
+
+ /**
+ * Adds a Target that is is specified in the manifest to the
+ * build system. It is available to any CDT 2.0 object model element that
+ * has a reference to it as part of its description.
+ *
+ * @param target
+ */
+ public static void addExtensionTarget(Target target) {
+ getExtensionTargetMap().put(target.getId(), target);
+ }
+
+ /**
+ * Creates a new project instance for the resource based on the parent project type.
+ *
+ * @param resource
+ * @param parentTarget
+ * @return new <code>ITarget</code> with settings based on the parent passed in the arguments
+ * @throws BuildException
+ */
+ public static IManagedProject createManagedProject(IResource resource, IProjectType parent)
+ throws BuildException
+ {
+ return new ManagedProject(resource, parent);
+ }
+
+ /**
* Creates a new target for the resource based on the parentTarget.
*
* @param resource
@@ -721,7 +1189,6 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
// In this case we should trigger an init and deltas
newEntries.add(ManagedBuildInfo.containerEntry);
cProject.setRawPathEntries((IPathEntry[])newEntries.toArray(new IPathEntry[newEntries.size()]), new NullProgressMonitor());
- info.setContainerCreated(true);
}
}
@@ -753,15 +1220,33 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
* Load the build information for the specified resource from its project
* file. Pay attention to the version number too.
*/
- private static ManagedBuildInfo loadBuildInfo(IProject project) {
+ private static ManagedBuildInfo loadBuildInfo(IProject project) throws Exception {
ManagedBuildInfo buildInfo = null;
IFile file = project.getFile(SETTINGS_FILE_NAME);
if (!file.exists())
return null;
// So there is a project file, load the information there
+ InputStream stream = null;
+ try {
+ stream = file.getContents();
+ } catch (ResourceException e) {
+ // TODO: Why couldn't the file be read?
+ if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
+ // TODO: Issue a warning?
+ // Read it anyway...
+ try {
+ stream = file.getContents(true);
+ } catch (Exception fe) {
+ throw fe;
+ }
+ }
+ } catch (Exception e) {
+ buildInfo = null;
+ // TODO: Issue an error message that the managed build project file (.cdtbuild) is invalid
+ }
+
try {
- InputStream stream = file.getContents();
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = parser.parse(stream);
String fileVersion = null;
@@ -793,66 +1278,302 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
if (fileVersion != null) {
buildInfo.setVersion(fileVersion);
}
+ if(!UpdateManagedProjectManager.isCompatibleProject(buildInfo)){
+ try{
+ UpdateManagedProjectManager.updateProject(project,buildInfo);
+ } catch(CoreException e){
+ //TODO: error occured while updating the project,
+ //handle error, log error or display the message
+ }
+ }
project.setSessionProperty(buildInfoProperty, buildInfo);
}
} catch (Exception e) {
+ throw e;
}
return buildInfo;
}
/* (non-Javadoc)
+ * This method loads all of the managed build system manifest files
+ * that have been installed with CDT. An internal hierarchy of
+ * objects is created that contains the information from the manifest
+ * files. The information is then accessed through the ManagedBuildManager.
+ *
* Since the class does not have a constructor but all public methods
* call this method first, it is effectively a startup method
*/
private static void loadExtensions() throws BuildException {
- if (extensionTargetsLoaded)
+ if (projectTypesLoaded)
return;
- // Get those extensions
+ // Do this once
+ projectTypesLoaded = true;
+
+ // Get the extensions that use the current CDT managed build model
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID);
- IExtension[] extensions = extensionPoint.getExtensions();
+ if( extensionPoint != null) {
+ IExtension[] extensions = extensionPoint.getExtensions();
+ if (extensions != null) {
- // First call the constructors
- for (int i = 0; i < extensions.length; ++i) {
- IExtension extension = extensions[i];
- // Can we read this manifest
- if (!isVersionCompatible(extension)) {
- //The version of the Plug-in is greater than what the manager thinks it understands
- throw new BuildException(ManagedMakeMessages.getResourceString(MANIFEST_VERSION_ERROR));
- }
- IConfigurationElement[] elements = extension.getConfigurationElements();
- loadConfigElements(DefaultManagedConfigElement.convertArray(elements));
- }
- // Then call resolve.
- Iterator toolIter = getExtensionToolMap().values().iterator();
- while (toolIter.hasNext()) {
- try {
- Tool tool = (Tool)toolIter.next();
- tool.resolveReferences();
- } catch (Exception ex) {
- // TODO: log
- ex.printStackTrace();
+ // First call the constructors of the internal classes that correspond to the
+ // build model elements
+ for (int i = 0; i < extensions.length; ++i) {
+ IExtension extension = extensions[i];
+ // Can we read this manifest
+ if (!isVersionCompatible(extension)) {
+ //The version of the Plug-in is greater than what the manager thinks it understands
+ throw new BuildException(ManagedMakeMessages.getResourceString(MANIFEST_VERSION_ERROR));
+ }
+ // Get the "configuraton elements" defined in the plugin.xml file.
+ // Note that these "configuration elements" are not related to the
+ // managed build system "configurations".
+ // From the PDE Guide:
+ // A configuration element, with its attributes and children, directly
+ // reflects the content and structure of the extension section within the
+ // declaring plug-in's manifest (plugin.xml) file.
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ loadConfigElements(DefaultManagedConfigElement.convertArray(elements));
+ }
+ // Then call resolve.
+ //
+ // Here are notes on "references" within the managed build system.
+ // References are "pointers" from one model element to another.
+ // These are encoded in manifest and managed build system project files (.cdtbuild)
+ // using unique string IDs (e.g. "cdt.managedbuild.tool.gnu.c.linker").
+ // These string IDs are "resolved" to pointers to interfaces in model
+ // elements in the in-memory represent of the managed build system information.
+ //
+ // Here are the current "rules" for references:
+ // 1. A reference is always resolved to an interface pointer in the
+ // referenced object.
+ // 2. A reference is always TO an extension object - that is, an object
+ // loaded from a manifest file or a dynamic element provider. It cannot
+ // be to an object loaded from a managed build system project file (.cdtbuild).
+ //
+
+ Iterator projectTypeIter = getExtensionProjectTypeMap().values().iterator();
+ while (projectTypeIter.hasNext()) {
+ try {
+ ProjectType projectType = (ProjectType)projectTypeIter.next();
+ projectType.resolveReferences();
+ } catch (Exception ex) {
+ // TODO: log
+ ex.printStackTrace();
+ }
+ }
+ Iterator configurationIter = getExtensionConfigurationMap().values().iterator();
+ while (configurationIter.hasNext()) {
+ try {
+ Configuration configuration = (Configuration)configurationIter.next();
+ configuration.resolveReferences();
+ } catch (Exception ex) {
+ // TODO: log
+ ex.printStackTrace();
+ }
+ }
+ Iterator resConfigIter = getExtensionResourceConfigurationMap().values().iterator();
+ while (resConfigIter.hasNext()) {
+ try {
+ ResourceConfiguration resConfig = (ResourceConfiguration)resConfigIter.next();
+ resConfig.resolveReferences();
+ } catch (Exception ex) {
+ // TODO: log
+ ex.printStackTrace();
+ }
+ }
+ Iterator toolChainIter = getExtensionToolChainMap().values().iterator();
+ while (toolChainIter.hasNext()) {
+ try {
+ ToolChain toolChain = (ToolChain)toolChainIter.next();
+ toolChain.resolveReferences();
+ } catch (Exception ex) {
+ // TODO: log
+ ex.printStackTrace();
+ }
+ }
+ Iterator toolIter = getExtensionToolMap().values().iterator();
+ while (toolIter.hasNext()) {
+ try {
+ Tool tool = (Tool)toolIter.next();
+ tool.resolveReferences();
+ } catch (Exception ex) {
+ // TODO: log
+ ex.printStackTrace();
+ }
+ }
+ Iterator targetPlatformIter = getExtensionTargetPlatformMap().values().iterator();
+ while (targetPlatformIter.hasNext()) {
+ try {
+ TargetPlatform targetPlatform = (TargetPlatform)targetPlatformIter.next();
+ targetPlatform.resolveReferences();
+ } catch (Exception ex) {
+ // TODO: log
+ ex.printStackTrace();
+ }
+ }
+ Iterator builderIter = getExtensionBuilderMap().values().iterator();
+ while (builderIter.hasNext()) {
+ try {
+ Builder builder = (Builder)builderIter.next();
+ builder.resolveReferences();
+ } catch (Exception ex) {
+ // TODO: log
+ ex.printStackTrace();
+ }
+ }
+ Iterator optionIter = getExtensionOptionMap().values().iterator();
+ while (optionIter.hasNext()) {
+ try {
+ Option option = (Option)optionIter.next();
+ option.resolveReferences();
+ } catch (Exception ex) {
+ // TODO: log
+ ex.printStackTrace();
+ }
+ }
+ Iterator optionCatIter = getExtensionOptionCategoryMap().values().iterator();
+ while (optionCatIter.hasNext()) {
+ try {
+ OptionCategory optionCat = (OptionCategory)optionCatIter.next();
+ optionCat.resolveReferences();
+ } catch (Exception ex) {
+ // TODO: log
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+
+ // Get the extensions that use the CDT 2.0 build model
+ extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID_V2);
+ if( extensionPoint != null) {
+ IExtension[] extensions = extensionPoint.getExtensions();
+ if (extensions != null) {
+ if (extensions.length > 0) {
+
+ // Call the constructors of the internal classes that correspond to the
+ // V2.0 build model elements. Some of these objects are converted to new model objects.
+ // Others can use the same classes.
+ for (int i = 0; i < extensions.length; ++i) {
+ IExtension extension = extensions[i];
+ // Can we read this manifest
+ if (!isVersionCompatible(extension)) {
+ //The version of the Plug-in is greater than what the manager thinks it understands
+ throw new BuildException(ManagedMakeMessages.getResourceString(MANIFEST_VERSION_ERROR));
+ }
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ loadConfigElementsV2(DefaultManagedConfigElement.convertArray(elements));
+ }
+ // Resolve references
+ Iterator targetIter = getExtensionTargetMap().values().iterator();
+ while (targetIter.hasNext()) {
+ try {
+ Target target = (Target)targetIter.next();
+ target.resolveReferences();
+ } catch (Exception ex) {
+ // TODO: log
+ ex.printStackTrace();
+ }
+ }
+ // The V2 model can also add top-level Tools - they need to be "resolved"
+ Iterator toolIter = getExtensionToolMap().values().iterator();
+ while (toolIter.hasNext()) {
+ try {
+ Tool tool = (Tool)toolIter.next();
+ tool.resolveReferences();
+ } catch (Exception ex) {
+ // TODO: log
+ ex.printStackTrace();
+ }
+ }
+ // Convert the targets to the new model
+ targetIter = getExtensionTargetMap().values().iterator();
+ while (targetIter.hasNext()) {
+ try {
+ Target target = (Target)targetIter.next();
+ // Check to see if it has already been converted - if not, do it
+ if (target.getCreatedProjectType() == null) {
+ target.convertToProjectType();
+ }
+ } catch (Exception ex) {
+ // TODO: log
+ ex.printStackTrace();
+ }
+ }
+ // Resolve references for new ProjectTypes
+ Iterator projTypeIter = getExtensionProjectTypeMap().values().iterator();
+ while (projTypeIter.hasNext()) {
+ try {
+ ProjectType projType = (ProjectType)projTypeIter.next();
+ projType.resolveReferences();
+ } catch (Exception ex) {
+ // TODO: log
+ ex.printStackTrace();
+ }
+ }
+
+ // TODO: Clear the target and configurationV2 maps so that the object can be garbage collected
+ // We can't do this yet, because the UpdateManagedProjectAction class may need these elements later
+ // Can we change UpdateManagedProjectAction to see the converted model elements?
+ //targetIter = getExtensionTargetMap().values().iterator();
+ //while (targetIter.hasNext()) {
+ // try {
+ // Target target = (Target)targetIter.next();
+ // ManagedBuildManager.removeConfigElement(target);
+ // getExtensionTargetMap().remove(target);
+ // } catch (Exception ex) {
+ // // TODO: log
+ // ex.printStackTrace();
+ // }
+ //}
+ //getExtensionConfigurationV2Map().clear();
+ }
}
}
- Iterator targetIter = getExtensionTargetMap().values().iterator();
- while (targetIter.hasNext()) {
+ }
+
+ private static void loadConfigElements(IManagedConfigElement[] elements) {
+ for (int toolIndex = 0; toolIndex < elements.length; ++toolIndex) {
try {
- Target target = (Target)targetIter.next();
- target.resolveReferences();
+ IManagedConfigElement element = elements[toolIndex];
+ // Load the top level elements, which in turn load their children
+ if (element.getName().equals(IProjectType.PROJECTTYPE_ELEMENT_NAME)) {
+ new ProjectType(element);
+ } else if (element.getName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
+ new Configuration((ProjectType)null, element);
+ } else if (element.getName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) {
+ new ToolChain((Configuration)null, element);
+ } else if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
+ new Tool((ProjectType)null, element);
+ } else if (element.getName().equals(ITargetPlatform.TARGET_PLATFORM_ELEMENT_NAME)) {
+ new TargetPlatform((ToolChain)null, element);
+ } else if (element.getName().equals(IBuilder.BUILDER_ELEMENT_NAME)) {
+ new Builder((ToolChain)null, element);
+ } else if (element.getName().equals(IManagedConfigElementProvider.ELEMENT_NAME)) {
+ // don't allow nested config providers.
+ if (element instanceof DefaultManagedConfigElement) {
+ IManagedConfigElement[] providedConfigs;
+ IManagedConfigElementProvider provider = createConfigProvider(
+ (DefaultManagedConfigElement)element);
+ providedConfigs = provider.getConfigElements();
+ loadConfigElements(providedConfigs); // This must use the current build model
+ }
+ } else {
+ // TODO: Report an error (log?)
+ }
} catch (Exception ex) {
// TODO: log
ex.printStackTrace();
}
}
- // Let's never do that again
- extensionTargetsLoaded = true;
}
- private static void loadConfigElements(IManagedConfigElement[] elements) {
+ private static void loadConfigElementsV2(IManagedConfigElement[] elements) {
for (int toolIndex = 0; toolIndex < elements.length; ++toolIndex) {
try {
IManagedConfigElement element = elements[toolIndex];
- // Load the targets
+ // Load the top level elements, which in turn load their children
if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
new Tool(element);
} else if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME)) {
@@ -864,7 +1585,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
IManagedConfigElementProvider provider = createConfigProvider(
(DefaultManagedConfigElement)element);
providedConfigs = provider.getConfigElements();
- loadConfigElements(providedConfigs);
+ loadConfigElementsV2(providedConfigs); // This must use the 2.0 build model
}
}
} catch (Exception ex) {
@@ -977,10 +1698,16 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
return null;
}
+ if(buildInfo == null && resource instanceof IProject)
+ buildInfo = findBuildInfoSynchronized((IProject)resource);
+/*
// Nothing in session store, so see if we can load it from cdtbuild
if (buildInfo == null && resource instanceof IProject) {
- buildInfo = loadBuildInfo((IProject)resource);
- // Make sure there was no error
+ try {
+ buildInfo = loadBuildInfo((IProject)resource);
+ } catch (Exception e) {
+ // TODO: Issue error reagarding not being able to load the project file (.cdtbuild)
+ }
try {
// Check if the project needs its container initialized
@@ -989,6 +1716,61 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
// We can live without a path entry container if the build information is valid
}
}
+*/
+ return buildInfo;
+ }
+
+ /* (non-Javadoc)
+ * this method is called if managed build info session property
+ * was not set. The caller will use the workspace root rool
+ * to synchronize with other callers
+ * findBuildInfoSynchronized could also be called from project converter
+ * in this case the ManagedBuildInfo saved in the converter would be returned
+ *
+ * @param resource
+ * @return
+ */
+ private static ManagedBuildInfo findBuildInfoSynchronized(IProject project/*, boolean create*/) {
+ ManagedBuildInfo buildInfo = null;
+ final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
+ IJobManager jobManager = Platform.getJobManager();
+
+ // Check if there is any build info associated with this project for this session
+ try{
+ jobManager.beginRule(rule, null);
+ try {
+ buildInfo = (ManagedBuildInfo)project.getSessionProperty(buildInfoProperty);
+ // Make sure that if a project has build info, that the info is not corrupted
+ if (buildInfo != null) {
+ buildInfo.updateOwner(project);
+ }
+ } catch (CoreException e) {
+ // return null;
+ }
+
+ // Check weather getBuildInfo is called from converter
+ if(buildInfo == null)
+ buildInfo = UpdateManagedProjectManager.getConvertedManagedBuildInfo(project);
+
+ // Nothing in session store, so see if we can load it from cdtbuild
+ if (buildInfo == null) {
+ try {
+ buildInfo = loadBuildInfo(project);
+ } catch (Exception e) {
+ // TODO: Issue error reagarding not being able to load the project file (.cdtbuild)
+ }
+
+ try {
+ // Check if the project needs its container initialized
+ initBuildInfoContainer(buildInfo);
+ } catch (CoreException e) {
+ // We can live without a path entry container if the build information is valid
+ }
+ }
+ }
+ finally{
+ jobManager.endRule(rule);
+ }
return buildInfo;
}
@@ -1092,6 +1874,13 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
public static void putConfigElement(IBuildObject buildObj, IManagedConfigElement configElement) {
getConfigElementMap().put(buildObj, configElement);
}
+
+ /**
+ * Removes an item from the map
+ */
+ private static void removeConfigElement(IBuildObject buildObj) {
+ getConfigElementMap().remove(buildObj);
+ }
/**
* This method public for implementation reasons. Not intended for use
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
index 23c8cdcc1e0..af6c9ff6297 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
@@ -1,5 +1,3 @@
-package org.eclipse.cdt.managedbuilder.core;
-
/**********************************************************************
* Copyright (c) 2003, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -10,6 +8,7 @@ package org.eclipse.cdt.managedbuilder.core;
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
+package org.eclipse.cdt.managedbuilder.core;
import org.eclipse.cdt.managedbuilder.internal.core.GeneratedMakefileBuilder;
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildCPathEntryContainer;
@@ -25,10 +24,10 @@ public class ManagedBuilderCorePlugin extends Plugin {
public static final String DEP_CALC_ID ="dependencyCalculator"; //$NON-NLS-1$
// The shared instance
private static ManagedBuilderCorePlugin plugin;
- // The attribute name for the scanner info collector
- public static final String SCANNER_INFO_ID = "scannerInfoCollector"; //$NON-NLS-1$
// The attribute name for the makefile generator
public static final String MAKEGEN_ID ="makefileGenerator"; //$NON-NLS-1$
+ public static final String BUILDFILEGEN_ID ="buildfileGenerator"; //$NON-NLS-1$
+ public static final String COMMANDLINEGEN_ID = "commandlineGenerator"; //$NON-NLS-1$
// The unique id for all managed make projects
public static final String MANAGED_MAKE_PROJECT_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".managedMake"; //$NON-NLS-1$
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
new file mode 100644
index 00000000000..e98af542a25
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
@@ -0,0 +1,526 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.eclipse.cdt.managedbuilder.core.IBuildObject;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.IBuilder;
+import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class Builder extends BuildObject implements IBuilder {
+
+ private static final String EMPTY_STRING = new String();
+
+ // Superclass
+ private IBuilder superClass;
+ private String superClassId;
+ // Parent and children
+ private IToolChain parent;
+ // Managed Build model attributes
+ private String unusedChildren;
+ private String errorParserIds;
+ private Boolean isAbstract;
+ private String command;
+ private String args;
+ private IConfigurationElement buildFileGeneratorElement;
+ // Miscellaneous
+ private boolean isExtensionBuilder = false;
+ private boolean isDirty = false;
+ private boolean resolved = true;
+
+ /*
+ * C O N S T R U C T O R S
+ */
+
+ /**
+ * This constructor is called to create a builder defined by an extension point in
+ * a plugin manifest file, or returned by a dynamic element provider
+ *
+ * @param parent The IToolChain parent of this builder, or <code>null</code> if
+ * defined at the top level
+ * @param element The builder definition from the manifest file or a dynamic element
+ * provider
+ */
+ public Builder(IToolChain parent, IManagedConfigElement element) {
+ this.parent = parent;
+ isExtensionBuilder = true;
+
+ // setup for resolving
+ resolved = false;
+
+ loadFromManifest(element);
+
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionBuilder(this);
+ }
+
+ /**
+ * This constructor is called to create a Builder whose attributes and children will be
+ * added by separate calls.
+ *
+ * @param ToolChain The parent of the builder, if any
+ * @param Builder The superClass, if any
+ * @param String The id for the new tool chain
+ * @param String The name for the new tool chain
+ * @param boolean Indicates whether this is an extension element or a managed project element
+ */
+ public Builder(ToolChain parent, IBuilder superClass, String Id, String name, boolean isExtensionElement) {
+ this.parent = parent;
+ this.superClass = superClass;
+ if (this.superClass != null) {
+ superClassId = this.superClass.getId();
+ }
+ setId(Id);
+ setName(name);
+ isExtensionBuilder = isExtensionElement;
+ if (isExtensionElement) {
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionBuilder(this);
+ } else {
+ setDirty(true);
+ }
+ }
+
+ /**
+ * Create a <code>Builder</code> based on the specification stored in the
+ * project file (.cdtbuild).
+ *
+ * @param parent The <code>IToolChain</code> the Builder will be added to.
+ * @param element The XML element that contains the Builder settings.
+ */
+ public Builder(IToolChain parent, Element element) {
+ this.parent = parent;
+ isExtensionBuilder = false;
+
+ // Initialize from the XML attributes
+ loadFromProject(element);
+ }
+
+ /**
+ * Create a <code>Builder</code> based upon an existing builder.
+ *
+ * @param parent The <code>IToolChain</code> the builder will be added to.
+ * @param builder The existing builder to clone.
+ */
+ public Builder(IToolChain parent, String Id, String name, Builder builder) {
+ this.parent = parent;
+ superClass = builder.superClass;
+ if (superClass != null) {
+ if (builder.superClassId != null) {
+ superClassId = new String(builder.superClassId);
+ }
+ }
+ setId(Id);
+ setName(name);
+ isExtensionBuilder = false;
+
+ // Copy the remaining attributes
+ if (builder.unusedChildren != null) {
+ unusedChildren = new String(builder.unusedChildren);
+ }
+ if (builder.errorParserIds != null) {
+ errorParserIds = new String(builder.errorParserIds);
+ }
+ if (builder.isAbstract != null) {
+ isAbstract = new Boolean(builder.isAbstract.booleanValue());
+ }
+ if (builder.command != null) {
+ command = new String(builder.command);
+ }
+ if (builder.args != null) {
+ args = new String(builder.args);
+ }
+ buildFileGeneratorElement = builder.buildFileGeneratorElement;
+
+ setDirty(true);
+ }
+
+ /*
+ * E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S
+ */
+
+ /* (non-Javadoc)
+ * Loads the project-type information from the ManagedConfigElement specified in the
+ * argument.
+ *
+ * @param element Contains the tool-chain information
+ */
+ protected void loadFromManifest(IManagedConfigElement element) {
+ ManagedBuildManager.putConfigElement(this, element);
+
+ // id
+ setId(element.getAttribute(IBuildObject.ID));
+
+ // Get the name
+ setName(element.getAttribute(IBuildObject.NAME));
+
+ // superClass
+ superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+
+ // Get the unused children, if any
+ unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+
+ // isAbstract
+ String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
+ if (isAbs != null){
+ isAbstract = new Boolean("true".equals(isAbs)); //$NON-NLS-1$
+ }
+
+ // command
+ command = element.getAttribute(IBuilder.COMMAND);
+
+ // arguments
+ args = element.getAttribute(IBuilder.ARGUMENTS);
+
+ // Get the semicolon separated list of IDs of the error parsers
+ errorParserIds = element.getAttribute(IToolChain.ERROR_PARSERS);
+
+ // build file generator
+ if (element instanceof DefaultManagedConfigElement)
+ buildFileGeneratorElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
+ }
+
+ /* (non-Javadoc)
+ * Initialize the builder information from the XML element
+ * specified in the argument
+ *
+ * @param element An XML element containing the builder information
+ */
+ protected void loadFromProject(Element element) {
+
+ // id
+ setId(element.getAttribute(IBuildObject.ID));
+
+ // name
+ if (element.hasAttribute(IBuildObject.NAME)) {
+ setName(element.getAttribute(IBuildObject.NAME));
+ }
+
+ // superClass
+ superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ if (superClassId != null && superClassId.length() > 0) {
+ superClass = ManagedBuildManager.getExtensionBuilder(superClassId);
+ if (superClass == null) {
+ // TODO: Report error
+ }
+ }
+
+ // Get the unused children, if any
+ if (element.hasAttribute(IProjectType.UNUSED_CHILDREN)) {
+ unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ }
+
+ // isAbstract
+ if (element.hasAttribute(IProjectType.IS_ABSTRACT)) {
+ String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
+ if (isAbs != null){
+ isAbstract = new Boolean("true".equals(isAbs)); //$NON-NLS-1$
+ }
+ }
+
+ // command
+ if (element.hasAttribute(IBuilder.COMMAND)) {
+ command = element.getAttribute(IBuilder.COMMAND);
+ }
+
+ // arguments
+ if (element.hasAttribute(IBuilder.ARGUMENTS)) {
+ args = element.getAttribute(IBuilder.ARGUMENTS);
+ }
+
+ // Get the semicolon separated list of IDs of the error parsers
+ if (element.hasAttribute(IToolChain.ERROR_PARSERS)) {
+ errorParserIds = element.getAttribute(IToolChain.ERROR_PARSERS);
+ }
+
+ // Note: build file generator cannot be specified in a project file because
+ // an IConfigurationElement is needed to load it!
+ if (element.hasAttribute(ManagedBuilderCorePlugin.BUILDFILEGEN_ID)) {
+ // TODO: Issue warning?
+ }
+ }
+
+ /**
+ * Persist the builder to the project file.
+ *
+ * @param doc
+ * @param element
+ */
+ public void serialize(Document doc, Element element) {
+ if (superClass != null)
+ element.setAttribute(IProjectType.SUPERCLASS, superClass.getId());
+
+ element.setAttribute(IBuildObject.ID, id);
+
+ if (name != null) {
+ element.setAttribute(IBuildObject.NAME, name);
+ }
+
+ if (unusedChildren != null) {
+ element.setAttribute(IProjectType.UNUSED_CHILDREN, unusedChildren);
+ }
+
+ if (isAbstract != null) {
+ element.setAttribute(IProjectType.IS_ABSTRACT, isAbstract.toString());
+ }
+
+ if (errorParserIds != null) {
+ element.setAttribute(IToolChain.ERROR_PARSERS, errorParserIds);
+ }
+
+ if (command != null) {
+ element.setAttribute(IBuilder.COMMAND, command);
+ }
+
+ if (args != null) {
+ element.setAttribute(IBuilder.ARGUMENTS, args);
+ }
+
+ // Note: build file generator cannot be specified in a project file because
+ // an IConfigurationElement is needed to load it!
+ if (buildFileGeneratorElement != null) {
+ // TODO: issue warning?
+ }
+
+ // I am clean now
+ isDirty = false;
+ }
+
+ /*
+ * P A R E N T A N D C H I L D H A N D L I N G
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuilder#getParent()
+ */
+ public IToolChain getParent() {
+ return parent;
+ }
+
+ /*
+ * M O D E L A T T R I B U T E A C C E S S O R S
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#getSuperClass()
+ */
+ public IBuilder getSuperClass() {
+ return superClass;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuilder#getName()
+ */
+ public String getName() {
+ return (name == null && superClass != null) ? superClass.getName() : name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuilder#isAbstract()
+ */
+ public boolean isAbstract() {
+ if (isAbstract != null) {
+ return isAbstract.booleanValue();
+ } else {
+ return false; // Note: no inheritance from superClass
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuilder#getUnusedChildren()
+ */
+ public String getUnusedChildren() {
+ if (unusedChildren != null) {
+ return unusedChildren;
+ } else
+ return EMPTY_STRING; // Note: no inheritance from superClass
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuilder#getCommand()
+ */
+ public String getCommand() {
+ if (command == null) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ return superClass.getCommand();
+ } else {
+ return new String("make"); //$NON-NLS-1$
+ }
+ }
+ return command;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuilder#getArguments()
+ */
+ public String getArguments() {
+ if (args == null) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ return superClass.getArguments();
+ } else {
+ return new String("-k"); //$NON-NLS-1$
+ }
+ }
+ return args;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#getErrorParserIds()
+ */
+ public String getErrorParserIds() {
+ String ids = errorParserIds;
+ if (ids == null) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ ids = superClass.getErrorParserIds();
+ }
+ }
+ return ids;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#getErrorParserList()
+ */
+ public String[] getErrorParserList() {
+ String parserIDs = getErrorParserIds();
+ String[] errorParsers = null;
+ if (parserIDs != null) {
+ // Check for an empty string
+ if (parserIDs.length() == 0) {
+ errorParsers = new String[0];
+ } else {
+ StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$
+ List list = new ArrayList(tok.countTokens());
+ while (tok.hasMoreElements()) {
+ list.add(tok.nextToken());
+ }
+ String[] strArr = {""}; //$NON-NLS-1$
+ errorParsers = (String[]) list.toArray(strArr);
+ }
+ } else {
+ errorParsers = new String[0];
+ }
+ return errorParsers;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuilder.setCommand(String)
+ */
+ public void setCommand(String cmd) {
+ if (cmd == null && command == null) return;
+ if (command == null || cmd == null || !cmd.equals(command)) {
+ command = cmd;
+ setDirty(true);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuilder#setArguments(String)
+ */
+ public void setArguments(String newArgs) {
+ if (newArgs == null && args == null) return;
+ if (args == null || newArgs == null || !newArgs.equals(args)) {
+ args = newArgs;
+ setDirty(true);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#setErrorParserIds()
+ */
+ public void setErrorParserIds(String ids) {
+ String currentIds = getErrorParserIds();
+ if (ids == null && currentIds == null) return;
+ if (currentIds == null || ids == null || !(currentIds.equals(ids))) {
+ errorParserIds = ids;
+ isDirty = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * Sets the isAbstract attribute
+ */
+ public void setIsAbstract(boolean b) {
+ isAbstract = new Boolean(b);
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#setBuildFileGeneratorElement(String)
+ */
+ public void setBuildFileGeneratorElement(IConfigurationElement element) {
+ buildFileGeneratorElement = element;
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#getBuildFileGeneratorElement()
+ */
+ public IConfigurationElement getBuildFileGeneratorElement() {
+ return buildFileGeneratorElement;
+ }
+
+ /*
+ * O B J E C T S T A T E M A I N T E N A N C E
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#isExtensionElement()
+ */
+ public boolean isExtensionElement() {
+ return isExtensionBuilder;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#isDirty()
+ */
+ public boolean isDirty() {
+ // This shouldn't be called for an extension Builder
+ if (isExtensionBuilder) return false;
+ return isDirty;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#setDirty(boolean)
+ */
+ public void setDirty(boolean isDirty) {
+ this.isDirty = isDirty;
+ }
+
+ /* (non-Javadoc)
+ * Resolve the element IDs to interface references
+ */
+ public void resolveReferences() {
+ if (!resolved) {
+ resolved = true;
+ // Resolve superClass
+ if (superClassId != null && superClassId.length() > 0) {
+ superClass = ManagedBuildManager.getExtensionBuilder(superClassId);
+ if (superClass == null) {
+ // TODO: Report error
+ }
+ }
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
index 4b2d76b3371..fff0585bb80 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
@@ -12,285 +12,488 @@ package org.eclipse.cdt.managedbuilder.internal.core;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
import java.util.Vector;
import org.eclipse.cdt.core.CCProjectNature;
+import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.managedbuilder.core.IToolReference;
+import org.eclipse.cdt.managedbuilder.core.IBuilder;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.internal.core.ResourceConfiguration;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class Configuration extends BuildObject implements IConfiguration {
- private boolean isDirty = false;
+
+ private static final String EMPTY_STRING = new String();
+
+ // Parent and children
private IConfiguration parent;
+ private ProjectType projectType;
+ private ManagedProject managedProject;
+ private ToolChain toolChain;
+ private List resourceConfigurationList;
+ private Map resourceConfigurationMap;
+ // Managed Build model attributes
+ private String artifactName;
+ private String cleanCommand;
+ private String artifactExtension;
+ private String errorParserIds;
+ // Miscellaneous
+ private boolean isExtensionConfig = false;
+ private boolean isDirty = false;
private boolean rebuildNeeded = false;
private boolean resolved = true;
- private ITarget target;
- private List toolReferences;
+
+ /*
+ * C O N S T R U C T O R S
+ */
/**
- * Build a configuration from the project manifest file.
+ * Create an extension configuration from the project manifest file element.
*
- * @param target The <code>Target</code> the configuration belongs to.
- * @param element The element from the manifest that contains the overridden configuration information.
+ * @param projectType The <code>ProjectType</code> the configuration will be added to.
+ * @param element The element from the manifest that contains the configuration information.
*/
- public Configuration(Target target, Element element) {
- this.target = target;
+ public Configuration(ProjectType projectType, IManagedConfigElement element) {
+ this.projectType = projectType;
+ isExtensionConfig = true;
- // id
- setId(element.getAttribute(IConfiguration.ID));
+ // setup for resolving
+ resolved = false;
- // hook me up
- target.addConfiguration(this);
+ // Initialize from the XML attributes
+ loadFromManifest(element);
- // name
- if (element.hasAttribute(IConfiguration.NAME))
- setName(element.getAttribute(IConfiguration.NAME));
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionConfiguration(this);
- if (element.hasAttribute(IConfiguration.PARENT)) {
- // See if the target has a parent
- ITarget targetParent = target.getParent();
- // If so, then get my parent from it
- if (targetParent != null) {
- parent = targetParent.getConfiguration(element.getAttribute(IConfiguration.PARENT));
- }
- else {
- parent = null;
+ // Hook me up to the ProjectType
+ if (projectType != null) {
+ projectType.addConfiguration(this);
+ }
+
+ // Load the children
+ IManagedConfigElement[] configElements = element.getChildren();
+ for (int l = 0; l < configElements.length; ++l) {
+ IManagedConfigElement configElement = configElements[l];
+ if (configElement.getName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) {
+ toolChain = new ToolChain(this, configElement);
+ }else if (configElement.getName().equals(IResourceConfiguration.RESOURCE_CONFIGURATION_ELEMENT_NAME)) {
+ ResourceConfiguration resConfig = new ResourceConfiguration(this, configElement);
+ addResourceConfiguration(resConfig);
}
}
+ }
+
+ /**
+ * Create a new extension configuration based on one already defined.
+ *
+ * @param projectType The <code>ProjectType</code> the configuration will be added to.
+ * @param parentConfig The <code>IConfiguration</code> to copy the settings from.
+ * @param id A unique ID for the new configuration.
+ */
+ public Configuration(ProjectType projectType, IConfiguration parentConfig, String id) {
+ setId(id);
+ this.projectType = projectType;
+ isExtensionConfig = true;
+ // setup for resolving
+ resolved = false;
+
+ if (parentConfig != null) {
+ name = parentConfig.getName();
+ // If this contructor is called to clone an existing
+ // configuration, the parent of the parent should be stored.
+ // As of 2.1, there is still one single level of inheritence to
+ // worry about
+ parent = parentConfig.getParent() == null ? parentConfig : parentConfig.getParent();
+ }
+
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionConfiguration(this);
+
+ // Hook me up to the ProjectType
+ if (projectType != null) {
+ projectType.addConfiguration(this);
+ }
+ }
+
+ /**
+ * Create a new extension configuration and fill in the attributes and childen later.
+ *
+ * @param projectType The <code>ProjectType</code> the configuration will be added to.
+ * @param id A unique ID for the new configuration.
+ * @param name A name for the new configuration.
+ */
+ public Configuration(ProjectType projectType, IConfiguration parentConfig, String id, String name) {
+ setId(id);
+ setName(name);
+ this.projectType = projectType;
+ parent = parentConfig;
+ isExtensionConfig = true;
+
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionConfiguration(this);
+
+ // Hook me up to the ProjectType
+ if (projectType != null) {
+ projectType.addConfiguration(this);
+ }
+ }
+
+ /**
+ * Create a <code>Configuration</code> based on the specification stored in the
+ * project file (.cdtbuild).
+ *
+ * @param managedProject The <code>ManagedProject</code> the configuration will be added to.
+ * @param element The XML element that contains the configuration settings.
+ */
+ public Configuration(ManagedProject managedProject, Element element) {
+ this.managedProject = managedProject;
+ isExtensionConfig = false;
+
+ // Initialize from the XML attributes
+ loadFromProject(element);
+
+ // Hook me up
+ managedProject.addConfiguration(this);
+
NodeList configElements = element.getChildNodes();
for (int i = 0; i < configElements.getLength(); ++i) {
Node configElement = configElements.item(i);
- if (configElement.getNodeName().equals(IConfiguration.TOOLREF_ELEMENT_NAME)) {
- new ToolReference(this, (Element)configElement);
+ if (configElement.getNodeName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) {
+ toolChain = new ToolChain(this, (Element)configElement);
+ }else if (configElement.getNodeName().equals(IResourceConfiguration.RESOURCE_CONFIGURATION_ELEMENT_NAME)) {
+ ResourceConfiguration resConfig = new ResourceConfiguration(this, (Element)configElement);
+ addResourceConfiguration(resConfig);
}
}
-
}
/**
- * Create a new configuration based on one already defined.
+ * Create a new project, non-extension, configuration based on one already defined.
*
- * @param target The <code>Target</code> the receiver will be added to.
+ * @param managedProject The <code>ManagedProject</code> the configuration will be added to.
* @param parentConfig The <code>IConfiguration</code> to copy the settings from.
- * @param id A unique ID for the configuration.
+ * @param id A unique ID for the new configuration.
*/
- public Configuration(Target target, IConfiguration parentConfig, String id) {
- this.id = id;
- this.name = parentConfig.getName();
- this.target = target;
+ public Configuration(ManagedProject managedProject, Configuration cloneConfig, String id, boolean cloneTools) {
+ setId(id);
+ setName(cloneConfig.getName());
+ this.managedProject = managedProject;
+ isExtensionConfig = false;
// If this contructor is called to clone an existing
- // configuration, the parent of the parent should be stored.
- // As of 2.0, there is still one single level of inheritence to
- // worry about
- parent = parentConfig.getParent() == null ? parentConfig : parentConfig.getParent();
-
- // Check that the tool and the project match
- IProject project = (IProject) target.getOwner();
-
- // Get the tool references from the target and parent
- List allToolRefs = new Vector(target.getLocalToolReferences());
- allToolRefs.addAll(((Configuration)parentConfig).getLocalToolReferences());
- Iterator iter = allToolRefs.listIterator();
- while (iter.hasNext()) {
- ToolReference toolRef = (ToolReference)iter.next();
+ // configuration, the parent of the cloning config should be stored.
+ parent = cloneConfig.getParent() == null ? cloneConfig : cloneConfig.getParent();
- // Make a new ToolReference based on the tool in the ref
- ITool parentTool = toolRef.getTool();
- ToolReference newRef = new ToolReference(this, parentTool);
+ // Copy the remaining attributes
+ projectType = cloneConfig.projectType;
+ if (cloneConfig.artifactName != null) {
+ artifactName = new String(cloneConfig.artifactName);
+ }
+ if (cloneConfig.cleanCommand != null) {
+ cleanCommand = new String(cloneConfig.cleanCommand);
+ }
+ if (cloneConfig.artifactExtension != null) {
+ artifactExtension = new String(cloneConfig.artifactExtension);
+ }
+ if (cloneConfig.errorParserIds != null) {
+ errorParserIds = new String(cloneConfig.errorParserIds);
+ }
+
+ // Clone the configuration's children
+ // Tool Chain
+ int nnn = ManagedBuildManager.getRandomNumber();
+ String subId;
+ String subName;
+ if (cloneConfig.parent != null) {
+ subId = cloneConfig.parent.getToolChain().getId() + "." + nnn; //$NON-NLS-1$
+ subName = cloneConfig.parent.getToolChain().getName(); //$NON-NLS-1$
+ } else {
+ subId = cloneConfig.getToolChain().getId() + "." + nnn; //$NON-NLS-1$
+ subName = cloneConfig.getToolChain().getName(); //$NON-NLS-1$
+ }
+
+ if (cloneTools) {
+ toolChain = new ToolChain(this, subId, subName, (ToolChain)cloneConfig.getToolChain());
+ } else {
+ // Add a tool-chain element that specifies as its superClass the
+ // tool-chain that is the child of the configuration.
+ ToolChain superChain = (ToolChain)cloneConfig.getToolChain();
+ subId = superChain.getId() + "." + nnn; //$NON-NLS-1$
+ IToolChain newChain = createToolChain(superChain, subId, superChain.getName(), false);
- // The reference may have a different command than the parent tool
- String refCmd = toolRef.getToolCommand();
- if (!refCmd.equals(parentTool.getToolCommand())) {
- newRef.setToolCommand(refCmd);
+ // For each tool element child of the tool-chain that is the child of
+ // the selected configuration element, create a tool element child of
+ // the cloned configuration’s tool-chain element that specifies the
+ // original tool element as its superClass.
+ Iterator iter = superChain.getToolList().listIterator();
+ while (iter.hasNext()) {
+ Tool toolChild = (Tool) iter.next();
+ nnn = ManagedBuildManager.getRandomNumber();
+ subId = toolChild.getId() + "." + nnn; //$NON-NLS-1$
+ newChain.createTool(toolChild, subId, toolChild.getName(), false);
}
-
- List optRefs = toolRef.getOptionReferenceList();
- Iterator optIter = optRefs.listIterator();
- while (optIter.hasNext()) {
- OptionReference optRef = (OptionReference)optIter.next();
- IOption opt = optRef.getOption();
- try {
- switch (opt.getValueType()) {
- case IOption.BOOLEAN:
- new OptionReference(newRef, opt).setValue(optRef.getBooleanValue());
- break;
- case IOption.STRING:
- new OptionReference(newRef, opt).setValue(optRef.getStringValue());
- break;
- case IOption.ENUMERATED:
- new OptionReference(newRef, opt).setValue(optRef.getSelectedEnum());
- break;
- case IOption.STRING_LIST :
- new OptionReference(newRef, opt).setValue(optRef.getStringListValue());
- break;
- case IOption.INCLUDE_PATH :
- new OptionReference(newRef, opt).setValue(optRef.getIncludePaths());
- break;
- case IOption.PREPROCESSOR_SYMBOLS :
- new OptionReference(newRef, opt).setValue(optRef.getDefinedSymbols());
- break;
- case IOption.LIBRARIES :
- new OptionReference(newRef, opt).setValue(optRef.getLibraries());
- break;
- case IOption.OBJECTS :
- new OptionReference(newRef, opt).setValue(optRef.getUserObjects());
- break;
- }
- } catch (BuildException e) {
- continue;
- }
+ }
+
+ // Resource Configurations
+ if (cloneConfig.resourceConfigurationList != null) {
+ List resElements = cloneConfig.getResourceConfigurationList();
+ Iterator iter = resElements.listIterator();
+ while (iter.hasNext()) {
+ ResourceConfiguration resConfig = (ResourceConfiguration) iter.next();
+ subId = getId() + "." + resConfig.getResourcePath(); //$NON-NLS-1$
+ ResourceConfiguration newResConfig = new ResourceConfiguration(this, resConfig, subId);
+ addResourceConfiguration(newResConfig);
}
}
- target.addConfiguration(this);
+ // Hook me up
+ managedProject.addConfiguration(this);
+ setDirty(true);
+ setRebuildState(true);
}
- /**
- * Create a new <code>Configuration</code> based on the specification in the plugin manifest.
+ /*
+ * E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S
+ */
+
+ /* (non-Javadoc)
+ * Initialize the configuration information from an element in the
+ * manifest file or provided by a dynamicElementProvider
*
- * @param target The <code>Target</code> the receiver will be added to.
- * @param element The element from the manifest that contains the default configuration settings.
+ * @param element An obejct implementing IManagedConfigElement
*/
- public Configuration(Target target, IManagedConfigElement element) {
- this.target = target;
-
- // setup for resolving
+ protected void loadFromManifest(IManagedConfigElement element) {
ManagedBuildManager.putConfigElement(this, element);
- resolved = false;
// id
setId(element.getAttribute(IConfiguration.ID));
+
+ // name
+ name = element.getAttribute(IConfiguration.NAME);
- // hook me up
- target.addConfiguration(this);
+ // parent
+ String parentID = element.getAttribute(IConfiguration.PARENT);
+ if (parentID != null) {
+ // Lookup the parent configuration by ID
+ parent = ManagedBuildManager.getExtensionConfiguration(parentID);
+ }
+
+ // Get the name of the build artifact associated with configuration
+ artifactName = element.getAttribute(ARTIFACT_NAME);
- // name
- setName(element.getAttribute(IConfiguration.NAME));
+ // Get the semicolon separated list of IDs of the error parsers
+ errorParserIds = element.getAttribute(ERROR_PARSERS);
- IManagedConfigElement[] configElements = element.getChildren();
- for (int l = 0; l < configElements.length; ++l) {
- IManagedConfigElement configElement = configElements[l];
- if (configElement.getName().equals(IConfiguration.TOOLREF_ELEMENT_NAME)) {
- new ToolReference(this, configElement);
- }
- }
+ // Get the artifact extension
+ artifactExtension = element.getAttribute(EXTENSION);
+
+ // Get the clean command
+ cleanCommand = element.getAttribute(CLEAN_COMMAND);
}
- /**
- * A fresh new configuration for a target.
+ /* (non-Javadoc)
+ * Initialize the configuration information from the XML element
+ * specified in the argument
*
- * @param target
- * @param id
- */
- public Configuration(Target target, String id) {
- this.id = id;
- this.target = target;
+ * @param element An XML element containing the configuration information
+ */
+ protected void loadFromProject(Element element) {
- target.addConfiguration(this);
- }
+ // id
+ setId(element.getAttribute(IConfiguration.ID));
- public void resolveReferences() {
- if (!resolved) {
- resolved = true;
-// IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
- Iterator refIter = getLocalToolReferences().iterator();
- while (refIter.hasNext()) {
- ToolReference ref = (ToolReference)refIter.next();
- ref.resolveReferences();
+ // name
+ if (element.hasAttribute(IConfiguration.NAME))
+ setName(element.getAttribute(IConfiguration.NAME));
+
+ if (element.hasAttribute(IConfiguration.PARENT)) {
+ // See if the parent belongs to the same project
+ parent = managedProject.getConfiguration(element.getAttribute(IConfiguration.PARENT));
+ // If not, then try the extension configurations
+ if (parent == null) {
+ parent = ManagedBuildManager.getExtensionConfiguration(element.getAttribute(IConfiguration.PARENT));
}
}
+
+ // Get the name of the build artifact associated with target (usually
+ // in the plugin specification).
+ if (element.hasAttribute(ARTIFACT_NAME)) {
+ artifactName = element.getAttribute(ARTIFACT_NAME);
+ }
+
+ // Get the semicolon separated list of IDs of the error parsers
+ if (element.hasAttribute(ERROR_PARSERS)) {
+ errorParserIds = element.getAttribute(ERROR_PARSERS);
+ }
+
+ // Get the artifact extension
+ if (element.hasAttribute(EXTENSION)) {
+ artifactExtension = element.getAttribute(EXTENSION);
+ }
+
+ // Get the clean command
+ if (element.hasAttribute(CLEAN_COMMAND)) {
+ cleanCommand = element.getAttribute(CLEAN_COMMAND);
+ }
}
-
+
/**
- * Adds a tool reference to the receiver.
+ * Persist this configuration to project file.
*
- * @param toolRef
+ * @param doc
+ * @param element
*/
- public void addToolReference(ToolReference toolRef) {
- getLocalToolReferences().add(toolRef);
+ public void serialize(Document doc, Element element) {
+ element.setAttribute(IConfiguration.ID, id);
+
+ if (name != null)
+ element.setAttribute(IConfiguration.NAME, name);
+
+ if (parent != null)
+ element.setAttribute(IConfiguration.PARENT, parent.getId());
+
+ if (artifactName != null)
+ element.setAttribute(ARTIFACT_NAME, artifactName);
+
+ if (errorParserIds != null)
+ element.setAttribute(ERROR_PARSERS, errorParserIds);
+
+ if (artifactExtension != null)
+ element.setAttribute(EXTENSION, artifactExtension);
+
+ if (cleanCommand != null)
+ element.setAttribute(CLEAN_COMMAND, cleanCommand);
+
+ // Serialize my children
+ Element toolChainElement = doc.createElement(IToolChain.TOOL_CHAIN_ELEMENT_NAME);
+ element.appendChild(toolChainElement);
+ toolChain.serialize(doc, toolChainElement);
+ List resElements = getResourceConfigurationList();
+ Iterator iter = resElements.listIterator();
+ while (iter.hasNext()) {
+ ResourceConfiguration resConfig = (ResourceConfiguration) iter.next();
+ Element resElement = doc.createElement(IResourceConfiguration.RESOURCE_CONFIGURATION_ELEMENT_NAME);
+ element.appendChild(resElement);
+ resConfig.serialize(doc, resElement);
+ }
+
+ // I am clean now
+ isDirty = false;
}
+
+ /*
+ * P A R E N T A N D C H I L D H A N D L I N G
+ */
/* (non-Javadoc)
- * @param option
- * @return
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getParent()
*/
- private OptionReference createOptionReference(IOption option) {
- ToolReference searchRef = null;
- ToolReference answer = null;
- // The option may already be a reference created to hold user settings
- if (option instanceof OptionReference) {
- // The option reference belongs to an existing tool reference
- OptionReference optionRef = (OptionReference)option;
- searchRef = optionRef.getToolReference();
-
- // That tool reference may belong to a target or to the configuration
- if (searchRef.ownedByConfiguration(this))
- return optionRef;
- else {
- // All this means is that the tool ref does not belong to the receiver.
- // The receiver may also have a reference to the tool
- if ((answer = findLocalReference(searchRef)) == null) {
- // Otherwise, create one and save the option setting in it
- answer = new ToolReference(this, searchRef);
- }
- return answer.createOptionReference(option);
- }
- } else {
- // Find out if a tool reference already exists
- searchRef = (ToolReference) getToolReference(option.getTool());
- if (searchRef == null) {
- answer = new ToolReference(this, option.getTool());
- } else {
- // The reference may belong to the target
- if (!searchRef.ownedByConfiguration(this)) {
- answer = new ToolReference(this, searchRef);
- } else {
- answer = searchRef;
- }
- }
- return answer.createOptionReference(option);
- }
+ public IConfiguration getParent() {
+ return parent;
}
/* (non-Javadoc)
- * @param toolRef
- * @return
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getOwner()
*/
- private ToolReference findLocalReference(ToolReference toolRef) {
- Iterator iter = getLocalToolReferences().iterator();
-
+ public IResource getOwner() {
+ if (managedProject != null)
+ return managedProject.getOwner();
+ else {
+ return null; // Extension configurations don't have an "owner"
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getProjectType()
+ */
+ public IProjectType getProjectType() {
+ return (IProjectType)projectType;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getManagedProject()
+ */
+ public IManagedProject getManagedProject() {
+ return (IManagedProject)managedProject;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getToolChain(IToolChain, String, String, boolean)
+ */
+ public IToolChain createToolChain(IToolChain superClass, String Id, String name, boolean isExtensionElement) {
+ toolChain = new ToolChain(this, superClass, Id, name, isExtensionElement);
+ setDirty(true);
+ return (IToolChain)toolChain;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getToolChain()
+ */
+ public IToolChain getToolChain() {
+ return (IToolChain)toolChain;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getResourceConfigurations()
+ */
+ public IResourceConfiguration[] getResourceConfigurations() {
+ IResourceConfiguration[] resConfigs = new IResourceConfiguration[getResourceConfigurationList().size()];
+ Iterator iter = getResourceConfigurationList().listIterator();
+ int i = 0;
while (iter.hasNext()) {
- ToolReference ref = (ToolReference)iter.next();
- if (toolRef.getTool().equals(ref.getTool())) {
- return ref;
- }
+ ResourceConfiguration resConfig = (ResourceConfiguration)iter.next();
+ resConfigs[i++] = (IResourceConfiguration)resConfig;
}
-
- return null;
+ return resConfigs;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getFilteredTools(org.eclipse.core.resources.IProject)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getResourceConfiguration(java.lang.String)
*/
- public ITool[] getFilteredTools(IProject project) {
- ITool[] localTools = getTools();
+ public IResourceConfiguration getResourceConfiguration(String resPath) {
+ ResourceConfiguration resConfig = (ResourceConfiguration)getResourceConfigurationMap().get(resPath);
+ return (IResourceConfiguration)resConfig;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getFilteredTools()
+ */
+ public ITool[] getFilteredTools() {
+ if (toolChain == null) {
+ return new ITool[0];
+ }
+ ITool[] localTools = toolChain.getTools();
+ IManagedProject manProj = getManagedProject();
+ if (manProj == null) {
+ // If this is not associated with a project, then there is nothing to filter with
+ return localTools;
+ }
+ IProject project = (IProject)manProj.getOwner();
Vector tools = new Vector(localTools.length);
for (int i = 0; i < localTools.length; i++) {
ITool tool = localTools[i];
@@ -322,333 +525,463 @@ public class Configuration extends BuildObject implements IConfiguration {
return (ITool[])tools.toArray(new ITool[tools.size()]);
}
- /* (non-javadoc)
- * A safety method to avoid NPEs. It answers the tool reference list in the
- * receiver. It does not look at the tool references defined in the parent.
- *
- * @return List
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getTools()
*/
- protected List getLocalToolReferences() {
- if (toolReferences == null) {
- toolReferences = new ArrayList();
- }
- return toolReferences;
+ public ITool[] getTools() {
+ return toolChain.getTools();
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#getName()
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getTool(java.lang.String)
*/
- public String getName() {
- return (name == null && parent != null) ? parent.getName() : name;
+ public ITool getTool(String id) {
+ return toolChain.getTool(id);
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#getTools()
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setToolCommand(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String)
*/
- public ITool[] getTools() {
- ITool[] tools = parent != null
- ? parent.getTools()
- : target.getTools();
-
- // Validate that the tools correspond to the nature
- IProject project = (IProject)target.getOwner();
- if (project != null) {
- List validTools = new ArrayList();
-
- // The target is associated with a real project
- for (int i = 0; i < tools.length; ++i) {
- ITool tool = tools[i];
- // Make sure the tool filter and project nature agree
- switch (tool.getNatureFilter()) {
- case ITool.FILTER_C:
- try {
- if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- validTools.add(tool);
- }
- } catch (CoreException e) {
- continue;
- }
- break;
- case ITool.FILTER_CC:
- try {
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- validTools.add(tool);
- }
- } catch (CoreException e) {
- continue;
- }
- break;
- case ITool.FILTER_BOTH:
- validTools.add(tool);
- break;
- }
+ public String getToolCommand(ITool tool) {
+ // TODO: Do we need to verify that the tool is part of the configuration?
+ return tool.getToolCommand();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setToolCommand(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String)
+ */
+ public void setToolCommand(ITool tool, String command) {
+ // TODO: Do we need to verify that the tool is part of the configuration?
+ tool.setToolCommand(command);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, boolean)
+ */
+ public IOption setOption(ITool tool, IOption option, boolean value) throws BuildException {
+ // Is there a change?
+ IOption retOpt = option;
+ if (option.getBooleanValue() != value) {
+ if (option.isExtensionElement()) {
+ // If the extension element is only overriding the "value" of its superclass, hook the
+ // new option up to its superclass directly. This is to avoid references to oddly id'ed
+ // elements that are automatically generated from V2.0 model optionReferences. If these
+ // end up in the project file, then the project could have a problem when the integration
+ // provider switches to providing the new model.
+ IOption newSuperClass = option;
+ if (option.overridesOnlyValue()) {
+ newSuperClass = option.getSuperClass();
+ }
+ // Create an Option element for the managed build project file (.CDTBUILD)
+ String subId;
+ int nnn = ManagedBuildManager.getRandomNumber();
+ subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
+ retOpt = tool.createOption(newSuperClass, subId, null, false);
+ retOpt.setValueType(option.getValueType());
+ retOpt.setValue(value);
+ setDirty(true);
+ } else {
+ option.setValue(value);
}
- // Now put the valid tools back into the array
- tools = (ITool[]) validTools.toArray(new ITool[validTools.size()]);
- }
-
- // Replace tools with local overrides
- for (int i = 0; i < tools.length; ++i) {
- IToolReference ref = getToolReference(tools[i]);
- if (ref != null)
- tools[i] = ref;
+ rebuildNeeded = true;
}
-
- return tools;
+ return retOpt;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isDirty()
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String)
*/
- public boolean isDirty() {
- // If I need saving, just say yes
- if (isDirty) return true;
-
- // Otherwise see if any tool references need saving
- Iterator iter = getLocalToolReferences().listIterator();
- while (iter.hasNext()) {
- IToolReference ref = (IToolReference) iter.next();
- if (ref.isDirty()) return true;
+ public IOption setOption(ITool tool, IOption option, String value) throws BuildException {
+ IOption retOpt = option;
+ String oldValue;
+ oldValue = option.getStringValue();
+ if (oldValue != null && !oldValue.equals(value)) {
+ if (option.isExtensionElement()) {
+ // If the extension element is only overriding the "value" of its superclass, hook the
+ // new option up to its superclass directly. This is to avoid references to oddly id'ed
+ // elements that are automatically generated from V2.0 model optionReferences. If these
+ // end up in the project file, then the project could have a problem when the integration
+ // provider switches to providing the new model.
+ IOption newSuperClass = option;
+ if (option.overridesOnlyValue()) {
+ newSuperClass = option.getSuperClass();
+ }
+ // Create an Option element for the managed build project file (.CDTBUILD)
+ String subId;
+ int nnn = ManagedBuildManager.getRandomNumber();
+ subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
+ retOpt = tool.createOption(newSuperClass, subId, null, false);
+ retOpt.setValueType(option.getValueType());
+ retOpt.setValue(value);
+ setDirty(true);
+ } else {
+ option.setValue(value);
+ }
+ rebuildNeeded = true;
}
-
- return isDirty;
+ return retOpt;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#needsRebuild()
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String[])
*/
- public boolean needsRebuild() {
- return rebuildNeeded;
+ public IOption setOption(ITool tool, IOption option, String[] value) throws BuildException {
+ IOption retOpt = option;
+ // Is there a change?
+ String[] oldValue;
+ switch (option.getValueType()) {
+ case IOption.STRING_LIST :
+ oldValue = option.getStringListValue();
+ break;
+ case IOption.INCLUDE_PATH :
+ oldValue = option.getIncludePaths();
+ break;
+ case IOption.PREPROCESSOR_SYMBOLS :
+ oldValue = option.getDefinedSymbols();
+ break;
+ case IOption.LIBRARIES :
+ oldValue = option.getLibraries();
+ break;
+ case IOption.OBJECTS :
+ oldValue = option.getUserObjects();
+ break;
+ default :
+ oldValue = new String[0];
+ break;
+ }
+ if(!Arrays.equals(value, oldValue)) {
+ if (option.isExtensionElement()) {
+ // If the extension element is only overriding the "value" of its superclass, hook the
+ // new option up to its superclass directly. This is to avoid references to oddly id'ed
+ // elements that are automatically generated from V2.0 model optionReferences. If these
+ // end up in the project file, then the project could have a problem when the integration
+ // provider switches to providing the new model.
+ IOption newSuperClass = option;
+ if (option.overridesOnlyValue()) {
+ newSuperClass = option.getSuperClass();
+ }
+ // Create an Option element for the managed build project file (.CDTBUILD)
+ String subId;
+ int nnn = ManagedBuildManager.getRandomNumber();
+ subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
+ retOpt = tool.createOption(newSuperClass, subId, null, false);
+ retOpt.setValueType(option.getValueType());
+ retOpt.setValue(value);
+ setDirty(true);
+ } else {
+ option.setValue(value);
+ }
+ rebuildNeeded = true;
+ }
+ return retOpt;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#getParent()
+ * Safe accessor for the list of resource configs.
+ *
+ * @return List containing the tools
*/
- public IConfiguration getParent() {
- return parent;
+ private List getResourceConfigurationList() {
+ if (resourceConfigurationList == null) {
+ resourceConfigurationList = new ArrayList();
+ }
+ return resourceConfigurationList;
}
- /* (non-javadoc)
+ /* (non-Javadoc)
+ * Safe accessor for the map of resource paths to resource configs
*
- * @param tool
- * @return List
+ * @return
*/
- protected List getOptionReferences(ITool tool) {
- List references = new ArrayList();
-
- // Get all the option references I add for this tool
- IToolReference toolRef = getToolReference(tool);
- if (toolRef != null) {
- references.addAll(toolRef.getOptionReferenceList());
+ private Map getResourceConfigurationMap() {
+ if (resourceConfigurationMap == null) {
+ resourceConfigurationMap = new HashMap();
}
-
- // See if there is anything that my parents add that I don't
- if (parent != null) {
- List temp = ((Configuration)parent).getOptionReferences(tool);
- Iterator iter = temp.listIterator();
- while (iter.hasNext()) {
- OptionReference ref = (OptionReference) iter.next();
- if (!references.contains(ref)) {
- references.add(ref);
- }
- }
- }
-
- return references;
+ return resourceConfigurationMap;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolById(java.lang.String)
+ * Adds the Resource Configuration to the Resource Configuration list and map
+ *
+ * @param resConfig
*/
- public ITool getToolById(String id) {
- ITool[] tools = parent != null
- ? parent.getTools()
- : target.getTools();
+ public void addResourceConfiguration(ResourceConfiguration resConfig) {
+ getResourceConfigurationList().add(resConfig);
+ getResourceConfigurationMap().put(resConfig.getResourcePath(), resConfig);
+ }
- // Replace tools with local overrides
- for (int i = 0; i < tools.length; ++i) {
- IToolReference ref = getToolReference(tools[i]);
- if (ref != null)
- tools[i] = ref;
- }
+ public void removeResourceConfiguration(IResourceConfiguration resConfig) {
+ getResourceConfigurationList().remove((ResourceConfiguration)resConfig);
+ }
+ /*
+ * M O D E L A T T R I B U T E A C C E S S O R S
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getName()
+ */
+ public String getName() {
+ return (name == null && parent != null) ? parent.getName() : name;
+ }
- // Search the result for the ID
- for (int index = tools.length - 1; index >= 0; --index) {
- if (tools[index].getId().equals(id)) {
- return tools[index];
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getArtifactExtension()
+ */
+ public String getArtifactExtension() {
+ if (artifactExtension == null) {
+ // Ask my parent first
+ if (parent != null) {
+ return parent.getArtifactExtension();
+ } else {
+ return EMPTY_STRING;
}
+ } else {
+ return artifactExtension;
}
-
- return null;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#getTarget()
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getArtifactName()
*/
- public ITarget getTarget() {
- return (target == null && parent != null) ? parent.getTarget() : target;
+ public String getArtifactName() {
+ if (artifactName == null) {
+ // If I have a parent, ask it
+ if (parent != null) {
+ return parent.getArtifactName();
+ } else {
+ // I'm it and this is not good!
+ return EMPTY_STRING;
+ }
+ } else {
+ return artifactName;
+ }
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#getOwner()
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getBuildArguments()
*/
- public IResource getOwner() {
- return getTarget().getOwner();
+ public String getBuildArguments() {
+ IToolChain tc = getToolChain();
+ IBuilder builder = tc.getBuilder();
+ if (builder != null) {
+ return builder.getArguments();
+ }
+ return new String("-k"); //$NON-NLS-1$
}
/* (non-Javadoc)
- * Returns the reference for a given tool or <code>null</code> if one is not
- * found.
- *
- * @param tool
- * @return ToolReference
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getBuildCommand()
*/
- private IToolReference getToolReference(ITool tool) {
- // Sanity
- if (tool == null) return null;
+ public String getBuildCommand() {
+ IToolChain tc = getToolChain();
+ IBuilder builder = tc.getBuilder();
+ if (builder != null) {
+ return builder.getCommand();
+ }
+ return new String("make"); //$NON-NLS-1$
+ }
- // See if the receiver has a reference to the tool
- Iterator iter = getLocalToolReferences().listIterator();
- while (iter.hasNext()) {
- ToolReference temp = (ToolReference)iter.next();
- if (temp.references(tool)) {
- return temp;
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getCleanCommand()
+ */
+ public String getCleanCommand() {
+ // Return the command used to remove files
+ if (cleanCommand == null) {
+ if (parent != null) {
+ return parent.getCleanCommand();
+ } else {
+ // User forgot to specify it. Guess based on OS.
+ if (Platform.getOS().equals("OS_WIN32")) { //$NON-NLS-1$
+ return new String("del"); //$NON-NLS-1$
+ } else {
+ return new String("rm"); //$NON-NLS-1$
+ }
}
+ } else {
+ // This was spec'd in the manifest
+ return cleanCommand;
}
-
- // See if the target that the receiver belongs to has a reference to the tool
- ITool[] targetTools = target.getTools();
- for (int index = targetTools.length - 1; index >= 0; --index) {
- ITool targetTool = targetTools[index];
- if (targetTool instanceof ToolReference) {
- if (((ToolReference)targetTool).references(tool)) {
- return (ToolReference)targetTool;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getErrorParserIds()
+ */
+ public String getErrorParserIds() {
+ if (errorParserIds != null) {
+ return errorParserIds;
+ }
+ // If I have a parent, ask it
+ String errorParsers = null;
+ if (parent != null) {
+ errorParsers = parent.getErrorParserIds();
+ }
+ // If no error parsers are specified by the configuration, the default is
+ // the error parsers from the tool-chain
+ if (errorParsers == null && toolChain != null) {
+ errorParsers = toolChain.getErrorParserIds(this);
+ }
+ return errorParsers;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getErrorParserList()
+ */
+ public String[] getErrorParserList() {
+ String parserIDs = getErrorParserIds();
+ String[] errorParsers;
+ if (parserIDs != null) {
+ // Check for an empty string
+ if (parserIDs.length() == 0) {
+ errorParsers = new String[0];
+ } else {
+ StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$
+ List list = new ArrayList(tok.countTokens());
+ while (tok.hasMoreElements()) {
+ list.add(tok.nextToken());
}
+ String[] strArr = {""}; //$NON-NLS-1$
+ errorParsers = (String[]) list.toArray(strArr);
}
+ } else {
+ // If no error parsers are specified, the default is
+ // all error parsers
+ errorParsers = CCorePlugin.getDefault().getAllErrorParsersIDs();
}
- return null;
+ return errorParsers;
}
- /**
- * @param targetElement
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setArtifactExtension(java.lang.String)
*/
- public void reset(IManagedConfigElement element) {
- // I just need to reset the tool references
- getLocalToolReferences().clear();
- IManagedConfigElement[] configElements = element.getChildren();
- for (int l = 0; l < configElements.length; ++l) {
- IManagedConfigElement configElement = configElements[l];
- if (configElement.getName().equals(IConfiguration.TOOLREF_ELEMENT_NAME)) {
- ToolReference ref = new ToolReference(this, configElement);
- ref.resolveReferences();
- }
+ public void setArtifactExtension(String extension) {
+ if (extension == null && artifactExtension == null) return;
+ if (artifactExtension == null || extension == null || !artifactExtension.equals(extension)) {
+ artifactExtension = extension;
+ setRebuildState(true);
+ isDirty = true;
}
- isDirty = true;
}
- /**
- * Persist receiver to project file.
- *
- * @param doc
- * @param element
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#setArtifactName(java.lang.String)
*/
- public void serialize(Document doc, Element element) {
- element.setAttribute(IConfiguration.ID, id);
-
- if (name != null)
- element.setAttribute(IConfiguration.NAME, name);
-
- if (parent != null)
- element.setAttribute(IConfiguration.PARENT, parent.getId());
-
- // Serialize only the tool references defined in the configuration
- Iterator iter = getLocalToolReferences().listIterator();
- while (iter.hasNext()) {
- ToolReference toolRef = (ToolReference) iter.next();
- Element toolRefElement = doc.createElement(IConfiguration.TOOLREF_ELEMENT_NAME);
- element.appendChild(toolRefElement);
- toolRef.serialize(doc, toolRefElement);
+ public void setArtifactName(String name) {
+ if (name == null && artifactName == null) return;
+ if (artifactName == null || name == null || !artifactName.equals(name)) {
+ artifactName = name;
+ setRebuildState(true);
+ isDirty = true;
}
-
- // I am clean now
- isDirty = false;
}
-
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setDirty(boolean)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setErrorParserIds()
*/
- public void setDirty(boolean isDirty) {
- // Override the dirty flag
- this.isDirty = isDirty;
- // And do the same for the tool references
- Iterator iter = getLocalToolReferences().listIterator();
- while (iter.hasNext()) {
- ((ToolReference)iter.next()).setDirty(isDirty);
+ public void setErrorParserIds(String ids) {
+ String currentIds = getErrorParserIds();
+ if (ids == null && currentIds == null) return;
+ if (currentIds == null || ids == null || !(currentIds.equals(ids))) {
+ errorParserIds = ids;
+ isDirty = true;
}
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, boolean)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setCleanCommand()
*/
- public void setOption(IOption option, boolean value) throws BuildException {
- // Is there a delta
- if (option.getBooleanValue() != value) {
- createOptionReference(option).setValue(value);
+ public void setCleanCommand(String command) {
+ if (command == null && cleanCommand == null) return;
+ if (cleanCommand == null || command == null || !cleanCommand.equals(command)) {
+ cleanCommand = command;
isDirty = true;
- rebuildNeeded = true;
}
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setBuildArguments()
*/
- public void setOption(IOption option, String value) throws BuildException {
- String oldValue;
- // Check whether this is an enumerated option
- if (option.getValueType() == IOption.ENUMERATED) {
- oldValue = option.getSelectedEnum();
+ public void setBuildArguments(String makeArgs) {
+ IToolChain tc = getToolChain();
+ IBuilder builder = tc.getBuilder();
+ if (builder.isExtensionElement()) {
+ int nnn = ManagedBuildManager.getRandomNumber();
+ String subId = builder.getId() + "." + nnn; //$NON-NLS-1$
+ String builderName = builder.getName() + "." + getName(); //$NON-NLS-1$
+ builder = toolChain.createBuilder(builder, subId, builderName, false);
}
- else {
- oldValue = option.getStringValue();
+ builder.setArguments(makeArgs);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setBuildCommand()
+ */
+ public void setBuildCommand(String command) {
+ IToolChain tc = getToolChain();
+ IBuilder builder = tc.getBuilder();
+ if (builder.isExtensionElement()) {
+ int nnn = ManagedBuildManager.getRandomNumber();
+ String subId = builder.getId() + "." + nnn; //$NON-NLS-1$
+ String builderName = builder.getName() + "." + getName(); //$NON-NLS-1$
+ builder = toolChain.createBuilder(builder, subId, builderName, false);
}
- if (oldValue != null && !oldValue.equals(value)) {
- createOptionReference(option).setValue(value);
- isDirty = true;
- rebuildNeeded = true;
+ builder.setCommand(command);
+ }
+
+
+ /*
+ * O B J E C T S T A T E M A I N T E N A N C E
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isExtensionElement()
+ */
+ public boolean isExtensionElement() {
+ return isExtensionConfig;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isDirty()
+ */
+ public boolean isDirty() {
+ // This shouldn't be called for an extension configuration
+ if (isExtensionConfig) return false;
+
+ // If I need saving, just say yes
+ if (isDirty) return true;
+
+ // Otherwise see if any children need saving
+ if (toolChain.isDirty()) return true;
+ Iterator iter = getResourceConfigurationList().listIterator();
+ while (iter.hasNext()) {
+ ResourceConfiguration current = (ResourceConfiguration) iter.next();
+ if (current.isDirty()) return true;
}
+
+ return isDirty;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String[])
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#needsRebuild()
*/
- public void setOption(IOption option, String[] value) throws BuildException {
- // Is there a delta
- String[] oldValue;
- switch (option.getValueType()) {
- case IOption.STRING_LIST :
- oldValue = option.getStringListValue();
- break;
- case IOption.INCLUDE_PATH :
- oldValue = option.getIncludePaths();
- break;
- case IOption.PREPROCESSOR_SYMBOLS :
- oldValue = option.getDefinedSymbols();
- break;
- case IOption.LIBRARIES :
- oldValue = option.getLibraries();
- break;
- case IOption.OBJECTS :
- oldValue = option.getUserObjects();
- break;
- default :
- oldValue = new String[0];
- break;
+ public boolean needsRebuild() {
+ return rebuildNeeded;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setDirty(boolean)
+ */
+ public void setDirty(boolean isDirty) {
+ // Override the dirty flag
+ this.isDirty = isDirty;
+ // Propagate "false" to the children
+ if (!isDirty) {
+ toolChain.setDirty(false);
+ Iterator iter = getResourceConfigurationList().listIterator();
+ while (iter.hasNext()) {
+ ResourceConfiguration current = (ResourceConfiguration) iter.next();
+ current.setDirty(false);
+ }
}
- if(!Arrays.equals(value, oldValue)) {
- createOptionReference(option).setValue(value);
- isDirty = true;
- rebuildNeeded = true;
- }
}
/* (non-Javadoc)
@@ -659,23 +992,90 @@ public class Configuration extends BuildObject implements IConfiguration {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setToolCommand(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#hasOverriddenBuildCommand()
*/
- public void setToolCommand(ITool tool, String command) {
- // Make sure the command is different
- if (command != null) {
- // Does this config have a ref to the tool
- IToolReference ref = getToolReference(tool);
- if (ref == null) {
- // Then make one
- ref = new ToolReference(this, tool);
+ public boolean hasOverriddenBuildCommand() {
+ IBuilder builder = getToolChain().getBuilder();
+ if (builder != null) {
+ IBuilder superB = builder.getSuperClass();
+ if (superB != null) {
+ String command = builder.getCommand();
+ if (command != null) {
+ String superC = superB.getCommand();
+ if (superC != null) {
+ if (!command.equals(superC)) {
+ return true;
+ }
+ }
+ }
+ String args = builder.getArguments();
+ if (args != null) {
+ String superA = superB.getArguments();
+ if (superA != null) {
+ if (!args.equals(superA)) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public void resolveReferences() {
+ if (!resolved) {
+ resolved = true;
+
+ // call resolve references on any children
+ toolChain.resolveReferences();
+ Iterator resConfigIter = getResourceConfigurationList().iterator();
+ while (resConfigIter.hasNext()) {
+ ResourceConfiguration current = (ResourceConfiguration)resConfigIter.next();
+ current.resolveReferences();
}
- // Set the ref's command
- if (ref != null) {
- isDirty = ref.setToolCommand(command);
- rebuildNeeded = isDirty;
+ }
+ }
+
+ /**
+ * Reset the configuration's, tools', options
+ */
+ public void reset() {
+ // We just need to remove all Options
+ ITool[] tools = getTools();
+ for (int i = 0; i < tools.length; i++) {
+ ITool tool = tools[i];
+ IOption[] opts = tool.getOptions();
+ for (int j = 0; j < opts.length; j++) {
+ tool.removeOption(opts[j]);
}
}
}
+ /*
+ * Create a resource configuration object for the passed-in file
+ */
+ public IResourceConfiguration createResourceConfiguration(IFile file)
+ {
+ String path = file.getFullPath().toString();
+ String resourceName = file.getName();
+ String id = getId() + "." + path; //$NON-NLS-1$
+ ResourceConfiguration resConfig = new ResourceConfiguration( (IConfiguration) this, id, resourceName, path);
+
+ // Get file extension.
+ String extString = file.getFileExtension();
+
+ // Add the resource specific tools to this resource.
+ ITool tools[] = getFilteredTools();
+ String subId = new String();
+ for (int i = 0; i < tools.length; i++) {
+ if( tools[i].buildsFileType(extString) ) {
+ subId = tools[i].getId() + "." + path; //$NON-NLS-1$
+ resConfig.createTool(tools[i], subId, tools[i].getName(), false);
+ }
+ }
+
+ // Add this resource to the list.
+ addResourceConfiguration(resConfig);
+ return resConfig;
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ConfigurationV2.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ConfigurationV2.java
new file mode 100644
index 00000000000..ad401d1eb1d
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ConfigurationV2.java
@@ -0,0 +1,710 @@
+/**********************************************************************
+ * Copyright (c) 2003,2004 IBM Rational Software and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.core;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.cdt.core.CCProjectNature;
+import org.eclipse.cdt.core.CProjectNature;
+import org.eclipse.cdt.managedbuilder.core.BuildException;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IConfigurationV2;
+import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
+import org.eclipse.cdt.managedbuilder.core.IOption;
+import org.eclipse.cdt.managedbuilder.core.ITarget;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IToolReference;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * This class is deprecated in 2.1
+ */
+public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
+ private boolean isDirty = false;
+ private IConfigurationV2 parent;
+ private boolean rebuildNeeded = false;
+ private boolean resolved = true;
+ private ITarget target;
+ private List toolReferences;
+ private IConfiguration createdConfig;
+
+ /**
+ * Build a configuration from the project manifest file.
+ *
+ * @param target The <code>Target</code> the configuration belongs to.
+ * @param element The element from the manifest that contains the overridden configuration information.
+ */
+ public ConfigurationV2(Target target, Element element) {
+ this.target = target;
+
+ // id
+ setId(element.getAttribute(IConfigurationV2.ID));
+
+ // hook me up
+ target.addConfiguration(this);
+
+ // name
+ if (element.hasAttribute(IConfigurationV2.NAME))
+ setName(element.getAttribute(IConfigurationV2.NAME));
+
+ if (element.hasAttribute(IConfigurationV2.PARENT)) {
+ // See if the target has a parent
+ ITarget targetParent = target.getParent();
+ // If so, then get my parent from it
+ if (targetParent != null) {
+ parent = targetParent.getConfiguration(element.getAttribute(IConfigurationV2.PARENT));
+ }
+ else {
+ parent = null;
+ }
+ }
+
+ NodeList configElements = element.getChildNodes();
+ for (int i = 0; i < configElements.getLength(); ++i) {
+ Node configElement = configElements.item(i);
+ if (configElement.getNodeName().equals(IConfigurationV2.TOOLREF_ELEMENT_NAME)) {
+ new ToolReference(this, (Element)configElement);
+ }
+ }
+
+ }
+
+ /**
+ * Create a new configuration based on one already defined.
+ *
+ * @param target The <code>Target</code> the receiver will be added to.
+ * @param parentConfig The <code>IConfigurationV2</code> to copy the settings from.
+ * @param id A unique ID for the configuration.
+ */
+ public ConfigurationV2(Target target, IConfigurationV2 parentConfig, String id) {
+ this.id = id;
+ this.name = parentConfig.getName();
+ this.target = target;
+
+ // If this contructor is called to clone an existing
+ // configuration, the parent of the parent should be stored.
+ // As of 2.0, there is still one single level of inheritence to
+ // worry about
+ parent = parentConfig.getParent() == null ? parentConfig : parentConfig.getParent();
+
+ // Check that the tool and the project match
+ IProject project = (IProject) target.getOwner();
+
+ // Get the tool references from the target and parent
+ List allToolRefs = new Vector(target.getLocalToolReferences());
+ allToolRefs.addAll(((ConfigurationV2)parentConfig).getLocalToolReferences());
+ Iterator iter = allToolRefs.listIterator();
+ while (iter.hasNext()) {
+ ToolReference toolRef = (ToolReference)iter.next();
+
+ // Make a new ToolReference based on the tool in the ref
+ ITool parentTool = toolRef.getTool();
+ ToolReference newRef = new ToolReference(this, parentTool);
+
+ // The reference may have a different command than the parent tool
+ String refCmd = toolRef.getToolCommand();
+ if (!refCmd.equals(parentTool.getToolCommand())) {
+ newRef.setToolCommand(refCmd);
+ }
+
+ List optRefs = toolRef.getOptionReferenceList();
+ Iterator optIter = optRefs.listIterator();
+ while (optIter.hasNext()) {
+ OptionReference optRef = (OptionReference)optIter.next();
+ IOption opt = optRef.getOption();
+ try {
+ switch (opt.getValueType()) {
+ case IOption.BOOLEAN:
+ new OptionReference(newRef, opt).setValue(optRef.getBooleanValue());
+ break;
+ case IOption.STRING:
+ new OptionReference(newRef, opt).setValue(optRef.getStringValue());
+ break;
+ case IOption.ENUMERATED:
+ new OptionReference(newRef, opt).setValue(optRef.getSelectedEnum());
+ break;
+ case IOption.STRING_LIST :
+ new OptionReference(newRef, opt).setValue(optRef.getStringListValue());
+ break;
+ case IOption.INCLUDE_PATH :
+ new OptionReference(newRef, opt).setValue(optRef.getIncludePaths());
+ break;
+ case IOption.PREPROCESSOR_SYMBOLS :
+ new OptionReference(newRef, opt).setValue(optRef.getDefinedSymbols());
+ break;
+ case IOption.LIBRARIES :
+ new OptionReference(newRef, opt).setValue(optRef.getLibraries());
+ break;
+ case IOption.OBJECTS :
+ new OptionReference(newRef, opt).setValue(optRef.getUserObjects());
+ break;
+ }
+ } catch (BuildException e) {
+ continue;
+ }
+ }
+ }
+
+ target.addConfiguration(this);
+ }
+
+ /**
+ * Create a new <code>ConfigurationV2</code> based on the specification in the plugin manifest.
+ *
+ * @param target The <code>Target</code> the receiver will be added to.
+ * @param element The element from the manifest that contains the default configuration settings.
+ */
+ public ConfigurationV2(Target target, IManagedConfigElement element) {
+ this.target = target;
+
+ // setup for resolving
+ ManagedBuildManager.putConfigElement(this, element);
+ resolved = false;
+
+ // id
+ setId(element.getAttribute(IConfigurationV2.ID));
+
+ // hook me up
+ target.addConfiguration(this);
+
+ // name
+ setName(element.getAttribute(IConfigurationV2.NAME));
+
+ IManagedConfigElement[] configElements = element.getChildren();
+ for (int l = 0; l < configElements.length; ++l) {
+ IManagedConfigElement configElement = configElements[l];
+ if (configElement.getName().equals(IConfigurationV2.TOOLREF_ELEMENT_NAME)) {
+ new ToolReference(this, configElement);
+ }
+ }
+ }
+
+ /**
+ * A fresh new configuration for a target.
+ *
+ * @param target
+ * @param id
+ */
+ public ConfigurationV2(Target target, String id) {
+ this.id = id;
+ this.target = target;
+
+ target.addConfiguration(this);
+ }
+
+ public void resolveReferences() {
+ if (!resolved) {
+ resolved = true;
+// IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
+ Iterator refIter = getLocalToolReferences().iterator();
+ while (refIter.hasNext()) {
+ ToolReference ref = (ToolReference)refIter.next();
+ ref.resolveReferences();
+ }
+ }
+ }
+
+ /**
+ * Adds a tool reference to the receiver.
+ *
+ * @param toolRef
+ */
+ public void addToolReference(ToolReference toolRef) {
+ getLocalToolReferences().add(toolRef);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#getToolReferences()
+ */
+ public IToolReference[] getToolReferences() {
+ List list = getLocalToolReferences();
+ IToolReference[] tools = new IToolReference[list.size()];
+ list.toArray(tools);
+ return tools;
+ }
+
+ /* (non-Javadoc)
+ * @param option
+ * @return
+ */
+ private OptionReference createOptionReference(IOption option) {
+ ToolReference searchRef = null;
+ ToolReference answer = null;
+ // The option may already be a reference created to hold user settings
+ if (option instanceof OptionReference) {
+ // The option reference belongs to an existing tool reference
+ OptionReference optionRef = (OptionReference)option;
+ searchRef = optionRef.getToolReference();
+
+ // That tool reference may belong to a target or to the configuration
+ if (searchRef.ownedByConfiguration(this))
+ return optionRef;
+ else {
+ // All this means is that the tool ref does not belong to the receiver.
+ // The receiver may also have a reference to the tool
+ if ((answer = findLocalReference(searchRef)) == null) {
+ // Otherwise, create one and save the option setting in it
+ answer = new ToolReference(this, searchRef);
+ }
+ return answer.createOptionReference(option);
+ }
+ } else {
+ // Find out if a tool reference already exists
+ searchRef = (ToolReference) getToolReference(option.getParent());
+ if (searchRef == null) {
+ answer = new ToolReference(this, option.getParent());
+ } else {
+ // The reference may belong to the target
+ if (!searchRef.ownedByConfiguration(this)) {
+ answer = new ToolReference(this, searchRef);
+ } else {
+ answer = searchRef;
+ }
+ }
+ return answer.createOptionReference(option);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @param toolRef
+ * @return
+ */
+ private ToolReference findLocalReference(ToolReference toolRef) {
+ Iterator iter = getLocalToolReferences().iterator();
+
+ while (iter.hasNext()) {
+ ToolReference ref = (ToolReference)iter.next();
+ if (toolRef.getTool().equals(ref.getTool())) {
+ return ref;
+ }
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#getFilteredTools(org.eclipse.core.resources.IProject)
+ */
+ public ITool[] getFilteredTools(IProject project) {
+ ITool[] localTools = getTools();
+ Vector tools = new Vector(localTools.length);
+ for (int i = 0; i < localTools.length; i++) {
+ ITool tool = localTools[i];
+ try {
+ // Make sure the tool is right for the project
+ switch (tool.getNatureFilter()) {
+ case ITool.FILTER_C:
+ if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ tools.add(tool);
+ }
+ break;
+ case ITool.FILTER_CC:
+ if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ tools.add(tool);
+ }
+ break;
+ case ITool.FILTER_BOTH:
+ tools.add(tool);
+ break;
+ default:
+ break;
+ }
+ } catch (CoreException e) {
+ continue;
+ }
+ }
+
+ // Answer the filtered tools as an array
+ return (ITool[])tools.toArray(new ITool[tools.size()]);
+ }
+
+ /* (non-javadoc)
+ * A safety method to avoid NPEs. It answers the tool reference list in the
+ * receiver. It does not look at the tool references defined in the parent.
+ *
+ * @return List
+ */
+ protected List getLocalToolReferences() {
+ if (toolReferences == null) {
+ toolReferences = new ArrayList();
+ }
+ return toolReferences;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#getName()
+ */
+ public String getName() {
+ return (name == null && parent != null) ? parent.getName() : name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#getTools()
+ */
+ public ITool[] getTools() {
+ ITool[] tools = parent != null
+ ? parent.getTools()
+ : target.getTools();
+
+ // Validate that the tools correspond to the nature
+ IProject project = (IProject)target.getOwner();
+ if (project != null) {
+ List validTools = new ArrayList();
+
+ // The target is associated with a real project
+ for (int i = 0; i < tools.length; ++i) {
+ ITool tool = tools[i];
+ // Make sure the tool filter and project nature agree
+ switch (tool.getNatureFilter()) {
+ case ITool.FILTER_C:
+ try {
+ if (project.hasNature(CProjectNature.C_NATURE_ID) && !project.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ validTools.add(tool);
+ }
+ } catch (CoreException e) {
+ continue;
+ }
+ break;
+ case ITool.FILTER_CC:
+ try {
+ if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ validTools.add(tool);
+ }
+ } catch (CoreException e) {
+ continue;
+ }
+ break;
+ case ITool.FILTER_BOTH:
+ validTools.add(tool);
+ break;
+ }
+ }
+ // Now put the valid tools back into the array
+ tools = (ITool[]) validTools.toArray(new ITool[validTools.size()]);
+ }
+
+ // Replace tools with local overrides
+ for (int i = 0; i < tools.length; ++i) {
+ IToolReference ref = getToolReference(tools[i]);
+ if (ref != null)
+ tools[i] = ref;
+ }
+
+ return tools;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#isDirty()
+ */
+ public boolean isDirty() {
+ // If I need saving, just say yes
+ if (isDirty) return true;
+
+ // Otherwise see if any tool references need saving
+ Iterator iter = getLocalToolReferences().listIterator();
+ while (iter.hasNext()) {
+ IToolReference ref = (IToolReference) iter.next();
+ if (ref.isDirty()) return true;
+ }
+
+ return isDirty;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#needsRebuild()
+ */
+ public boolean needsRebuild() {
+ return rebuildNeeded;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#getParent()
+ */
+ public IConfigurationV2 getParent() {
+ return parent;
+ }
+
+ /* (non-javadoc)
+ *
+ * @param tool
+ * @return List
+ */
+ protected List getOptionReferences(ITool tool) {
+ List references = new ArrayList();
+
+ // Get all the option references I add for this tool
+ IToolReference toolRef = getToolReference(tool);
+ if (toolRef != null) {
+ references.addAll(toolRef.getOptionReferenceList());
+ }
+
+ // See if there is anything that my parents add that I don't
+ if (parent != null) {
+ List temp = ((ConfigurationV2)parent).getOptionReferences(tool);
+ Iterator iter = temp.listIterator();
+ while (iter.hasNext()) {
+ OptionReference ref = (OptionReference) iter.next();
+ if (!references.contains(ref)) {
+ references.add(ref);
+ }
+ }
+ }
+
+ return references;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#getToolById(java.lang.String)
+ */
+ public ITool getToolById(String id) {
+ ITool[] tools = parent != null
+ ? parent.getTools()
+ : target.getTools();
+
+ // Replace tools with local overrides
+ for (int i = 0; i < tools.length; ++i) {
+ IToolReference ref = getToolReference(tools[i]);
+ if (ref != null)
+ tools[i] = ref;
+ }
+
+ // Search the result for the ID
+ for (int index = tools.length - 1; index >= 0; --index) {
+ if (tools[index].getId().equals(id)) {
+ return tools[index];
+ }
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#getTarget()
+ */
+ public ITarget getTarget() {
+ return (target == null && parent != null) ? parent.getTarget() : target;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#getOwner()
+ */
+ public IResource getOwner() {
+ return getTarget().getOwner();
+ }
+
+ /* (non-Javadoc)
+ * Returns the reference for a given tool or <code>null</code> if one is not
+ * found.
+ *
+ * @param tool
+ * @return ToolReference
+ */
+ private IToolReference getToolReference(ITool tool) {
+ // Sanity
+ if (tool == null) return null;
+
+ // See if the receiver has a reference to the tool
+ Iterator iter = getLocalToolReferences().listIterator();
+ while (iter.hasNext()) {
+ ToolReference temp = (ToolReference)iter.next();
+ if (temp.references(tool)) {
+ return temp;
+ }
+ }
+
+ // See if the target that the receiver belongs to has a reference to the tool
+ ITool[] targetTools = target.getTools();
+ for (int index = targetTools.length - 1; index >= 0; --index) {
+ ITool targetTool = targetTools[index];
+ if (targetTool instanceof ToolReference) {
+ if (((ToolReference)targetTool).references(tool)) {
+ return (ToolReference)targetTool;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param targetElement
+ */
+ public void reset(IManagedConfigElement element) {
+ // I just need to reset the tool references
+ getLocalToolReferences().clear();
+ IManagedConfigElement[] configElements = element.getChildren();
+ for (int l = 0; l < configElements.length; ++l) {
+ IManagedConfigElement configElement = configElements[l];
+ if (configElement.getName().equals(IConfigurationV2.TOOLREF_ELEMENT_NAME)) {
+ ToolReference ref = new ToolReference(this, configElement);
+ ref.resolveReferences();
+ }
+ }
+ isDirty = true;
+ }
+
+ /**
+ * Persist receiver to project file.
+ *
+ * @param doc
+ * @param element
+ */
+ public void serialize(Document doc, Element element) {
+ element.setAttribute(IConfigurationV2.ID, id);
+
+ if (name != null)
+ element.setAttribute(IConfigurationV2.NAME, name);
+
+ if (parent != null)
+ element.setAttribute(IConfigurationV2.PARENT, parent.getId());
+
+ // Serialize only the tool references defined in the configuration
+ Iterator iter = getLocalToolReferences().listIterator();
+ while (iter.hasNext()) {
+ ToolReference toolRef = (ToolReference) iter.next();
+ Element toolRefElement = doc.createElement(IConfigurationV2.TOOLREF_ELEMENT_NAME);
+ element.appendChild(toolRefElement);
+ toolRef.serialize(doc, toolRefElement);
+ }
+
+ // I am clean now
+ isDirty = false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#setDirty(boolean)
+ */
+ public void setDirty(boolean isDirty) {
+ // Override the dirty flag
+ this.isDirty = isDirty;
+ // And do the same for the tool references
+ Iterator iter = getLocalToolReferences().listIterator();
+ while (iter.hasNext()) {
+ ((ToolReference)iter.next()).setDirty(isDirty);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#setOption(org.eclipse.cdt.core.build.managed.IOption, boolean)
+ */
+ public void setOption(IOption option, boolean value) throws BuildException {
+ // Is there a delta
+ if (option.getBooleanValue() != value) {
+ createOptionReference(option).setValue(value);
+ isDirty = true;
+ rebuildNeeded = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String)
+ */
+ public void setOption(IOption option, String value) throws BuildException {
+ String oldValue;
+ // Check whether this is an enumerated option
+ if (option.getValueType() == IOption.ENUMERATED) {
+ oldValue = option.getSelectedEnum();
+ }
+ else {
+ oldValue = option.getStringValue();
+ }
+ if (oldValue != null && !oldValue.equals(value)) {
+ createOptionReference(option).setValue(value);
+ isDirty = true;
+ rebuildNeeded = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String[])
+ */
+ public void setOption(IOption option, String[] value) throws BuildException {
+ // Is there a delta
+ String[] oldValue;
+ switch (option.getValueType()) {
+ case IOption.STRING_LIST :
+ oldValue = option.getStringListValue();
+ break;
+ case IOption.INCLUDE_PATH :
+ oldValue = option.getIncludePaths();
+ break;
+ case IOption.PREPROCESSOR_SYMBOLS :
+ oldValue = option.getDefinedSymbols();
+ break;
+ case IOption.LIBRARIES :
+ oldValue = option.getLibraries();
+ break;
+ case IOption.OBJECTS :
+ oldValue = option.getUserObjects();
+ break;
+ default :
+ oldValue = new String[0];
+ break;
+ }
+ if(!Arrays.equals(value, oldValue)) {
+ createOptionReference(option).setValue(value);
+ isDirty = true;
+ rebuildNeeded = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#setRebuildState(boolean)
+ */
+ public void setRebuildState(boolean rebuild) {
+ rebuildNeeded = rebuild;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#setToolCommand(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String)
+ */
+ public void setToolCommand(ITool tool, String command) {
+ // Make sure the command is different
+ if (command != null) {
+ // Does this config have a ref to the tool
+ IToolReference ref = getToolReference(tool);
+ if (ref == null) {
+ // Then make one
+ ref = new ToolReference(this, tool);
+ }
+ // Set the ref's command
+ if (ref != null) {
+ isDirty = ref.setToolCommand(command);
+ rebuildNeeded = isDirty;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#setCreatedConfig(IConfiguration)
+ */
+ public void setCreatedConfig(IConfiguration config) {
+ createdConfig = config;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#getCreatedConfig()
+ */
+ public IConfiguration getCreatedConfig() {
+ return createdConfig;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
index bf56a060005..7fe125d4236 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
@@ -1,8 +1,6 @@
-package org.eclipse.cdt.managedbuilder.internal.core;
-
/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * Copyright (c) 2002,2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
@@ -10,6 +8,7 @@ package org.eclipse.cdt.managedbuilder.internal.core;
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.core;
import java.io.IOException;
import java.io.OutputStream;
@@ -232,8 +231,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
}
// Create a makefile generator for the build
- String targetID = info.getDefaultTarget().getParent().getId();
- IManagedBuilderMakefileGenerator generator = ManagedBuildManager.getMakefileGenerator(targetID);
+ IManagedBuilderMakefileGenerator generator = ManagedBuildManager.getBuildfileGenerator(info.getDefaultConfiguration());
generator.initialize(getProject(), info, monitor);
// So let's figure out why we got called
@@ -309,8 +307,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
// Create a makefile generator for the build
status = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.clean.build.clean", buildDir.getName()); //$NON-NLS-1$
monitor.subTask(status);
- String targetID = info.getDefaultTarget().getParent().getId();
- IManagedBuilderMakefileGenerator generator = ManagedBuildManager.getMakefileGenerator(targetID);
+ IManagedBuilderMakefileGenerator generator = ManagedBuildManager.getBuildfileGenerator(info.getDefaultConfiguration());
generator.initialize(getProject(), info, monitor);
cleanBuild(info, generator, monitor);
}
@@ -352,8 +349,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
checkCancel(monitor);
String statusMsg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.rebuild.makefiles", getProject().getName()); //$NON-NLS-1$
monitor.subTask(statusMsg);
- String targetID = info.getDefaultTarget().getParent().getId();
- generator = ManagedBuildManager.getMakefileGenerator(targetID);
+ generator = ManagedBuildManager.getBuildfileGenerator(info.getDefaultConfiguration());
generator.initialize(getProject(), info, monitor);
MultiStatus result = generator.regenerateMakefiles();
if (result.getCode() == IStatus.WARNING || result.getCode() == IStatus.INFO) {
@@ -410,6 +406,13 @@ public class GeneratedMakefileBuilder extends ACBuilder {
if (extension != null) {
// There could be many of these
IExtension[] extensions = extension.getExtensions();
+ // Get the "configuraton elements" defined in the plugin.xml file.
+ // Note that these "configuration elements" are not related to the
+ // managed build system "configurations".
+ // From the PDE Guide:
+ // A configuration element, with its attributes and children, directly
+ // reflects the content and structure of the extension section within the
+ // declaring plug-in's manifest (plugin.xml) file.
for (int i = 0; i < extensions.length; i++) {
IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
for (int j = 0; j < configElements.length; j++) {
@@ -583,7 +586,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
}
// Flag to the user that make is about to be called
- IPath makeCommand = new Path(info.getMakeCommand());
+ IPath makeCommand = new Path(info.getBuildCommand());
if (makeCommand != null) {
String[] msgs = new String[2];
msgs[0] = makeCommand.toString();
@@ -624,7 +627,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
// Get the arguments to be passed to make from build model
ArrayList makeArgs = new ArrayList();
- String arg = info.getMakeArguments();
+ String arg = info.getBuildArguments();
if (arg.length() > 0) {
String[] args = arg.split("\\s"); //$NON-NLS-1$
for (int i = 0; i < args.length; ++i) {
@@ -655,7 +658,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
}
// Hook up an error parser manager
- String[] errorParsers = info.getDefaultTarget().getErrorParserList();
+ String[] errorParsers = info.getDefaultConfiguration().getErrorParserList();
ErrorParserManager epm = new ErrorParserManager(getProject(), workingDirectory, this, errorParsers);
epm.setOutputStream(consoleOutStream);
OutputStream stdout = epm.getOutputStream();
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
index c7a0b09f270..3edfd56b327 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
@@ -30,11 +30,17 @@ import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.model.IPathEntryContainer;
import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.IOption;
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.ITarget;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IOption;
+import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildCPathEntryContainer;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
@@ -60,20 +66,22 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
private static final QualifiedName defaultTargetProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "defaultTarget"); //$NON-NLS-1$
public static final String MAJOR_SEPERATOR = ";"; //$NON-NLS-1$
public static final String MINOR_SEPERATOR = "::"; //$NON-NLS-1$
+ private static final String EMPTY_STRING = new String();
- private boolean containerCreated;
- private ICProject cProject;
- private String defaultConfigIds;
- private Map defaultConfigMap;
- private ITarget defaultTarget;
- private String defaultTargetId;
+ private IManagedProject managedProject;
+ private ICProject cProject;
+ private IConfiguration defaultConfig;
+ private String defaultConfigId;
private boolean isDirty;
private IResource owner;
private boolean rebuildNeeded;
- private ITarget selectedTarget;
+ private String version;
+ private IConfiguration selectedConfig;
+
private List targetList;
private Map targetMap;
- private String version;
+
+ private boolean isReadOnly = false;
/**
@@ -85,29 +93,17 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
this.owner = owner;
cProject = CoreModel.getDefault().create(owner.getProject());
- // The container for this project has never been created
- containerCreated = false;
-
// Does not need a save but should be rebuilt
isDirty = false;
rebuildNeeded = true;
- // The id of the default target from the project persistent settings store
+ // Get the default configs
IProject project = owner.getProject();
- defaultTargetId = null;
- try {
- defaultTargetId = project.getPersistentProperty(defaultTargetProperty);
- } catch (CoreException e) {
- // We have all the build elements so we can stop if this occurs
- return;
- }
-
- // Get the default configs for every target out of the same store
- defaultConfigIds = null;
+ defaultConfigId = null;
try {
- defaultConfigIds = project.getPersistentProperty(defaultConfigProperty);
+ defaultConfigId = project.getPersistentProperty(defaultConfigProperty);
} catch (CoreException e) {
- // Again, hitting this error just means the default config is not set
+ // Hitting this error just means the default config is not set
return;
}
}
@@ -122,13 +118,12 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
public ManagedBuildInfo(IResource owner, Element element) {
this(owner);
- // Container has already been created for this project
- containerCreated = true;
-
- // Inflate the targets
- NodeList targetNodes = element.getElementsByTagName(ITarget.TARGET_ELEMENT_NAME);
- for (int targIndex = targetNodes.getLength() - 1; targIndex >= 0; --targIndex) {
- new Target(this, (Element)targetNodes.item(targIndex));
+ // Recreate the managed build project element and its children
+ NodeList projNodes = element.getElementsByTagName(IManagedProject.MANAGED_PROJECT_ELEMENT_NAME);
+ // TODO: There should only be 1?
+ for (int projIndex = projNodes.getLength() - 1; projIndex >= 0; --projIndex) {
+ ManagedProject proj = new ManagedProject(this, (Element)projNodes.item(projIndex));
+ proj.resolveReferences();
}
// Switch the rebuild off since this is an existing project
@@ -136,24 +131,27 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#addTarget(org.eclipse.cdt.core.build.managed.ITarget)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setManagedProject(IManagedProject)
*/
- public void addTarget(ITarget target) {
- getTargetMap().put(target.getId(), target);
- getTargets().add(target);
- setDirty(true);
+ public void setManagedProject(IManagedProject managedProject) {
+ this.managedProject = managedProject;
+ //setDirty(true); - It is primarily up to the ManagedProject to maintain the dirty state
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getManagedProject()
+ */
+ public IManagedProject getManagedProject() {
+ return managedProject;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#buildsFileType(java.lang.String)
*/
public boolean buildsFileType(String srcExt) {
- // Make sure the owner is treated as a project for the duration
- IProject project = (IProject)owner;
-
// Check to see if there is a rule to build a file with this extension
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getFilteredTools(project);
+ IConfiguration config = getDefaultConfiguration();
+ ITool[] tools = config.getFilteredTools();
for (int index = 0; index < tools.length; index++) {
ITool tool = tools[index];
if (tool != null && tool.buildsFileType(srcExt)) {
@@ -168,9 +166,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
*/
public String getBuildArtifactExtension() {
String ext = new String();
- ITarget target = getDefaultTarget();
- if (target != null) {
- ext = target.getArtifactExtension();
+ IConfiguration config = getDefaultConfiguration();
+ if (config != null) {
+ ext = config.getArtifactExtension();
}
return ext;
}
@@ -179,11 +177,11 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getBuildArtifactName()
*/
public String getBuildArtifactName() {
- // Get the default target and use its value
+ // Get the default configuration and use its value
String name = new String();
- ITarget target = getDefaultTarget();
- if (target != null) {
- name = target.getArtifactName();
+ IConfiguration config = getDefaultConfiguration();
+ if (config != null) {
+ name = config.getArtifactName();
}
return name;
}
@@ -194,9 +192,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
public String getCleanCommand() {
// Get from the model
String command = new String();
- ITarget target = getDefaultTarget();
- if (target != null) {
- command = target.getCleanCommand();
+ IConfiguration config = getDefaultConfiguration();
+ if (config != null) {
+ command = config.getCleanCommand();
}
return command;
}
@@ -206,7 +204,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
*/
public String getConfigurationName() {
// Return the human-readable name of the default configuration
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+ IConfiguration config = getDefaultConfiguration();
return config == null ? new String() : config.getName();
}
@@ -215,7 +213,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
*/
public String[] getConfigurationNames() {
ArrayList configNames = new ArrayList();
- IConfiguration[] configs = getDefaultTarget().getConfigurations();
+ IConfiguration[] configs = managedProject.getConfigurations();
for (int i = 0; i < configs.length; i++) {
IConfiguration configuration = configs[i];
configNames.add(configuration.getName());
@@ -229,70 +227,16 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
/* (non-Javadoc)
- *
- * @return Returns the map of ITarget ids to IConfigurations.
- */
- private Map getDefaultConfigMap() {
- if (defaultConfigMap == null) {
- defaultConfigMap = new HashMap();
- // We read this as part of the constructor
- if (defaultConfigIds != null) {
- String[] majorTokens = defaultConfigIds.split(MAJOR_SEPERATOR);
- for (int index = majorTokens.length - 1; index >= 0; --index) {
- // Now split each token into the target and config id component
- String idToken = majorTokens[index];
- if (idToken != null) {
- String[] minorTokens = idToken.split(MINOR_SEPERATOR);
- // The first token is the target ID
- ITarget target = getTarget(minorTokens[0]);
- if (target == null) continue;
- // The second is the configuration ID
- IConfiguration config = target.getConfiguration(minorTokens[1]);
- if (config != null) {
- defaultConfigMap.put(target.getId(), config);
- }
- }
- }
- }
- }
- return defaultConfigMap;
- }
-
- /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getDefaultConfiguration()
*/
- public IConfiguration getDefaultConfiguration(ITarget target) {
- // Get the default config associated with the defalt target
- IConfiguration config = (IConfiguration) getDefaultConfigMap().get(target.getId());
-
- // If null, look up the first configuration associated with the target
- if (config == null) {
- IConfiguration[] configs = getDefaultTarget().getConfigurations();
- if (configs.length > 0) {
- config = configs[0];
- }
- }
- return config;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getDefaultTarget()
- */
- public ITarget getDefaultTarget() {
- if (defaultTarget == null) {
- // See if there is a target that was persisted
- if (defaultTargetId != null) {
- defaultTarget = (ITarget) getTargetMap().get(defaultTargetId);
- }
- // If that failed, look for anything
- if (defaultTarget == null) {
- // Are there any defined targets
- if (getTargets().size() > 0) {
- return (ITarget) getTargets().get(0);
- }
+ public IConfiguration getDefaultConfiguration() {
+ // Get the default config associated with the project
+ if (defaultConfig == null) {
+ if (defaultConfigId != null && managedProject != null) {
+ defaultConfig = managedProject.getConfiguration(defaultConfigId);
}
}
- return defaultTarget;
+ return defaultConfig;
}
/* (non-Javadoc)
@@ -301,16 +245,18 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
public Map getDefinedSymbols() {
// Return the defined symbols for the default configuration
HashMap symbols = getMacroPathEntries();
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getFilteredTools(owner.getProject());
+ IConfiguration config = getDefaultConfiguration();
+ if(config == null)
+ return symbols;
+ ITool[] tools = config.getFilteredTools();
for (int i = 0; i < tools.length; i++) {
ITool tool = tools[i];
// Now extract the valid tool's options
IOption[] opts = tool.getOptions();
for (int j = 0; j < opts.length; j++) {
IOption option = opts[j];
- if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
- try {
+ try {
+ if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
ArrayList symbolList = new ArrayList();
symbolList.addAll(Arrays.asList(option.getDefinedSymbols()));
Iterator iter = symbolList.listIterator();
@@ -324,11 +270,10 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
String value = (tokens.length > 1) ? tokens[1].trim() : new String();
symbols.put(key, value);
}
-
- } catch (BuildException e) {
- // we should never get here
- continue;
}
+ } catch (BuildException e) {
+ // TODO: report error
+ continue;
}
}
}
@@ -339,13 +284,14 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#getDependencyGenerator(java.lang.String)
*/
public IManagedDependencyGenerator getDependencyGenerator(String sourceExtension) {
- // Find the tool and ask the target for its dep generator
+ // Find the tool and ask the Managed Build Manager for its dep generator
try {
- ITarget target = getDefaultTarget();
- ITool[] tools = getFilteredTools();
- for (int index = 0; index < tools.length; ++index) {
- if(tools[index].buildsFileType(sourceExtension)) {
- return target.getDependencyGenerator(tools[index].getId());
+ if (getDefaultConfiguration() != null) {
+ ITool[] tools = getDefaultConfiguration().getFilteredTools();
+ for (int index = 0; index < tools.length; ++index) {
+ if(tools[index].buildsFileType(sourceExtension)) {
+ return ManagedBuildManager.getDependencyGenerator(tools[index].getId());
+ }
}
}
} catch (NullPointerException e) {
@@ -363,9 +309,8 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
*/
private ITool[] getFilteredTools() {
// Get all the tools for the current config filtered by the project nature
- IProject project = owner.getProject();
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- return config.getFilteredTools(project);
+ IConfiguration config = getDefaultConfiguration();
+ return config.getFilteredTools();
}
/* (non-Javadoc)
@@ -388,9 +333,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolFlags(java.lang.String)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getFlagsForConfiguration(java.lang.String)
*/
- public String getFlagsForTarget(String extension) {
+ public String getFlagsForConfiguration(String extension) {
// Treat null extensions as an empty string
String ext = extension == null ? new String() : extension;
@@ -440,22 +385,22 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
public String[] getIncludePaths() {
// Return the include paths for the default configuration
ArrayList paths = getIncludePathEntries();
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+ IConfiguration config = getDefaultConfiguration();
IPath location = owner.getLocation();
// If the build info is out of date this might be null
if (location == null) {
location = new Path("."); //$NON-NLS-1$
}
IPath root = location.addTrailingSeparator().append(config.getName());
- ITool[] tools = config.getFilteredTools(owner.getProject());
+ ITool[] tools = config.getFilteredTools();
for (int i = 0; i < tools.length; i++) {
ITool tool = tools[i];
// The tool checks out for this project, get its options
IOption[] opts = tool.getOptions();
for (int j = 0; j < opts.length; j++) {
IOption option = opts[j];
- if (option.getValueType() == IOption.INCLUDE_PATH) {
- try {
+ try {
+ if (option.getValueType() == IOption.INCLUDE_PATH) {
// Get all the user-defined paths from the option as absolute paths
String[] userPaths = option.getIncludePaths();
for (int index = 0; index < userPaths.length; ++index) {
@@ -466,11 +411,11 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
IPath absPath = root.addTrailingSeparator().append(userPath);
paths.add(absPath.makeAbsolute().toOSString());
}
- }
- } catch (BuildException e) {
- // we should never get here, but continue anyway
- continue;
+ }
}
+ } catch (BuildException e) {
+ // TODO: report error
+ continue;
}
}
}
@@ -480,9 +425,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getLibsForTarget(java.lang.String)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getLibsForConfiguration(java.lang.String)
*/
- public String[] getLibsForTarget(String extension) {
+ public String[] getLibsForConfiguration(String extension) {
Vector libs = new Vector();
ITool[] tools = getFilteredTools();
for (int index = 0; index < tools.length; index++) {
@@ -492,17 +437,18 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
// Look for the lib option type
for (int i = 0; i < opts.length; i++) {
IOption option = opts[i];
- if (option.getValueType() == IOption.LIBRARIES) {
- try {
+ try {
+ if (option.getValueType() == IOption.LIBRARIES) {
String command = option.getCommand();
String[] allLibs = option.getLibraries();
for (int j = 0; j < allLibs.length; j++) {
String string = allLibs[j];
libs.add(command + string);
}
- } catch (BuildException e) {
- continue;
}
+ } catch (BuildException e) {
+ // TODO: report error
+ continue;
}
}
}
@@ -534,15 +480,25 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getMakeArguments()
*/
- public String getMakeArguments() {
- return getDefaultTarget().getMakeArguments();
+ public String getBuildArguments() {
+ if (getDefaultConfiguration() != null) {
+ IToolChain toolChain = getDefaultConfiguration().getToolChain();
+ IBuilder builder = toolChain.getBuilder();
+ return builder.getArguments();
+ }
+ return EMPTY_STRING;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getMakeCommand()
*/
- public String getMakeCommand() {
- return getDefaultTarget().getMakeCommand();
+ public String getBuildCommand() {
+ if (getDefaultConfiguration() != null) {
+ IToolChain toolChain = getDefaultConfiguration().getToolChain();
+ IBuilder builder = toolChain.getBuilder();
+ return builder.getCommand();
+ }
+ return EMPTY_STRING;
}
/* (non-Javadoc)
@@ -608,42 +564,6 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getSelectedTarget()
- */
- public ITarget getSelectedTarget() {
- return selectedTarget;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getTarget(org.eclipse.cdt.core.build.managed.IConfiguration)
- */
- public ITarget getTarget(String id) {
- return (ITarget) getTargetMap().get(id);
- }
-
- /* (non-Javadoc)
- * Safe accessor.
- *
- * @return Returns the map of IDs to ITargets.
- */
- private Map getTargetMap() {
- if (targetMap == null) {
- targetMap = new HashMap();
- }
- return targetMap;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getTargets(org.eclipse.cdt.core.build.managed.IConfiguration)
- */
- public List getTargets() {
- if (targetList == null) {
- targetList = new ArrayList();
- }
- return targetList;
- }
-
- /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolForSource(java.lang.String)
*/
public String getToolForSource(String sourceExtension) {
@@ -661,7 +581,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolInvocation(java.lang.String)
*/
- public String getToolForTarget(String extension) {
+ public String getToolForConfiguration(String extension) {
// Treat a null argument as an empty string
String ext = extension == null ? new String() : extension;
// Get all the tools for the current config
@@ -674,11 +594,30 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
return null;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#generateCommandLineInfo(java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
+ */
+ public IManagedCommandLineInfo generateCommandLineInfo(
+ String sourceExtension, String[] flags, String outputFlag,
+ String outputPrefix, String outputName, String[] inputResources) {
+ ITool[] tools = getFilteredTools();
+ for (int index = 0; index < tools.length; index++) {
+ ITool tool = tools[index];
+ if (tool.buildsFileType(sourceExtension)) {
+ IManagedCommandLineGenerator gen = tool.getCommandLineGenerator();
+ return gen.generateCommandLineInfo( tool, tool.getToolCommand(),
+ flags, outputFlag, outputPrefix, outputName, inputResources,
+ tool.getCommandLinePattern() );
+ }
+ }
+ return null;
+ }
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#getUserObjectsForTarget(java.lang.String)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#getUserObjectsForConfiguration(java.lang.String)
*/
- public String[] getUserObjectsForTarget(String extension) {
+ public String[] getUserObjectsForConfiguration(String extension) {
Vector objs = new Vector();
// Get all the tools for the current config
ITool[] tools = getFilteredTools();
@@ -690,12 +629,13 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
// Look for the user object option type
for (int i = 0; i < opts.length; i++) {
IOption option = opts[i];
- if (option.getValueType() == IOption.OBJECTS) {
- try {
+ try {
+ if (option.getValueType() == IOption.OBJECTS) {
objs.addAll(Arrays.asList(option.getUserObjects()));
- } catch (BuildException e) {
- continue;
}
+ } catch (BuildException e) {
+ // TODO: report error
+ continue;
}
}
}
@@ -730,15 +670,8 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
return true;
}
- // Check if any of the defined targets are dirty
- Iterator iter = getTargets().listIterator();
- while (iter.hasNext()) {
- if (((ITarget)iter.next()).isDirty()) {
- return true;
- }
- }
-
- return false;
+ // Check if the project is dirty
+ return managedProject.isDirty();
}
/* (non-Javadoc)
@@ -748,8 +681,8 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
IProject project = (IProject)owner;
// Check to see if there is a rule to build a file with this extension
- IConfiguration config = getDefaultConfiguration(getDefaultTarget());
- ITool[] tools = config.getTools();
+ IConfiguration config = getDefaultConfiguration();
+ ITool[] tools = config.getFilteredTools();
for (int index = 0; index < tools.length; index++) {
ITool tool = tools[index];
try {
@@ -781,68 +714,25 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
public boolean needsRebuild() {
if (rebuildNeeded) return true;
- Iterator iter = getTargets().listIterator();
- while (iter.hasNext()) {
- if (((ITarget)iter.next()).needsRebuild()) {
- return true;
- }
+ if (getDefaultConfiguration() != null) {
+ return getDefaultConfiguration().needsRebuild();
}
-
return false;
}
/* (non-Javadoc)
*
*/
- private void persistDefaultConfigurations() {
- // Create a buffer of the default configuration IDs
- StringBuffer defaultConfigs = new StringBuffer();
- Iterator iter = getTargets().listIterator();
- while (iter.hasNext()) {
- // Persist the default target configuration pair as <targ_ID>::<conf_ID>
- ITarget targ = (ITarget)iter.next();
- IConfiguration config = getDefaultConfiguration((ITarget)targ);
- if (config != null) {
- defaultConfigs.append(targ.getId());
- defaultConfigs.append(MINOR_SEPERATOR);
- defaultConfigs.append(config.getId());
- defaultConfigs.append(MAJOR_SEPERATOR);
- }
- }
- // Persist the default configurations
+ private void persistDefaultConfiguration() {
+ // Persist the default configuration
IProject project = owner.getProject();
try {
- project.setPersistentProperty(defaultConfigProperty, defaultConfigs.toString().trim());
+ if(defaultConfigId != null)
+ project.setPersistentProperty(defaultConfigProperty, defaultConfigId.toString().trim());
} catch (CoreException e) {
// Too bad
}
}
-
- /* (non-Javadoc)
- *
- */
- private void persistDefaultTarget() {
- // Persist the default target as a project setting
- IProject project = owner.getProject();
- ITarget defTarget = getDefaultTarget();
- if (defTarget != null){
- try {
- project.setPersistentProperty(defaultTargetProperty, defTarget.getId());
- } catch (CoreException e) {
- // Tough
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#removeTarget(java.lang.String)
- */
- public void removeTarget(String id) {
- getTargets().remove(getTarget(id));
- getTargetMap().remove(id);
- setDirty(true);
-
- }
/**
* Write the contents of the build model to the persistent store
@@ -852,47 +742,46 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
* @param element
*/
public void serialize(Document doc, Element element) {
- // Write out each target
- Iterator iter = getTargets().listIterator();
- while (iter.hasNext()) {
- // Get the target
- Target targ = (Target)iter.next();
- // Create an XML element to hold the target settings
- Element targetElement = doc.createElement(ITarget.TARGET_ELEMENT_NAME);
- element.appendChild(targetElement);
- targ.serialize(doc, targetElement);
- }
- // Remember the default target and configurations
- persistDefaultTarget();
- persistDefaultConfigurations();
+ // Write out the managed build project
+
+ if(managedProject != null){
+ Element projElement = doc.createElement(IManagedProject.MANAGED_PROJECT_ELEMENT_NAME);
+ element.appendChild(projElement);
+ managedProject.serialize(doc, projElement);
+ }
+ else{
+ Iterator iter = getTargets().listIterator();
+ while (iter.hasNext()) {
+ // Get the target
+ Target targ = (Target)iter.next();
+ // Create an XML element to hold the target settings
+ Element targetElement = doc.createElement(ITarget.TARGET_ELEMENT_NAME);
+ element.appendChild(targetElement);
+ targ.serialize(doc, targetElement);
+ }
+// persistDefaultTarget();
+ }
+
+
+ // Remember the default configuration
+ persistDefaultConfiguration();
// I'm clean now
setDirty(false);
}
- public void setContainerCreated(boolean isCreated) {
- containerCreated = isCreated;
- }
-
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
*/
public void setDefaultConfiguration(IConfiguration configuration) {
// Sanity
if (configuration == null) return;
-
- // Get the target associated with the argument
- ITarget target = configuration.getTarget();
-
- // See if there is anything to be done
- IConfiguration oldDefault = getDefaultConfiguration(target);
- if (defaultTarget == null || !configuration.equals(oldDefault)) {
- // Make sure the containing target is also the default target
- setDefaultTarget(target);
- // Make the argument the default configuration
- getDefaultConfigMap().put(target.getId(), configuration);
+ if (!configuration.equals(getDefaultConfiguration())) {
// Save it
- persistDefaultConfigurations();
+ defaultConfig = configuration;
+ defaultConfigId = configuration.getId();
+ // TODO: is this appropriate?
+ persistDefaultConfiguration();
}
}
@@ -902,7 +791,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
public boolean setDefaultConfiguration(String configName) {
if (configName != null) {
// Look for the configuration with the same name as the argument
- IConfiguration[] configs = getDefaultTarget().getConfigurations();
+ IConfiguration[] configs = managedProject.getConfigurations();
for (int index = configs.length - 1; index >= 0; --index) {
IConfiguration config = configs[index];
if (configName.equalsIgnoreCase(config.getName())) {
@@ -915,34 +804,14 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultTarget(org.eclipse.cdt.core.build.managed.ITarget)
- */
- public void setDefaultTarget(ITarget target) {
- // Sanity
- if (target == null) return;
-
- // Make sure there is something to change
- if (!target.equals(defaultTarget)) {
- defaultTarget = target;
- defaultTargetId = target.getId();
- persistDefaultTarget();
- if (containerCreated) {
- initializePathEntries();
- }
- }
- }
-
- /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#setDirty(boolean)
*/
public void setDirty(boolean isDirty) {
// Reset the dirty status here
this.isDirty = isDirty;
- // and in the contained targets
- Iterator iter = getTargets().listIterator();
- while (iter.hasNext()) {
- ITarget target = (ITarget)iter.next();
- target.setDirty(isDirty);
+ // and in the managed project
+ if (managedProject != null) {
+ managedProject.setDirty(isDirty);
}
}
@@ -950,18 +819,11 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
* @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#setRebuildState(boolean)
*/
public void setRebuildState(boolean rebuild) {
- Iterator iter = getTargets().listIterator();
- while (iter.hasNext()) {
- ((ITarget)iter.next()).setRebuildState(rebuild);
- }
+ // Reset the status here
rebuildNeeded = rebuild;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setSelectedTarget(org.eclipse.cdt.core.build.managed.ITarget)
- */
- public void setSelectedTarget(ITarget target) {
- selectedTarget = target;
+ // TODO: Is the appropriate? Should the rebuild state be stored in the project file?
+ // and in the managed project
+ //managedProject.setRebuildNeeded(rebuild);
}
/**
@@ -970,7 +832,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
public void setVersion(String version) {
if (version != null && !version.equals(this.version)) {
this.version = version;
- setDirty(true);
+ //setDirty(true); - It is primarily up to the ManagedProject to maintain the dirty state
}
}
@@ -993,12 +855,8 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
if (resource != null) {
if (!owner.equals(resource)) {
owner = resource;
- // Do the same for the targets
- Iterator iter = getTargets().listIterator();
- while(iter.hasNext()) {
- ITarget target = (ITarget) iter.next();
- target.updateOwner(resource);
- }
+ // Do the same for the managed project
+ managedProject.updateOwner(resource);
// And finally update the cModelElement
cProject = CoreModel.getDefault().create(owner.getProject());
@@ -1008,5 +866,81 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getSelectedConfiguration()
+ */
+ public IConfiguration getSelectedConfiguration() {
+ return selectedConfig;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setSelectedConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
+ */
+ public void setSelectedConfiguration(IConfiguration config) {
+ selectedConfig = config;
+ }
+
+ /*
+ * Note: "Target" routines are only currently applicable when loading a CDT 2.0
+ * or earlier managed build project file (.cdtbuild)
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#addTarget(org.eclipse.cdt.core.build.managed.ITarget)
+ */
+ public void addTarget(ITarget target) {
+ getTargetMap().put(target.getId(), target);
+ getTargets().add(target);
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo#removeTarget(java.lang.String)
+ */
+ public void removeTarget(String id) {
+ getTargets().remove(getTarget(id));
+ getTargetMap().remove(id);
+ setDirty(true);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getTarget(org.eclipse.cdt.core.build.managed.IConfiguration)
+ */
+ public ITarget getTarget(String id) {
+ return (ITarget) getTargetMap().get(id);
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor.
+ *
+ * @return Returns the map of IDs to ITargets.
+ */
+ private Map getTargetMap() {
+ if (targetMap == null) {
+ targetMap = new HashMap();
+ }
+ return targetMap;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getTargets(org.eclipse.cdt.core.build.managed.IConfiguration)
+ */
+ public List getTargets() {
+ if (targetList == null) {
+ targetList = new ArrayList();
+ }
+ return targetList;
+ }
+ public void setReadOnly(boolean readOnly){
+ if(!readOnly && isReadOnly)
+ setDirty(true);
+ isReadOnly = readOnly;
+ }
+
+ public boolean isReadOnly(){
+ return isReadOnly;
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedCommandLineGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedCommandLineGenerator.java
new file mode 100644
index 00000000000..91008debd84
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedCommandLineGenerator.java
@@ -0,0 +1,109 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.core;
+
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+
+public class ManagedCommandLineGenerator implements
+ IManagedCommandLineGenerator {
+
+ public final String AT = "@"; //$NON-NLS-1$
+ public final String COLON = ":"; //$NON-NLS-1$
+ public final String DOT = "."; //$NON-NLS-1$
+ public final String ECHO = "echo"; //$NON-NLS-1$
+ public final String IN_MACRO = "$<"; //$NON-NLS-1$
+ public final String LINEBREAK = "\\\n"; //$NON-NLS-1$
+ public final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
+ public final String OUT_MACRO = "$@"; //$NON-NLS-1$
+ public final String SEPARATOR = "/"; //$NON-NLS-1$
+ public final String SINGLE_QUOTE = "'"; //$NON-NLS-1$
+ public final String TAB = "\t"; //$NON-NLS-1$
+ public final String WHITESPACE = " "; //$NON-NLS-1$
+ public final String WILDCARD = "%"; //$NON-NLS-1$
+ public final String UNDERLINE = "_"; //$NON-NLS-1$
+
+ public final String VAR_FIRST_CHAR = "$"; //$NON-NLS-1$
+ public final char VAR_SECOND_CHAR = '{'; //$NON-NLS-1$
+ public final String VAR_FINAL_CHAR = "}"; //$NON-NLS-1$
+ public final String CLASS_PROPERTY_PREFIX = "get"; //$NON-NLS-1$
+
+ public final String CMD_LINE_PRM_NAME = "COMMAND"; //$NON-NLS-1$
+ public final String FLAGS_PRM_NAME = "FLAGS"; //$NON-NLS-1$
+ public final String OUTPUT_FLAG_PRM_NAME = "OUTPUT_FLAG"; //$NON-NLS-1$
+ public final String OUTPUT_PREFIX_PRM_NAME = "OUTPUT_PREFIX"; //$NON-NLS-1$
+ public final String OUTPUT_PRM_NAME = "OUTPUT"; //$NON-NLS-1$
+ public final String INPUTS_PRM_NAME = "INPUTS"; //$NON-NLS-1$
+
+ private static ManagedCommandLineGenerator cmdLineGen;
+
+ protected ManagedCommandLineGenerator() {
+ cmdLineGen = null;
+ }
+
+ public static ManagedCommandLineGenerator getCommandLineGenerator() {
+ if( cmdLineGen == null ) cmdLineGen = new ManagedCommandLineGenerator();
+ return cmdLineGen;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator#getCommandLineInfo(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String[], java.lang.String)
+ */
+ public IManagedCommandLineInfo generateCommandLineInfo(ITool tool,
+ String commandName, String[] flags, String outputFlag,
+ String outputPrefix, String outputName,
+ String[] inputResources, String commandLinePattern)
+ {
+ StringBuffer sb = new StringBuffer();
+ if( commandLinePattern == null || commandLinePattern.length() <= 0 )
+ commandLinePattern = Tool.DEFAULT_PATTERN;
+/*
+ sb.append( commandName + WHITESPACE + stringArrayToString( flags ) + WHITESPACE + outputFlag + WHITESPACE + outputPrefix +
+ outputName + WHITESPACE + stringArrayToString( inputResources ) );
+ else {
+*/
+ int start = 0;
+ int stop = 0;
+ while( (start = commandLinePattern.indexOf( VAR_FIRST_CHAR, start )) >= 0 ) {
+ if( commandLinePattern.charAt( start + 1 ) != VAR_SECOND_CHAR ) continue;
+ if( start > stop ) {
+ sb.append( commandLinePattern.substring(stop, start) );
+ }
+ stop = commandLinePattern.indexOf( VAR_FINAL_CHAR, start + 1 );
+ if( stop > 0 && stop <= commandLinePattern.length() ) try {
+ String varName = commandLinePattern.substring( start+2, stop ).trim();
+ if( varName.compareToIgnoreCase( CMD_LINE_PRM_NAME ) == 0 ) sb.append( commandName.trim() );
+ else if( varName.compareToIgnoreCase( FLAGS_PRM_NAME ) == 0 ) sb.append( stringArrayToString( flags ) );
+ else if( varName.compareToIgnoreCase( OUTPUT_FLAG_PRM_NAME ) == 0 ) sb.append( outputFlag.trim() );
+ else if( varName.compareToIgnoreCase( OUTPUT_PREFIX_PRM_NAME ) == 0 ) sb.append( outputPrefix.trim() );
+ else if( varName.compareToIgnoreCase( OUTPUT_PRM_NAME ) == 0 ) sb.append( outputName.trim() );
+ else if( varName.compareToIgnoreCase( INPUTS_PRM_NAME ) == 0 ) sb.append( stringArrayToString( inputResources ) );
+ else sb.append( VAR_FIRST_CHAR + VAR_SECOND_CHAR + varName + VAR_FINAL_CHAR );
+ } catch( Exception ex ) {
+ // do nothing for a while
+ }
+ start = ++stop;
+// }
+ }
+ return new ManagedCommandLineInfo( sb.toString().trim(), commandLinePattern, commandName, stringArrayToString( flags ),
+ outputFlag, outputPrefix, outputName, stringArrayToString( inputResources ) );
+ }
+
+ private String stringArrayToString( String[] array ) {
+ if( array == null || array.length <= 0 ) return new String();
+ StringBuffer sb = new StringBuffer();
+ for( int i = 0; i < array.length; i++ )
+ sb.append( array[i] + WHITESPACE );
+ return sb.toString().trim();
+ }
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedCommandLineInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedCommandLineInfo.java
new file mode 100644
index 00000000000..a3c502562f5
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedCommandLineInfo.java
@@ -0,0 +1,94 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.core;
+
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
+
+public class ManagedCommandLineInfo implements
+ IManagedCommandLineInfo {
+
+ private String commandLine;
+ private String commandLinePattern;
+ private String commandName;
+ private String flags;
+ private String outputFlag;
+ private String outputPrefix;
+ private String outputName;
+ private String inputResources;
+
+ public ManagedCommandLineInfo( String commandLine, String commandLinePattern, String commandName, String flags, String outputFlag,
+ String outputPrefix, String outputName, String inputResources) {
+ this.commandLine = commandLine;
+ this.commandLinePattern = commandLinePattern;
+ this.commandName = commandName;
+ this.flags = flags;
+ this.outputFlag = outputFlag;
+ this.outputPrefix = outputPrefix;
+ this.outputName = outputName;
+ this.inputResources = inputResources;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getCommandLine()
+ */
+ public String getCommandLine() {
+ return this.commandLine;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getCommandLinePattern()
+ */
+ public String getCommandLinePattern() {
+ return this.commandLinePattern;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getCommandName()
+ */
+ public String getCommandName() {
+ return this.commandName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getFlags()
+ */
+ public String getFlags() {
+ return this.flags;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getOutputFlag()
+ */
+ public String getOutputFlag() {
+ return this.outputFlag;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getOutputPrefix()
+ */
+ public String getOutputPrefix() {
+ return this.outputPrefix;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getOutputName()
+ */
+ public String getOutput() {
+ return this.outputName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getInputResources()
+ */
+ public String getInputs() {
+ return this.inputResources;
+ }
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java
new file mode 100644
index 00000000000..67e154b3fab
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java
@@ -0,0 +1,357 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.core;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.managedbuilder.core.IBuildObject;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IResource;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class ManagedProject extends BuildObject implements IManagedProject {
+
+ private static final String EMPTY_STRING = new String();
+ private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
+
+ // Parent and children
+ private IProjectType projectType;
+ private String projectTypeId;
+ private IResource owner;
+ private List configList; // Configurations of this project type
+ private Map configMap;
+ // Miscellaneous
+ private boolean isDirty = false;
+ private boolean resolved = true;
+
+ /*
+ * C O N S T R U C T O R S
+ */
+
+ /* (non-Javadoc)
+ * Sets the Eclipse project that owns the Managed Project
+ *
+ * @param owner
+ */
+ protected ManagedProject(IResource owner) {
+ this.owner = owner;
+ }
+
+ /**
+ * Create a project instance from the project-type specified in the argument,
+ * that is owned by the specified Eclipse project.
+ *
+ * @param owner the Eclipse project that owns the Managed Project
+ * @param projectType
+ */
+ public ManagedProject(IResource owner, IProjectType projectType) {
+ // Make the owner of the ProjectType the project resource
+ this(owner);
+
+ // Copy the parent's identity
+ this.projectType = projectType;
+ int id = ManagedBuildManager.getRandomNumber();
+ setId(owner.getName() + "." + projectType.getId() + "." + id); //$NON-NLS-1$ //$NON-NLS-2$
+ setName(projectType.getName());
+
+ // Hook me up
+ IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(owner);
+ buildInfo.setManagedProject(this);
+ setDirty(true);
+ }
+
+ /**
+ * Create the project instance from project file.
+ *
+ * @param buildInfo
+ * @param element
+ */
+ public ManagedProject(ManagedBuildInfo buildInfo, Element element) {
+ this(buildInfo.getOwner());
+
+ // Initialize from the XML attributes
+ loadFromProject(element);
+
+ // Load children
+ NodeList configElements = element.getChildNodes();
+ for (int i = 0; i < configElements.getLength(); ++i) {
+ Node configElement = configElements.item(i);
+ if (configElement.getNodeName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
+ Configuration config = new Configuration(this, (Element)configElement);
+ }
+ }
+
+ // hook me up
+ buildInfo.setManagedProject(this);
+ }
+
+ /*
+ * E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S
+ */
+
+ /* (non-Javadoc)
+ * Initialize the project information from the XML element
+ * specified in the argument
+ *
+ * @param element An XML element containing the project information
+ */
+ protected void loadFromProject(Element element) {
+
+ // id
+ setId(element.getAttribute(IBuildObject.ID));
+
+ // name
+ if (element.hasAttribute(IBuildObject.NAME)) {
+ setName(element.getAttribute(IBuildObject.NAME));
+ }
+
+ // projectType
+ projectTypeId = element.getAttribute(PROJECTTYPE);
+ if (projectTypeId != null && projectTypeId.length() > 0) {
+ projectType = ManagedBuildManager.getExtensionProjectType(projectTypeId);
+ if (projectType == null) {
+ // TODO: Report error
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#serialize()
+ */
+ public void serialize(Document doc, Element element) {
+ element.setAttribute(IBuildObject.ID, id);
+
+ if (name != null) {
+ element.setAttribute(IBuildObject.NAME, name);
+ }
+
+ if (projectType != null) {
+ element.setAttribute(PROJECTTYPE, projectType.getId());
+ }
+
+ // Serialize my children
+ List configElements = getConfigurationList();
+ Iterator iter = configElements.listIterator();
+ while (iter.hasNext()) {
+ Configuration config = (Configuration) iter.next();
+ Element configElement = doc.createElement(IConfiguration.CONFIGURATION_ELEMENT_NAME);
+ element.appendChild(configElement);
+ config.serialize(doc, configElement);
+ }
+
+ // I am clean now
+ isDirty = false;
+ }
+
+ /*
+ * P A R E N T A N D C H I L D H A N D L I N G
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#getOwner()
+ */
+ public IResource getOwner() {
+ return owner;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#updateOwner(org.eclipse.core.resources.IResource)
+ */
+ public void updateOwner(IResource resource) {
+ if (!resource.equals(owner)) {
+ // Set the owner correctly
+ owner = resource;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#getProjectType()
+ */
+ public IProjectType getProjectType() {
+ return projectType;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IManagedProject#createConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
+ */
+ public IConfiguration createConfiguration(IConfiguration parent, String id) {
+ Configuration config = new Configuration(this, (Configuration)parent, id, false);
+ return (IConfiguration)config;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IManagedProject#createConfigurationClone(org.eclipse.cdt.core.build.managed.IConfiguration)
+ */
+ public IConfiguration createConfigurationClone(IConfiguration parent, String id) {
+ Configuration config = new Configuration(this, (Configuration)parent, id, true);
+ return (IConfiguration)config;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IManagedProject#getConfiguration()
+ */
+ public IConfiguration getConfiguration(String id) {
+ return (IConfiguration)getConfigurationMap().get(id);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#getConfigurations()
+ */
+ public IConfiguration[] getConfigurations() {
+ IConfiguration[] configs = new IConfiguration[getConfigurationList().size()];
+ Iterator iter = getConfigurationList().listIterator();
+ int i = 0;
+ while (iter.hasNext()) {
+ Configuration config = (Configuration)iter.next();
+ configs[i++] = (IConfiguration)config;
+ }
+ return configs;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#removeConfiguration(java.lang.String)
+ */
+ public void removeConfiguration(String id) {
+ // Remove the specified configuration from the list and map
+ Iterator iter = getConfigurationList().listIterator();
+ while (iter.hasNext()) {
+ IConfiguration config = (IConfiguration)iter.next();
+ if (config.getId().equals(id)) {
+ getConfigurationList().remove(config);
+ getConfigurationMap().remove(id);
+ break;
+ }
+ }
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * Adds the Configuration to the Configuration list and map
+ *
+ * @param Tool
+ */
+ public void addConfiguration(Configuration configuration) {
+ getConfigurationList().add(configuration);
+ getConfigurationMap().put(configuration.getId(), configuration);
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the list of configurations.
+ *
+ * @return List containing the configurations
+ */
+ private List getConfigurationList() {
+ if (configList == null) {
+ configList = new ArrayList();
+ }
+ return configList;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the map of configuration ids to configurations
+ *
+ * @return
+ */
+ private Map getConfigurationMap() {
+ if (configMap == null) {
+ configMap = new HashMap();
+ }
+ return configMap;
+ }
+
+ /*
+ * M O D E L A T T R I B U T E A C C E S S O R S
+ */
+
+ /*
+ * O B J E C T S T A T E M A I N T E N A N C E
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#(getDefaultArtifactName)
+ */
+ public String getDefaultArtifactName(){
+ String name = new String();
+ // Check for spaces
+ String[] tokens = getOwner().getName().split("\\s"); //$NON-NLS-1$
+ for (int index = 0; index < tokens.length; ++index) {
+ name += tokens[index];
+ }
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * Resolve the element IDs to interface references
+ */
+ public void resolveReferences() {
+ if (!resolved) {
+ resolved = true;
+ // Resolve project-type
+ if (projectTypeId != null && projectTypeId.length() > 0) {
+ projectType = ManagedBuildManager.getExtensionProjectType(projectTypeId);
+ if (projectType == null) {
+ // TODO: Report error
+ }
+ }
+
+ // call resolve references on any children
+ Iterator configIter = getConfigurationList().iterator();
+ while (configIter.hasNext()) {
+ Configuration current = (Configuration)configIter.next();
+ current.resolveReferences();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#isDirty()
+ */
+ public boolean isDirty() {
+ // If I need saving, just say yes
+ if (isDirty) return true;
+
+ // Otherwise see if any configurations need saving
+ Iterator iter = getConfigurationList().listIterator();
+ while (iter.hasNext()) {
+ Configuration current = (Configuration) iter.next();
+ if (current.isDirty()) return true;
+ }
+
+ return isDirty;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#setDirty(boolean)
+ */
+ public void setDirty(boolean isDirty) {
+ this.isDirty = isDirty;
+ // Propagate "false" to the children
+ if (!isDirty) {
+ Iterator iter = getConfigurationList().listIterator();
+ while (iter.hasNext()) {
+ Configuration current = (Configuration) iter.next();
+ current.setDirty(false);
+ }
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
index 6469a1cad13..a51f3e5955f 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
@@ -11,6 +11,7 @@
package org.eclipse.cdt.managedbuilder.internal.core;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -19,50 +20,232 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
public class Option extends BuildObject implements IOption {
// Static default return values
private static final String EMPTY_STRING = new String();
private static final String[] EMPTY_STRING_ARRAY = new String[0];
- // Private bookeeping attributes
- private int browseType;
+ // Superclass
+ private IOption superClass;
+ private String superClassId;
+ // Parent and children
+ private ITool tool;
+ // Managed Build model attributes
+ private String unusedChildren;
+ private Integer browseType;
private List builtIns;
private IOptionCategory category;
+ private String categoryId;
private String command;
private String commandFalse;
- private String defaultEnumId;
+ private List enumList;
private Map enumCommands;
private Map enumNames;
- private ITool tool;
private Object value;
- private int valueType;
+ private Object defaultValue;
+ private Integer valueType;
+ private Boolean isAbstract;
+ private Integer resourceFilter;
+ // Miscellaneous
+ private boolean isExtensionOption = false;
+ private boolean isDirty = false;
private boolean resolved = true;
-
- public Option(ITool tool) {
- this.tool = tool;
- }
+
+ /*
+ * C O N S T R U C T O R S
+ */
- public Option(Tool tool, IManagedConfigElement element) {
- this(tool);
+ /**
+ * This constructor is called to create an option defined by an extension point in
+ * a plugin manifest file, or returned by a dynamic element provider
+ *
+ * @param parent The ITool parent of this option, or <code>null</code> if
+ * defined at the top level
+ * @param element The option definition from the manifest file or a dynamic element
+ * provider
+ */
+ public Option(Tool parent, IManagedConfigElement element) {
+ this.tool = parent;
+ isExtensionOption = true;
+
// setup for resolving
- ManagedBuildManager.putConfigElement(this, element);
resolved = false;
+
+ loadFromManifest(element);
+
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionOption(this);
+ }
+
+ /**
+ * This constructor is called to create an Option whose attributes and children will be
+ * added by separate calls.
+ *
+ * @param Tool The parent of the tool, if any
+ * @param Option The superClass, if any
+ * @param String The id for the new option
+ * @param String The name for the new option
+ * @param boolean Indicates whether this is an extension element or a managed project element
+ */
+ public Option(Tool parent, IOption superClass, String Id, String name, boolean isExtensionElement) {
+ this.tool = parent;
+ this.superClass = superClass;
+ if (this.superClass != null) {
+ superClassId = this.superClass.getId();
+ }
+ setId(Id);
+ setName(name);
+ isExtensionOption = isExtensionElement;
+ if (isExtensionElement) {
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionOption(this);
+ } else {
+ setDirty(true);
+ }
+ }
+
+ /**
+ * Create an <code>Option</code> based on the specification stored in the
+ * project file (.cdtbuild).
+ *
+ * @param parent The <code>ITool</code> the option will be added to.
+ * @param element The XML element that contains the option settings.
+ */
+ public Option(Tool parent, Element element) {
+ this.tool = parent;
+ isExtensionOption = false;
+
+ // Initialize from the XML attributes
+ loadFromProject(element);
+ }
+
+ /**
+ * Create an <code>Option</code> based upon an existing option.
+ *
+ * @param parent The <code>ITool</code> the option will be added to.
+ * @param tool The existing option to clone.
+ */
+ public Option(ITool parent, String Id, String name, Option option){
+ this.tool = parent;
+ superClass = option.superClass;
+ if (superClass != null) {
+ superClassId = option.superClass.getId();
+ }
+ setId(Id);
+ setName(name);
+ isExtensionOption = false;
+
+ // Copy the remaining attributes
+ if (option.unusedChildren != null) {
+ unusedChildren = new String(option.unusedChildren);
+ }
+ if (option.isAbstract != null) {
+ isAbstract = new Boolean(option.isAbstract.booleanValue());
+ }
+ if (option.command != null) {
+ command = new String(option.command);
+ }
+ if (option.commandFalse != null) {
+ commandFalse = new String(option.commandFalse);
+ }
+ if (option.categoryId != null) {
+ categoryId = new String(option.categoryId);
+ }
+ if (option.builtIns != null) {
+ builtIns = new ArrayList(option.builtIns);
+ }
+ if (option.browseType != null) {
+ browseType = new Integer(option.browseType.intValue());
+ }
+ if (option.resourceFilter != null) {
+ resourceFilter = new Integer(option.resourceFilter.intValue());
+ }
+ if (option.enumList != null) {
+ enumList = new ArrayList(option.enumList);
+ enumCommands = new HashMap(option.enumCommands);
+ enumNames = new HashMap(option.enumNames);
+ }
+ if (option.valueType != null) {
+ valueType = new Integer(option.valueType.intValue());
+ switch (valueType.intValue()) {
+ case BOOLEAN:
+ if (option.value != null) {
+ value = new Boolean(((Boolean)option.value).booleanValue());
+ }
+ if (option.defaultValue != null) {
+ defaultValue = new Boolean(((Boolean)option.defaultValue).booleanValue());
+ }
+ break;
+ case STRING:
+ case ENUMERATED:
+ if (option.value != null) {
+ value = new String((String)option.value);
+ }
+ if (option.defaultValue != null) {
+ defaultValue = new String((String)option.defaultValue);
+ }
+ break;
+ case STRING_LIST:
+ case INCLUDE_PATH:
+ case PREPROCESSOR_SYMBOLS:
+ case LIBRARIES:
+ case OBJECTS:
+ if (option.value != null) {
+ value = new ArrayList((ArrayList)option.value);
+ }
+ if (option.defaultValue != null) {
+ defaultValue = new ArrayList((ArrayList)option.defaultValue);
+ }
+ break;
+ }
+ }
+ category = option.category;
+
+ setDirty(true);
+ }
+
+ /*
+ * E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S
+ */
+
+ /* (non-Javadoc)
+ * Loads the option information from the ManagedConfigElement specified in the
+ * argument.
+ *
+ * @param element Contains the option information
+ */
+ protected void loadFromManifest(IManagedConfigElement element) {
+ ManagedBuildManager.putConfigElement(this, element);
- // Get the unique id of the option
- setId(element.getAttribute(ID));
+ // id
+ setId(element.getAttribute(IBuildObject.ID));
- // Hook me up to a tool
- tool.addOption(this);
+ // Get the name
+ setName(element.getAttribute(IBuildObject.NAME));
- // Get the option Name (this is what the user will see in the UI)
- setName(element.getAttribute(NAME));
+ // superClass
+ superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+
+ // Get the unused children, if any
+ unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+
+ // isAbstract
+ String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
+ if (isAbs != null){
+ isAbstract = new Boolean("true".equals(isAbs)); //$NON-NLS-1$
+ }
// Get the command defined for the option
command = element.getAttribute(COMMAND);
@@ -72,125 +255,510 @@ public class Option extends BuildObject implements IOption {
// Options hold different types of values
String valueTypeStr = element.getAttribute(VALUE_TYPE);
- if (valueTypeStr == null)
- valueType = -1;
- else if (valueTypeStr.equals(TYPE_STRING))
- valueType = STRING;
+ if (valueTypeStr != null) {
+ valueType = new Integer(ValueTypeStrToInt(valueTypeStr));
+ }
+
+ // Note: The value and defaultValue attributes are loaded in the resolveReferences routine.
+ // This is because we need to have the value-type, and this may be defined in a
+ // superClass that is not yet loaded.
+
+ // Determine if there needs to be a browse button
+ String browseTypeStr = element.getAttribute(BROWSE_TYPE);
+ if (browseTypeStr == null || browseTypeStr.equals(NONE)) {
+ browseType = new Integer(BROWSE_NONE);
+ } else if (browseTypeStr.equals(FILE)) {
+ browseType = new Integer(BROWSE_FILE);
+ } else if (browseTypeStr.equals(DIR)) {
+ browseType = new Integer(BROWSE_DIR);
+ }
+
+ categoryId = element.getAttribute(CATEGORY);
+
+ // Get the resourceFilter attribute
+ String resFilterStr = element.getAttribute(RESOURCE_FILTER);
+ if (resFilterStr == null || resFilterStr.equals(ALL)) {
+ resourceFilter = new Integer(FILTER_ALL);
+ } else if (resFilterStr.equals(FILE)) {
+ resourceFilter = new Integer(FILTER_FILE);
+ } else if (resFilterStr.equals(PROJECT)) {
+ resourceFilter = new Integer(FILTER_PROJECT);
+ }
+ }
+
+ /* (non-Javadoc)
+ * Initialize the option information from the XML element
+ * specified in the argument
+ *
+ * @param element An XML element containing the option information
+ */
+ protected void loadFromProject(Element element) {
+
+ // id
+ setId(element.getAttribute(IBuildObject.ID));
+
+ // name
+ if (element.hasAttribute(IBuildObject.NAME)) {
+ setName(element.getAttribute(IBuildObject.NAME));
+ }
+
+ // superClass
+ superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ if (superClassId != null && superClassId.length() > 0) {
+ superClass = ManagedBuildManager.getExtensionOption(superClassId);
+ if (superClass == null) {
+ // TODO: Report error
+ }
+ }
+
+ // Get the unused children, if any
+ if (element.hasAttribute(IProjectType.UNUSED_CHILDREN)) {
+ unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ }
+
+ // isAbstract
+ if (element.hasAttribute(IProjectType.IS_ABSTRACT)) {
+ String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
+ if (isAbs != null){
+ isAbstract = new Boolean("true".equals(isAbs)); //$NON-NLS-1$
+ }
+ }
+
+ // Get the command defined for the option
+ if (element.hasAttribute(COMMAND)) {
+ command = element.getAttribute(COMMAND);
+ }
+
+ // Get the command defined for a Boolean option when the value is False
+ if (element.hasAttribute(COMMAND_FALSE)) {
+ commandFalse = element.getAttribute(COMMAND_FALSE);
+ }
+
+ // Options hold different types of values
+ if (element.hasAttribute(VALUE_TYPE)) {
+ String valueTypeStr = element.getAttribute(VALUE_TYPE);
+ valueType = new Integer(ValueTypeStrToInt(valueTypeStr));
+ }
+
+ // Now get the actual value based upon value-type
+ try {
+ int valType = getValueType();
+ switch (valType) {
+ case BOOLEAN:
+ // Convert the string to a boolean
+ if (element.hasAttribute(VALUE)) {
+ value = new Boolean(element.getAttribute(VALUE));
+ }
+ if (element.hasAttribute(DEFAULT_VALUE)) {
+ defaultValue = new Boolean(element.getAttribute(DEFAULT_VALUE));
+ }
+ break;
+ case STRING:
+ // Just get the value out of the option directly
+ if (element.hasAttribute(VALUE)) {
+ value = element.getAttribute(VALUE);
+ }
+ if (element.hasAttribute(DEFAULT_VALUE)) {
+ defaultValue = element.getAttribute(DEFAULT_VALUE);
+ }
+ break;
+ case ENUMERATED:
+ if (element.hasAttribute(VALUE)) {
+ value = element.getAttribute(VALUE);
+ }
+ if (element.hasAttribute(DEFAULT_VALUE)) {
+ defaultValue = element.getAttribute(DEFAULT_VALUE);
+ }
+
+ // Do we have enumeratedOptionValue children? If so, load them
+ // to define the valid values and the default value.
+ NodeList configElements = element.getChildNodes();
+ for (int i = 0; i < configElements.getLength(); ++i) {
+ Node configNode = configElements.item(i);
+ if (configNode.getNodeName().equals(ENUM_VALUE)) {
+ Element configElement = (Element)configNode;
+ String optId = configElement.getAttribute(ID);
+ if (i == 0) {
+ enumList = new ArrayList();
+ if (defaultValue == null) {
+ defaultValue = optId; // Default value to be overridden is default is specified
+ }
+ }
+ enumList.add(optId);
+ if (configElement.hasAttribute(COMMAND)) {
+ getEnumCommandMap().put(optId, configElement.getAttribute(COMMAND));
+ } else {
+ getEnumCommandMap().put(optId, EMPTY_STRING);
+ }
+ getEnumNameMap().put(optId, configElement.getAttribute(NAME));
+ if (configElement.hasAttribute(IS_DEFAULT)) {
+ Boolean isDefault = new Boolean(configElement.getAttribute(IS_DEFAULT));
+ if (isDefault.booleanValue()) {
+ defaultValue = optId;
+ }
+ }
+ }
+ }
+ break;
+ case STRING_LIST:
+ case INCLUDE_PATH:
+ case PREPROCESSOR_SYMBOLS:
+ case LIBRARIES:
+ case OBJECTS:
+ // Note: These string-list options do not load either the "value" or
+ // "defaultValue" attributes. Instead, the ListOptionValue children
+ // are loaded in the value field.
+ List valueList = null;
+ configElements = element.getChildNodes();
+ for (int i = 0; i < configElements.getLength(); ++i) {
+ if (i == 0) {
+ valueList = new ArrayList();
+ builtIns = new ArrayList();
+ }
+ Node configNode = configElements.item(i);
+ if (configNode.getNodeName().equals(LIST_VALUE)) {
+ Element valueElement = (Element)configNode;
+ Boolean isBuiltIn;
+ if (valueElement.hasAttribute(IS_DEFAULT)) {
+ isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN));
+ } else {
+ isBuiltIn = new Boolean(false);
+ }
+ if (isBuiltIn.booleanValue()) {
+ builtIns.add(valueElement.getAttribute(LIST_ITEM_VALUE));
+ }
+ else {
+ valueList.add(valueElement.getAttribute(LIST_ITEM_VALUE));
+ }
+ }
+ }
+ value = valueList;
+ break;
+ default :
+ break;
+ }
+ } catch (BuildException e) {
+ // TODO: report error
+ }
+
+ // Determine if there needs to be a browse button
+ if (element.hasAttribute(BROWSE_TYPE)) {
+ String browseTypeStr = element.getAttribute(BROWSE_TYPE);
+ if (browseTypeStr == null || browseTypeStr.equals(NONE)) {
+ browseType = new Integer(BROWSE_NONE);
+ } else if (browseTypeStr.equals(FILE)) {
+ browseType = new Integer(BROWSE_FILE);
+ } else if (browseTypeStr.equals(DIR)) {
+ browseType = new Integer(BROWSE_DIR);
+ }
+ }
+
+ if (element.hasAttribute(CATEGORY)) {
+ categoryId = element.getAttribute(CATEGORY);
+ if (categoryId != null) {
+ category = ((Tool)tool).getOptionCategory(categoryId);
+ }
+ }
+
+ // Get the resourceFilter attribute
+ if (element.hasAttribute(RESOURCE_FILTER)) {
+ String resFilterStr = element.getAttribute(RESOURCE_FILTER);
+ if (resFilterStr == null || resFilterStr.equals(ALL)) {
+ resourceFilter = new Integer(FILTER_ALL);
+ } else if (resFilterStr.equals(FILE)) {
+ resourceFilter = new Integer(FILTER_FILE);
+ } else if (resFilterStr.equals(PROJECT)) {
+ resourceFilter = new Integer(FILTER_PROJECT);
+ }
+ }
+ }
+
+ private int ValueTypeStrToInt(String valueTypeStr) {
+ if (valueTypeStr == null) return -1;
+ if (valueTypeStr.equals(TYPE_STRING))
+ return STRING;
else if (valueTypeStr.equals(TYPE_STR_LIST))
- valueType = STRING_LIST;
+ return STRING_LIST;
else if (valueTypeStr.equals(TYPE_BOOL))
- valueType = BOOLEAN;
+ return BOOLEAN;
else if (valueTypeStr.equals(TYPE_ENUM))
- valueType = ENUMERATED;
+ return ENUMERATED;
else if (valueTypeStr.equals(TYPE_INC_PATH))
- valueType = INCLUDE_PATH;
+ return INCLUDE_PATH;
else if (valueTypeStr.equals(TYPE_LIB))
- valueType = LIBRARIES;
+ return LIBRARIES;
else if (valueTypeStr.equals(TYPE_USER_OBJS))
- valueType = OBJECTS;
- else
- valueType = PREPROCESSOR_SYMBOLS;
+ return OBJECTS;
+ else if (valueTypeStr.equals(TYPE_DEFINED_SYMBOLS))
+ return PREPROCESSOR_SYMBOLS;
+ else {
+ // TODO: This was the CDT 2.0 default - should we keep it?
+ return PREPROCESSOR_SYMBOLS;
+ }
+ }
+
+ /**
+ * Persist the option to the project file.
+ *
+ * @param doc
+ * @param element
+ */
+ public void serialize(Document doc, Element element) throws BuildException {
+ if (superClass != null)
+ element.setAttribute(IProjectType.SUPERCLASS, superClass.getId());
- // Now get the actual value
- switch (valueType) {
- case BOOLEAN:
- // Convert the string to a boolean
- value = new Boolean(element.getAttribute(DEFAULT_VALUE));
- break;
- case STRING:
- // Just get the value out of the option directly
- value = element.getAttribute(DEFAULT_VALUE);
- break;
- case ENUMERATED:
- List enumList = new ArrayList();
- IManagedConfigElement[] enumElements = element.getChildren(ENUM_VALUE);
- for (int i = 0; i < enumElements.length; ++i) {
- String optId = enumElements[i].getAttribute(ID);
- enumList.add(optId);
- getEnumCommandMap().put(optId, enumElements[i].getAttribute(COMMAND));
- getEnumNameMap().put(optId, enumElements[i].getAttribute(NAME));
- Boolean isDefault = new Boolean(enumElements[i].getAttribute(IS_DEFAULT));
- if (isDefault.booleanValue()) {
- defaultEnumId = optId;
- }
- }
- value = enumList;
- break;
- case STRING_LIST:
- case INCLUDE_PATH:
- case PREPROCESSOR_SYMBOLS:
- case LIBRARIES:
- case OBJECTS:
- List valueList = new ArrayList();
- builtIns = new ArrayList();
- IManagedConfigElement[] valueElements = element.getChildren(LIST_VALUE);
- for (int i = 0; i < valueElements.length; ++i) {
- IManagedConfigElement valueElement = valueElements[i];
- Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN));
- if (isBuiltIn.booleanValue()) {
- builtIns.add(valueElement.getAttribute(LIST_ITEM_VALUE));
+ element.setAttribute(IBuildObject.ID, id);
+
+ if (name != null) {
+ element.setAttribute(IBuildObject.NAME, name);
+ }
+
+ if (unusedChildren != null) {
+ element.setAttribute(IProjectType.UNUSED_CHILDREN, unusedChildren);
+ }
+
+ if (isAbstract != null) {
+ element.setAttribute(IProjectType.IS_ABSTRACT, isAbstract.toString());
+ }
+
+ if (command != null) {
+ element.setAttribute(COMMAND, command);
+ }
+
+ if (commandFalse != null) {
+ element.setAttribute(COMMAND_FALSE, commandFalse);
+ }
+
+ /*
+ * Note: We store value & value-type as a pair, so we know what type of value we are
+ * dealing with when we read it back in.
+ * This is also true of defaultValue.
+ */
+ boolean storeValueType = false;
+
+ // value
+ if (value != null) {
+ storeValueType = true;
+ switch (getValueType()) {
+ case BOOLEAN:
+ element.setAttribute(VALUE, ((Boolean)value).toString());
+ break;
+ case STRING:
+ case ENUMERATED:
+ element.setAttribute(VALUE, (String)value);
+ break;
+ case STRING_LIST:
+ case INCLUDE_PATH:
+ case PREPROCESSOR_SYMBOLS:
+ case LIBRARIES:
+ case OBJECTS:
+ if (value != null) {
+ ArrayList stringList = (ArrayList)value;
+ ListIterator iter = stringList.listIterator();
+ while (iter.hasNext()) {
+ Element valueElement = doc.createElement(LIST_VALUE);
+ valueElement.setAttribute(LIST_ITEM_VALUE, (String)iter.next());
+ valueElement.setAttribute(LIST_ITEM_BUILTIN, "false"); //$NON-NLS-1$
+ element.appendChild(valueElement);
+ }
}
- else {
- valueList.add(valueElement.getAttribute(LIST_ITEM_VALUE));
+ // Serialize the built-ins that have been overridden
+ if (builtIns != null) {
+ ListIterator iter = builtIns.listIterator();
+ while (iter.hasNext()) {
+ Element valueElement = doc.createElement(LIST_VALUE);
+ valueElement.setAttribute(LIST_ITEM_VALUE, (String)iter.next());
+ valueElement.setAttribute(LIST_ITEM_BUILTIN, "true"); //$NON-NLS-1$
+ element.appendChild(valueElement);
+ }
}
- }
- value = valueList;
- break;
- default :
- break;
+ break;
+ }
+ }
+
+ // defaultValue
+ if (defaultValue != null) {
+ storeValueType = true;
+ switch (getValueType()) {
+ case BOOLEAN:
+ element.setAttribute(DEFAULT_VALUE, ((Boolean)defaultValue).toString());
+ break;
+ case STRING:
+ case ENUMERATED:
+ element.setAttribute(DEFAULT_VALUE, (String)defaultValue);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (storeValueType) {
+ String str;
+ switch (getValueType()) {
+ case BOOLEAN:
+ str = TYPE_BOOL;
+ break;
+ case STRING:
+ str = TYPE_STRING;
+ break;
+ case ENUMERATED:
+ str = TYPE_ENUM;
+ break;
+ case STRING_LIST:
+ str = TYPE_STR_LIST;
+ break;
+ case INCLUDE_PATH:
+ str = TYPE_INC_PATH;
+ break;
+ case LIBRARIES:
+ str = TYPE_LIB;
+ break;
+ case OBJECTS:
+ str = TYPE_USER_OBJS;
+ break;
+ case PREPROCESSOR_SYMBOLS:
+ str = TYPE_DEFINED_SYMBOLS;
+ break;
+ default:
+ // TODO; is this a problem...
+ str = EMPTY_STRING;
+ break;
+ }
+ element.setAttribute(VALUE_TYPE, str);
}
- // Determine if there needs to be a browse button
- String browseTypeStr = element.getAttribute(BROSWE_TYPE);
- if (browseTypeStr == null || browseTypeStr.equals(NONE)) {
- browseType = BROWSE_NONE;
- } else if (browseTypeStr.equals(FILE)) {
- browseType = BROWSE_FILE;
- } else if (browseTypeStr.equals(DIR)) {
- browseType = BROWSE_DIR;
+ // browse type
+ if (browseType != null) {
+ String str;
+ switch (getBrowseType()) {
+ case BROWSE_NONE:
+ str = NONE;
+ break;
+ case BROWSE_FILE:
+ str = FILE;
+ break;
+ case BROWSE_DIR:
+ str = DIR;
+ break;
+ default:
+ str = EMPTY_STRING;
+ break;
+ }
+ element.setAttribute(BROWSE_TYPE, str);
}
+ if (categoryId != null) {
+ element.setAttribute(CATEGORY, categoryId);
+ }
+
+ // resource filter
+ if (resourceFilter != null) {
+ String str;
+ switch (getResourceFilter()) {
+ case FILTER_ALL:
+ str = ALL;
+ break;
+ case FILTER_FILE:
+ str = FILE;
+ break;
+ case FILTER_PROJECT:
+ str = PROJECT;
+ break;
+ default:
+ str = EMPTY_STRING;
+ break;
+ }
+ element.setAttribute(RESOURCE_FILTER, str);
+ }
+
+ // I am clean now
+ isDirty = false;
}
+
+ /*
+ * P A R E N T A N D C H I L D H A N D L I N G
+ */
- public void resolveReferences() {
- if (!resolved) {
- resolved = true;
- IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
- // Options can be grouped into categories
- String categoryId = element.getAttribute(CATEGORY);
- if (categoryId != null)
- setCategory(((Tool)tool).getOptionCategory(categoryId));
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getParent()
+ */
+ public ITool getParent() {
+ return tool;
+ }
+
+ /*
+ * M O D E L A T T R I B U T E A C C E S S O R S
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#getSuperClass()
+ */
+ public IOption getSuperClass() {
+ return superClass;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getName()
+ */
+ public String getName() {
+ return (name == null && superClass != null) ? superClass.getName() : name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getApplicableValues()
*/
public String[] getApplicableValues() {
+ // Does this option instance have the list of values?
+ if (enumList == null) {
+ if (superClass != null) {
+ return superClass.getApplicableValues();
+ } else {
+ return EMPTY_STRING_ARRAY;
+ }
+ }
// Get all of the enumerated names from the option
- List ids = (List) value;
- if (ids == null || ids.size() == 0) {
+ if (enumList.size() == 0) {
return EMPTY_STRING_ARRAY;
} else {
// Return the elements in the order they are specified in the manifest
- String[] enumNames = new String[ids.size()];
- for (int index = 0; index < ids.size(); ++ index) {
- enumNames[index] = (String) getEnumNameMap().get(ids.get(index));
+ String[] enumNames = new String[enumList.size()];
+ for (int index = 0; index < enumList.size(); ++ index) {
+ enumNames[index] = (String) getEnumNameMap().get(enumList.get(index));
}
return enumNames;
}
}
-
+
public boolean getBooleanValue() {
- Boolean bool = (Boolean) value;
- return bool.booleanValue();
+ return ((Boolean)getValue()).booleanValue();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IOption#getBrowseType()
*/
public int getBrowseType() {
- return browseType;
+ if (browseType == null) {
+ if (superClass != null) {
+ return superClass.getBrowseType();
+ } else {
+ return BROWSE_NONE;
+ }
+ }
+ return browseType.intValue();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#getResourceFilter()
+ */
+ public int getResourceFilter() {
+ if (resourceFilter == null) {
+ if (superClass != null) {
+ return superClass.getResourceFilter();
+ } else {
+ return FILTER_ALL;
+ }
+ }
+ return resourceFilter.intValue();
}
/* (non-Javadoc)
@@ -198,22 +766,41 @@ public class Option extends BuildObject implements IOption {
*/
public String[] getBuiltIns() {
// Return the list of built-ins as an array
- return builtIns == null ?
- EMPTY_STRING_ARRAY:
- (String[])builtIns.toArray(new String[builtIns.size()]);
+ if (builtIns == null) {
+ if (superClass != null) {
+ return superClass.getBuiltIns();
+ } else {
+ return EMPTY_STRING_ARRAY;
+ }
+ }
+ return (String[])builtIns.toArray(new String[builtIns.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getCategory()
*/
public IOptionCategory getCategory() {
- return category != null ? category : getTool().getTopOptionCategory();
+ if (category == null) {
+ if (superClass != null) {
+ return superClass.getCategory();
+ } else {
+ return getParent().getTopOptionCategory();
+ }
+ }
+ return category;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getCommand()
*/
public String getCommand() {
+ if (command == null) {
+ if (superClass != null) {
+ return superClass.getCommand();
+ } else {
+ return EMPTY_STRING;
+ }
+ }
return command;
}
@@ -221,6 +808,13 @@ public class Option extends BuildObject implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getCommandFalse()
*/
public String getCommandFalse() {
+ if (commandFalse == null) {
+ if (superClass != null) {
+ return superClass.getCommandFalse();
+ } else {
+ return EMPTY_STRING;
+ }
+ }
return commandFalse;
}
@@ -228,10 +822,10 @@ public class Option extends BuildObject implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getDefinedSymbols()
*/
public String[] getDefinedSymbols() throws BuildException {
- if (valueType != PREPROCESSOR_SYMBOLS) {
+ if (getValueType() != PREPROCESSOR_SYMBOLS) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
- ArrayList v = (ArrayList)value;
+ ArrayList v = (ArrayList)getValue();
if (v == null) {
return EMPTY_STRING_ARRAY;
} else {
@@ -243,18 +837,29 @@ public class Option extends BuildObject implements IOption {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
*/
- public String getEnumCommand(String id) {
+ public String getEnumCommand(String id) throws BuildException {
// Sanity
if (id == null) return EMPTY_STRING;
-
+
+ // Does this option instance have the list of values?
+ if (enumList == null) {
+ if (superClass != null) {
+ return superClass.getEnumCommand(id);
+ } else {
+ return EMPTY_STRING;
+ }
+ }
+ if (getValueType() != ENUMERATED) {
+ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
+ }
+
// First check for the command in ID->command map
String cmd = (String) getEnumCommandMap().get(id);
if (cmd == null) {
// This may be a 1.2 project or plugin manifest. If so, the argument is the human readable
// name of the enumeration. Search for the ID that maps to the name and use that to find the
// command.
- List ids = (List) value;
- ListIterator iter = ids.listIterator();
+ ListIterator iter = enumList.listIterator();
while (iter.hasNext()) {
String realID = (String) iter.next();
String name = (String) getEnumNameMap().get(realID);
@@ -270,9 +875,21 @@ public class Option extends BuildObject implements IOption {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumName(java.lang.String)
*/
- public String getEnumName(String id) {
+ public String getEnumName(String id) throws BuildException {
// Sanity
if (id == null) return EMPTY_STRING;
+
+ // Does this option instance have the list of values?
+ if (enumList == null) {
+ if (superClass != null) {
+ return superClass.getEnumName(id);
+ } else {
+ return EMPTY_STRING;
+ }
+ }
+ if (getValueType() != ENUMERATED) {
+ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
+ }
// First check for the command in ID->name map
String name = (String) getEnumNameMap().get(id);
@@ -301,8 +918,21 @@ public class Option extends BuildObject implements IOption {
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IOption#getEnumeratedId(java.lang.String)
*/
- public String getEnumeratedId(String name) {
+ public String getEnumeratedId(String name) throws BuildException {
if (name == null) return null;
+
+ // Does this option instance have the list of values?
+ if (enumList == null) {
+ if (superClass != null) {
+ return superClass.getEnumeratedId(name);
+ } else {
+ return EMPTY_STRING;
+ }
+ }
+ if (getValueType() != ENUMERATED) {
+ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
+ }
+
Set idSet = getEnumNameMap().keySet();
Iterator iter = idSet.iterator();
while (iter.hasNext()) {
@@ -330,10 +960,10 @@ public class Option extends BuildObject implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getIncludePaths()
*/
public String[] getIncludePaths() throws BuildException {
- if (valueType != INCLUDE_PATH) {
+ if (getValueType() != INCLUDE_PATH) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
- ArrayList v = (ArrayList)value;
+ ArrayList v = (ArrayList)getValue();
if (v == null) {
return EMPTY_STRING_ARRAY;
} else {
@@ -346,10 +976,10 @@ public class Option extends BuildObject implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getLibraries()
*/
public String[] getLibraries() throws BuildException {
- if (valueType != LIBRARIES) {
+ if (getValueType() != LIBRARIES) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
- ArrayList v = (ArrayList)value;
+ ArrayList v = (ArrayList)getValue();
if (v == null) {
return EMPTY_STRING_ARRAY;
} else {
@@ -362,20 +992,20 @@ public class Option extends BuildObject implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
*/
public String getSelectedEnum() throws BuildException {
- if (valueType != ENUMERATED) {
+ if (getValueType() != ENUMERATED) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
- return defaultEnumId == null ? EMPTY_STRING : defaultEnumId;
+ return getStringValue();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue()
*/
public String[] getStringListValue() throws BuildException {
- if (valueType != STRING_LIST) {
+ if (getValueType() != STRING_LIST) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
- ArrayList v = (ArrayList)value;
+ ArrayList v = (ArrayList)getValue();
if (v == null) {
return EMPTY_STRING_ARRAY;
} else {
@@ -388,28 +1018,21 @@ public class Option extends BuildObject implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getStringValue()
*/
public String getStringValue() throws BuildException {
- if (valueType != STRING) {
+ if (getValueType() != STRING && getValueType() != ENUMERATED) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
- return value == null ? EMPTY_STRING : (String)value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getTool()
- */
- public ITool getTool() {
- return tool;
+ return getValue() == null ? EMPTY_STRING : (String)getValue();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IOption#getUserObjects()
*/
public String[] getUserObjects() throws BuildException {
- if (valueType != OBJECTS) {
+ if (getValueType() != OBJECTS) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
// This is the right puppy, so return its list value
- ArrayList v = (ArrayList)value;
+ ArrayList v = (ArrayList)getValue();
if (v == null) {
return EMPTY_STRING_ARRAY;
} else {
@@ -421,55 +1044,360 @@ public class Option extends BuildObject implements IOption {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getValueType()
*/
- public int getValueType() {
- return valueType;
+ public int getValueType() throws BuildException {
+ if (valueType == null) {
+ if (superClass != null) {
+ return superClass.getValueType();
+ } else {
+ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$;
+ }
+ }
+ return valueType.intValue();
+ }
+
+ /* (non-Javadoc)
+ * Gets the value, applying appropriate defaults if necessary.
+ */
+ public Object getValue() {
+ /*
+ * In order to determine the current value of an option, perform the following steps until a value is found:
+ * 1. Examine the value attribute of the option.
+ * 2. Examine the value attribute of the option’s superClass recursively.
+ * 3. Examine the dynamicDefaultValue attribute of the option and invoke it if specified. (not yet implemented)
+ * 4. Examine the defaultValue attribute of the option.
+ * 5. Examine the dynamicDefaultValue attribute of the option’s superClass and invoke it if specified. (not yet implemented)
+ * 6. Examine the defaultValue attribute of the option’s superClass.
+ * 7. Go to step 5 recursively until no more super classes.
+ * 8. Use the default value for the option type.
+ */
+
+ Object val = getRawValue();
+ if (val == null) {
+ val = getDefaultValue();
+ if (val == null) {
+ int valType;
+ try {
+ valType = getValueType();
+ } catch (BuildException e) {
+ return EMPTY_STRING;
+ }
+ switch (valType) {
+ case BOOLEAN:
+ val = new Boolean(false);
+ break;
+ case STRING:
+ val = EMPTY_STRING;
+ break;
+ case ENUMERATED:
+ // TODO: Can we default to the first enumerated id?
+ val = EMPTY_STRING;
+ break;
+ case STRING_LIST:
+ case INCLUDE_PATH:
+ case PREPROCESSOR_SYMBOLS:
+ case LIBRARIES:
+ case OBJECTS:
+ val = new ArrayList();
+ break;
+ default:
+ val = EMPTY_STRING;
+ break;
+ }
+ }
+ }
+ return val;
+ }
+
+ /* (non-Javadoc)
+ * Gets the raw value, applying appropriate defauls if necessary.
+ */
+ public Object getRawValue() {
+ if (value == null) {
+ if (superClass != null) {
+ Option mySuperClass = (Option)superClass;
+ return mySuperClass.getRawValue();
+ }
+ }
+ return value;
}
/* (non-Javadoc)
+ * Gets the raw default value.
+ */
+ public Object getDefaultValue() {
+ // Note: string-list options do not have a default value
+ if (defaultValue == null) {
+ if (superClass != null) {
+ return superClass.getDefaultValue();
+ }
+ }
+ return defaultValue;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setValue(Object)
+ */
+ public void setDefaultValue(Object v) {
+ defaultValue = v;
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#setCategory(org.eclipse.cdt.core.build.managed.IOptionCategory)
*/
public void setCategory(IOptionCategory category) {
this.category = category;
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setCommand(String)
+ */
+ public void setCommand(String cmd) {
+ if (cmd == null && command == null) return;
+ if (cmd == null || command == null || !cmd.equals(command)) {
+ command = cmd;
+ isDirty = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setCommandFalse(String)
+ */
+ public void setCommandFalse(String cmd) {
+ if (cmd == null && commandFalse == null) return;
+ if (cmd == null || commandFalse == null || !cmd.equals(commandFalse)) {
+ commandFalse = cmd;
+ isDirty = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#setResourceFilter(int)
+ */
+ public void setResourceFilter(int filter) {
+ if (resourceFilter == null || !(filter == resourceFilter.intValue())) {
+ resourceFilter = new Integer(filter);
+ isDirty = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#setBrowseType(int)
+ */
+ public void setBrowseType(int type) {
+ if (browseType == null || !(type == browseType.intValue())) {
+ browseType = new Integer(type);
+ isDirty = true;
+ }
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#setStringValue(org.eclipse.cdt.core.build.managed.IConfiguration, java.lang.String)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setValue(boolean)
*/
- public IOption setValue(IConfiguration config, String value)
- throws BuildException
- {
- if (valueType != IOption.STRING
- || valueType != ENUMERATED)
+ public void setValue(boolean value) throws BuildException {
+ if (!isExtensionElement() && getValueType() == BOOLEAN)
+ this.value = new Boolean(value);
+ else {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
+ }
+ setDirty(true);
+ }
+
- if (config == null) {
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setValue(String)
+ */
+ public void setValue(String value) throws BuildException {
+ // Note that we can still set the human-readable value here
+ if (!isExtensionElement() && (getValueType() == STRING || getValueType() == ENUMERATED)) {
this.value = value;
- return this;
} else {
- // Magic time
- return null;
+ throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
+ setDirty(true);
}
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#setStringValue(org.eclipse.cdt.core.build.managed.IConfiguration, java.lang.String[])
+ * @see org.eclipse.cdt.core.build.managed.IOption#setValue(String [])
*/
- public IOption setValue(IConfiguration config, String[] value)
- throws BuildException
- {
- if (valueType != STRING_LIST
- || valueType != INCLUDE_PATH
- || valueType != PREPROCESSOR_SYMBOLS
- || valueType != LIBRARIES
- || valueType != OBJECTS)
+ public void setValue(String [] value) throws BuildException {
+ if (!isExtensionElement() &&
+ (getValueType() == STRING_LIST
+ || getValueType() == INCLUDE_PATH
+ || getValueType() == PREPROCESSOR_SYMBOLS
+ || getValueType() == LIBRARIES
+ || getValueType() == OBJECTS)) {
+ // Just replace what the option reference is holding onto
+ this.value = new ArrayList(Arrays.asList(value));
+ }
+ else {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
-
- if (config == null) {
- this.value = value;
- return this;
+ }
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setValue(Object)
+ */
+ public void setValue(Object v) {
+ value = v;
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setValueType()
+ */
+ public void setValueType(int type) {
+ // TODO: Verify that this is a valid type
+ if (valueType == null || valueType.intValue() != type) {
+ valueType = new Integer(type);
+ setDirty(true);
+ }
+ }
+
+ /*
+ * O B J E C T S T A T E M A I N T E N A N C E
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#isExtensionElement()
+ */
+ public boolean isExtensionElement() {
+ return isExtensionOption;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#overridesOnlyValue()
+ */
+ public boolean overridesOnlyValue() {
+ if (superClass != null &&
+ unusedChildren == null &&
+ browseType == null &&
+ builtIns == null &&
+ category == null &&
+ categoryId == null &&
+ command == null &&
+ commandFalse == null &&
+ enumList == null &&
+ enumCommands == null &&
+ enumNames == null &&
+ defaultValue == null) {
+ return true;
} else {
- // More magic
- return null;
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#isDirty()
+ */
+ public boolean isDirty() {
+ // This shouldn't be called for an extension option
+ if (isExtensionOption) return false;
+ return isDirty;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#setDirty(boolean)
+ */
+ public void setDirty(boolean isDirty) {
+ this.isDirty = isDirty;
+ }
+
+ public void resolveReferences() {
+
+ if (!resolved) {
+ resolved = true;
+ // Resolve superClass
+ if (superClassId != null && superClassId.length() > 0) {
+ superClass = ManagedBuildManager.getExtensionOption(superClassId);
+ if (superClass == null) {
+ // TODO: Report error
+ }
+ }
+ if (categoryId != null) {
+ category = ((Tool)tool).getOptionCategory(categoryId);
+ }
+ // Process the value and default value attributes. This is delayed until now
+ // because we may not know the valueType until after we have resolved the superClass above
+ // Now get the actual value
+ try {
+ IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
+ switch (getValueType()) {
+ case BOOLEAN:
+ // Convert the string to a boolean
+ String val = element.getAttribute(VALUE);
+ if (val != null) {
+ value = new Boolean(val);
+ }
+ val = element.getAttribute(DEFAULT_VALUE);
+ if (val != null) {
+ defaultValue = new Boolean(val);
+ }
+ break;
+ case STRING:
+ // Just get the value out of the option directly
+ value = element.getAttribute(VALUE);
+ defaultValue = element.getAttribute(DEFAULT_VALUE);
+ break;
+ case ENUMERATED:
+ value = element.getAttribute(VALUE);
+ defaultValue = element.getAttribute(DEFAULT_VALUE);
+
+ // Do we have enumeratedOptionValue children? If so, load them
+ // to define the valid values and the default value.
+ IManagedConfigElement[] enumElements = element.getChildren(ENUM_VALUE);
+ for (int i = 0; i < enumElements.length; ++i) {
+ String optId = enumElements[i].getAttribute(ID);
+ if (i == 0) {
+ enumList = new ArrayList();
+ if (defaultValue == null) {
+ defaultValue = optId; // Default value to be overridden if default is specified
+ }
+ }
+ enumList.add(optId);
+ getEnumCommandMap().put(optId, enumElements[i].getAttribute(COMMAND));
+ getEnumNameMap().put(optId, enumElements[i].getAttribute(NAME));
+ Boolean isDefault = new Boolean(enumElements[i].getAttribute(IS_DEFAULT));
+ if (isDefault.booleanValue()) {
+ defaultValue = optId;
+ }
+ }
+ break;
+ case STRING_LIST:
+ case INCLUDE_PATH:
+ case PREPROCESSOR_SYMBOLS:
+ case LIBRARIES:
+ case OBJECTS:
+ // Note: These string-list options do not load either the "value" or
+ // "defaultValue" attributes. Instead, the ListOptionValue children
+ // are loaded in the value field.
+ List valueList = null;
+ IManagedConfigElement[] valueElements = element.getChildren(LIST_VALUE);
+ for (int i = 0; i < valueElements.length; ++i) {
+ if (i == 0) {
+ valueList = new ArrayList();
+ builtIns = new ArrayList();
+ }
+ IManagedConfigElement valueElement = valueElements[i];
+ Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN));
+ if (isBuiltIn.booleanValue()) {
+ builtIns.add(valueElement.getAttribute(LIST_ITEM_VALUE));
+ }
+ else {
+ valueList.add(valueElement.getAttribute(LIST_ITEM_VALUE));
+ }
+ }
+ value = valueList;
+ break;
+ default :
+ break;
+ }
+ } catch (BuildException e) {
+ // TODO: report error
+ }
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java
index 946db2da521..e6665df31ce 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java
@@ -13,64 +13,160 @@ package org.eclipse.cdt.managedbuilder.internal.core;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.managedbuilder.core.IToolReference;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
/**
*
*/
public class OptionCategory extends BuildObject implements IOptionCategory {
- private IOptionCategory owner;
- private List children;
+ private static final IOptionCategory[] emtpyCategories = new IOptionCategory[0];
+
+ // Parent and children
private Tool tool;
+ private List children; // Note: These are logical Option Category children, not "model" children
+ // Managed Build model attributes
+ private IOptionCategory owner; // The logical Option Category parent
+ private String ownerId;
+ // Miscellaneous
+ private boolean isExtensionOptionCategory = false;
+ private boolean isDirty = false;
private boolean resolved = true;
-
- private static final IOptionCategory[] emtpyCategories = new IOptionCategory[0];
+ /*
+ * C O N S T R U C T O R S
+ */
+
public OptionCategory(IOptionCategory owner) {
this.owner = owner;
}
- public OptionCategory(Tool tool, IManagedConfigElement element) {
+ /**
+ * This constructor is called to create an option category defined by an extension point in
+ * a plugin manifest file, or returned by a dynamic element provider
+ *
+ * @param parent The IToolChain parent of this builder, or <code>null</code> if
+ * defined at the top level
+ * @param element The builder definition from the manifest file or a dynamic element
+ * provider
+ */
+ public OptionCategory(Tool parent, IManagedConfigElement element) {
+ this.tool = parent;
+ isExtensionOptionCategory = true;
+
// setup for resolving
- ManagedBuildManager.putConfigElement(this, element);
resolved = false;
- this.tool = tool;
+
+ loadFromManifest(element);
+
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionOptionCategory(this);
+
+ // Add the category to the tool
+ tool.addOptionCategory(this);
+ }
+
+ /**
+ * Create an <codeOptionCategory</code> based on the specification stored in the
+ * project file (.cdtbuild).
+ *
+ * @param parent The <code>Tool</code> the OptionCategory will be added to.
+ * @param element The XML element that contains the OptionCategory settings.
+ */
+ public OptionCategory(Tool parent, Element element) {
+ tool = parent;
+ isExtensionOptionCategory = false;
+
+ // Initialize from the XML attributes
+ loadFromProject(element);
+
+ // Add the category to the tool
+ tool.addOptionCategory(this);
+ }
+
+ /*
+ * E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S
+ */
+
+ public void loadFromManifest(IManagedConfigElement element) {
+ ManagedBuildManager.putConfigElement(this, element);
// id
setId(element.getAttribute(IOptionCategory.ID));
- // Name
+ // name
setName(element.getAttribute(IOptionCategory.NAME));
+ // owner
+ ownerId = element.getAttribute(IOptionCategory.OWNER);
+ }
+
+ /* (non-Javadoc)
+ * Initialize the OptionCategory information from the XML element
+ * specified in the argument
+ *
+ * @param element An XML element containing the OptionCategory information
+ */
+ protected void loadFromProject(Element element) {
+
+ // id
+ setId(element.getAttribute(IBuildObject.ID));
- tool.addOptionCategory(this);
+ // name
+ if (element.hasAttribute(IBuildObject.NAME)) {
+ setName(element.getAttribute(IBuildObject.NAME));
+ }
+
+ // owner
+ if (element.hasAttribute(IOptionCategory.OWNER)) {
+ ownerId = element.getAttribute(IOptionCategory.OWNER);
+ }
+ if (ownerId != null) {
+ owner = tool.getOptionCategory(ownerId);
+ } else {
+ owner = tool;
+ }
+
+ // Hook me in
+ if (owner instanceof Tool)
+ ((Tool)owner).addChildCategory(this);
+ else
+ ((OptionCategory)owner).addChildCategory(this);
}
- public void resolveReferences() {
- if (!resolved) {
- resolved = true;
- IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
- String parentId = element.getAttribute(IOptionCategory.OWNER);
- if (parentId != null)
- owner = tool.getOptionCategory(parentId);
- else
- owner = tool;
-
- // Hook me in
- if (owner instanceof Tool)
- ((Tool)owner).addChildCategory(this);
- else
- ((OptionCategory)owner).addChildCategory(this);
+ /**
+ * Persist the OptionCategory to the project file.
+ *
+ * @param doc
+ * @param element
+ */
+ public void serialize(Document doc, Element element) {
+ element.setAttribute(IBuildObject.ID, id);
+
+ if (name != null) {
+ element.setAttribute(IBuildObject.NAME, name);
}
+
+ if (owner != null)
+ element.setAttribute(IOptionCategory.OWNER, owner.getId());
+
+ // I am clean now
+ isDirty = false;
}
+ /*
+ * P A R E N T A N D C H I L D H A N D L I N G
+ */
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getChildCategories()
*/
@@ -86,6 +182,72 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
children = new ArrayList();
children.add(category);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptions(org.eclipse.cdt.core.build.managed.ITool)
+ */
+ public Object[][] getOptions(IConfiguration configuration) {
+ ITool[] tools = null;
+ if (configuration != null) {
+ tools = configuration.getTools();
+ }
+ return getOptions(tools, FILTER_PROJECT);
+ }
+
+ public Object[][] getOptions(IResourceConfiguration resConfig) {
+ ITool[] tools = null;
+ if (resConfig != null) {
+ tools = resConfig.getTools();
+ }
+ return getOptions(tools, FILTER_FILE);
+ }
+
+ private Object[][] getOptions(ITool[] tools, int filterValue) {
+ ITool catTool = getTool();
+ ITool tool = null;
+
+ if (tools != null) {
+ // Find the child of the configuration/resource configuration that represents the same tool.
+ // It could the tool itself, or a "sub-class" of the tool.
+ for (int i = 0; i < tools.length; ++i) {
+ ITool current = tools[i];
+ do {
+ if (catTool == current) {
+ tool = tools[i];
+ break;
+ }
+ } while ((current = current.getSuperClass()) != null);
+ if (tool != null) break;
+ }
+ }
+ if (tool == null) {
+ tool = catTool;
+ }
+
+ // Get all of the tool's options and see which ones are part of
+ // this category.
+ IOption[] allOptions = tool.getOptions();
+ Object[][] myOptions = new Object[allOptions.length][2];
+ int index = 0;
+ for (int i = 0; i < allOptions.length; ++i) {
+ IOption option = allOptions[i];
+ if (option.getCategory().equals(this)) {
+
+ // Check whether this option can be displayed for a specific resource type.
+ if( (option.getResourceFilter() == FILTER_ALL) || (option.getResourceFilter() == filterValue) ) {
+ myOptions[index] = new Object[2];
+ myOptions[index][0] = tool;
+ myOptions[index][1] = option;
+ index++;
+ }
+ }
+ }
+
+ return myOptions;
+ }
+ /*
+ * M O D E L A T T R I B U T E A C C E S S O R S
+ */
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOwner()
@@ -102,35 +264,47 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
return owner.getTool();
}
+ /*
+ * O B J E C T S T A T E M A I N T E N A N C E
+ */
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptions(org.eclipse.cdt.core.build.managed.ITool)
+ * @see org.eclipse.cdt.managedbuilder.core.IOptionCategory#isExtensionElement()
*/
- public IOption[] getOptions(IConfiguration configuration) {
- ITool tool = getTool();
- if (configuration != null) {
- // TODO don't like this much
- ITool[] tools = configuration.getTools();
- for (int i = 0; i < tools.length; ++i) {
- if (tools[i] instanceof IToolReference) {
- if (((IToolReference)tools[i]).references(tool)) {
- tool = tools[i];
- break;
- }
- } else if (tools[i].equals(tool))
- break;
- }
- }
+ public boolean isExtensionElement() {
+ return isExtensionOptionCategory;
+ }
- IOption[] allOptions = tool.getOptions();
- List myOptions = new ArrayList();
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOptionCategory#isDirty()
+ */
+ public boolean isDirty() {
+ // This shouldn't be called for an extension OptionCategory
+ if (isExtensionOptionCategory) return false;
+ return isDirty;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IIOptionCategory#setDirty(boolean)
+ */
+ public void setDirty(boolean isDirty) {
+ this.isDirty = isDirty;
+ }
+
+ public void resolveReferences() {
+ if (!resolved) {
+ resolved = true;
+ if (ownerId != null)
+ owner = tool.getOptionCategory(ownerId);
+ else
+ owner = tool;
- for (int i = 0; i < allOptions.length; ++i) {
- IOption option = allOptions[i];
- if (option.getCategory().equals(this))
- myOptions.add(option);
+ // Hook me in
+ if (owner instanceof Tool)
+ ((Tool)owner).addChildCategory(this);
+ else
+ ((OptionCategory)owner).addChildCategory(this);
}
-
- return (IOption[])myOptions.toArray(new IOption[myOptions.size()]);
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
index c115677ec1e..a7f6d074c52 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
@@ -34,9 +34,13 @@ import org.w3c.dom.NodeList;
*/
public class OptionReference implements IOption {
+ private static final String EMPTY_STRING = new String();
+
// List of built-in values a tool defines
private List builtIns;
// Used for all option references that override the command
+ // Note: This is not currently used - don't start using it because
+ // it is not handled in converting from the CDT 2.0 object model
private String command;
// The option this reference overrides
private IOption option;
@@ -99,11 +103,16 @@ public class OptionReference implements IOption {
return;
}
+ int optValType;
+ try {
+ optValType = option.getValueType();
+ } catch (BuildException e) {return;}
+
// Hook the reference up
owner.addOptionReference(this);
// value
- switch (option.getValueType()) {
+ switch (optValType) {
case BOOLEAN:
value = new Boolean(element.getAttribute(DEFAULT_VALUE));
break;
@@ -155,8 +164,15 @@ public class OptionReference implements IOption {
((OptionReference)option).resolveReferences();
}
+ // Note: The "value" loaded here when the optionReference is read from the manifest file.
+ // This because the "valueType" is only known once the option reference is resolved.
+ int optValType;
+ try {
+ optValType = option.getValueType();
+ } catch (BuildException e) {return;}
+
// value
- switch (option.getValueType()) {
+ switch (optValType) {
case BOOLEAN:
value = new Boolean(element.getAttribute(DEFAULT_VALUE));
break;
@@ -165,14 +181,9 @@ public class OptionReference implements IOption {
break;
case ENUMERATED:
String temp = element.getAttribute(DEFAULT_VALUE);
- if (temp == null) {
- try {
- temp = option.getSelectedEnum();
- } catch (BuildException e) {
- temp = new String();
- }
+ if (temp != null) {
+ value = temp;
}
- value = temp;
break;
case STRING_LIST:
case INCLUDE_PATH:
@@ -189,7 +200,8 @@ public class OptionReference implements IOption {
}
else {
valueList.add(valueElement.getAttribute(LIST_ITEM_VALUE));
- } }
+ }
+ }
value = valueList;
break;
}
@@ -205,8 +217,16 @@ public class OptionReference implements IOption {
public void serialize(Document doc, Element element) {
element.setAttribute(ID, option.getId());
+ int optValType;
+ try {
+ optValType = option.getValueType();
+ } catch (BuildException e) {
+ // TODO: Issue an error message
+ return;
+ }
+
// value
- switch (option.getValueType()) {
+ switch (optValType) {
case BOOLEAN:
element.setAttribute(DEFAULT_VALUE, ((Boolean)value).toString());
break;
@@ -291,10 +311,12 @@ public class OptionReference implements IOption {
resolveReferences();
}
if (option != null) {
- return option.getEnumCommand(id);
- } else {
- return new String();
+ try {
+ String command = option.getEnumCommand(id);
+ return command;
+ } catch (BuildException e) {}
}
+ return new String();
}
/* (non-Javadoc)
@@ -305,10 +327,12 @@ public class OptionReference implements IOption {
resolveReferences();
}
if (option != null) {
- return option.getEnumName(id);
- } else {
- return new String();
- }
+ try {
+ String name = option.getEnumName(id);
+ return name;
+ } catch (BuildException e) {}
+ }
+ return new String();
}
/* (non-Javadoc)
@@ -319,11 +343,12 @@ public class OptionReference implements IOption {
resolveReferences();
}
if (option != null) {
- return option.getEnumeratedId(name);
- } else {
- return new String();
+ try {
+ String id = option.getEnumeratedId(name);
+ return id;
+ } catch (BuildException e) {}
}
-
+ return new String();
}
/* (non-Javadoc)
@@ -474,9 +499,9 @@ public class OptionReference implements IOption {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getTool()
+ * @see org.eclipse.cdt.core.build.managed.IOption#getParent()
*/
- public ITool getTool() {
+ public ITool getParent() {
return owner;
}
@@ -507,9 +532,21 @@ public class OptionReference implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getValueType()
*/
public int getValueType() {
- return option.getValueType();
+ int optValType;
+ try {
+ optValType = option.getValueType();
+ } catch (BuildException e) {return -1;}
+
+ return optValType;
}
+ /* (non-Javadoc)
+ * Returns the raw value.
+ */
+ public Object getValue() {
+ return value;
+ }
+
/**
* Answers <code>true</code> if the receiver is a reference to the
* <code>IOption</code> specified in the argument, esle answers <code>false</code>.
@@ -593,4 +630,95 @@ public class OptionReference implements IOption {
}
}
+ /*
+ * The following methods are here in order to implement the new ITool methods.
+ * They should never be called.
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#isExtensionElement()
+ */
+ public boolean isExtensionElement() {
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#overridesOnlyValue()
+ */
+ public boolean overridesOnlyValue() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * Sets the raw value.
+ */
+ public void setValue(Object v) {
+ value = v;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setValueType()
+ */
+ public void setValueType(int type) {
+ }
+
+ /* (non-Javadoc)
+ * Returns the raw default value.
+ */
+ public Object getDefaultValue() {
+ return value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setValue(Object)
+ */
+ public void setDefaultValue(Object v) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#getSuperClass()
+ */
+ public IOption getSuperClass() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#getResourceFilter()
+ */
+ public int getResourceFilter() {
+ return FILTER_ALL;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#setResourceFilter(int)
+ */
+ public void setResourceFilter(int filter) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IOption#setBrowseType(int)
+ */
+ public void setBrowseType(int type) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setCategory(org.eclipse.cdt.core.build.managed.IOptionCategory)
+ */
+ public void setCategory(IOptionCategory category) {
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setCommand(String)
+ */
+ public void setCommand(String cmd) {
+ if (cmd == null && command == null) return;
+ if (cmd == null || command == null || !cmd.equals(command)) {
+ command = cmd;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setCommandFalse(String)
+ */
+ public void setCommandFalse(String cmd) {
+ }
+
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java
new file mode 100644
index 00000000000..594affaa1b7
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java
@@ -0,0 +1,336 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.core;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+
+public class ProjectType extends BuildObject implements IProjectType {
+
+ private static final String EMPTY_STRING = new String();
+ private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
+
+ // Superclass
+ private IProjectType superClass;
+ private String superClassId;
+ // Parent and children
+ private List configList; // Configurations of this project type
+ private Map configMap;
+ // Managed Build model attributes
+ private Boolean isAbstract;
+ private Boolean isTest;
+ private String unusedChildren;
+ // Miscellaneous
+ private boolean resolved = true;
+
+ /*
+ * C O N S T R U C T O R S
+ */
+
+ /**
+ * This constructor is called to create a projectType defined by an extension point in
+ * a plugin manifest file.
+ *
+ * @param element
+ */
+ public ProjectType(IManagedConfigElement element) {
+ // setup for resolving
+ resolved = false;
+
+ loadFromManifest(element);
+
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionProjectType(this);
+
+ // Load the configuration children
+ IManagedConfigElement[] configs = element.getChildren(IConfiguration.CONFIGURATION_ELEMENT_NAME);
+ for (int n = 0; n < configs.length; ++n) {
+ Configuration config = new Configuration(this, configs[n]);
+ }
+ }
+
+ /**
+ * This constructor is called to create a project type whose attributes and children will be
+ * added by separate calls.
+ *
+ * @param ProjectType The superClass, if any
+ * @param String The id for the new project type
+ * @param String The name for the new project type
+ */
+ public ProjectType(ProjectType superClass, String Id, String name) {
+ // setup for resolving
+ resolved = false;
+
+ this.superClass = superClass;
+ if (this.superClass != null) {
+ superClassId = this.superClass.getId();
+ }
+ setId(Id);
+ setName(name);
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionProjectType(this);
+ }
+
+ /*
+ * E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S
+ */
+
+ /* (non-Javadoc)
+ * Load the project-type information from the XML element specified in the
+ * argument
+ * @param element An XML element containing the project type information
+ */
+ protected void loadFromManifest(IManagedConfigElement element) {
+ ManagedBuildManager.putConfigElement(this, element);
+
+ // id
+ setId(element.getAttribute(ID));
+
+ // Get the name
+ setName(element.getAttribute(NAME));
+
+ // superClass
+ superClassId = element.getAttribute(SUPERCLASS);
+
+ // Get the unused children, if any
+ unusedChildren = element.getAttribute(UNUSED_CHILDREN);
+
+ // isAbstract
+ String isAbs = element.getAttribute(IS_ABSTRACT);
+ if (isAbs != null){
+ isAbstract = new Boolean("true".equals(isAbs)); //$NON-NLS-1$
+ }
+
+ // Is this a test project type
+ String isTestStr = element.getAttribute(IS_TEST); //$NON-NLS-1$
+ if (isTestStr != null){
+ isTest = new Boolean("true".equals(isTestStr)); //$NON-NLS-1$
+ }
+ }
+
+ /*
+ * P A R E N T A N D C H I L D H A N D L I N G
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IProjectType#createConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
+ */
+ public IConfiguration createConfiguration(IConfiguration parent, String id, String name) {
+ Configuration config = new Configuration(this, parent, id, name);
+ return (IConfiguration)config;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IProjectType#getConfiguration()
+ */
+ public IConfiguration getConfiguration(String id) {
+ return (IConfiguration)getConfigurationMap().get(id);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IProjectType#getConfigurations()
+ */
+ public IConfiguration[] getConfigurations() {
+ IConfiguration[] configs = new IConfiguration[getConfigurationList().size()];
+ Iterator iter = getConfigurationList().listIterator();
+ int i = 0;
+ while (iter.hasNext()) {
+ Configuration config = (Configuration)iter.next();
+ configs[i++] = (IConfiguration)config;
+ }
+ return configs;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IProjectType#removeConfiguration(java.lang.String)
+ */
+ public void removeConfiguration(String id) {
+ // Remove the specified configuration from the list and map
+ Iterator iter = getConfigurationList().listIterator();
+ while (iter.hasNext()) {
+ IConfiguration config = (IConfiguration)iter.next();
+ if (config.getId().equals(id)) {
+ getConfigurationList().remove(config);
+ getConfigurationMap().remove(id);
+ break;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * Adds the Configuration to the Configuration list and map
+ *
+ * @param Tool
+ */
+ public void addConfiguration(Configuration configuration) {
+ getConfigurationList().add(configuration);
+ getConfigurationMap().put(configuration.getId(), configuration);
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the list of configurations.
+ *
+ * @return List containing the configurations
+ */
+ private List getConfigurationList() {
+ if (configList == null) {
+ configList = new ArrayList();
+ }
+ return configList;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the map of configuration ids to configurations
+ *
+ * @return
+ */
+ private Map getConfigurationMap() {
+ if (configMap == null) {
+ configMap = new HashMap();
+ }
+ return configMap;
+ }
+
+ /*
+ * M O D E L A T T R I B U T E A C C E S S O R S
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getName()
+ */
+ public String getName() {
+ // If I am unnamed, see if I can inherit one from my parent
+ if (name == null) {
+ if (superClass != null) {
+ return superClass.getName();
+ } else {
+ return new String(""); //$NON-NLS-1$
+ }
+ } else {
+ return name;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IProjectType#getSuperClass()
+ */
+ public IProjectType getSuperClass() {
+ return superClass;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IProjectType#isAbstract()
+ */
+ public boolean isAbstract() {
+ if (isAbstract != null) {
+ return isAbstract.booleanValue();
+ } else {
+ return false; // Note: no inheritance from superClass
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IProjectType#unusedChildren()
+ */
+ public String getUnusedChildren() {
+ if (unusedChildren != null) {
+ return unusedChildren;
+ } else
+ return EMPTY_STRING; // Note: no inheritance from superClass
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IProjectType#isTestProjectType()
+ */
+ public boolean isTestProjectType() {
+ if (isTest == null) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ return superClass.isTestProjectType();
+ } else {
+ return false;
+ }
+ }
+ return isTest.booleanValue();
+ }
+
+ /* (non-Javadoc)
+ * Sets the isAbstract attribute
+ */
+ public void setIsAbstract(boolean b) {
+ isAbstract = new Boolean(b);
+ }
+
+ /* (non-Javadoc)
+ * Sets the isTest attribute
+ */
+ public void setIsTest(boolean b) {
+ isTest = new Boolean(b);
+ }
+
+ /*
+ * O B J E C T S T A T E M A I N T E N A N C E
+ */
+
+ /* (non-Javadoc)
+ * Resolve the element IDs to interface references
+ */
+ public void resolveReferences() {
+ if (!resolved) {
+ resolved = true;
+ // Resolve superClass
+ if (superClassId != null && superClassId.length() > 0) {
+ superClass = ManagedBuildManager.getExtensionProjectType(superClassId);
+ if (superClass == null) {
+ // TODO: Report error
+ }
+ }
+
+ // Add configurations from our superClass that are not overridden here
+ if (superClass != null) {
+ ((ProjectType)superClass).resolveReferences();
+ IConfiguration[] superConfigs = superClass.getConfigurations();
+ for (int i = 0; i < superConfigs.length; i++) {
+ String superId = superConfigs[i].getId();
+
+ check: {
+ IConfiguration[] currentConfigs = getConfigurations();
+ for (int j = 0; j < currentConfigs.length; j++) {
+ IConfiguration config = currentConfigs[j];
+ while (config.getParent() != null) {
+ if (config.getParent().getId().equals(superId)) break check;
+ config = config.getParent();
+ }
+ }
+ addConfiguration((Configuration)superConfigs[i]);
+ } // end check
+
+ }
+ }
+
+ // Call resolve references on any children
+ Iterator configIter = getConfigurationList().iterator();
+ while (configIter.hasNext()) {
+ Configuration current = (Configuration)configIter.next();
+ current.resolveReferences();
+ }
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java
new file mode 100644
index 00000000000..aa477aa3b08
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java
@@ -0,0 +1,618 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.core;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.managedbuilder.core.BuildException;
+import org.eclipse.cdt.managedbuilder.core.IBuildObject;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IOption;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IResource;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class ResourceConfiguration extends BuildObject implements IResourceConfiguration {
+
+ private static final String EMPTY_STRING = new String();
+
+ // Parent and children
+ private IConfiguration parent;
+ private List toolList;
+ private Map toolMap;
+ // Managed Build model attributes
+ private String resPath;
+ private Boolean isExcluded;
+ // Miscellaneous
+ private boolean isExtensionResourceConfig = false;
+ private boolean isDirty = false;
+ private boolean resolved = true;
+ private boolean rebuildNeeded = false;
+
+ /*
+ * C O N S T R U C T O R S
+ */
+
+ /**
+ * This constructor is called to create a resource configuration defined by an
+ * extension point in a plugin manifest file, or returned by a dynamic element provider
+ *
+ * @param parent The IConfiguration parent of this resource configuration
+ * @param element The resource configuration definition from the manifest file
+ * or a dynamic element provider
+ */
+ public ResourceConfiguration(IConfiguration parent, IManagedConfigElement element) {
+ this.parent = parent;
+ isExtensionResourceConfig = true;
+
+ // setup for resolving
+ resolved = false;
+
+ loadFromManifest(element);
+
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionResourceConfiguration(this);
+
+ // Load the tool children
+ IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME);
+ for (int n = 0; n < tools.length; ++n) {
+ Tool toolChild = new Tool(this, tools[n]);
+ toolList.add(toolChild);
+ }
+ }
+
+ /**
+ * Create a <code>ResourceConfiguration</code> based on the specification stored in the
+ * project file (.cdtbuild).
+ *
+ * @param parent The <code>IConfiguration</code> the resource configuration will be added to.
+ * @param element The XML element that contains the resource configuration settings.
+ */
+ public ResourceConfiguration(IConfiguration parent, Element element) {
+ this.parent = parent;
+ isExtensionResourceConfig = false;
+
+ // Initialize from the XML attributes
+ loadFromProject(element);
+
+ // Load children
+ NodeList configElements = element.getChildNodes();
+ for (int i = 0; i < configElements.getLength(); ++i) {
+ Node configElement = configElements.item(i);
+ if (configElement.getNodeName().equals(ITool.TOOL_ELEMENT_NAME)) {
+ Tool tool = new Tool((IBuildObject)this, (Element)configElement);
+ addTool(tool);
+ }
+ }
+ }
+
+ public ResourceConfiguration(IConfiguration parent, String id, String resourceName, String path){
+ this.parent = parent;
+
+ setId(id);
+ setName(resourceName);
+
+ resPath = path;
+ isDirty = false;
+ isExcluded = new Boolean(false);
+ }
+
+ /**
+ * Create a new resource configuration based on one already defined.
+ *
+ * @param managedProject The <code>ManagedProject</code> the configuration will be added to.
+ * @param parentConfig The <code>IConfiguration</code> to copy the settings from.
+ * @param id A unique ID for the new configuration.
+ */
+ public ResourceConfiguration(IConfiguration parent, ResourceConfiguration cloneConfig, String id) {
+ setId(id);
+ setName(cloneConfig.getName());
+ this.parent = parent;
+ isExtensionResourceConfig = false;
+
+ // Copy the remaining attributes
+ if (cloneConfig.resPath != null) {
+ resPath = new String(cloneConfig.resPath);
+ }
+ if (cloneConfig.isExcluded != null) {
+ isExcluded = new Boolean(cloneConfig.isExcluded.booleanValue());
+ }
+
+ // Clone the resource configuration's tool children
+ if (cloneConfig.toolList != null) {
+ Iterator iter = cloneConfig.getToolList().listIterator();
+ while (iter.hasNext()) {
+ Tool toolChild = (Tool) iter.next();
+ int nnn = ManagedBuildManager.getRandomNumber();
+ String subId;
+ String subName;
+ if (toolChild.getSuperClass() != null) {
+ subId = toolChild.getSuperClass().getId() + "." + nnn; //$NON-NLS-1$
+ subName = toolChild.getSuperClass().getName();
+ } else {
+ subId = toolChild.getId() + "." + nnn; //$NON-NLS-1$
+ subName = toolChild.getName();
+ }
+ // The superclass for the cloned tool is not the same as the one from the tool being cloned.
+ // The superclasses reside in different configurations.
+ ITool toolSuperClass = null;
+ // Search for the tool in this configuration that has the same grand-superClass as the
+ // tool being cloned
+ ITool[] tools = parent.getTools();
+ for (int i=0; i<tools.length; i++) {
+ ITool configTool = tools[i];
+ if (configTool.getSuperClass() == toolChild.getSuperClass().getSuperClass())
+ {
+ toolSuperClass = configTool;
+ break;
+ }
+ }
+ if (toolSuperClass == null) {
+ // TODO: report an error
+ }
+ Tool newTool = new Tool(this, toolSuperClass, subId, subName, toolChild);
+ addTool(newTool);
+ }
+ }
+
+ setDirty(true);
+ }
+
+ /*
+ * E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S
+ */
+
+ /* (non-Javadoc)
+ * Loads the resource configuration information from the ManagedConfigElement
+ * specified in the argument.
+ *
+ * @param element Contains the resource configuration information
+ */
+ protected void loadFromManifest(IManagedConfigElement element) {
+ ManagedBuildManager.putConfigElement(this, element);
+
+ // id
+ setId(element.getAttribute(IBuildObject.ID));
+
+ // Get the name
+ setName(element.getAttribute(IBuildObject.NAME));
+
+ // resourcePath
+ resPath = element.getAttribute(IResourceConfiguration.RESOURCE_PATH);
+
+ // exclude
+ String excludeStr = element.getAttribute(IResourceConfiguration.EXCLUDE);
+ if (excludeStr != null){
+ isExcluded = new Boolean("true".equals(excludeStr)); //$NON-NLS-1$
+ }
+ }
+
+ /* (non-Javadoc)
+ * Initialize the resource configuration information from the XML element
+ * specified in the argument
+ *
+ * @param element An XML element containing the resource configuration information
+ */
+ protected void loadFromProject(Element element) {
+
+ // id
+ setId(element.getAttribute(IBuildObject.ID));
+
+ // name
+ if (element.hasAttribute(IBuildObject.NAME)) {
+ setName(element.getAttribute(IBuildObject.NAME));
+ }
+
+ // exclude
+ if (element.hasAttribute(IResourceConfiguration.EXCLUDE)) {
+ String excludeStr = element.getAttribute(IResourceConfiguration.EXCLUDE);
+ if (excludeStr != null){
+ isExcluded = new Boolean("true".equals(excludeStr)); //$NON-NLS-1$
+ }
+ }
+
+ // resourcePath
+ if (element.hasAttribute(IResourceConfiguration.RESOURCE_PATH)) {
+ resPath = element.getAttribute(IResourceConfiguration.RESOURCE_PATH);
+ }
+ }
+
+ /**
+ * Persist the resource configuration to the project file.
+ *
+ * @param doc
+ * @param element
+ */
+ public void serialize(Document doc, Element element) {
+
+ element.setAttribute(IBuildObject.ID, id);
+
+ if (name != null) {
+ element.setAttribute(IBuildObject.NAME, name);
+ }
+
+ if (isExcluded != null) {
+ element.setAttribute(IResourceConfiguration.EXCLUDE, isExcluded.toString());
+ }
+
+ if (resPath != null) {
+ element.setAttribute(IResourceConfiguration.RESOURCE_PATH, resPath);
+ }
+
+ // Serialize my children
+ List toolElements = getToolList();
+ Iterator iter = toolElements.listIterator();
+ while (iter.hasNext()) {
+ Tool tool = (Tool) iter.next();
+ Element toolElement = doc.createElement(ITool.TOOL_ELEMENT_NAME);
+ element.appendChild(toolElement);
+ tool.serialize(doc, toolElement);
+ }
+
+ // I am clean now
+ isDirty = false;
+ }
+
+ /*
+ * P A R E N T A N D C H I L D H A N D L I N G
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IResourceConfiguration#getParent()
+ */
+ public IConfiguration getParent() {
+ return parent;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IResourceConfiguration#getTools()
+ */
+ public ITool[] getTools() {
+ ITool[] tools = new ITool[getToolList().size()];
+ Iterator iter = getToolList().listIterator();
+ int i = 0;
+ while (iter.hasNext()) {
+ Tool tool = (Tool)iter.next();
+ tools[i++] = (ITool)tool;
+ }
+ return tools;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IResourceConfiguration#getTool(java.lang.String)
+ */
+ public ITool getTool(String id) {
+ Tool tool = (Tool)getToolMap().get(id);
+ return (ITool)tool;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the list of tools.
+ *
+ * @return List containing the tools
+ */
+ private List getToolList() {
+ if (toolList == null) {
+ toolList = new ArrayList();
+ }
+ return toolList;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the map of tool ids to tools
+ *
+ * @return
+ */
+ private Map getToolMap() {
+ if (toolMap == null) {
+ toolMap = new HashMap();
+ }
+ return toolMap;
+ }
+
+ /* (non-Javadoc)
+ * Adds the Tool to the Tool list and map
+ *
+ * @param Tool
+ */
+ public void addTool(Tool tool) {
+ getToolList().add(tool);
+ getToolMap().put(tool.getId(), tool);
+ }
+
+ /*
+ * M O D E L A T T R I B U T E A C C E S S O R S
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IResourceConfiguration#isExcluded()
+ */
+ public boolean isExcluded() {
+ if (isExcluded != null) {
+ return isExcluded.booleanValue();
+ } else {
+ return false;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IResourceConfiguration#getResourcePath()
+ */
+ public String getResourcePath() {
+ String path = resPath;
+ if (path == null) return EMPTY_STRING;
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IResourceConfiguration#setExclude()
+ */
+ public void setExclude(boolean excluded) {
+ if (isExcluded == null || excluded != isExcluded.booleanValue()) {
+ isExcluded = new Boolean(excluded);
+ setDirty(true);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IResourceConfiguration#setResourcePath()
+ */
+ public void setResourcePath(String path) {
+ if( path == null)
+ return;
+ if (resPath == null || !path.equals(resPath)) {
+ resPath = path;
+ setDirty(true);
+ }
+ }
+
+ /*
+ * O B J E C T S T A T E M A I N T E N A N C E
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IResourceConfiguration#isExtensionElement()
+ */
+ public boolean isExtensionResourceConfiguration() {
+ return isExtensionResourceConfig;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IResourceConfiguration#isDirty()
+ */
+ public boolean isDirty() {
+ // This shouldn't be called for an extension tool-chain
+ if (isExtensionResourceConfig) return false;
+
+ // If I need saving, just say yes
+ if (isDirty) return true;
+
+ // Otherwise see if any tools need saving
+ Iterator iter = getToolList().listIterator();
+ while (iter.hasNext()) {
+ Tool toolChild = (Tool) iter.next();
+ if (toolChild.isDirty()) return true;
+ }
+
+ return isDirty;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IResourceConfiguration#setDirty(boolean)
+ */
+ public void setDirty(boolean isDirty) {
+ this.isDirty = isDirty;
+ // Propagate "false" to the children
+ if (!isDirty) {
+ Iterator iter = getToolList().listIterator();
+ while (iter.hasNext()) {
+ Tool toolChild = (Tool) iter.next();
+ toolChild.setDirty(false);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * Resolve the element IDs to interface references
+ */
+ public void resolveReferences() {
+ if (!resolved) {
+ resolved = true;
+
+ // Call resolveReferences on our children
+ Iterator iter = getToolList().listIterator();
+ while (iter.hasNext()) {
+ Tool toolChild = (Tool) iter.next();
+ toolChild.resolveReferences();
+ }
+ }
+ }
+
+ public ITool createTool(ITool superClass, String id, String name, boolean isExtensionElement) {
+ Tool tool = new Tool(this, superClass, id, name, isExtensionElement);
+ addTool(tool);
+ setDirty(true);
+ return (ITool)tool;
+ }
+
+ public void reset() {
+ // We just need to remove all Options
+ ITool[] tools = getTools();
+ for (int i = 0; i < tools.length; i++) {
+ ITool tool = tools[i];
+ IOption[] opts = tool.getOptions();
+ for (int j = 0; j < opts.length; j++) {
+ tool.removeOption(opts[j]);
+ }
+ }
+ isExcluded = new Boolean(false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IResourceConfiguration#setToolCommand(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String)
+ */
+ public void setToolCommand(ITool tool, String command) {
+ // TODO: Do we need to verify that the tool is part of the configuration?
+ tool.setToolCommand(command);
+ }
+
+ public IOption setOption(ITool tool, IOption option, boolean value) throws BuildException {
+ // Is there a change?
+ IOption retOpt = option;
+ if (option.getBooleanValue() != value) {
+ // If this resource config does not already override this option, then we need to
+ // create a new option
+ if (option.getParent().getParent() != this) {
+ IOption newSuperClass = option;
+ if (!newSuperClass.isExtensionElement()) {
+ newSuperClass = newSuperClass.getSuperClass();
+ }
+ if (newSuperClass.isExtensionElement()) {
+ // If the extension element is only overriding the "value" of its superclass, hook the
+ // new option up to its superclass directly. This is to avoid references to oddly id'ed
+ // elements that are automatically generated from V2.0 model optionReferences. If these
+ // end up in the project file, then the project could have a problem when the integration
+ // provider switches to providing the new model.
+ if (newSuperClass.overridesOnlyValue()) {
+ newSuperClass = newSuperClass.getSuperClass();
+ }
+ }
+ // Create an Option element for the managed build project file (.CDTBUILD)
+ String subId;
+ int nnn = ManagedBuildManager.getRandomNumber();
+ subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
+ retOpt = tool.createOption(newSuperClass, subId, null, false);
+ retOpt.setValueType(option.getValueType());
+ retOpt.setValue(value);
+ setDirty(true);
+ } else {
+ option.setValue(value);
+ }
+ rebuildNeeded = true;
+ }
+ return retOpt;
+ }
+
+ public IOption setOption(ITool tool, IOption option, String value) throws BuildException {
+ IOption retOpt = option;
+ String oldValue;
+ oldValue = option.getStringValue();
+ if (oldValue != null && !oldValue.equals(value)) {
+ // If this resource config does not already override this option, then we need to
+ // create a new option
+ if (option.getParent().getParent() != this) {
+ IOption newSuperClass = option;
+ if (!newSuperClass.isExtensionElement()) {
+ newSuperClass = newSuperClass.getSuperClass();
+ }
+ if (newSuperClass.isExtensionElement()) {
+ // If the extension element is only overriding the "value" of its superclass, hook the
+ // new option up to its superclass directly. This is to avoid references to oddly id'ed
+ // elements that are automatically generated from V2.0 model optionReferences. If these
+ // end up in the project file, then the project could have a problem when the integration
+ // provider switches to providing the new model.
+ if (newSuperClass.overridesOnlyValue()) {
+ newSuperClass = newSuperClass.getSuperClass();
+ }
+ }
+ // Create an Option element for the managed build project file (.CDTBUILD)
+ String subId;
+ int nnn = ManagedBuildManager.getRandomNumber();
+ subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
+ retOpt = tool.createOption(newSuperClass, subId, null, false);
+ retOpt.setValueType(option.getValueType());
+ retOpt.setValue(value);
+ setDirty(true);
+ } else {
+ option.setValue(value);
+ }
+ rebuildNeeded = true;
+ }
+ return retOpt;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String[])
+ */
+ public IOption setOption(ITool tool, IOption option, String[] value) throws BuildException {
+ IOption retOpt = option;
+ // Is there a change?
+ String[] oldValue;
+ switch (option.getValueType()) {
+ case IOption.STRING_LIST :
+ oldValue = option.getStringListValue();
+ break;
+ case IOption.INCLUDE_PATH :
+ oldValue = option.getIncludePaths();
+ break;
+ case IOption.PREPROCESSOR_SYMBOLS :
+ oldValue = option.getDefinedSymbols();
+ break;
+ case IOption.LIBRARIES :
+ oldValue = option.getLibraries();
+ break;
+ case IOption.OBJECTS :
+ oldValue = option.getUserObjects();
+ break;
+ default :
+ oldValue = new String[0];
+ break;
+ }
+ if(!Arrays.equals(value, oldValue)) {
+ // If this resource config does not already override this option, then we need to
+ // create a new option
+ if (option.getParent().getParent() != this) {
+ IOption newSuperClass = option;
+ if (!newSuperClass.isExtensionElement()) {
+ newSuperClass = newSuperClass.getSuperClass();
+ }
+ if (newSuperClass.isExtensionElement()) {
+ // If the extension element is only overriding the "value" of its superclass, hook the
+ // new option up to its superclass directly. This is to avoid references to oddly id'ed
+ // elements that are automatically generated from V2.0 model optionReferences. If these
+ // end up in the project file, then the project could have a problem when the integration
+ // provider switches to providing the new model.
+ if (newSuperClass.overridesOnlyValue()) {
+ newSuperClass = newSuperClass.getSuperClass();
+ }
+ }
+ // Create an Option element for the managed build project file (.CDTBUILD)
+ String subId;
+ int nnn = ManagedBuildManager.getRandomNumber();
+ subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
+ retOpt = tool.createOption(newSuperClass, subId, null, false);
+ retOpt.setValueType(option.getValueType());
+ retOpt.setValue(value);
+ setDirty(true);
+ } else {
+ option.setValue(value);
+ }
+ rebuildNeeded = true;
+ }
+ return retOpt;
+ }
+
+ public IResource getOwner() {
+ return getParent().getOwner();
+ }
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
index ed6f7f0e69c..ffaa447db43 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
@@ -1,5 +1,3 @@
-package org.eclipse.cdt.managedbuilder.internal.core;
-
/**********************************************************************
* Copyright (c) 2003,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -10,22 +8,28 @@ package org.eclipse.cdt.managedbuilder.internal.core;
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.core;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Random;
import java.util.StringTokenizer;
import java.util.Vector;
import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.managedbuilder.core.IConfigurationV2;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IToolReference;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
+import org.eclipse.cdt.managedbuilder.core.IBuilder;
+import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
import org.eclipse.core.resources.IResource;
@@ -36,7 +40,7 @@ import org.w3c.dom.Node;
public class Target extends BuildObject implements ITarget {
private static final String EMPTY_STRING = new String();
- private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
+ private static final IConfigurationV2[] emptyConfigs = new IConfigurationV2[0];
private String artifactName;
private String binaryParserId;
private String cleanCommand;
@@ -59,6 +63,7 @@ public class Target extends BuildObject implements ITarget {
private List toolList;
private Map toolMap;
private List toolReferences;
+ private ProjectType createdProjectType;
/**
* This constructor is called to create a target defined by an extension point in
@@ -127,20 +132,23 @@ public class Target extends BuildObject implements ITarget {
targetArchList.add(archTokens[j].trim());
}
}
+
// Load any tool references we might have
- IManagedConfigElement[] toolRefs = element.getChildren(IConfiguration.TOOLREF_ELEMENT_NAME);
+ IManagedConfigElement[] toolRefs = element.getChildren(IConfigurationV2.TOOLREF_ELEMENT_NAME);
for (int k = 0; k < toolRefs.length; ++k) {
new ToolReference(this, toolRefs[k]);
}
// Then load any tools defined for the target
IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME);
for (int m = 0; m < tools.length; ++m) {
- new Tool(this, tools[m]);
+ ITool newTool = new Tool(this, tools[m]);
+ // Add this tool to the target, as this is not done in the constructor
+ this.addTool(newTool);
}
// Then load the configurations which may have tool references
- IManagedConfigElement[] configs = element.getChildren(IConfiguration.CONFIGURATION_ELEMENT_NAME);
+ IManagedConfigElement[] configs = element.getChildren(IConfigurationV2.CONFIGURATION_ELEMENT_NAME);
for (int n = 0; n < configs.length; ++n) {
- new Configuration(this, configs[n]);
+ new ConfigurationV2(this, configs[n]);
}
}
@@ -166,12 +174,7 @@ public class Target extends BuildObject implements ITarget {
// Copy the parent's identity
this.parent = parent;
- Random r = new Random();
- r.setSeed(System.currentTimeMillis());
- int id = r.nextInt();
- if (id < 0) {
- id *= -1;
- }
+ int id = ManagedBuildManager.getRandomNumber();
setId(owner.getName() + "." + parent.getId() + "." + id); //$NON-NLS-1$ //$NON-NLS-2$
setName(parent.getName());
setArtifactName(parent.getArtifactName());
@@ -245,8 +248,8 @@ public class Target extends BuildObject implements ITarget {
Node child = element.getFirstChild();
while (child != null) {
- if (child.getNodeName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
- new Configuration(this, (Element)child);
+ if (child.getNodeName().equals(IConfigurationV2.CONFIGURATION_ELEMENT_NAME)) {
+ new ConfigurationV2(this, (Element)child);
}
child = child.getNextSibling();
}
@@ -255,7 +258,7 @@ public class Target extends BuildObject implements ITarget {
/**
* @param configuration
*/
- public void addConfiguration(IConfiguration configuration) {
+ public void addConfiguration(IConfigurationV2 configuration) {
getConfigurationList().add(configuration);
getConfigurationMap().put(configuration.getId(), configuration);
}
@@ -301,21 +304,20 @@ public class Target extends BuildObject implements ITarget {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITarget#createConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
+ * @see org.eclipse.cdt.core.build.managed.ITarget#createConfiguration(org.eclipse.cdt.core.build.managed.IConfigurationV2)
*/
- public IConfiguration createConfiguration(IConfiguration parent, String id) {
+ public IConfigurationV2 createConfiguration(IConfigurationV2 parent, String id) {
isDirty = true;
- return new Configuration(this, parent, id);
+ return new ConfigurationV2(this, parent, id);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITarget#createConfiguration()
*/
- public IConfiguration createConfiguration(String id) {
- return new Configuration(this, id);
+ public IConfigurationV2 createConfiguration(String id) {
+ return new ConfigurationV2(this, id);
}
-
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getArtifactExtension()
*/
@@ -395,8 +397,8 @@ public class Target extends BuildObject implements ITarget {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITarget#getConfiguration()
*/
- public IConfiguration getConfiguration(String id) {
- return (IConfiguration)getConfigurationMap().get(id);
+ public IConfigurationV2 getConfiguration(String id) {
+ return (IConfigurationV2)getConfigurationMap().get(id);
}
/* (non-Javadoc)
@@ -426,11 +428,10 @@ public class Target extends BuildObject implements ITarget {
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getConfigurations()
*/
- public IConfiguration[] getConfigurations() {
- return (IConfiguration[])getConfigurationList().toArray(new IConfiguration[getConfigurationList().size()]);
+ public IConfigurationV2[] getConfigurations() {
+ return (IConfigurationV2[])getConfigurationList().toArray(new IConfigurationV2[getConfigurationList().size()]);
}
-
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getDefaultExtension()
*/
@@ -642,7 +643,7 @@ public class Target extends BuildObject implements ITarget {
}
return (String[]) targetOSList.toArray(new String[targetOSList.size()]);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getTool(java.lang.String)
*/
@@ -659,7 +660,7 @@ public class Target extends BuildObject implements ITarget {
// If not defined in parents, check if defined at all
if (result == null) {
- result = ManagedBuildManager.getTool(id);
+ result = ManagedBuildManager.getExtensionTool(id);
}
return result;
@@ -747,7 +748,7 @@ public class Target extends BuildObject implements ITarget {
// Iterate over the configurations and ask them if they need saving
Iterator iter = getConfigurationList().listIterator();
while (iter.hasNext()) {
- if (((IConfiguration)iter.next()).isDirty()) {
+ if (((IConfigurationV2)iter.next()).isDirty()) {
return true;
}
}
@@ -769,7 +770,7 @@ public class Target extends BuildObject implements ITarget {
// Iterate over the configurations and ask them if they need saving
Iterator iter = getConfigurationList().listIterator();
while (iter.hasNext()) {
- if (((IConfiguration)iter.next()).needsRebuild()) {
+ if (((IConfigurationV2)iter.next()).needsRebuild()) {
return true;
}
}
@@ -783,7 +784,7 @@ public class Target extends BuildObject implements ITarget {
// Remove the specified configuration from the list and map
Iterator iter = getConfigurationList().listIterator();
while (iter.hasNext()) {
- IConfiguration config = (IConfiguration)iter.next();
+ IConfigurationV2 config = (IConfigurationV2)iter.next();
if (config.getId().equals(id)) {
getConfigurationList().remove(config);
getConfigurationMap().remove(id);
@@ -819,7 +820,7 @@ public class Target extends BuildObject implements ITarget {
// should resolve before calling methods on it
((Target)parent).resolveReferences();
// copy over the parents configs
- IConfiguration[] parentConfigs = parent.getConfigurations();
+ IConfigurationV2[] parentConfigs = parent.getConfigurations();
for (int i = 0; i < parentConfigs.length; ++i)
addConfiguration(parentConfigs[i]);
}
@@ -837,7 +838,7 @@ public class Target extends BuildObject implements ITarget {
}
Iterator configIter = getConfigurationList().iterator();
while (configIter.hasNext()) {
- Configuration current = (Configuration)configIter.next();
+ ConfigurationV2 current = (ConfigurationV2)configIter.next();
current.resolveReferences();
}
}
@@ -877,8 +878,8 @@ public class Target extends BuildObject implements ITarget {
// Serialize the configuration settings
Iterator iter = getConfigurationList().listIterator();
while (iter.hasNext()) {
- Configuration config = (Configuration) iter.next();
- Element configElement = doc.createElement(IConfiguration.CONFIGURATION_ELEMENT_NAME);
+ ConfigurationV2 config = (ConfigurationV2) iter.next();
+ Element configElement = doc.createElement(IConfigurationV2.CONFIGURATION_ELEMENT_NAME);
element.appendChild(configElement);
config.serialize(doc, configElement);
}
@@ -917,7 +918,7 @@ public class Target extends BuildObject implements ITarget {
// and in the configurations
Iterator iter = getConfigurationList().listIterator();
while (iter.hasNext()) {
- IConfiguration config = (IConfiguration)iter.next();
+ IConfigurationV2 config = (IConfigurationV2)iter.next();
config.setDirty(isDirty);
}
}
@@ -956,14 +957,13 @@ public class Target extends BuildObject implements ITarget {
}
}
-
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITarget#setRebuildState(boolean)
*/
public void setRebuildState(boolean rebuild) {
Iterator iter = getConfigurationList().listIterator();
while (iter.hasNext()) {
- ((IConfiguration)iter.next()).setRebuildState(rebuild);
+ ((IConfigurationV2)iter.next()).setRebuildState(rebuild);
}
}
@@ -977,4 +977,193 @@ public class Target extends BuildObject implements ITarget {
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITarget#convertToProjectType()
+ */
+ public void convertToProjectType() {
+ // Create a ProjectType + Configuration + Toolchain + Builder + TargetPlatform
+ // from the Target
+
+ // The "parent" needs to have been converted already.
+ // Do it now if necessary.
+ ProjectType parentProj = null;
+ if (parent != null) {
+ parentProj = parent.getCreatedProjectType();
+ if (parentProj == null) {
+ parent.convertToProjectType();
+ parentProj = parent.getCreatedProjectType();
+ }
+ }
+ ProjectType projectType = new ProjectType(parentProj, getId(), getName());
+ createdProjectType = projectType;
+ // Set the project type attributes
+ projectType.setIsAbstract(isAbstract);
+ projectType.setIsTest(isTest);
+ // Add children
+ // Add configurations (Configuration -> ToolChain -> Builder -> TargetPlatform)
+ Iterator iter = getConfigurationList().listIterator();
+ while (iter.hasNext()) {
+ IConfigurationV2 configV2 = (IConfigurationV2)iter.next();
+ if (configV2.getCreatedConfig() != null) continue;
+ // The new config's superClass needs to be the
+ // Configuration created from the ConfigurationV2 parent...
+ IConfiguration configSuperClass = null;
+ IConfigurationV2 parentV2 = configV2.getParent();
+ if (parentV2 != null) {
+ configSuperClass = parentV2.getCreatedConfig();
+ }
+ String id = configV2.getId();
+ String name = configV2.getName();
+ IConfiguration config = projectType.createConfiguration(configSuperClass, id, name);
+ configV2.setCreatedConfig(config);
+ // Set the configuration attributes
+ config.setArtifactName(getArtifactName());
+ config.setArtifactExtension(getArtifactExtension());
+ config.setCleanCommand(getCleanCommand());
+ config.setErrorParserIds(getErrorParserIds());
+ // Create the Tool-chain
+ String subId;
+ String subName;
+ subId = id + ".toolchain"; //$NON-NLS-1$
+ subName = name + ".toolchain"; //$NON-NLS-1$
+ IToolChain toolChain = config.createToolChain(null, subId, subName, true);
+ // Set the tool chain attributes
+ toolChain.setIsAbstract(isAbstract);
+ toolChain.setOSList(getTargetOSList());
+ toolChain.setArchList(getTargetArchList());
+ IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
+ if (element instanceof DefaultManagedConfigElement) {
+ toolChain.setScannerInfoCollectorElement(((DefaultManagedConfigElement)element).getConfigurationElement());
+ }
+ // Create the Builder
+ subId = id + ".builder"; //$NON-NLS-1$
+ subName = name + ".builder"; //$NON-NLS-1$
+ IBuilder builder = toolChain.createBuilder(null, subId, subName, true);
+ // Set the builder attributes
+ builder.setIsAbstract(isAbstract);
+ builder.setCommand(getMakeCommand());
+ builder.setArguments(getMakeArguments());
+ if (element instanceof DefaultManagedConfigElement) {
+ builder.setBuildFileGeneratorElement(((DefaultManagedConfigElement)element).getConfigurationElement());
+ }
+ // Create the TargetPlatform
+ subId = id + ".targetplatform"; //$NON-NLS-1$
+ subName = name + ".targetplatform"; //$NON-NLS-1$
+ ITargetPlatform targetPlatform = toolChain.createTargetPlatform(null, subId, subName, true);
+ // Set the target platform attributes
+ targetPlatform.setIsAbstract(isAbstract);
+ targetPlatform.setOSList(getTargetOSList());
+ targetPlatform.setArchList(getTargetArchList());
+ targetPlatform.setBinaryParserId(getBinaryParserId());
+
+ // Handle ConfigurationV2 children (ToolReference)
+ // The tools references fetched here are strictly local to the configuration,
+ // so additional work is required to fetch the tool references from the target
+ IToolReference[] configToolRefs = configV2.getToolReferences();
+ // Add the "local" tool references (they are direct children of the target and
+ // its parent targets)
+ Vector targetToolRefs = new Vector();
+ addTargetToolReferences(targetToolRefs);
+ IToolReference[] toolRefs;
+ if (targetToolRefs.size() > 0) {
+ toolRefs = new IToolReference[targetToolRefs.size() + configToolRefs.length];
+ int i;
+ for (i = 0; i < configToolRefs.length; ++i) {
+ toolRefs[i] = configToolRefs[i];
+ }
+ Iterator localToolRefIter = targetToolRefs.iterator();
+ while (localToolRefIter.hasNext()) {
+ toolRefs[i++] = (IToolReference)localToolRefIter.next();
+ }
+ } else {
+ toolRefs = configToolRefs;
+ }
+ for (int i = 0; i < toolRefs.length; ++i) {
+ IToolReference toolRef = toolRefs[i];
+ subId = id + "." + toolRef.getId(); //$NON-NLS-1$
+ // The ToolReference's Tool becomes the newTool's SuperClass
+ ITool newTool = toolChain.createTool(toolRef.getTool(), subId, toolRef.getName(), true);
+ // Set the tool attributes
+ newTool.setToolCommand(toolRef.getRawToolCommand());
+ newTool.setOutputPrefix(toolRef.getRawOutputPrefix());
+ newTool.setOutputFlag(toolRef.getRawOutputFlag());
+ newTool.setOutputExtensions(toolRef.getRawOutputExtensions());
+ // Handle ToolReference children (OptionReference)
+ Iterator optRefIter = toolRef.getOptionReferenceList().listIterator();
+ while (optRefIter.hasNext()) {
+ OptionReference optRef = (OptionReference)optRefIter.next();
+ subId = id + "." + optRef.getId(); //$NON-NLS-1$
+ IOption newOption = newTool.createOption(optRef.getOption(), subId, optRef.getName(), true);
+ // Set the option attributes
+ newOption.setValue(optRef.getValue());
+ newOption.setValueType(optRef.getValueType());
+ }
+ }
+
+ // Process the tools in the configuration, adding them to the toolchain
+ // Tools for a configuration are stored in the enclosing target, so getting
+ // the tools for the configuration ultimately gets them from the enclosing target
+ ITool[] configTools = configV2.getTools();
+ for (int i = 0; i < configTools.length; ++i) {
+ ITool tool = configTools[i];
+ // If tool references encountered, they have already been processed, above,
+ // so ignore them now
+ if (!(tool instanceof ToolReference)) {
+ // See if the toolchain already has a tool with a SuperClass that has an id
+ // equal to the tool that we are considering adding to the toolchain; if so,
+ // don't add it
+ // This case arises when we have added a tool to the toolchain because
+ // we processed a ToolReference (above) that references this tool
+ // The original tool referenced in the ToolReference becomes the SuperClass
+ // of the tool that is created because of the ToolReference
+ boolean found = false;
+ ITool[] tools = toolChain.getTools();
+ ITool currentTool;
+ ITool supercurrentTool;
+ for (int j = 0; j < tools.length; ++j) {
+ currentTool = tools[j];
+ supercurrentTool = currentTool.getSuperClass();
+ if (supercurrentTool != null) {
+ if (supercurrentTool.getId() == tool.getId()) {
+ found = true;
+ // If this tool was already added to the toolchain because of a
+ // ToolReference, then we disconnent this redundant
+ // tool from the target by setting the parent to null
+ ((Tool)tool).setToolParent(null);
+ break;
+ }
+ }
+ }
+
+ if (!found)
+ // This tool is not in the toolchain yet, so add it to the toolchain
+ ((ToolChain)toolChain).addTool((Tool)tool);
+
+ }
+ }
+ // Normalize the outputextensions list by adding an empty string for each tool
+ // which did not have an explicit output file extension specified
+ ((ToolChain)toolChain).normalizeOutputExtensions();
+ }
+ }
+
+ /*
+ * A target element may contain toolReference elements. These get applied to all of the configurations
+ * of the target. The method adds the list of this target's local tool references to the passed in vector.
+ */
+ public void addTargetToolReferences(Vector toolRefs) {
+ toolRefs.addAll(getLocalToolReferences());
+ if (parent != null) {
+ Target targetParent = (Target)parent;
+ targetParent.addTargetToolReferences(toolRefs);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITarget#getCreatedProjectType()
+ */
+ public ProjectType getCreatedProjectType() {
+ return createdProjectType;
+ }
+
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java
new file mode 100644
index 00000000000..9cf870fc046
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java
@@ -0,0 +1,531 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.core;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.cdt.managedbuilder.core.IBuildObject;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
+import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class TargetPlatform extends BuildObject implements ITargetPlatform {
+
+ private static final String EMPTY_STRING = new String();
+
+ // Superclass
+ private ITargetPlatform superClass;
+ private String superClassId;
+ // Parent and children
+ private IToolChain parent;
+ // Managed Build model attributes
+ private String unusedChildren;
+ private String errorParserIds;
+ private Boolean isAbstract;
+ private List osList;
+ private List archList;
+ private String binaryParserId;
+ // Miscellaneous
+ private boolean isExtensionTargetPlatform = false;
+ private boolean isDirty = false;
+ private boolean resolved = true;
+
+ /*
+ * C O N S T R U C T O R S
+ */
+
+ /**
+ * This constructor is called to create a TargetPlatform defined by an
+ * extension point in a plugin manifest file, or returned by a dynamic element provider
+ *
+ * @param parent The IToolChain parent of this TargetPlatform, or <code>null</code> if
+ * defined at the top level
+ * @param element The TargetPlatform definition from the manifest file or a dynamic element
+ * provider
+ */
+ public TargetPlatform(IToolChain parent, IManagedConfigElement element) {
+ this.parent = parent;
+ isExtensionTargetPlatform = true;
+
+ // setup for resolving
+ resolved = false;
+
+ loadFromManifest(element);
+
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionTargetPlatform(this);
+ }
+
+ /**
+ * This constructor is called to create a TargetPlatform whose attributes and children will be
+ * added by separate calls.
+ *
+ * @param ToolChain The parent of the builder, if any
+ * @param TargetPlatform The superClass, if any
+ * @param String The id for the new tool chain
+ * @param String The name for the new tool chain
+ * @param boolean Indicates whether this is an extension element or a managed project element
+ */
+ public TargetPlatform(ToolChain parent, ITargetPlatform superClass, String Id, String name, boolean isExtensionElement) {
+ this.parent = parent;
+ this.superClass = superClass;
+ if (this.superClass != null) {
+ superClassId = this.superClass.getId();
+ }
+ setId(Id);
+ setName(name);
+ isExtensionTargetPlatform = isExtensionElement;
+ if (isExtensionElement) {
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionTargetPlatform(this);
+ } else {
+ setDirty(true);
+ }
+ }
+
+ /**
+ * Create a <code>TargetPlatform</code> based on the specification stored in the
+ * project file (.cdtbuild).
+ *
+ * @param parent The <code>IToolChain</code> the TargetPlatform will be added to.
+ * @param element The XML element that contains the TargetPlatform settings.
+ */
+ public TargetPlatform(IToolChain parent, Element element) {
+ this.parent = parent;
+ isExtensionTargetPlatform = false;
+
+ // Initialize from the XML attributes
+ loadFromProject(element);
+ }
+
+ /**
+ * Create a <code>TargetPlatform</code> based upon an existing TargetPlatform.
+ *
+ * @param parent The <code>IToolChain</code> the TargetPlatform will be added to.
+ * @param builder The existing TargetPlatform to clone.
+ */
+ public TargetPlatform(IToolChain parent, String Id, String name, TargetPlatform targetPlatform) {
+ this.parent = parent;
+ superClass = targetPlatform.superClass;
+ if (superClass != null) {
+ if (targetPlatform.superClassId != null) {
+ superClassId = new String(targetPlatform.superClassId);
+ }
+ }
+ setId(Id);
+ setName(name);
+ isExtensionTargetPlatform = false;
+
+ // Copy the remaining attributes
+ if (targetPlatform.unusedChildren != null) {
+ unusedChildren = new String(targetPlatform.unusedChildren);
+ }
+ if (targetPlatform.errorParserIds != null) {
+ errorParserIds = new String(targetPlatform.errorParserIds);
+ }
+ if (targetPlatform.isAbstract != null) {
+ isAbstract = new Boolean(targetPlatform.isAbstract.booleanValue());
+ }
+ if (targetPlatform.osList != null) {
+ osList = new ArrayList(targetPlatform.osList);
+ }
+ if (targetPlatform.archList != null) {
+ archList = new ArrayList(targetPlatform.archList);
+ }
+ if (targetPlatform.binaryParserId != null) {
+ binaryParserId = new String(targetPlatform.binaryParserId);
+ }
+
+ setDirty(true);
+ }
+
+ /*
+ * E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S
+ */
+
+ /* (non-Javadoc)
+ * Loads the target platform information from the ManagedConfigElement specified in the
+ * argument.
+ *
+ * @param element Contains the tool-chain information
+ */
+ protected void loadFromManifest(IManagedConfigElement element) {
+ ManagedBuildManager.putConfigElement(this, element);
+
+ // id
+ setId(element.getAttribute(IBuildObject.ID));
+
+ // Get the name
+ setName(element.getAttribute(IBuildObject.NAME));
+
+ // superClass
+ superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+
+ // Get the unused children, if any
+ unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+
+ // isAbstract
+ String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
+ if (isAbs != null){
+ isAbstract = new Boolean("true".equals(isAbs)); //$NON-NLS-1$
+ }
+
+ // Get the comma-separated list of valid OS
+ String os = element.getAttribute(OS_LIST);
+ if (os != null) {
+ osList = new ArrayList();
+ String[] osTokens = os.split(","); //$NON-NLS-1$
+ for (int i = 0; i < osTokens.length; ++i) {
+ osList.add(osTokens[i].trim());
+ }
+ }
+
+ // Get the comma-separated list of valid Architectures
+ String arch = element.getAttribute(ARCH_LIST);
+ if (arch != null) {
+ archList = new ArrayList();
+ String[] archTokens = arch.split(","); //$NON-NLS-1$
+ for (int j = 0; j < archTokens.length; ++j) {
+ archList.add(archTokens[j].trim());
+ }
+ }
+
+ // Get the ID of the binary parser
+ binaryParserId = element.getAttribute(BINARY_PARSER);
+ }
+
+ /* (non-Javadoc)
+ * Initialize the target platform information from the XML element
+ * specified in the argument
+ *
+ * @param element An XML element containing the target platform information
+ */
+ protected void loadFromProject(Element element) {
+
+ // id
+ setId(element.getAttribute(IBuildObject.ID));
+
+ // name
+ if (element.hasAttribute(IBuildObject.NAME)) {
+ setName(element.getAttribute(IBuildObject.NAME));
+ }
+
+ // superClass
+ superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ if (superClassId != null && superClassId.length() > 0) {
+ superClass = ManagedBuildManager.getExtensionTargetPlatform(superClassId);
+ if (superClass == null) {
+ // TODO: Report error
+ }
+ }
+
+ // Get the unused children, if any
+ if (element.hasAttribute(IProjectType.UNUSED_CHILDREN)) {
+ unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ }
+
+ // isAbstract
+ if (element.hasAttribute(IProjectType.IS_ABSTRACT)) {
+ String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
+ if (isAbs != null){
+ isAbstract = new Boolean("true".equals(isAbs)); //$NON-NLS-1$
+ }
+ }
+
+ // Get the comma-separated list of valid OS
+ if (element.hasAttribute(OS_LIST)) {
+ String os = element.getAttribute(OS_LIST);
+ if (os != null) {
+ osList = new ArrayList();
+ String[] osTokens = os.split(","); //$NON-NLS-1$
+ for (int i = 0; i < osTokens.length; ++i) {
+ osList.add(osTokens[i].trim());
+ }
+ }
+ }
+
+ // Get the comma-separated list of valid Architectures
+ if (element.hasAttribute(ARCH_LIST)) {
+ String arch = element.getAttribute(ARCH_LIST);
+ if (arch != null) {
+ archList = new ArrayList();
+ String[] archTokens = arch.split(","); //$NON-NLS-1$
+ for (int j = 0; j < archTokens.length; ++j) {
+ archList.add(archTokens[j].trim());
+ }
+ }
+ }
+
+ // binaryParserId
+ if (element.hasAttribute(BINARY_PARSER)) {
+ binaryParserId = element.getAttribute(BINARY_PARSER);
+ }
+
+ }
+
+ /**
+ * Persist the target platform to the project file.
+ *
+ * @param doc
+ * @param element
+ */
+ public void serialize(Document doc, Element element) {
+ if (superClass != null)
+ element.setAttribute(IProjectType.SUPERCLASS, superClass.getId());
+
+ element.setAttribute(IBuildObject.ID, id);
+
+ if (name != null) {
+ element.setAttribute(IBuildObject.NAME, name);
+ }
+
+ if (unusedChildren != null) {
+ element.setAttribute(IProjectType.UNUSED_CHILDREN, unusedChildren);
+ }
+
+ if (isAbstract != null) {
+ element.setAttribute(IProjectType.IS_ABSTRACT, isAbstract.toString());
+ }
+
+ if (binaryParserId != null) {
+ element.setAttribute(BINARY_PARSER, binaryParserId);
+ }
+
+ if (osList != null) {
+ Iterator osIter = osList.listIterator();
+ String listValue = EMPTY_STRING;
+ while (osIter.hasNext()) {
+ String current = (String) osIter.next();
+ listValue += current;
+ if ((osIter.hasNext())) {
+ listValue += ","; //$NON-NLS-1$
+ }
+ }
+ element.setAttribute(OS_LIST, listValue);
+ }
+
+ if (archList != null) {
+ Iterator archIter = archList.listIterator();
+ String listValue = EMPTY_STRING;
+ while (archIter.hasNext()) {
+ String current = (String) archIter.next();
+ listValue += current;
+ if ((archIter.hasNext())) {
+ listValue += ","; //$NON-NLS-1$
+ }
+ }
+ element.setAttribute(ARCH_LIST, listValue);
+ }
+
+ // I am clean now
+ isDirty = false;
+ }
+
+ /*
+ * P A R E N T A N D C H I L D H A N D L I N G
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITargetPlatform#getParent()
+ */
+ public IToolChain getParent() {
+ return parent;
+ }
+
+ /*
+ * M O D E L A T T R I B U T E A C C E S S O R S
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITargetPlatform#getSuperClass()
+ */
+ public ITargetPlatform getSuperClass() {
+ return superClass;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITargetPlatform#getName()
+ */
+ public String getName() {
+ return (name == null && superClass != null) ? superClass.getName() : name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITargetPlatform#isAbstract()
+ */
+ public boolean isAbstract() {
+ if (isAbstract != null) {
+ return isAbstract.booleanValue();
+ } else {
+ return false; // Note: no inheritance from superClass
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITargetPlatform#getUnusedChildren()
+ */
+ public String getUnusedChildren() {
+ if (unusedChildren != null) {
+ return unusedChildren;
+ } else
+ return EMPTY_STRING; // Note: no inheritance from superClass
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITargetPlatform#getBinaryParserI()
+ */
+ public String getBinaryParserId() {
+ if (binaryParserId == null) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ return superClass.getBinaryParserId();
+ } else {
+ return EMPTY_STRING;
+ }
+ }
+ return binaryParserId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITargetPlatform#getArchList()
+ */
+ public String[] getArchList() {
+ if (archList == null) {
+ // Ask superClass for its list
+ if (superClass != null) {
+ return superClass.getArchList();
+ } else {
+ // I have no superClass and no defined list
+ return new String[] {"all"}; //$NON-NLS-1$
+ }
+ }
+ return (String[]) archList.toArray(new String[archList.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITargetPlatform#getOSList()
+ */
+ public String[] getOSList() {
+ if (osList == null) {
+ // Ask superClass for its list
+ if (superClass != null) {
+ return superClass.getOSList();
+ } else {
+ // I have no superClass and no defined filter list
+ return new String[] {"all"}; //$NON-NLS-1$
+ }
+ }
+ return (String[]) osList.toArray(new String[osList.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuilder#setBinaryParserId(String)
+ */
+ public void setBinaryParserId(String id) {
+ if (id == null && binaryParserId == null) return;
+ if (binaryParserId == null || id == null || !id.equals(binaryParserId)) {
+ binaryParserId = id;
+ setDirty(true);
+ }
+ }
+
+ /* (non-Javadoc)
+ * Sets the isAbstract attribute
+ */
+ public void setIsAbstract(boolean b) {
+ isAbstract = new Boolean(b);
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * Sets the OS list.
+ *
+ * @param String[] The list of OS names
+ */
+ public void setOSList(String[] OSs) {
+ if (osList == null) {
+ osList = new ArrayList();
+ } else {
+ osList.clear();
+ }
+ for (int i = 0; i < OSs.length; i++) {
+ osList.add(OSs[i]);
+ }
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * Sets the architecture list.
+ *
+ * @param String[] The list of OS names
+ */
+ public void setArchList(String[] archs) {
+ if (archList == null) {
+ archList = new ArrayList();
+ } else {
+ archList.clear();
+ }
+ for (int i = 0; i < archs.length; i++) {
+ archList.add(archs[i]);
+ }
+ setDirty(true);
+ }
+
+ /*
+ * O B J E C T S T A T E M A I N T E N A N C E
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#isExtensionElement()
+ */
+ public boolean isExtensionElement() {
+ return isExtensionTargetPlatform;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#isDirty()
+ */
+ public boolean isDirty() {
+ // This shouldn't be called for an extension Builder
+ if (isExtensionTargetPlatform) return false;
+ return isDirty;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#setDirty(boolean)
+ */
+ public void setDirty(boolean isDirty) {
+ this.isDirty = isDirty;
+ }
+
+ /* (non-Javadoc)
+ * Resolve the element IDs to interface references
+ */
+ public void resolveReferences() {
+ if (!resolved) {
+ resolved = true;
+ // Resolve superClass
+ if (superClassId != null && superClassId.length() > 0) {
+ superClass = ManagedBuildManager.getExtensionTargetPlatform(superClassId);
+ if (superClass == null) {
+ // TODO: Report error
+ }
+ }
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
index 313f5df2ac4..62cdb1823b0 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
@@ -20,13 +20,21 @@ import java.util.StringTokenizer;
import java.util.Vector;
import org.eclipse.cdt.managedbuilder.core.BuildException;
+import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.managedbuilder.core.IToolReference;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* Represents a tool that can be invoked during a build.
@@ -35,25 +43,45 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
*/
public class Tool extends BuildObject implements ITool, IOptionCategory {
+ public static final String DEFAULT_PATTERN = "${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}"; //$NON-NLS-1$
+
private static final String DEFAULT_SEPARATOR = ","; //$NON-NLS-1$
private static final IOptionCategory[] EMPTY_CATEGORIES = new IOptionCategory[0];
private static final IOption[] EMPTY_OPTIONS = new IOption[0];
+ private static final String EMPTY_STRING = new String();
+ // Superclass
+ private ITool superClass;
+ private String superClassId;
+ // Parent and children
+ private IBuildObject parent;
private Vector categoryIds;
private Map categoryMap;
private List childOptionCategories;
+ private Vector optionList;
+ private Map optionMap;
+ // Managed Build model attributes
+ private String unusedChildren;
+ private Boolean isAbstract;
private String command;
private List inputExtensions;
private List interfaceExtensions;
- private int natureFilter;
- private Vector optionList;
- private Map optionMap;
+ private Integer natureFilter;
private String outputExtensions;
private String outputFlag;
private String outputPrefix;
+ private String errorParserIds;
+ private String commandLinePattern;
+ // Miscellaneous
+ private boolean isExtensionTool = false;
+ private boolean isDirty = false;
private boolean resolved = true;
-
+ private IManagedCommandLineGenerator commandLineGenerator = null;
+ /*
+ * C O N S T R U C T O R S
+ */
+
/**
* Constructor to create a tool based on an element from the plugin
* manifest.
@@ -61,24 +89,741 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
* @param element The element containing the information about the tool.
*/
public Tool(IManagedConfigElement element) {
+ isExtensionTool = true;
+
+ // setup for resolving
+ resolved = false;
+
loadFromManifest(element);
// hook me up
ManagedBuildManager.addExtensionTool(this);
+
+ // set up the category map
+ addOptionCategory(this);
+
+ // Check for optionList
+ IManagedConfigElement[] toolElements = element.getChildren();
+ for (int l = 0; l < toolElements.length; ++l) {
+ IManagedConfigElement toolElement = toolElements[l];
+ if (toolElement.getName().equals(ITool.OPTION)) {
+ Option option = new Option(this, toolElement);
+ addOption(option);
+ } else if (toolElement.getName().equals(ITool.OPTION_CAT)) {
+ new OptionCategory(this, toolElement);
+ }
+ }
}
/**
- * Constructor to create a new tool for a target based on the information
+ * Constructor to create a new tool for a tool-chain based on the information
* defined in the plugin.xml manifest.
*
- * @param target The target the receiver will belong to.
+ * @param parent The parent of this tool. This can be a ToolChain or a
+ * ResourceConfiguration.
* @param element The element containing the information about the tool.
*/
- public Tool(Target target, IManagedConfigElement element) {
- loadFromManifest(element);
+ public Tool(IBuildObject parent, IManagedConfigElement element) {
+ this(element);
+ this.parent = parent;
+ }
+
+ /**
+ * This constructor is called to create a Tool whose attributes and children will be
+ * added by separate calls.
+ *
+ * @param ToolChain The parent of the tool, if any
+ * @param Tool The superClass, if any
+ * @param String The id for the new tool
+ * @param String The name for the new tool
+ * @param boolean Indicates whether this is an extension element or a managed project element
+ */
+ public Tool(ToolChain parent, ITool superClass, String Id, String name, boolean isExtensionElement) {
+ this.parent = parent;
+ this.superClass = superClass;
+ if (this.superClass != null) {
+ superClassId = this.superClass.getId();
+ }
+ setId(Id);
+ setName(name);
+ isExtensionTool = isExtensionElement;
+ if (isExtensionElement) {
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionTool(this);
+ } else {
+ setDirty(true);
+ }
+ }
+
+ /**
+ * This constructor is called to create a Tool whose attributes and children will be
+ * added by separate calls.
+ *
+ * @param ResourceConfiguration, The parent of the tool, if any
+ * @param Tool The superClass, if any
+ * @param String The id for the new tool
+ * @param String The name for the new tool
+ * @param boolean Indicates whether this is an extension element or a managed project element
+ */
+
+ public Tool(ResourceConfiguration parent, ITool superClass, String Id, String name, boolean isExtensionElement) {
+ this.parent = parent;
+ this.superClass = superClass;
+ if (this.superClass != null) {
+ superClassId = this.superClass.getId();
+ }
+ setId(Id);
+ setName(name);
+ isExtensionTool = isExtensionElement;
+ if (isExtensionElement) {
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionTool(this);
+ } else {
+ setDirty(true);
+ }
+ }
+
+ /**
+ * Create a <code>Tool</code> based on the specification stored in the
+ * project file (.cdtbuild).
+ *
+ * @param parent The <code>IToolChain</code> or <code>IResourceConfiguration</code>
+ * the tool will be added to.
+ * @param element The XML element that contains the tool settings.
+ */
+ public Tool(IBuildObject parent, Element element) {
+ this.parent = parent;
+ isExtensionTool = false;
- // hook me up
- target.addTool(this);
+ // Initialize from the XML attributes
+ loadFromProject(element);
+
+ // set up the category map
+ addOptionCategory(this);
+
+ // Check for optionList
+ NodeList toolElements = element.getChildNodes();
+ for (int i = 0; i < toolElements.getLength(); ++i) {
+ Node toolElement = toolElements.item(i);
+ if (toolElement.getNodeName().equals(ITool.OPTION)) {
+ Option option = new Option(this, (Element)toolElement);
+ addOption(option);
+ } else if (toolElement.getNodeName().equals(ITool.OPTION_CAT)) {
+ new OptionCategory(this, (Element)toolElement);
+ }
+ }
+ }
+
+ /**
+ * Create a <code>Tool</code> based upon an existing tool.
+ *
+ * @param parent The <code>IToolChain</code> or <code>IResourceConfiguration</code>
+ * the tool will be added to.
+ * @param tool The existing tool to clone.
+ */
+ public Tool(IBuildObject parent, ITool toolSuperClass, String Id, String name, Tool tool){
+ this.parent = parent;
+ if (toolSuperClass != null) {
+ superClass = toolSuperClass;
+ } else {
+ superClass = tool.superClass;
+ }
+ if (superClass != null) {
+ superClassId = superClass.getId();
+ }
+ setId(Id);
+ setName(name);
+ isExtensionTool = false;
+
+ // Copy the remaining attributes
+ if (tool.unusedChildren != null) {
+ unusedChildren = new String(tool.unusedChildren);
+ }
+ if (tool.errorParserIds != null) {
+ errorParserIds = new String(tool.errorParserIds);
+ }
+ if (tool.isAbstract != null) {
+ isAbstract = new Boolean(tool.isAbstract.booleanValue());
+ }
+ if (tool.command != null) {
+ command = new String(tool.command);
+ }
+ if (tool.inputExtensions != null) {
+ inputExtensions = new ArrayList(tool.inputExtensions);
+ }
+ if (tool.interfaceExtensions != null) {
+ interfaceExtensions = new ArrayList(tool.interfaceExtensions);
+ }
+ if (tool.natureFilter != null) {
+ natureFilter = new Integer(tool.natureFilter.intValue());
+ }
+ if (tool.outputExtensions != null) {
+ outputExtensions = new String(tool.outputExtensions);
+ }
+ if (tool.outputFlag != null) {
+ outputFlag = new String(tool.outputFlag);
+ }
+ if (tool.outputPrefix != null) {
+ outputPrefix = new String(tool.outputPrefix);
+ }
+
+ // Clone the children
+ // Note: This constructor ignores OptionCategories since they should not be
+ // found on an non-extension tool
+ if (tool.optionList != null) {
+ Iterator iter = tool.getOptionList().listIterator();
+ while (iter.hasNext()) {
+ Option option = (Option) iter.next();
+ int nnn = ManagedBuildManager.getRandomNumber();
+ String subId;
+ String subName;
+ if (option.getSuperClass() != null) {
+ subId = option.getSuperClass().getId() + "." + nnn; //$NON-NLS-1$
+ subName = option.getSuperClass().getName();
+ } else {
+ subId = option.getId() + "." + nnn; //$NON-NLS-1$
+ subName = option.getName();
+ }
+ Option newOption = new Option(this, subId, subName, option);
+ addOption(newOption);
+ }
+ }
+
+ setDirty(true);
+ }
+
+ /*
+ * E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S
+ */
+
+ /* (non-Javadoc)
+ * Load the tool information from the XML element specified in the
+ * argument
+ * @param element An XML element containing the tool information
+ */
+ protected void loadFromManifest(IManagedConfigElement element) {
+ // setup for resolving
+ ManagedBuildManager.putConfigElement(this, element);
+
+ // id
+ setId(element.getAttribute(ITool.ID));
+
+ // name
+ setName(element.getAttribute(ITool.NAME));
+
+ // superClass
+ superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+
+ // Get the unused children, if any
+ unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+
+ // isAbstract
+ String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
+ if (isAbs != null){
+ isAbstract = new Boolean("true".equals(isAbs)); //$NON-NLS-1$
+ }
+
+ // Get the semicolon separated list of IDs of the error parsers
+ errorParserIds = element.getAttribute(IToolChain.ERROR_PARSERS);
+
+ // Get the nature filter
+ String nature = element.getAttribute(NATURE);
+ if (nature != null) {
+ if ("both".equals(nature)) { //$NON-NLS-1$
+ natureFilter = new Integer(FILTER_BOTH);
+ } else if ("cnature".equals(nature)) { //$NON-NLS-1$
+ natureFilter = new Integer(FILTER_C);
+ } else if ("ccnature".equals(nature)) { //$NON-NLS-1$
+ natureFilter = new Integer(FILTER_CC);
+ } else {
+ natureFilter = new Integer(FILTER_BOTH);
+ }
+ }
+
+ // Get the supported input file extensions
+ String inputs = element.getAttribute(ITool.SOURCES);
+ if (inputs != null) {
+ StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
+ while (tokenizer.hasMoreElements()) {
+ getInputExtensionsList().add(tokenizer.nextElement());
+ }
+ }
+
+ // Get the interface (header file) extensions
+ String headers = element.getAttribute(INTERFACE_EXTS);
+ if (headers != null) {
+ StringTokenizer tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR);
+ while (tokenizer.hasMoreElements()) {
+ getInterfaceExtensionsList().add(tokenizer.nextElement());
+ }
+ }
+
+ // Get the output extension
+ outputExtensions = element.getAttribute(ITool.OUTPUTS);
+
+ // Get the tool invocation command
+ command = element.getAttribute(ITool.COMMAND);
+
+ // Get the flag to control output
+ outputFlag = element.getAttribute(ITool.OUTPUT_FLAG);
+
+ // Get the output prefix
+ outputPrefix = element.getAttribute(ITool.OUTPUT_PREFIX);
+
+ // Get command line pattern
+ commandLinePattern = element.getAttribute( ITool.COMMAND_LINE_PATTERN );
+ }
+
+ /* (non-Javadoc)
+ * Initialize the tool information from the XML element
+ * specified in the argument
+ *
+ * @param element An XML element containing the tool information
+ */
+ protected void loadFromProject(Element element) {
+
+ // id
+ setId(element.getAttribute(IBuildObject.ID));
+
+ // name
+ if (element.hasAttribute(IBuildObject.NAME)) {
+ setName(element.getAttribute(IBuildObject.NAME));
+ }
+
+ // superClass
+ superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ if (superClassId != null && superClassId.length() > 0) {
+ if( getParent() instanceof IResourceConfiguration ) {
+ IResourceConfiguration resConfig = (IResourceConfiguration) getParent();
+ superClass = resConfig.getParent().getTool(superClassId);
+ } else {
+ superClass = ManagedBuildManager.getExtensionTool(superClassId);
+ }
+ if (superClass == null) {
+ // TODO: Report error
+ }
+ }
+
+ // Get the unused children, if any
+ if (element.hasAttribute(IProjectType.UNUSED_CHILDREN)) {
+ unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ }
+
+ // isAbstract
+ if (element.hasAttribute(IProjectType.IS_ABSTRACT)) {
+ String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
+ if (isAbs != null){
+ isAbstract = new Boolean("true".equals(isAbs)); //$NON-NLS-1$
+ }
+ }
+
+ // Get the semicolon separated list of IDs of the error parsers
+ if (element.hasAttribute(IToolChain.ERROR_PARSERS)) {
+ errorParserIds = element.getAttribute(IToolChain.ERROR_PARSERS);
+ }
+
+ // Get the nature filter
+ if (element.hasAttribute(NATURE)) {
+ String nature = element.getAttribute(NATURE);
+ if (nature != null) {
+ if ("both".equals(nature)) { //$NON-NLS-1$
+ natureFilter = new Integer(FILTER_BOTH);
+ } else if ("cnature".equals(nature)) { //$NON-NLS-1$
+ natureFilter = new Integer(FILTER_C);
+ } else if ("ccnature".equals(nature)) { //$NON-NLS-1$
+ natureFilter = new Integer(FILTER_CC);
+ } else {
+ natureFilter = new Integer(FILTER_BOTH);
+ }
+ }
+ }
+
+ // Get the supported input file extension
+ if (element.hasAttribute(ITool.SOURCES)) {
+ String inputs = element.getAttribute(ITool.SOURCES);
+ if (inputs != null) {
+ StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
+ while (tokenizer.hasMoreElements()) {
+ getInputExtensionsList().add(tokenizer.nextElement());
+ }
+ }
+ }
+
+ // Get the interface (header file) extensions
+ if (element.hasAttribute(INTERFACE_EXTS)) {
+ String headers = element.getAttribute(INTERFACE_EXTS);
+ if (headers != null) {
+ StringTokenizer tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR);
+ while (tokenizer.hasMoreElements()) {
+ getInterfaceExtensionsList().add(tokenizer.nextElement());
+ }
+ }
+ }
+
+ // Get the output extension
+ if (element.hasAttribute(ITool.OUTPUTS)) {
+ outputExtensions = element.getAttribute(ITool.OUTPUTS);
+ }
+
+ // Get the tool invocation command
+ if (element.hasAttribute(ITool.COMMAND)) {
+ command = element.getAttribute(ITool.COMMAND);
+ }
+
+ // Get the flag to control output
+ if (element.hasAttribute(ITool.OUTPUT_FLAG)) {
+ outputFlag = element.getAttribute(ITool.OUTPUT_FLAG);
+ }
+
+ // Get the output prefix
+ if (element.hasAttribute(ITool.OUTPUT_PREFIX)) {
+ outputPrefix = element.getAttribute(ITool.OUTPUT_PREFIX);
+ }
+
+ // Get command line pattern
+ if( element.hasAttribute( ITool.COMMAND_LINE_PATTERN ) ) {
+ commandLinePattern = element.getAttribute( ITool.COMMAND_LINE_PATTERN );
+ }
+ }
+
+ /**
+ * Persist the tool to the project file.
+ *
+ * @param doc
+ * @param element
+ */
+ public void serialize(Document doc, Element element) {
+ try {
+ if (superClass != null)
+ element.setAttribute(IProjectType.SUPERCLASS, superClass.getId());
+
+ // id
+ element.setAttribute(IBuildObject.ID, id);
+
+ // name
+ if (name != null) {
+ element.setAttribute(IBuildObject.NAME, name);
+ }
+
+ // unused children
+ if (unusedChildren != null) {
+ element.setAttribute(IProjectType.UNUSED_CHILDREN, unusedChildren);
+ }
+
+ // isAbstract
+ if (isAbstract != null) {
+ element.setAttribute(IProjectType.IS_ABSTRACT, isAbstract.toString());
+ }
+
+ // error parsers
+ if (errorParserIds != null) {
+ element.setAttribute(IToolChain.ERROR_PARSERS, errorParserIds);
+ }
+
+ // nature filter
+ if (natureFilter != null) {
+ String nature;
+ if (natureFilter.intValue() == FILTER_C) {
+ nature = "cnature"; //$NON-NLS-1$
+ } else if (natureFilter.intValue() == FILTER_CC) {
+ nature = "ccnature"; //$NON-NLS-1$
+ } else {
+ nature = "both"; //$NON-NLS-1$
+ }
+ element.setAttribute(NATURE, nature);
+ }
+
+ // input file extensions
+ if (getInputExtensionsList().size() > 0) {
+ String inputs;
+ List list = getInputExtensionsList();
+ Iterator iter = list.listIterator();
+ inputs = (String)iter.next();
+ while (iter.hasNext()) {
+ inputs += DEFAULT_SEPARATOR;
+ inputs += iter.next();
+ }
+ element.setAttribute(ITool.SOURCES, inputs);
+ }
+
+ // interface (header file) extensions
+ if (getInterfaceExtensionsList().size() > 0) {
+ String headers;
+ List list = getInterfaceExtensionsList();
+ Iterator iter = list.listIterator();
+ headers = (String)iter.next();
+ while (iter.hasNext()) {
+ headers += DEFAULT_SEPARATOR;
+ headers += iter.next();
+ }
+ element.setAttribute(INTERFACE_EXTS, headers);
+ }
+
+ // output extension
+ if (outputExtensions != null) {
+ element.setAttribute(ITool.OUTPUTS, outputExtensions);
+ }
+
+ // command
+ if (command != null) {
+ element.setAttribute(ITool.COMMAND, command);
+ }
+
+ // flag to control output
+ if (outputFlag != null) {
+ element.setAttribute(ITool.OUTPUT_FLAG, outputFlag);
+ }
+
+ // output prefix
+ if (outputPrefix != null) {
+ element.setAttribute(ITool.OUTPUT_PREFIX, outputPrefix);
+ }
+
+ // command line pattern
+ if (commandLinePattern != null) {
+ element.setAttribute(ITool.COMMAND_LINE_PATTERN, commandLinePattern);
+ }
+
+ // Serialize my children
+ if (childOptionCategories != null) {
+ Iterator iter = childOptionCategories.listIterator();
+ while (iter.hasNext()) {
+ OptionCategory optCat = (OptionCategory)iter.next();
+ Element optCatElement = doc.createElement(OPTION);
+ element.appendChild(optCatElement);
+ optCat.serialize(doc, optCatElement);
+ }
+ }
+ List optionElements = getOptionList();
+ Iterator iter = optionElements.listIterator();
+ while (iter.hasNext()) {
+ Option option = (Option) iter.next();
+ Element optionElement = doc.createElement(OPTION);
+ element.appendChild(optionElement);
+ option.serialize(doc, optionElement);
+ }
+
+ // I am clean now
+ isDirty = false;
+ } catch (Exception e) {
+ // TODO: issue an error message
+ }
+ }
+
+ /*
+ * P A R E N T A N D C H I L D H A N D L I N G
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getParent()
+ */
+ public IBuildObject getParent() {
+ return parent;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setParent(IBuildObject)
+ */
+ public void setToolParent(IBuildObject newParent) {
+ this.parent = newParent;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#createOption(IOption, String, String, boolean)
+ */
+ public IOption createOption(IOption superClass, String Id, String name, boolean isExtensionElement) {
+ Option option = new Option(this, superClass, Id, name, isExtensionElement);
+ addOption(option);
+ setDirty(true);
+ return option;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#createOption(IOption, String, String, boolean)
+ */
+ public void removeOption(IOption option) {
+ getOptionList().remove(option);
+ getOptionMap().remove(option.getId());
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getOptions()
+ */
+ public IOption[] getOptions() {
+ IOption[] options = null;
+ // Merge our options with our superclass' options.
+ if (superClass != null) {
+ options = superClass.getOptions();
+ }
+ // Our options take precedence.
+ Vector ourOpts = getOptionList();
+ if (options != null) {
+ for (int i = 0; i < ourOpts.size(); i++) {
+ IOption ourOpt = (IOption)ourOpts.get(i);
+ int j;
+ for (j = 0; j < options.length; j++) {
+ if (options[j].overridesOnlyValue()) {
+ if (ourOpt.getSuperClass().getId().equals(options[j].getSuperClass().getId())) {
+ options[j] = ourOpt;
+ break;
+ }
+ } else {
+ if (ourOpt.getSuperClass().getId().equals(options[j].getId())) {
+ options[j] = ourOpt;
+ break;
+ }
+ }
+ }
+ // No Match? Add it.
+ if (j == options.length) {
+ IOption[] newOptions = new IOption[options.length + 1];
+ for (int k = 0; k < options.length; k++) {
+ newOptions[k] = options[k];
+ }
+ newOptions[j] = ourOpt;
+ options = newOptions;
+ }
+ }
+ } else {
+ options = (IOption[])ourOpts.toArray(new IOption[ourOpts.size()]);
+ }
+ return options;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getTopOptionCategory()
+ */
+ public IOptionCategory getTopOptionCategory() {
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getOption(java.lang.String)
+ */
+ public IOption getOption(String id) {
+ return getOptionById(id);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getOptionById(java.lang.String)
+ */
+ public IOption getOptionById(String id) {
+ IOption opt = (IOption)getOptionMap().get(id);
+ if (opt == null) {
+ if (superClass != null) {
+ return superClass.getOptionById(id);
+ }
+ }
+ return opt;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getChildCategories()
+ */
+ public IOptionCategory[] getChildCategories() {
+ if (childOptionCategories != null)
+ return (IOptionCategory[])childOptionCategories.toArray(new IOptionCategory[childOptionCategories.size()]);
+ else {
+ if (superClass != null) {
+ return superClass.getChildCategories();
+ } else {
+ return EMPTY_CATEGORIES;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOwner()
+ */
+ public IOptionCategory getOwner() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptions(org.eclipse.cdt.core.build.managed.ITool)
+ */
+ public Object[][] getOptions(IConfiguration configuration) {
+ // Find the child of the configuration that represents the same tool.
+ // It could the tool itself, or a "sub-class" of the tool.
+ if (configuration != null) {
+ ITool[] tools = configuration.getTools();
+ return getOptions(tools);
+ } else {
+ return getAllOptions(this);
+ }
+ }
+
+ public Object[][] getOptions(IResourceConfiguration resConfig) {
+ ITool[] tools = resConfig.getTools();
+ return getOptions(tools);
+ }
+
+ private Object[][] getOptions(ITool[] tools) {
+ ITool catTool = this;
+ ITool tool = null;
+ for (int i = 0; i < tools.length; ++i) {
+ ITool current = tools[i];
+ do {
+ if (catTool == current) {
+ tool = tools[i];
+ break;
+ }
+ } while ((current = current.getSuperClass()) != null);
+ if (tool != null) break;
+ }
+ // Get all of the tool's options and see which ones are part of
+ // this category.
+ if( tool == null)
+ return null;
+
+ return getAllOptions(tool);
+ }
+
+ private Object[][] getAllOptions(ITool tool) {
+ IOption[] allOptions = tool.getOptions();
+ Object[][] myOptions = new Object[allOptions.length][2];
+ int index = 0;
+ for (int i = 0; i < allOptions.length; ++i) {
+ IOption option = allOptions[i];
+ IOptionCategory optCat = option.getCategory();
+ if (optCat instanceof ITool) {
+ // Determine if the category is this tool or a superclass
+ ITool current = this;
+ boolean match = false;
+ do {
+ if (optCat == current) {
+ match = true;
+ break;
+ }
+ } while ((current = current.getSuperClass()) != null);
+ if (match) {
+ myOptions[index] = new Object[2];
+ myOptions[index][0] = tool;
+ myOptions[index][1] = option;
+ index++;
+ }
+ }
+ }
+
+ return myOptions;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getTool()
+ */
+ public ITool getTool() {
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * Memory-safe way to access the vector of category IDs
+ */
+ private Vector getCategoryIds() {
+ if (categoryIds == null) {
+ categoryIds = new Vector();
+ }
+ return categoryIds;
}
/**
@@ -104,25 +849,16 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
// Map the categories by ID for resolution later
getCategoryMap().put(category.getId(), category);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#handlesFileType(java.lang.String)
- */
- public boolean buildsFileType(String extension) {
- if (extension == null) {
- return false;
- }
- return getInputExtensions().contains(extension);
- }
- /* (non-Javadoc)
- * Memory-safe way to access the vector of category IDs
+ /**
+ * Answers the <code>IOptionCategory</code> that has the unique identifier
+ * specified in the argument.
+ *
+ * @param id The unique identifier of the option category
+ * @return <code>IOptionCategory</code> with the id specified in the argument
*/
- private Vector getCategoryIds() {
- if (categoryIds == null) {
- categoryIds = new Vector();
- }
- return categoryIds;
+ public IOptionCategory getOptionCategory(String id) {
+ return (IOptionCategory)getCategoryMap().get(id);
}
/* (non-Javadoc)
@@ -154,42 +890,130 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
}
return optionMap;
}
-
+
+ /*
+ * M O D E L A T T R I B U T E A C C E S S O R S
+ */
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITool#getOptions()
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getSuperClass()
*/
- public IOption[] getOptions() {
- return (IOption[])getOptionList().toArray(new IOption[getOptionList().size()]);
+ public ITool getSuperClass() {
+ return superClass;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITool#getTopOptionCategory()
+ * @see org.eclipse.cdt.core.build.managed.ITool#getName()
*/
- public IOptionCategory getTopOptionCategory() {
- return this;
+ public String getName() {
+ return (name == null && superClass != null) ? superClass.getName() : name;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getChildCategories()
+ * @see org.eclipse.cdt.core.build.managed.ITool#isAbstract()
*/
- public IOptionCategory[] getChildCategories() {
- if (childOptionCategories != null)
- return (IOptionCategory[])childOptionCategories.toArray(new IOptionCategory[childOptionCategories.size()]);
- else
- return EMPTY_CATEGORIES;
+ public boolean isAbstract() {
+ if (isAbstract != null) {
+ return isAbstract.booleanValue();
+ } else {
+ return false; // Note: no inheritance from superClass
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setIsAbstract(boolean)
+ */
+ public void setIsAbstract(boolean b) {
+ isAbstract = new Boolean(b);
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getUnusedChildren()
+ */
+ public String getUnusedChildren() {
+ if (unusedChildren != null) {
+ return unusedChildren;
+ } else
+ return EMPTY_STRING; // Note: no inheritance from superClass
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getErrorParserIds()
+ */
+ public String getErrorParserIds() {
+ String ids = errorParserIds;
+ if (ids == null) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ ids = superClass.getErrorParserIds();
+ }
+ }
+ return ids;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getErrorParserList()
+ */
+ public String[] getErrorParserList() {
+ String parserIDs = getErrorParserIds();
+ String[] errorParsers;
+ if (parserIDs != null) {
+ // Check for an empty string
+ if (parserIDs.length() == 0) {
+ errorParsers = new String[0];
+ } else {
+ StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$
+ List list = new ArrayList(tok.countTokens());
+ while (tok.hasMoreElements()) {
+ list.add(tok.nextToken());
+ }
+ String[] strArr = {""}; //$NON-NLS-1$
+ errorParsers = (String[]) list.toArray(strArr);
+ }
+ } else {
+ errorParsers = new String[0];
+ }
+ return errorParsers;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITool#getInputExtensions()
*/
public List getInputExtensions() {
+ if( (inputExtensions == null) || ( inputExtensions.size() == 0) ) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ return superClass.getInputExtensions();
+ } else {
+ inputExtensions = new ArrayList();
+ }
+ }
+ return inputExtensions;
+ }
+
+ private List getInputExtensionsList() {
if (inputExtensions == null) {
- inputExtensions = new ArrayList();
+ inputExtensions = new ArrayList();
}
return inputExtensions;
}
- private List getInterfaceExtensions() {
+ public List getInterfaceExtensions() {
+ if (interfaceExtensions == null || interfaceExtensions.size() == 0) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ return superClass.getInterfaceExtensions();
+ } else {
+ if (interfaceExtensions == null) {
+ interfaceExtensions = new ArrayList();
+ }
+ }
+ }
+ return interfaceExtensions;
+ }
+
+ private List getInterfaceExtensionsList() {
if (interfaceExtensions == null) {
interfaceExtensions = new ArrayList();
}
@@ -200,196 +1024,278 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
* @see org.eclipse.cdt.core.build.managed.ITool#getOutputFlag()
*/
public String getOutputFlag() {
- return outputFlag == null ? new String() : outputFlag.trim();
+ if (outputFlag == null) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ return superClass.getOutputFlag();
+ } else {
+ return EMPTY_STRING;
+ }
+ }
+ return outputFlag;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITool#getOutputPrefix()
*/
public String getOutputPrefix() {
- return outputPrefix == null ? new String() : outputPrefix.trim();
+ if (outputPrefix == null) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ return superClass.getOutputPrefix();
+ } else {
+ return EMPTY_STRING;
+ }
+ }
+ return outputPrefix;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOwner()
+ * @see org.eclipse.cdt.core.build.managed.ITool#getToolCommand()
*/
- public IOptionCategory getOwner() {
- return null;
+ public String getToolCommand() {
+ if (command == null) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ return superClass.getToolCommand();
+ } else {
+ return EMPTY_STRING;
+ }
+ }
+ return command;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getTool()
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getCommandLinePattern()
*/
- public ITool getTool() {
- return this;
+ public String getCommandLinePattern() {
+ if (commandLinePattern != null) {
+ return commandLinePattern;
+ } else {
+ return new String(DEFAULT_PATTERN); // Default pattern
+ }
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getToolCommand()
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getNatureFilter()
*/
- public String getToolCommand() {
- return command.trim();
+ public int getNatureFilter() {
+ if (natureFilter == null) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ return superClass.getNatureFilter();
+ } else {
+ return FILTER_BOTH;
+ }
+ }
+ return natureFilter.intValue();
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getToolFlags()
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getOutputExtensions()
*/
- public String getToolFlags() throws BuildException {
- // Get all of the optionList
- StringBuffer buf = new StringBuffer();
- IOption[] opts = getOptions();
- for (int index = 0; index < opts.length; index++) {
- IOption option = opts[index];
- switch (option.getValueType()) {
- case IOption.BOOLEAN :
- String boolCmd;
- if (option.getBooleanValue()) {
- boolCmd = option.getCommand();
- } else {
- // Note: getCommandFalse is new with CDT 2.0
- boolCmd = option.getCommandFalse();
- }
- if (boolCmd != null && boolCmd.length() > 0) {
- buf.append(boolCmd + WHITE_SPACE);
- }
- break;
-
- case IOption.ENUMERATED :
- String enum = option.getEnumCommand(option.getSelectedEnum());
- if (enum.length() > 0) {
- buf.append(enum + WHITE_SPACE);
- }
- break;
-
- case IOption.STRING :
- String strCmd = option.getCommand();
- String val = option.getStringValue();
- if (val.length() > 0) {
- if (strCmd != null) buf.append(strCmd);
- buf.append(val + WHITE_SPACE);
- }
- break;
-
- case IOption.STRING_LIST :
- String listCmd = option.getCommand();
- String[] list = option.getStringListValue();
- for (int j = 0; j < list.length; j++) {
- String temp = list[j];
- if (listCmd != null) buf.append(listCmd);
- buf.append(temp + WHITE_SPACE);
- }
- break;
-
- case IOption.INCLUDE_PATH :
- String incCmd = option.getCommand();
- String[] paths = option.getIncludePaths();
- for (int j = 0; j < paths.length; j++) {
- String temp = paths[j];
- buf.append(incCmd + temp + WHITE_SPACE);
- }
- break;
-
- case IOption.PREPROCESSOR_SYMBOLS :
- String defCmd = option.getCommand();
- String[] symbols = option.getDefinedSymbols();
- for (int j = 0; j < symbols.length; j++) {
- String temp = symbols[j];
- buf.append(defCmd + temp + WHITE_SPACE);
- }
- break;
-
- default :
- break;
+ public String[] getOutputExtensions() {
+ // TODO: Why is this treated differently than inputExtensions?
+ if (outputExtensions == null) {
+ if (superClass != null) {
+ return superClass.getOutputExtensions();
+ } else {
+ return null;
}
-
}
-
- return buf.toString().trim();
+ return outputExtensions.split(DEFAULT_SEPARATOR);
}
-
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptions(org.eclipse.cdt.core.build.managed.ITool)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getOutputExtension(java.lang.String)
*/
- public IOption[] getOptions(IConfiguration configuration) {
- ITool tool = this;
- if (configuration != null) {
- // TODO don't like this much
- ITool[] tools = configuration.getTools();
- for (int i = 0; i < tools.length; ++i) {
- if (tools[i] instanceof IToolReference) {
- if (((IToolReference)tools[i]).references(tool)) {
- tool = tools[i];
- break;
+ public String getOutputExtension(String inputExtension) {
+ // Examine the list of input extensions
+ ListIterator iter = getInputExtensions().listIterator();
+ int i = 0;
+ while (iter.hasNext()) {
+ if (((String)iter.next()).equals(inputExtension)) {
+ String[] exts = getOutputExtensions();
+ if (exts != null) {
+ if (i < exts.length) {
+ return exts[i];
+ } else {
+ return exts[exts.length - 1];
}
- } else if (tools[i].equals(tool))
- break;
+ }
}
+ i++;
}
+ return null;
+ }
- IOption[] allOptions = tool.getOptions();
- ArrayList myOptions = new ArrayList();
-
- for (int i = 0; i < allOptions.length; ++i) {
- IOption option = allOptions[i];
- if (option.getCategory().equals(this))
- myOptions.add(option);
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setErrorParserIds()
+ */
+ public void setErrorParserIds(String ids) {
+ String currentIds = getErrorParserIds();
+ if (ids == null && currentIds == null) return;
+ if (currentIds == null || ids == null || !(currentIds.equals(ids))) {
+ errorParserIds = ids;
+ isDirty = true;
}
-
- myOptions.trimToSize();
- return (IOption[])myOptions.toArray(new IOption[myOptions.size()]);
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITool#getNatureFilter()
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setToolCommand(java.lang.String)
*/
- public int getNatureFilter() {
- return natureFilter;
+ public boolean setToolCommand(String cmd) {
+ if (cmd == null && command == null) return false;
+ if (cmd == null || command == null || !cmd.equals(command)) {
+ command = cmd;
+ isDirty = true;
+ return true;
+ } else {
+ return false;
+ }
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITool#getOption(java.lang.String)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setCommandLinePattern()
*/
- public IOption getOption(String id) {
- return getOptionById(id);
+ public void setCommandLinePattern(String pattern) {
+ if (pattern == null && commandLinePattern == null) return;
+ if (pattern == null || commandLinePattern == null || !pattern.equals(commandLinePattern)) {
+ commandLinePattern = pattern;
+ isDirty = true;
+ }
}
-
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getOption(java.lang.String)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getCommandLineGenerator()
*/
- public IOption getOptionById(String id) {
- return (IOption)getOptionMap().get(id);
+ public IManagedCommandLineGenerator getCommandLineGenerator() {
+ if( commandLineGenerator == null ) commandLineGenerator = ManagedBuildManager.getCommandLineGenerator( this.getId() );
+ return commandLineGenerator;
}
-
- /**
- * Answers the <code>IOptionCategory</code> that has the unique identifier
- * specified in the argument.
- *
- * @param id The unique identifier of the option category
- * @return <code>IOptionCategory</code> with the id specified in the argument
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setOutputFlag(java.lang.String)
*/
- public IOptionCategory getOptionCategory(String id) {
- return (IOptionCategory)getCategoryMap().get(id);
+ public void setOutputFlag(String flag) {
+ if (flag == null && outputFlag == null) return;
+ if (outputFlag == null || flag == null || !(flag.equals(outputFlag))) {
+ outputFlag = flag;
+ isDirty = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setOutputPrefix(java.lang.String)
+ */
+ public void setOutputPrefix(String prefix) {
+ if (prefix == null && outputPrefix == null) return;
+ if (outputPrefix == null || prefix == null || !(prefix.equals(outputPrefix))) {
+ outputPrefix = prefix;
+ isDirty = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setOutputExtensions(java.lang.String)
+ */
+ public void setOutputExtensions(String ext) {
+ if (ext == null && outputExtensions == null) return;
+ if (outputExtensions == null || ext == null || !(ext.equals(outputExtensions))) {
+ outputExtensions = ext;
+ isDirty = true;
+ }
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITool#getOutputExtensions()
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getCommandFlags()
*/
- public String[] getOutputExtensions() {
- return outputExtensions.split(DEFAULT_SEPARATOR);
+ public String[] getCommandFlags() throws BuildException {
+ IOption[] opts = getOptions();
+ ArrayList flags = new ArrayList();
+ StringBuffer sb = new StringBuffer();
+ for (int index = 0; index < opts.length; index++) {
+ IOption option = opts[index];
+ sb.setLength( 0 );
+ switch (option.getValueType()) {
+ case IOption.BOOLEAN :
+ String boolCmd;
+ if (option.getBooleanValue()) {
+ boolCmd = option.getCommand();
+ } else {
+ // Note: getCommandFalse is new with CDT 2.0
+ boolCmd = option.getCommandFalse();
+ }
+ if (boolCmd != null && boolCmd.length() > 0) {
+ sb.append(boolCmd);
+ }
+ break;
+
+ case IOption.ENUMERATED :
+ String enum = option.getEnumCommand(option.getSelectedEnum());
+ if (enum.length() > 0) {
+ sb.append(enum);
+ }
+ break;
+
+ case IOption.STRING :
+ String strCmd = option.getCommand();
+ String val = option.getStringValue();
+ if (val.length() > 0) {
+ sb.append( evaluateCommand( strCmd, val ) );
+ }
+ break;
+
+ case IOption.STRING_LIST :
+ String listCmd = option.getCommand();
+ String[] list = option.getStringListValue();
+ for (int j = 0; j < list.length; j++) {
+ String temp = list[j];
+ sb.append( evaluateCommand( listCmd, temp ) + WHITE_SPACE );
+ }
+ break;
+
+ case IOption.INCLUDE_PATH :
+ String incCmd = option.getCommand();
+ String[] paths = option.getIncludePaths();
+ for (int j = 0; j < paths.length; j++) {
+ String temp = paths[j];
+ sb.append( evaluateCommand( incCmd, temp ) + WHITE_SPACE);
+ }
+ break;
+
+ case IOption.PREPROCESSOR_SYMBOLS :
+ String defCmd = option.getCommand();
+ String[] symbols = option.getDefinedSymbols();
+ for (int j = 0; j < symbols.length; j++) {
+ String temp = symbols[j];
+ sb.append( evaluateCommand( defCmd, temp ) + WHITE_SPACE);
+ }
+ break;
+
+ default :
+ break;
+ }
+ if( sb.toString().trim().length() > 0 ) flags.add( sb.toString().trim() );
+ }
+ String[] f = new String[ flags.size() ];
+ return (String[])flags.toArray( f );
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getOutput(java.lang.String)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getToolFlags()
*/
- public String getOutputExtension(String inputExtension) {
- // Examine the list of input extensions
- ListIterator iter = getInputExtensions().listIterator();
- while (iter.hasNext()) {
- if (((String)iter.next()).equals(inputExtension)) {
- return outputExtensions;
+ public String getToolFlags() throws BuildException {
+ // Get all of the optionList
+ StringBuffer buf = new StringBuffer();
+ String[] flags = getCommandFlags();
+ for (int index = 0; index < flags.length; index++) {
+ if( flags[ index ] != null ) {
+ buf.append( flags[ index ] + WHITE_SPACE );
}
}
- return null;
+
+ return buf.toString().trim();
}
/* (non-Javadoc)
@@ -401,104 +1307,94 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
}
return getInterfaceExtensions().contains(ext);
}
-
+
/* (non-Javadoc)
- * Load the tool information from the XML element specified in the
- * argument
- * @param element An XML element containing the tool information
+ * @see org.eclipse.cdt.core.build.managed.ITool#buildsFileType(java.lang.String)
*/
- protected void loadFromManifest(IManagedConfigElement element) {
- // setup for resolving
- ManagedBuildManager.putConfigElement(this, element);
- this.resolved = false;
-
- // id
- setId(element.getAttribute(ITool.ID));
-
- // name
- setName(element.getAttribute(ITool.NAME));
-
- // Get the nature filter
- String nature = element.getAttribute(NATURE);
- if (nature == null || "both".equals(nature)) { //$NON-NLS-1$
- natureFilter = FILTER_BOTH;
- } else if ("cnature".equals(nature)) { //$NON-NLS-1$
- natureFilter = FILTER_C;
- } else if ("ccnature".equals(nature)) { //$NON-NLS-1$
- natureFilter = FILTER_CC;
- } else {
- natureFilter = FILTER_BOTH;
- }
-
- // Get the supported input file extension
- String inputs = element.getAttribute(ITool.SOURCES) == null ?
- new String() :
- element.getAttribute(ITool.SOURCES);
- StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
- while (tokenizer.hasMoreElements()) {
- getInputExtensions().add(tokenizer.nextElement());
- }
-
- // Get the interface (header file) extensions
- String headers = element.getAttribute(INTERFACE_EXTS);
- if (headers == null) {
- headers = new String();
+ public boolean buildsFileType(String extension) {
+ if (extension == null) {
+ return false;
}
- tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR);
- while (tokenizer.hasMoreElements()) {
- getInterfaceExtensions().add(tokenizer.nextElement());
+ return getInputExtensions().contains(extension);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#producesFileType(java.lang.String)
+ */
+ public boolean producesFileType(String outputExtension) {
+ String[] exts = getOutputExtensions();
+ if (exts != null) {
+ for (int i = 0; i < exts.length; i++) {
+ if (exts[i].equals(outputExtension))
+ return true;
+ }
}
-
- // Get the output extension
- outputExtensions = element.getAttribute(ITool.OUTPUTS) == null ?
- new String() :
- element.getAttribute(ITool.OUTPUTS);
-
- // Get the tool invocation
- command = element.getAttribute(ITool.COMMAND) == null ?
- new String() :
- element.getAttribute(ITool.COMMAND);
-
- // Get the flag to control output
- outputFlag = element.getAttribute(ITool.OUTPUT_FLAG) == null ?
- new String() :
- element.getAttribute(ITool.OUTPUT_FLAG);
-
- // Get the output prefix
- outputPrefix = element.getAttribute(ITool.OUTPUT_PREFIX) == null ?
- new String() :
- element.getAttribute(ITool.OUTPUT_PREFIX);
+ return false;
+ }
- // set up the category map
- addOptionCategory(this);
+/*
+ * O B J E C T S T A T E M A I N T E N A N C E
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#isExtensionElement()
+ */
+ public boolean isExtensionElement() {
+ return isExtensionTool;
+ }
- // Check for optionList
- IManagedConfigElement[] toolElements = element.getChildren();
- for (int l = 0; l < toolElements.length; ++l) {
- IManagedConfigElement toolElement = toolElements[l];
- if (toolElement.getName().equals(ITool.OPTION)) {
- new Option(this, toolElement);
- } else if (toolElement.getName().equals(ITool.OPTION_CAT)) {
- new OptionCategory(this, toolElement);
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#isDirty()
+ */
+ public boolean isDirty() {
+ // This shouldn't be called for an extension tool
+ if (isExtensionTool) return false;
+
+ // If I need saving, just say yes
+ if (isDirty) return true;
+
+ // Otherwise see if any options need saving
+ List optionElements = getOptionList();
+ Iterator iter = optionElements.listIterator();
+ while (iter.hasNext()) {
+ Option option = (Option) iter.next();
+ if (option.isDirty()) return true;
}
+ return isDirty;
}
-
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#producesFileType(java.lang.String)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setDirty(boolean)
*/
- public boolean producesFileType(String outputExtension) {
- return this.outputExtensions.equals(outputExtension);
+ public void setDirty(boolean isDirty) {
+ this.isDirty = isDirty;
+ // Propagate "false" to the children
+ if (!isDirty) {
+ List optionElements = getOptionList();
+ Iterator iter = optionElements.listIterator();
+ while (iter.hasNext()) {
+ Option option = (Option) iter.next();
+ option.setDirty(false);
+ }
+
+ }
}
- /**
- *
+ /* (non-Javadoc)
+ * Resolve the element IDs to interface references
*/
public void resolveReferences() {
if (!resolved) {
resolved = true;
- // Tool doesn't have any references, but children might
+ // Resolve superClass
+ if (superClassId != null && superClassId.length() > 0) {
+ superClass = ManagedBuildManager.getExtensionTool(superClassId);
+ if (superClass == null) {
+ // TODO: Report error
+ }
+ }
+ // Call resolveReferences on our children
Iterator optionIter = getOptionList().iterator();
while (optionIter.hasNext()) {
Option current = (Option)optionIter.next();
@@ -517,4 +1413,10 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
}
}
}
+
+ private String evaluateCommand( String command, String values ) {
+ if( command == null ) return values.trim();
+ if( command.indexOf( "$(" ) > 0 ) return command.replaceAll( "\\$\\([value|Value|VALUE]\\)", values.trim() ).trim(); //$NON-NLS-1$ //$NON-NLS-2$
+ else return (new String(command + values)).trim();
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java
new file mode 100644
index 00000000000..9471a158ee3
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java
@@ -0,0 +1,960 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.core;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.eclipse.cdt.managedbuilder.core.IBuildObject;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
+import org.eclipse.cdt.managedbuilder.core.IBuilder;
+import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class ToolChain extends BuildObject implements IToolChain {
+
+ private static final String EMPTY_STRING = new String();
+
+ // Superclass
+ private IToolChain superClass;
+ private String superClassId;
+ // Parent and children
+ private IConfiguration parent;
+ private List toolList;
+ private Map toolMap;
+ private TargetPlatform targetPlatform;
+ private Builder builder;
+ // Managed Build model attributes
+ private String unusedChildren;
+ private String errorParserIds;
+ private List osList;
+ private List archList;
+ private Boolean isAbstract;
+ private IConfigurationElement scannerInfoCollectorElement;
+ // Miscellaneous
+ private boolean isExtensionToolChain = false;
+ private boolean isDirty = false;
+ private boolean resolved = true;
+
+ /*
+ * C O N S T R U C T O R S
+ */
+
+ /**
+ * This constructor is called to create a tool-chain defined by an extension point in
+ * a plugin manifest file, or returned by a dynamic element provider
+ *
+ * @param parent The IConfiguration parent of this tool-chain, or <code>null</code> if
+ * defined at the top level
+ * @param element The tool-chain definition from the manifest file or a dynamic element
+ * provider
+ */
+ public ToolChain(IConfiguration parent, IManagedConfigElement element) {
+ this.parent = parent;
+ isExtensionToolChain = true;
+
+ // setup for resolving
+ resolved = false;
+
+ loadFromManifest(element);
+
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionToolChain(this);
+
+ // Load the TargetPlatform child
+ IManagedConfigElement[] targetPlatforms =
+ element.getChildren(ITargetPlatform.TARGET_PLATFORM_ELEMENT_NAME);
+ if (targetPlatforms.length < 1 || targetPlatforms.length > 1) {
+ // TODO: Report error
+ }
+ if (targetPlatforms.length > 0) {
+ targetPlatform = new TargetPlatform(this, targetPlatforms[0]);
+ }
+
+ // Load the Builder child
+ IManagedConfigElement[] builders =
+ element.getChildren(IBuilder.BUILDER_ELEMENT_NAME);
+ if (builders.length < 1 || builders.length > 1) {
+ // TODO: Report error
+ }
+ if (builders.length > 0) {
+ builder = new Builder(this, builders[0]);
+ }
+
+ // Load the tool children
+ IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME);
+ for (int n = 0; n < tools.length; ++n) {
+ Tool toolChild = new Tool(this, tools[n]);
+ getToolList().add(toolChild);
+ }
+ }
+
+ /**
+ * This constructor is called to create a ToolChain whose attributes and children will be
+ * added by separate calls.
+ *
+ * @param Configuration The parent of the tool chain, if any
+ * @param ToolChain The superClass, if any
+ * @param String The id for the new tool chain
+ * @param String The name for the new tool chain
+ * @param boolean Indicates whether this is an extension element or a managed project element
+ */
+ public ToolChain(Configuration parent, IToolChain superClass, String Id, String name, boolean isExtensionElement) {
+ this.parent = parent;
+ this.superClass = superClass;
+ if (this.superClass != null) {
+ superClassId = this.superClass.getId();
+ }
+ setId(Id);
+ setName(name);
+ isExtensionToolChain = isExtensionElement;
+ if (isExtensionElement) {
+ // Hook me up to the Managed Build Manager
+ ManagedBuildManager.addExtensionToolChain(this);
+ } else {
+ setDirty(true);
+ }
+ }
+
+ /**
+ * Create a <code>ToolChain</code> based on the specification stored in the
+ * project file (.cdtbuild).
+ *
+ * @param parent The <code>IConfiguration</code> the tool-chain will be added to.
+ * @param element The XML element that contains the tool-chain settings.
+ */
+ public ToolChain(IConfiguration parent, Element element) {
+ this.parent = parent;
+ isExtensionToolChain = false;
+
+ // Initialize from the XML attributes
+ loadFromProject(element);
+
+ // Load children
+ NodeList configElements = element.getChildNodes();
+ for (int i = 0; i < configElements.getLength(); ++i) {
+ Node configElement = configElements.item(i);
+ if (configElement.getNodeName().equals(ITool.TOOL_ELEMENT_NAME)) {
+ Tool tool = new Tool(this, (Element)configElement);
+ addTool(tool);
+ }else if (configElement.getNodeName().equals(ITargetPlatform.TARGET_PLATFORM_ELEMENT_NAME)) {
+ if (targetPlatform != null) {
+ // TODO: report error
+ }
+ targetPlatform = new TargetPlatform(this, (Element)configElement);
+ }else if (configElement.getNodeName().equals(IBuilder.BUILDER_ELEMENT_NAME)) {
+ if (builder != null) {
+ // TODO: report error
+ }
+ builder = new Builder(this, (Element)configElement);
+ }
+ }
+ }
+
+ /**
+ * Create a <code>ToolChain</code> based upon an existing tool chain.
+ *
+ * @param parent The <code>IConfiguration</code> the tool-chain will be added to.
+ * @param toolChain The existing tool-chain to clone.
+ */
+ public ToolChain(IConfiguration parent, String Id, String name, ToolChain toolChain) {
+ this.parent = parent;
+ superClass = toolChain.superClass;
+ if (superClass != null) {
+ if (toolChain.superClassId != null) {
+ superClassId = new String(toolChain.superClassId);
+ }
+ }
+ setId(Id);
+ setName(name);
+ isExtensionToolChain = false;
+
+ // Copy the remaining attributes
+ if (toolChain.unusedChildren != null) {
+ unusedChildren = new String(toolChain.unusedChildren);
+ }
+ if (toolChain.errorParserIds != null) {
+ errorParserIds = new String(toolChain.errorParserIds);
+ }
+ if (toolChain.osList != null) {
+ osList = new ArrayList(toolChain.osList);
+ }
+ if (toolChain.archList != null) {
+ archList = new ArrayList(toolChain.archList);
+ }
+ if (toolChain.isAbstract != null) {
+ isAbstract = new Boolean(toolChain.isAbstract.booleanValue());
+ }
+ scannerInfoCollectorElement = toolChain.scannerInfoCollectorElement;
+
+ // Clone the children
+ if (toolChain.builder != null) {
+ int nnn = ManagedBuildManager.getRandomNumber();
+ String subId;
+ String subName;
+ if (toolChain.builder.getSuperClass() != null) {
+ subId = toolChain.builder.getSuperClass().getId() + "." + nnn; //$NON-NLS-1$
+ subName = toolChain.builder.getSuperClass().getName();
+ } else {
+ subId = toolChain.builder.getId() + "." + nnn; //$NON-NLS-1$
+ subName = toolChain.builder.getName();
+ }
+ builder = new Builder(this, subId, subName, toolChain.builder);
+ }
+ if (toolChain.targetPlatform != null) {
+ int nnn = ManagedBuildManager.getRandomNumber();
+ String subId;
+ String subName;
+ if (toolChain.targetPlatform.getSuperClass() != null) {
+ subId = toolChain.targetPlatform.getSuperClass().getId() + "." + nnn; //$NON-NLS-1$
+ subName = toolChain.targetPlatform.getSuperClass().getName();
+ } else {
+ subId = toolChain.targetPlatform.getId() + "." + nnn; //$NON-NLS-1$
+ subName = toolChain.targetPlatform.getName();
+ }
+ targetPlatform = new TargetPlatform(this, subId, subName, toolChain.targetPlatform);
+ }
+ if (toolChain.toolList != null) {
+ Iterator iter = toolChain.getToolList().listIterator();
+ while (iter.hasNext()) {
+ Tool toolChild = (Tool) iter.next();
+ int nnn = ManagedBuildManager.getRandomNumber();
+ String subId;
+ String subName;
+ if (toolChild.getSuperClass() != null) {
+ subId = toolChild.getSuperClass().getId() + "." + nnn; //$NON-NLS-1$
+ subName = toolChild.getSuperClass().getName();
+ } else {
+ subId = toolChild.getId() + "." + nnn; //$NON-NLS-1$
+ subName = toolChild.getName();
+ }
+ Tool newTool = new Tool(this, null, subId, subName, toolChild);
+ addTool(newTool);
+ }
+ }
+
+ setDirty(true);
+ }
+
+ /*
+ * E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S
+ */
+
+ /* (non-Javadoc)
+ * Loads the tool-chain information from the ManagedConfigElement specified in the
+ * argument.
+ *
+ * @param element Contains the tool-chain information
+ */
+ protected void loadFromManifest(IManagedConfigElement element) {
+ ManagedBuildManager.putConfigElement(this, element);
+
+ // id
+ setId(element.getAttribute(IBuildObject.ID));
+
+ // Get the name
+ setName(element.getAttribute(IBuildObject.NAME));
+
+ // superClass
+ superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+
+ // Get the unused children, if any
+ unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+
+ // isAbstract
+ String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
+ if (isAbs != null){
+ isAbstract = new Boolean("true".equals(isAbs)); //$NON-NLS-1$
+ }
+
+ // Get the semicolon separated list of IDs of the error parsers
+ errorParserIds = element.getAttribute(ERROR_PARSERS);
+
+ // Store the configuration element IFF there is a scanner info collector defined
+ String scannerInfoCollector = element.getAttribute(SCANNER_INFO_ID);
+ if (scannerInfoCollector != null && element instanceof DefaultManagedConfigElement) {
+ scannerInfoCollectorElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
+ }
+
+ // Get the comma-separated list of valid OS
+ String os = element.getAttribute(OS_LIST);
+ if (os != null) {
+ osList = new ArrayList();
+ String[] osTokens = os.split(","); //$NON-NLS-1$
+ for (int i = 0; i < osTokens.length; ++i) {
+ osList.add(osTokens[i].trim());
+ }
+ }
+
+ // Get the comma-separated list of valid Architectures
+ String arch = element.getAttribute(ARCH_LIST);
+ if (arch != null) {
+ archList = new ArrayList();
+ String[] archTokens = arch.split(","); //$NON-NLS-1$
+ for (int j = 0; j < archTokens.length; ++j) {
+ archList.add(archTokens[j].trim());
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * Initialize the tool-chain information from the XML element
+ * specified in the argument
+ *
+ * @param element An XML element containing the tool-chain information
+ */
+ protected void loadFromProject(Element element) {
+
+ // id
+ setId(element.getAttribute(IBuildObject.ID));
+
+ // name
+ if (element.hasAttribute(IBuildObject.NAME)) {
+ setName(element.getAttribute(IBuildObject.NAME));
+ }
+
+ // superClass
+ superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ if (superClassId != null && superClassId.length() > 0) {
+ superClass = ManagedBuildManager.getExtensionToolChain(superClassId);
+ if (superClass == null) {
+ // TODO: Report error
+ }
+ }
+
+ // Get the unused children, if any
+ if (element.hasAttribute(IProjectType.UNUSED_CHILDREN)) {
+ unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ }
+
+ // isAbstract
+ if (element.hasAttribute(IProjectType.IS_ABSTRACT)) {
+ String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
+ if (isAbs != null){
+ isAbstract = new Boolean("true".equals(isAbs)); //$NON-NLS-1$
+ }
+ }
+
+ // Get the semicolon separated list of IDs of the error parsers
+ if (element.hasAttribute(ERROR_PARSERS)) {
+ errorParserIds = element.getAttribute(ERROR_PARSERS);
+ }
+
+ // Get the comma-separated list of valid OS
+ if (element.hasAttribute(OS_LIST)) {
+ String os = element.getAttribute(OS_LIST);
+ if (os != null) {
+ osList = new ArrayList();
+ String[] osTokens = os.split(","); //$NON-NLS-1$
+ for (int i = 0; i < osTokens.length; ++i) {
+ osList.add(osTokens[i].trim());
+ }
+ }
+ }
+
+ // Get the comma-separated list of valid Architectures
+ if (element.hasAttribute(ARCH_LIST)) {
+ String arch = element.getAttribute(ARCH_LIST);
+ if (arch != null) {
+ archList = new ArrayList();
+ String[] archTokens = arch.split(","); //$NON-NLS-1$
+ for (int j = 0; j < archTokens.length; ++j) {
+ archList.add(archTokens[j].trim());
+ }
+ }
+ }
+ }
+
+ /**
+ * Persist the tool-chain to the project file.
+ *
+ * @param doc
+ * @param element
+ */
+ public void serialize(Document doc, Element element) {
+ if (superClass != null)
+ element.setAttribute(IProjectType.SUPERCLASS, superClass.getId());
+
+ element.setAttribute(IBuildObject.ID, id);
+
+ if (name != null) {
+ element.setAttribute(IBuildObject.NAME, name);
+ }
+
+ if (unusedChildren != null) {
+ element.setAttribute(IProjectType.UNUSED_CHILDREN, unusedChildren);
+ }
+
+ if (isAbstract != null) {
+ element.setAttribute(IProjectType.IS_ABSTRACT, isAbstract.toString());
+ }
+
+ if (errorParserIds != null) {
+ element.setAttribute(ERROR_PARSERS, errorParserIds);
+ }
+
+ if (osList != null) {
+ Iterator osIter = osList.listIterator();
+ String listValue = EMPTY_STRING;
+ while (osIter.hasNext()) {
+ String current = (String) osIter.next();
+ listValue += current;
+ if ((osIter.hasNext())) {
+ listValue += ","; //$NON-NLS-1$
+ }
+ }
+ element.setAttribute(OS_LIST, listValue);
+ }
+
+ if (archList != null) {
+ Iterator archIter = archList.listIterator();
+ String listValue = EMPTY_STRING;
+ while (archIter.hasNext()) {
+ String current = (String) archIter.next();
+ listValue += current;
+ if ((archIter.hasNext())) {
+ listValue += ","; //$NON-NLS-1$
+ }
+ }
+ element.setAttribute(ARCH_LIST, listValue);
+ }
+
+ // Serialize my children
+ if (targetPlatform != null) {
+ Element targetPlatformElement = doc.createElement(ITargetPlatform.TARGET_PLATFORM_ELEMENT_NAME);
+ element.appendChild(targetPlatformElement);
+ targetPlatform.serialize(doc, targetPlatformElement);
+ }
+ if (builder != null) {
+ Element builderElement = doc.createElement(IBuilder.BUILDER_ELEMENT_NAME);
+ element.appendChild(builderElement);
+ builder.serialize(doc, builderElement);
+ }
+ List toolElements = getToolList();
+ Iterator iter = toolElements.listIterator();
+ while (iter.hasNext()) {
+ Tool tool = (Tool) iter.next();
+ Element toolElement = doc.createElement(ITool.TOOL_ELEMENT_NAME);
+ element.appendChild(toolElement);
+ tool.serialize(doc, toolElement);
+ }
+
+ // I am clean now
+ isDirty = false;
+ }
+
+ /*
+ * P A R E N T A N D C H I L D H A N D L I N G
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IToolChain#getConfiguration()
+ */
+ public IConfiguration getParent() {
+ return parent;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IToolChain#createTargetPlatform(ITargetPlatform, String, String, boolean)
+ */
+ public ITargetPlatform createTargetPlatform(ITargetPlatform superClass, String id, String name, boolean isExtensionElement) {
+ targetPlatform = new TargetPlatform(this, superClass, id, name, isExtensionElement);
+ setDirty(true);
+ return (ITargetPlatform)targetPlatform;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IToolChain#getTargetPlatform()
+ */
+ public ITargetPlatform getTargetPlatform() {
+ if (targetPlatform == null) {
+ if (superClass != null) {
+ return superClass.getTargetPlatform();
+ }
+ }
+ return (ITargetPlatform)targetPlatform;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IToolChain#removeLocalTargetPlatform()
+ */
+ public void removeLocalTargetPlatform() {
+ if (targetPlatform == null) return;
+ targetPlatform = null;
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IToolChain#createBuilder(IBuilder, String, String, boolean)
+ */
+ public IBuilder createBuilder(IBuilder superClass, String id, String name, boolean isExtensionElement) {
+ builder = new Builder(this, superClass, id, name, isExtensionElement);
+ setDirty(true);
+ return (IBuilder)builder;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IToolChain#getBuilder()
+ */
+ public IBuilder getBuilder() {
+ if (builder == null) {
+ if (superClass != null) {
+ return superClass.getBuilder();
+ }
+ }
+ return (IBuilder)builder;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IToolChain#removeLocalBuilder()
+ */
+ public void removeLocalBuilder() {
+ if (builder == null) return;
+ builder = null;
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IToolChain#createTool(ITool, String, String, boolean)
+ */
+ public ITool createTool(ITool superClass, String id, String name, boolean isExtensionElement) {
+ Tool tool = new Tool(this, superClass, id, name, isExtensionElement);
+ addTool(tool);
+ setDirty(true);
+ return (ITool)tool;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IToolChain#getTools()
+ */
+ public ITool[] getTools() {
+ ITool[] tools = null;
+ // Merge our tools with our superclass' tools
+ if (superClass != null) {
+ tools = superClass.getTools();
+ }
+ // Our tools take precedence
+ if (tools != null) {
+ Iterator iter = getToolList().listIterator();
+ while (iter.hasNext()) {
+ Tool tool = (Tool)iter.next();
+ int j;
+ for (j = 0; j < tools.length; j++) {
+ if (tool.getSuperClass().getId().equals(tools[j].getId())) {
+ tools[j] = tool;
+ break;
+ }
+ }
+ // No Match? Add it.
+ if (j == tools.length) {
+ ITool[] newTools = new ITool[tools.length + 1];
+ for (int k = 0; k < tools.length; k++) {
+ newTools[k] = tools[k];
+ }
+ newTools[j] = tool;
+ tools = newTools;
+ }
+ }
+ } else {
+ tools = new ITool[getToolList().size()];
+ Iterator iter = getToolList().listIterator();
+ int i = 0;
+ while (iter.hasNext()) {
+ Tool tool = (Tool)iter.next();
+ tools[i++] = (ITool)tool;
+ }
+ }
+ return tools;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#getTool(java.lang.String)
+ */
+ public ITool getTool(String id) {
+ Tool tool = (Tool)getToolMap().get(id);
+ return (ITool)tool;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the list of tools.
+ *
+ * @return List containing the tools
+ */
+ public List getToolList() {
+ if (toolList == null) {
+ toolList = new ArrayList();
+ }
+ return toolList;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor for the map of tool ids to tools
+ *
+ * @return
+ */
+ private Map getToolMap() {
+ if (toolMap == null) {
+ toolMap = new HashMap();
+ }
+ return toolMap;
+ }
+
+ /* (non-Javadoc)
+ * Adds the Tool to the Tool-chain list and map
+ *
+ * @param Tool
+ */
+ public void addTool(Tool tool) {
+ getToolList().add(tool);
+ getToolMap().put(tool.getId(), tool);
+ }
+
+ /*
+ * M O D E L A T T R I B U T E A C C E S S O R S
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#getSuperClass()
+ */
+ public IToolChain getSuperClass() {
+ return superClass;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IToolChain#getName()
+ */
+ public String getName() {
+ return (name == null && superClass != null) ? superClass.getName() : name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IToolChain#isAbstract()
+ */
+ public boolean isAbstract() {
+ if (isAbstract != null) {
+ return isAbstract.booleanValue();
+ } else {
+ return false; // Note: no inheritance from superClass
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IToolChain#getUnusedChildren()
+ */
+ public String getUnusedChildren() {
+ if (unusedChildren != null) {
+ return unusedChildren;
+ } else
+ return EMPTY_STRING; // Note: no inheritance from superClass
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#getErrorParserIds()
+ */
+ public String getErrorParserIds() {
+ String ids = errorParserIds;
+ if (ids == null) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ ids = superClass.getErrorParserIds();
+ }
+ }
+ if (ids == null) {
+ // Collect the error parsers from my children
+ ids = builder.getErrorParserIds();
+ ITool[] tools = getTools();
+ for (int i = 0; i < tools.length; i++) {
+ ITool tool = tools[i];
+ String toolIds = tool.getErrorParserIds();
+ if (toolIds != null && toolIds.length() > 0) {
+ if (ids != null) {
+ ids += ";"; //$NON-NLS-1$
+ ids += toolIds;
+ } else {
+ ids = toolIds;
+ }
+ }
+ }
+ }
+ return ids;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#getErrorParserIds(IConfiguration)
+ */
+ public String getErrorParserIds(IConfiguration config) {
+ String ids = errorParserIds;
+ if (ids == null) {
+ // If I have a superClass, ask it
+ if (superClass != null) {
+ ids = superClass.getErrorParserIds(config);
+ }
+ }
+ if (ids == null) {
+ // Collect the error parsers from my children
+ if (builder != null) {
+ ids = builder.getErrorParserIds();
+ }
+ ITool[] tools = config.getFilteredTools();
+ for (int i = 0; i < tools.length; i++) {
+ ITool tool = tools[i];
+ String toolIds = tool.getErrorParserIds();
+ if (toolIds != null && toolIds.length() > 0) {
+ if (ids != null) {
+ ids += ";"; //$NON-NLS-1$
+ ids += toolIds;
+ } else {
+ ids = toolIds;
+ }
+ }
+ }
+ }
+ return ids;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#getErrorParserList()
+ */
+ public String[] getErrorParserList() {
+ String parserIDs = getErrorParserIds();
+ String[] errorParsers;
+ if (parserIDs != null) {
+ // Check for an empty string
+ if (parserIDs.length() == 0) {
+ errorParsers = new String[0];
+ } else {
+ StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$
+ List list = new ArrayList(tok.countTokens());
+ while (tok.hasMoreElements()) {
+ list.add(tok.nextToken());
+ }
+ String[] strArr = {""}; //$NON-NLS-1$
+ errorParsers = (String[]) list.toArray(strArr);
+ }
+ } else {
+ errorParsers = new String[0];
+ }
+ return errorParsers;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#getArchList()
+ */
+ public String[] getArchList() {
+ if (archList == null) {
+ // Ask superClass for its list
+ if (superClass != null) {
+ return superClass.getArchList();
+ } else {
+ // I have no superClass and no defined list
+ return new String[] {"all"}; //$NON-NLS-1$
+ }
+ }
+ return (String[]) archList.toArray(new String[archList.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#getOSList()
+ */
+ public String[] getOSList() {
+ if (osList == null) {
+ // Ask superClass for its list
+ if (superClass != null) {
+ return superClass.getOSList();
+ } else {
+ // I have no superClass and no defined filter list
+ return new String[] {"all"}; //$NON-NLS-1$
+ }
+ }
+ return (String[]) osList.toArray(new String[osList.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#setIsAbstract(boolean)
+ */
+ public void setIsAbstract(boolean b) {
+ isAbstract = new Boolean(b);
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#setErrorParserIds(String)
+ */
+ public void setErrorParserIds(String ids) {
+ String currentIds = getErrorParserIds();
+ if (ids == null && currentIds == null) return;
+ if (currentIds == null || ids == null || !(currentIds.equals(ids))) {
+ errorParserIds = ids;
+ isDirty = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#setOSList(String[])
+ */
+ public void setOSList(String[] OSs) {
+ if (osList == null) {
+ osList = new ArrayList();
+ } else {
+ osList.clear();
+ }
+ for (int i = 0; i < OSs.length; i++) {
+ osList.add(OSs[i]);
+ }
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#setArchList(String[])
+ */
+ public void setArchList(String[] archs) {
+ if (archList == null) {
+ archList = new ArrayList();
+ } else {
+ archList.clear();
+ }
+ for (int i = 0; i < archs.length; i++) {
+ archList.add(archs[i]);
+ }
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#getScannerInfoCollectorElement()
+ */
+ public IConfigurationElement getScannerInfoCollectorElement() {
+ if (scannerInfoCollectorElement == null) {
+ if (superClass != null) {
+ return superClass.getScannerInfoCollectorElement();
+ }
+ }
+ return scannerInfoCollectorElement;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#setScannerInfoCollectorElement(IConfigurationElement)
+ */
+ public void setScannerInfoCollectorElement(IConfigurationElement element) {
+ scannerInfoCollectorElement = element;
+ setDirty(true);
+ }
+
+ /*
+ * O B J E C T S T A T E M A I N T E N A N C E
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#isExtensionElement()
+ */
+ public boolean isExtensionElement() {
+ return isExtensionToolChain;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#isDirty()
+ */
+ public boolean isDirty() {
+ // This shouldn't be called for an extension tool-chain
+ if (isExtensionToolChain) return false;
+
+ // If I need saving, just say yes
+ if (isDirty) return true;
+
+ // Otherwise see if any tools need saving
+ Iterator iter = getToolList().listIterator();
+ while (iter.hasNext()) {
+ Tool toolChild = (Tool) iter.next();
+ if (toolChild.isDirty()) return true;
+ }
+
+ return isDirty;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#setDirty(boolean)
+ */
+ public void setDirty(boolean isDirty) {
+ this.isDirty = isDirty;
+ // Propagate "false" to the children
+ if (!isDirty) {
+ Iterator iter = getToolList().listIterator();
+ while (iter.hasNext()) {
+ Tool toolChild = (Tool) iter.next();
+ toolChild.setDirty(false);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * Resolve the element IDs to interface references
+ */
+ public void resolveReferences() {
+ if (!resolved) {
+ resolved = true;
+ // Resolve superClass
+ if (superClassId != null && superClassId.length() > 0) {
+ superClass = ManagedBuildManager.getExtensionToolChain(superClassId);
+ if (superClass == null) {
+ // TODO: Report error
+ }
+ }
+ // Call resolveReferences on our children
+ if (targetPlatform != null) {
+ targetPlatform.resolveReferences();
+ }
+ if (builder != null) {
+ builder.resolveReferences();
+ }
+ Iterator iter = getToolList().listIterator();
+ while (iter.hasNext()) {
+ Tool toolChild = (Tool) iter.next();
+ toolChild.resolveReferences();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * Normalize the list of output extensions,for all tools in the toolchain by populating the list
+ * with an empty string for those tools which have no explicit output extension (as defined in the
+ * manifest file. In a post 2.1 manifest, all tools must have a specifed output extension, even
+ * if it is "")
+ */
+ public void normalizeOutputExtensions(){
+ ITool[] tools = getTools();
+ if (tools != null) {
+ for (int i = 0; i < tools.length; i++) {
+ ITool tool = tools[i];
+ String[] extensions = tool.getOutputExtensions();
+ if (extensions == null) {
+ tool.setOutputExtensions(""); //$NON-NLS-1$
+ continue;
+ }
+ if (extensions.length == 0){
+ tool.setOutputExtensions(""); //$NON-NLS-1$
+ continue;
+ }
+ }
+ }
+ }
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
index f72f61ede10..899fb263187 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
@@ -17,13 +17,14 @@ import java.util.List;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IConfigurationV2;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolReference;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -46,23 +47,23 @@ public class ToolReference implements IToolReference {
* Create a new tool reference based on information contained in
* a project file.
*
- * @param owner The <code>Configuration</code> the receiver will be added to.
+ * @param owner The <code>ConfigurationV2</code> the receiver will be added to.
* @param element The element defined in the project file containing build information
* for the receiver.
*/
public ToolReference(BuildObject owner, Element element) {
this.owner = owner;
- if (owner instanceof Configuration) {
+ if (owner instanceof ConfigurationV2) {
if (parent == null) {
- Target parentTarget = (Target) ((Configuration)owner).getTarget();
+ Target parentTarget = (Target) ((ConfigurationV2)owner).getTarget();
try {
parent = ((Target)parentTarget.getParent()).getTool(element.getAttribute(ID));
} catch (NullPointerException e) {
parent = null;
}
}
- ((Configuration)owner).addToolReference(this);
+ ((ConfigurationV2)owner).addToolReference(this);
} else if (owner instanceof Target) {
if (parent == null) {
try {
@@ -115,8 +116,8 @@ public class ToolReference implements IToolReference {
this.owner = owner;
// hook me up
- if (owner instanceof Configuration) {
- ((Configuration)owner).addToolReference(this);
+ if (owner instanceof ConfigurationV2) {
+ ((ConfigurationV2)owner).addToolReference(this);
} else if (owner instanceof Target) {
((Target)owner).addToolReference(this);
}
@@ -201,8 +202,8 @@ public class ToolReference implements IToolReference {
}
}
- if (owner instanceof Configuration) {
- ((Configuration)owner).addToolReference(this);
+ if (owner instanceof ConfigurationV2) {
+ ((ConfigurationV2)owner).addToolReference(this);
} else if (owner instanceof Target) {
((Target)owner).addToolReference(this);
}
@@ -234,8 +235,8 @@ public class ToolReference implements IToolReference {
resolved = true;
IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
// resolve my parent
- if (owner instanceof Configuration) {
- Target target = (Target) ((Configuration)owner).getTarget();
+ if (owner instanceof ConfigurationV2) {
+ Target target = (Target) ((ConfigurationV2)owner).getTarget();
parent = target.getTool(element.getAttribute(ID));
} else if (owner instanceof Target) {
parent = ((Target)owner).getTool(element.getAttribute(ID));
@@ -300,8 +301,8 @@ public class ToolReference implements IToolReference {
*/
protected List getAllOptionRefs() {
// First get all the option references this tool reference contains
- if (owner instanceof Configuration) {
- return ((Configuration)owner).getOptionReferences(parent);
+ if (owner instanceof ConfigurationV2) {
+ return ((ConfigurationV2)owner).getOptionReferences(parent);
} else if (owner instanceof Target) {
return ((Target)owner).getOptionReferences(parent);
} else {
@@ -644,9 +645,9 @@ public class ToolReference implements IToolReference {
* @param config
* @return
*/
- public boolean ownedByConfiguration(IConfiguration config) {
- if (owner instanceof Configuration) {
- return ((IConfiguration)owner).equals(config);
+ public boolean ownedByConfiguration(IConfigurationV2 config) {
+ if (owner instanceof ConfigurationV2) {
+ return ((IConfigurationV2)owner).equals(config);
}
return false;
}
@@ -717,6 +718,39 @@ public class ToolReference implements IToolReference {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setOutputFlag(java.lang.String)
+ */
+ public void setOutputFlag(String flag) {
+ if (flag == null) return;
+ if (outputFlag == null || !(flag.equals(outputFlag))) {
+ outputFlag = flag;
+ isDirty = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setOutputPrefix(java.lang.String)
+ */
+ public void setOutputPrefix(String prefix) {
+ if (prefix == null) return;
+ if (outputPrefix == null || !(prefix.equals(outputPrefix))) {
+ outputPrefix = prefix;
+ isDirty = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setOutputExtensions(java.lang.String)
+ */
+ public void setOutputExtensions(String ext) {
+ if (ext == null) return;
+ if (outputExtensions == null || !(ext.equals(outputExtensions))) {
+ outputExtensions = ext;
+ isDirty = true;
+ }
+ }
+
+ /* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
@@ -732,4 +766,169 @@ public class ToolReference implements IToolReference {
}
}
+ /*
+ * The following methods are here in order to implement the new ITool methods.
+ * They should never be called.
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getSuperClass()
+ */
+ public ITool getSuperClass() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#isAbstract()
+ */
+ public boolean isAbstract() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getUnusedChildren()
+ */
+ public String getUnusedChildren() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getErrorParserList()
+ */
+ public String[] getErrorParserList() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getErrorParserIds()
+ */
+ public String getErrorParserIds() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setErrorParserIds()
+ */
+ public void setErrorParserIds(String ids) {
+ }
+
+ public List getInterfaceExtensions() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#isExtensionElement()
+ */
+ public boolean isExtensionElement() {
+ return false;
+ }
+
+ /*
+ * The following methods are added to allow the converter from ToolReference -> Tool
+ * to retrieve the actual value of attributes. These routines do not go to the
+ * referenced Tool for a value if the ToolReference does not have a value.
+ */
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolReference#getRawOutputExtensions()
+ */
+ public String getRawOutputExtensions() {
+ return outputExtensions;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolReference#getRawOutputFlag()
+ */
+ public String getRawOutputFlag() {
+ return outputFlag;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolReference#getRawOutputPrefix()
+ */
+ public String getRawOutputPrefix() {
+ return outputPrefix;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolReference#getRawToolCommand()
+ */
+ public String getRawToolCommand() {
+ return command;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#createOption()
+ */
+ public IOption createOption(IOption superClass, String Id, String name, boolean b) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#removeOption()
+ */
+ public void removeOption(IOption o) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getChildCategories()
+ */
+ public IOptionCategory[] getChildCategories() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setParent(IBuildObject)
+ */
+ public void setToolParent(IBuildObject newParent) {
+ if (parent == null) {
+ // bad reference
+ return;
+ }
+ // Set the parent in the parent of this ToolRefernce, the tool
+ ((Tool)parent).setToolParent(newParent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setIsAbstract(boolean)
+ */
+ public void setIsAbstract(boolean b) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getParent()
+ */
+ public IBuildObject getParent() {
+ return owner;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getCommandLinePattern()
+ */
+ public String getCommandLinePattern() {
+ if( parent == null ) return new String();
+ return parent.getCommandLinePattern();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getCommandLinePattern()
+ */
+ public void setCommandLinePattern(String pattern) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getCommandLineGenerator()
+ */
+ public IManagedCommandLineGenerator getCommandLineGenerator() {
+ if( parent == null ) return null;
+ return parent.getCommandLineGenerator();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getCommandFlags()
+ */
+ public String[] getCommandFlags() throws BuildException {
+ if( parent == null ) return null;
+ return parent.getCommandFlags();
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/scannerconfig/ManagedBuildCPathEntryContainer.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/scannerconfig/ManagedBuildCPathEntryContainer.java
index ac1e3ff76e9..c7efc2d1f61 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/scannerconfig/ManagedBuildCPathEntryContainer.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/scannerconfig/ManagedBuildCPathEntryContainer.java
@@ -26,6 +26,7 @@ import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IExternalScannerInfoProvider;
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
+import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.ITarget;
@@ -126,7 +127,7 @@ public class ManagedBuildCPathEntryContainer implements IPathEntryContainer {
}
protected void calculateBuiltIns(ITarget defaultTarget, IConfiguration config) {
- ITool[] tools = config.getFilteredTools(info.getOwner().getProject());
+ ITool[] tools = config.getFilteredTools();
// Iterate over the list
for (int toolIndex = 0; toolIndex < tools.length; ++toolIndex) {
@@ -135,24 +136,26 @@ public class ManagedBuildCPathEntryContainer implements IPathEntryContainer {
IOption[] options = tool.getOptions();
for (int optIndex = 0; optIndex < options.length; ++optIndex) {
IOption option = options[optIndex];
- if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
- String[] builtIns = option.getBuiltIns();
- Map macroMap = new HashMap();
- for (int biIndex = 0; biIndex < builtIns.length; ++biIndex) {
- String symbol = builtIns[biIndex];
- String[] tokens = symbol.split("="); //$NON-NLS-1$
- String macro = tokens[0].trim();
- String value = (tokens.length > 1) ? tokens[1] : new String();
- macroMap.put(macro, value);
+ try {
+ if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
+ String[] builtIns = option.getBuiltIns();
+ Map macroMap = new HashMap();
+ for (int biIndex = 0; biIndex < builtIns.length; ++biIndex) {
+ String symbol = builtIns[biIndex];
+ String[] tokens = symbol.split("="); //$NON-NLS-1$
+ String macro = tokens[0].trim();
+ String value = (tokens.length > 1) ? tokens[1] : new String();
+ macroMap.put(macro, value);
+ }
+ addDefinedSymbols(macroMap);
+ } else if (option.getValueType() == IOption.INCLUDE_PATH) {
+ // Make sure it is a built-in, not a user-defined path
+ String[] values = option.getBuiltIns();
+ if (values.length > 0) {
+ addIncludePaths(Arrays.asList(values));
+ }
}
- addDefinedSymbols(macroMap);
- } else if (option.getValueType() == IOption.INCLUDE_PATH) {
- // Make sure it is a built-in, not a user-defined path
- String[] values = option.getBuiltIns();
- if (values.length > 0) {
- addIncludePaths(Arrays.asList(values));
- }
- }
+ } catch (BuildException e) {}
}
}
@@ -199,22 +202,15 @@ public class ManagedBuildCPathEntryContainer implements IPathEntryContainer {
ManagedBuildCPathEntryContainer.outputError(project.getName(), "Build information is null"); //$NON-NLS-1$
return (IPathEntry[])entries.toArray(new IPathEntry[entries.size()]);
}
- defaultTarget = info.getDefaultTarget();
- if (defaultTarget == null) {
- // The build information has not been loaded yet
- ManagedBuildCPathEntryContainer.outputError(project.getName(), "Build information has not been loaded yet"); //$NON-NLS-1$
- return (IPathEntry[])entries.toArray(new IPathEntry[entries.size()]);
- }
- ITarget parent = defaultTarget.getParent();
- if (parent == null) {
+ IConfiguration defaultConfig = info.getDefaultConfiguration();
+ if (defaultConfig == null) {
// The build information has not been loaded yet
ManagedBuildCPathEntryContainer.outputError(project.getName(), "Build information has not been loaded yet"); //$NON-NLS-1$
return (IPathEntry[])entries.toArray(new IPathEntry[entries.size()]);
}
-
+
// See if we can load a dynamic resolver
- String baseTargetId = parent.getId();
- IManagedScannerInfoCollector collector = ManagedBuildManager.getScannerInfoCollector(baseTargetId);
+ IManagedScannerInfoCollector collector = ManagedBuildManager.getScannerInfoCollector(defaultConfig);
if (collector != null) {
ManagedBuildCPathEntryContainer.outputTrace(project.getName(), "Path entries collected dynamically"); //$NON-NLS-1$
collector.setProject(info.getOwner().getProject());
@@ -223,10 +219,9 @@ public class ManagedBuildCPathEntryContainer implements IPathEntryContainer {
addDefinedSymbols(collector.getDefinedSymbols());
} else {
// If none supplied, use the built-ins
- IConfiguration config = info.getDefaultConfiguration(defaultTarget);
- if (config != null) {
- calculateBuiltIns(defaultTarget, config);
- ManagedBuildCPathEntryContainer.outputTrace(project.getName(), "Path entries set using built-in definitions from " + config.getName()); //$NON-NLS-1$
+ if (defaultConfig != null) {
+ calculateBuiltIns(defaultTarget, defaultConfig);
+ ManagedBuildCPathEntryContainer.outputTrace(project.getName(), "Path entries set using built-in definitions from " + defaultConfig.getName()); //$NON-NLS-1$
} else {
ManagedBuildCPathEntryContainer.outputError(project.getName(), "Configuration is null"); //$NON-NLS-1$
return (IPathEntry[])entries.toArray(new IPathEntry[entries.size()]);
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
index ab2d934bfe9..9039080ff5b 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.makegen.gnu;
-
/**********************************************************************
- * Copyright (c) 2003,2004 Rational Software Corporation and others.
+ * Copyright (c) 2003,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -10,6 +8,7 @@ package org.eclipse.cdt.managedbuilder.makegen.gnu;
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
+package org.eclipse.cdt.managedbuilder.makegen.gnu;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -27,9 +26,14 @@ import java.util.Vector;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.internal.core.model.Util;
+import org.eclipse.cdt.managedbuilder.core.BuildException;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
@@ -343,19 +347,45 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
String projectLocation = project.getLocation().toString();
String resourcePath = null;
String buildRule = null;
+ String OptDotExt = ""; //$NON-NLS-1$
+ boolean isItLinked = false;
+
+ if (outputExtension != "") //$NON-NLS-1$
+ OptDotExt = DOT + outputExtension;
+
// figure out path to use to resource
if(!resourceLocation.toString().startsWith(projectLocation)) {
// it IS linked, so use the actual location
+ isItLinked = true;
resourcePath = resourceLocation.toString();
// Need a hardcoded rule, not a pattern rule, as a linked file
// can reside in any path
- buildRule = relativePath + resourceName + DOT + outputExtension + COLON + WHITESPACE + resourcePath;
+ buildRule = relativePath + resourceName + OptDotExt + COLON + WHITESPACE + resourcePath;
} else {
// use the relative path (not really needed to store per se but in the future someone may want this)
resourcePath = relativePath;
+
// The rule and command to add to the makefile
- buildRule = relativePath + WILDCARD + DOT + outputExtension + COLON + WHITESPACE + ROOT + SEPARATOR + resourcePath + WILDCARD + DOT + inputExtension;
+ buildRule = relativePath + WILDCARD + OptDotExt + COLON + WHITESPACE + ROOT + SEPARATOR + resourcePath + WILDCARD + DOT + inputExtension;
} // end fix for PR 70491
+
+ IConfiguration config = info.getSelectedConfiguration();
+
+ // For testing only
+/* if( config.getResourceConfigurations().length > 0) {
+ IResourceConfiguration[] resConfigs = config.getResourceConfigurations();
+ for (int i = 0; i < resConfigs.length; i++) {
+ System.out.println("Name :" + resConfigs[i].getName());
+ }
+ }
+*/
+
+// We need to check whether we have any resource specific build information.
+ IResourceConfiguration resConfig = null;
+ if( config != null ) resConfig = config.getResourceConfiguration(resource.getFullPath().toString());
+ if( resConfig != null) {
+ buildRule = resourcePath + resourceName + OptDotExt + COLON + WHITESPACE + "$(ROOT)/" + resourcePath + resourceName + DOT + inputExtension; //$NON-NLS-1$
+ }
// No duplicates in a makefile
if (getRuleList().contains(buildRule)) {
@@ -366,14 +396,58 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
}
buffer.append(buildRule + NEWLINE);
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_START_FILE + WHITESPACE + IN_MACRO + SINGLE_QUOTE + NEWLINE);
- buildFlags = info.getFlagsForSource(inputExtension);
- outflag = info.getOutputFlag(outputExtension);
- outputPrefix = info.getOutputPrefix(outputExtension);
-
- // The command to build
- String buildCmd = cmd + WHITESPACE + buildFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + OUT_MACRO + WHITESPACE + IN_MACRO;
- buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
- buffer.append(TAB + AT + buildCmd);
+
+ IManagedCommandLineInfo cmdLInfo = null;
+ String[] inputs = null;
+ if( resConfig != null) {
+ ITool[] tools = resConfig.getTools();
+ try {
+ buildFlags = tools[0].getToolFlags();
+ } catch (BuildException e) {
+ buildFlags = null;
+ }
+ outflag = tools[0].getOutputFlag();
+ outputPrefix = tools[0].getOutputPrefix();
+ cmd = tools[0].getToolCommand();
+// The command to build
+
+ String fileName;
+ String rootDir = "../"; //$NON-NLS-1$
+ if (isItLinked)
+ fileName = resourcePath;
+ else
+ fileName = rootDir + relativePath + resConfig.getName();
+
+ inputs = new String[1]; inputs[0] = fileName;
+ String[] flags = null;
+ try {
+ flags = tools[0].getCommandFlags();
+ } catch( BuildException ex ) {
+ // TODO add some routines to catch this
+ flags = null;
+ }
+ IManagedCommandLineGenerator cmdLGen = tools[0].getCommandLineGenerator();
+ cmdLInfo = cmdLGen.generateCommandLineInfo( tools[0], cmd, flags, outflag, outputPrefix,
+ resourcePath + resourceName + OptDotExt, inputs, tools[0].getCommandLinePattern() );
+
+ String buildCmd = cmdLInfo.getCommandLine();
+// String buildCmd = cmd + WHITESPACE + buildFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + resourceName + OptDotExt + WHITESPACE + fileName;
+ buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
+ buffer.append(TAB + AT + buildCmd);
+ } else {
+ buildFlags = info.getFlagsForSource(inputExtension);
+ outflag = info.getOutputFlag(outputExtension);
+ outputPrefix = info.getOutputPrefix(outputExtension);
+ String[] flags = buildFlags.split( "\\s" ); //$NON-NLS-1$
+ inputs = new String[1]; inputs[0] = IN_MACRO;
+ cmdLInfo = info.generateCommandLineInfo( inputExtension, flags, outflag, outputPrefix, OUT_MACRO, inputs );
+ // The command to build
+ String buildCmd = null;
+ if( cmdLInfo == null ) buildCmd = cmd + WHITESPACE + buildFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + OUT_MACRO + WHITESPACE + IN_MACRO;
+ else buildCmd = cmdLInfo.getCommandLine();
+ buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
+ buffer.append(TAB + AT + buildCmd);
+ }
// determine if there are any deps to calculate
if (doDepGen && depGen.getCalculatorType() == IManagedDependencyGenerator.TYPE_COMMAND) {
@@ -409,7 +483,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
HashMap extensionToRuleStringMap = new HashMap();
// get the set of output extensions for all tools
- Set outputExtensionsSet = getOutputExtentions();
+ Set outputExtensionsSet = getOutputExtensions();
// put in rules if the file type is not a generated file
Iterator iter = buildTools.iterator();
@@ -421,7 +495,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// create a macro of the form "EXTENSION_SRCS := "
String extensionName = exListIterator.next().toString();
if(!extensionToRuleStringMap.containsKey(extensionName) && // do we already have a map entry?
- !getOutputExtentions().contains(extensionName)) { // is the file generated?
+ !getOutputExtensions().contains(extensionName)) { // is the file generated?
// Get the name in the proper macro format
StringBuffer macroName = getMacroName(extensionName);
@@ -443,16 +517,27 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// Visit the resources in this folder
IResource[] resources = module.members();
+ IConfiguration config = info.getSelectedConfiguration();
+ if (config == null) {
+ config = info.getDefaultConfiguration();
+ }
+ IResourceConfiguration resConfig;
+
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
if (resource.getType() == IResource.FILE) {
+ // Check whether this resource is excluded from build
+ resConfig = config.getResourceConfiguration(resource.getFullPath().toString());
+ if( (resConfig != null) && (resConfig.isExcluded()) )
+ continue;
+
String ext = resource.getFileExtension();
if (info.buildsFileType(ext)) {
// look for the extension in the map
StringBuffer bufferForExtension = new StringBuffer();
bufferForExtension.append(extensionToRuleStringMap.get(ext).toString());
if(bufferForExtension != null &&
- !getOutputExtentions().contains(bufferForExtension.toString())) {
+ !getOutputExtensions().contains(bufferForExtension.toString())) {
bufferForExtension.append(resource.getName() + WHITESPACE + LINEBREAK);
@@ -520,8 +605,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
StringBuffer buffer = new StringBuffer();
// Assemble the information needed to generate the targets
- String cmd = info.getToolForTarget(extension);
- String flags = info.getFlagsForTarget(extension);
+ String cmd = info.getToolForConfiguration(extension);
+ String flags = info.getFlagsForConfiguration(extension);
String outflag = info.getOutputFlag(extension);
String outputPrefix = info.getOutputPrefix(extension);
String targets = rebuild ? "clean all" : "all"; //$NON-NLS-1$ //$NON-NLS-2$
@@ -807,7 +892,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
String fileName = getFileName(deletedFile);
String srcExtension = deletedFile.getFileExtension();
String targetExtension = info.getOutputExtension(srcExtension);
- fileName += DOT + targetExtension;
+ if (targetExtension != "") //$NON-NLS-1$
+ fileName += DOT + targetExtension;
IPath projectRelativePath = deletedFile.getProjectRelativePath().removeLastSegments(1);
IPath targetFilePath = getBuildWorkingDir().append(projectRelativePath).append(fileName);
IResource depFile = project.findMember(targetFilePath);
@@ -1127,7 +1213,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
*
* @return a <code>Set</code> containing all of the output extensions
*/
- protected Set getOutputExtentions() {
+ protected Set getOutputExtensions() {
if (outputExtensionsSet == null) {
// The set of output extensions which will be produced by this tool.
// It is presumed that this set is not very large (likely < 10) so
@@ -1138,8 +1224,11 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// and add that to our list of output extensions.
Iterator iter = buildTools.iterator();
while(iter.hasNext()) {
- String[] outputs = ((ITool)iter.next()) .getOutputExtensions();
- outputExtensionsSet.addAll(Arrays.asList(outputs));
+ ITool tool = (ITool)iter.next();
+ String[] outputs = tool.getOutputExtensions();
+ if (outputs != null) {
+ outputExtensionsSet.addAll(Arrays.asList(outputs));
+ }
}
}
return outputExtensionsSet;
@@ -1190,7 +1279,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
extension = new String();
}
// Cache the build tools
- buildTools = new Vector(Arrays.asList(info.getDefaultTarget().getTools()));
+ buildTools = new Vector(Arrays.asList(info.getDefaultConfiguration().getFilteredTools()));
}
/* (non-Javadoc)
@@ -1424,7 +1513,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// Add the libraries this project depends on
macroBuffer.append("LIBS := "); //$NON-NLS-1$
- String[] libs = info.getLibsForTarget(extension);
+ String[] libs = info.getLibsForConfiguration(extension);
for (int i = 0; i < libs.length; i++) {
String string = libs[i];
macroBuffer.append(LINEBREAK + string);
@@ -1433,7 +1522,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// Add the extra user-specified objects
macroBuffer.append("USER_OBJS := "); //$NON-NLS-1$
- String[] userObjs = info.getUserObjectsForTarget(extension);
+ String[] userObjs = info.getUserObjectsForConfiguration(extension);
for (int j = 0; j < userObjs.length; j++) {
String string = userObjs[j];
macroBuffer.append(LINEBREAK + string);
@@ -1468,15 +1557,17 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// checked however.
// Generated files should not appear in the list.
- if(!getOutputExtentions().contains(extensionName) && !handledInputExtensions.contains(extensionName)) {
+ if(!getOutputExtensions().contains(extensionName) && !handledInputExtensions.contains(extensionName)) {
handledInputExtensions.add(extensionName);
StringBuffer macroName = getMacroName(extensionName);
-
+ String OptDotExt = ""; //$NON-NLS-1$
+ if (tool.getOutputExtension(extensionName) != "") //$NON-NLS-1$
+ OptDotExt = DOT + tool.getOutputExtension(extensionName);
+
// create dependency rule of the form
// OBJS = $(macroName1: $(ROOT)/%.input1=%.output1) ... $(macroNameN: $(ROOT)/%.inputN=%.outputN)
objectsBuffer.append(WHITESPACE + "$(" + macroName + COLON + "$(ROOT)" + SEPARATOR + WILDCARD //$NON-NLS-1$ //$NON-NLS-2$
- + DOT + extensionName + "=" + WILDCARD + DOT + //$NON-NLS-1$
- tool.getOutputExtension(extensionName) + ")" ); //$NON-NLS-1$
+ + DOT + extensionName + "=" + WILDCARD + OptDotExt + ")" ); //$NON-NLS-1$ //$NON-NLS-2$
// And another for the deps makefiles
// DEPS = $(macroName1: $(ROOT)/%.input1=%.DEP_EXT) ... $(macroNameN: $(ROOT)/%.inputN=%.DEP_EXT)
@@ -1512,7 +1603,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
while(exListIterator.hasNext()) {
// create a macro of the form "EXTENSION_SRCS :="
String extensionName = exListIterator.next().toString();
- if(!getOutputExtentions().contains(extensionName) && !handledInputExtensions.contains(extensionName)) {
+ if(!getOutputExtensions().contains(extensionName) && !handledInputExtensions.contains(extensionName)) {
handledInputExtensions.add(extensionName);
StringBuffer macroName = getMacroName(extensionName);
buffer.append(macroName + WHITESPACE + ":=" + WHITESPACE + NEWLINE); //$NON-NLS-1$
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/ConverterMessages.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/ConverterMessages.java
new file mode 100644
index 00000000000..75f851069c9
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/ConverterMessages.java
@@ -0,0 +1,52 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.projectconverter;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class ConverterMessages {
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.managedbuilder.projectconverter.PluginResources";//$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private ConverterMessages() {
+ }
+/*
+ public static String getString(String key) {
+ // TODO Auto-generated method stub
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+*/
+ public static String getResourceString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (NullPointerException e) {
+ return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ public static String getFormattedString(String key, String arg) {
+ return MessageFormat.format(getResourceString(key), new String[] { arg });
+ }
+
+ public static String getFormattedString(String key, String[] args) {
+ return MessageFormat.format(getResourceString(key), args);
+ }
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/PluginResources.properties b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/PluginResources.properties
new file mode 100644
index 00000000000..0956f33209a
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/PluginResources.properties
@@ -0,0 +1,42 @@
+#########################################
+# Copyright (c) 2004 Intel Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Common Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/cpl-v10.html
+#
+# Contributors:
+# Intel Corporation - Initial API and implementation
+#########################################
+
+UpdateManagedProject20.0=Backing up the settings file for {0}
+UpdateManagedProject20.1=Updating build settings for project {0}
+UpdateManagedProject20.10=No configurations were found for project {0}
+UpdateManagedProject20.11=Build exception occured while creating managed project {0} : {1}
+UpdateManagedProject20.2=convertConfiguration: Configuration {0} was not found
+UpdateManagedProject20.3=convertToolRef: Tool ID attribute does not exist
+UpdateManagedProject20.4=convertToolRef: Toolchain does not contain tools
+UpdateManagedProject20.5=convertToolRef: Parent not found for tool {0}
+UpdateManagedProject20.6=convertOptionRef: option ID attribute does not exist
+UpdateManagedProject20.7=convertOptionRef: option {0} not found
+UpdateManagedProject20.8=convertOptionRef: BuildException occured: {0}
+UpdateManagedProject20.9=Project type {0} not found
+UpdateManagedProject12.0=Backing up the settings file for {0}
+UpdateManagedProject12.1=Updating build settings for project {0}
+UpdateManagedProject12.2=configuration {0} not found
+UpdateManagedProject12.3=Parent not found for option {0}
+UpdateManagedProject12.4=option {0} not found
+UpdateManagedProject12.5=convertOptionRef: BuildException occured: {0}
+UpdateManagedProject12.6=Project type {0} not found
+UpdateManagedProject12.7=No configurations were found for project {0}
+UpdateManagedProject12.8=Build exception occured while creating managed project {0} : {1}
+UpdateManagedProject12.9=Toolchain does not contain tools
+UpdateManagedProject12.10=Parent not found for tool {0}
+UpdateManagedProject12.11=tool {0} not found
+UpdateManagedProjectManager.0=Backup File Already Exists
+UpdateManagedProjectManager.1=A backup file {0} already exists for the project {1}.\n Do you want to convert the project anyway?
+UpdateManagedProjectManager.2=The update operation has been cancelled.\n The build system will not be able to read the project settings until you update the project.
+UpdateManagedProjectManager.3=Update Managed Builder Project
+UpdateManagedProjectManager.4=The project {0} build settings are stored in a format that is no longer supported (version {1}).\n\nWould you like to convert it to the newer version ({2})?\n\nNOTE: Converted projects can no longer be loaded by previous versions of the Managed Build System.\nIf you select "No", project settings will be available in readonly mode.
+UpdateManagedProjectManager.5=Managed project conversion FAILED: \n ManagedBuildManager version {0} is not equivalent to ManagedProject version {1} (project ID = {2})
+UpdateManagedProjectManager.6=the project .cdtbuild file does not exist
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/actions/UpdateManagedProjectAction.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject12.java
index 35b568bf141..242280b3045 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/actions/UpdateManagedProjectAction.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject12.java
@@ -1,67 +1,48 @@
/**********************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
+ * Copyright (c) 2004 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
- * IBM - Initial API and implementation
+ * Intel Corporation - Initial API and implementation
**********************************************************************/
-package org.eclipse.cdt.managedbuilder.ui.actions;
+package org.eclipse.cdt.managedbuilder.projectconverter;
-import java.io.IOException;
import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Random;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IConfigurationV2;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IOption;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.IToolReference;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-/**
- * @since 2.0
- */
-public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegate {
+class UpdateManagedProject12 {
private static final String ID_CYGWIN = "cygwin"; //$NON-NLS-1$
@@ -104,44 +85,12 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
private static final int TYPE_SHARED = 1;
private static final int TYPE_STATIC = 2;
- /* (non-Javadoc)
- * Create a back-up file containing the pre-2.0 project settings.
- *
- * @param settingsFile
- * @param monitor
- * @param project
- * @throws CoreException
- */
- protected static void backupFile(IFile settingsFile, IProgressMonitor monitor, IProject project) throws CoreException {
- // Make a back-up of the settings file
- String newName = settingsFile.getName() + "_12backup"; //$NON-NLS-1$
- IContainer destFolder = (IContainer)project;
- IFile backupFile = destFolder.getFile(new Path(newName));
- if (backupFile.exists()) {
- Shell shell = ManagedBuilderUIPlugin.getDefault().getShell();
- boolean shouldUpdate = MessageDialog.openQuestion(shell,
- ManagedBuilderUIMessages.getResourceString("ManagedBuildConvert.12x.warning.title"), //$NON-NLS-1$
- ManagedBuilderUIMessages.getFormattedString("ManagedBuildConvert.12x.warning.message", project.getName())); //$NON-NLS-1$
- if (shouldUpdate) {
- backupFile.delete(true, monitor);
- } else {
- monitor.setCanceled(true);
- throw new OperationCanceledException(ManagedBuilderUIMessages.getFormattedString("ManagedBuildConvert.12x.cancelled.message", project.getName())); //$NON-NLS-1$
- }
- }
- settingsFile.copy(backupFile.getFullPath(), true, monitor);
- }
-
- protected static void convertConfiguration(ITarget newTarget, ITarget newParent, Element oldConfig, IProgressMonitor monitor) {
- IConfiguration newParentConfig = null;
- IConfiguration newConfig = null;
+ protected static String getNewConfigurationId(String oldId){
boolean cygwin = false;
boolean debug = false;
int type = -1;
- // Figure out what the original parent of the config is
- String parentId = oldConfig.getAttribute(IConfiguration.PARENT);
- StringTokenizer idTokens = new StringTokenizer(parentId, ID_SEPARATOR);
+ StringTokenizer idTokens = new StringTokenizer(oldId, ID_SEPARATOR);
while (idTokens.hasMoreTokens()) {
String id = idTokens.nextToken();
if (id.equalsIgnoreCase(ID_CYGWIN)) {
@@ -169,33 +118,71 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
defId += ID_STATIC;
break;
}
- defId += ID_SEPARATOR + (debug ? "debug" : "release"); //$NON-NLS-1$ //$NON-NLS-2$
- newParentConfig = newParent.getConfiguration(defId);
+ defId += ID_SEPARATOR + (debug ? "debug" : "release"); //$NON-NLS-1$ //$NON-NLS-2$
+ return defId;
+ }
+
+ protected static void convertConfiguration(IManagedProject newProject, IProjectType newParent, Element oldConfig, IProgressMonitor monitor)
+ throws CoreException {
+ IConfiguration newParentConfig = null;
+ IConfiguration newConfig = null;
+
+
+ // Figure out what the original parent of the config is
+ String parentId = oldConfig.getAttribute(IConfigurationV2.PARENT);
+ parentId = getNewConfigurationId(parentId);
+
+ newParentConfig = newParent.getConfiguration(parentId);
if (newParentConfig == null) {
- // Create a default gnu exe release or debug
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject12.2",parentId), null)); //$NON-NLS-1$
}
+
// Generate a random number for the new config id
- Random rand = new Random();
- rand.setSeed(System.currentTimeMillis());
- int randomElement = rand.nextInt();
- if (randomElement < 0) {
- randomElement *= -1;
- }
+ int randomElement = ManagedBuildManager.getRandomNumber();
+ String newConfigId = parentId + ID_SEPARATOR + randomElement;
// Create the new configuration
- newConfig = newTarget.createConfiguration(newParentConfig, defId + ID_SEPARATOR + randomElement);
+ newConfig = newProject.createConfiguration(newParentConfig, newConfigId);
+
+ Element oldTarget = (Element)oldConfig.getParentNode();
+ if(oldTarget.hasAttribute(ITarget.ARTIFACT_NAME)){
+ String artName = oldTarget.getAttribute(ITarget.ARTIFACT_NAME);
+ String ext = newConfig.getArtifactExtension();
+ int extIndex = artName.lastIndexOf("."); //$NON-NLS-1$
+ try{
+ if(extIndex != -1){
+ String name_ext = artName.substring(extIndex+1);
+ if(!"".equals(name_ext) && name_ext.equalsIgnoreCase(ext)) //$NON-NLS-1$
+ artName = artName.substring(0,extIndex);
+ }
+ }
+ catch(IndexOutOfBoundsException e){
+
+ }
+ newConfig.setArtifactName(artName);
+
+// newConfig(oldTarget.getAttribute(ITarget.ARTIFACT_NAME));
+ }
// Convert the tool references
- NodeList toolRefNodes = oldConfig.getElementsByTagName(IConfiguration.TOOLREF_ELEMENT_NAME);
+ IToolChain toolChain = newConfig.getToolChain();
+
+ NodeList toolRefNodes = oldConfig.getElementsByTagName(IConfigurationV2.TOOLREF_ELEMENT_NAME);
for (int refIndex = 0; refIndex < toolRefNodes.getLength(); ++refIndex) {
- convertToolRef(newConfig, (Element) toolRefNodes.item(refIndex), monitor);
+ try{
+ convertToolRef(toolChain, (Element) toolRefNodes.item(refIndex), monitor);
+ }
+ catch(CoreException e){
+ newProject.removeConfiguration(newConfigId);
+ throw e;
+ }
}
monitor.worked(1);
}
- protected static void convertOptionRef(IConfiguration newConfig, ITool newTool, Element optRef) {
- String optId = optRef.getAttribute(IOption.ID);
- if (optId == null) return;
- String[] idTokens = optId.split("\\."); //$NON-NLS-1$
+ protected static String getNewOptionId(IToolChain toolChain, ITool tool, String oldId)
+ throws CoreException{
+ String[] idTokens = oldId.split("\\."); //$NON-NLS-1$
// New ID will be in for gnu.[compiler|link|lib].[c|c++|both].option.{1.2_component}
Vector newIdVector = new Vector(idTokens.length + 2);
@@ -262,26 +249,56 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
}
// Construct the new ID
- String newOptionId = new String();
+ String optId = new String();
for (int rebuildIndex = 0; rebuildIndex < newIdVector.size(); ++ rebuildIndex) {
String token = (String) newIdVector.get(rebuildIndex);
- newOptionId += token;
+ optId += token;
if (rebuildIndex < newIdVector.size() - 1) {
- newOptionId += ID_SEPARATOR;
+ optId += ID_SEPARATOR;
}
}
+ IConfiguration configuration = toolChain.getParent();
+
+ IOption options[] = tool.getOptions();
+ for(int i = 0; i < options.length; i++){
+ IOption curOption = options[i];
+ IOption parent = curOption.getSuperClass();
+ String curOptionId = curOption.getId();
+
+ if(parent == null)
+ continue;
+
+ String parentId = parent.getId();
+ if(!parentId.equals(optId))
+ continue;
+
+ return curOption.getId();
+ }
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject12.3",optId), null)); //$NON-NLS-1$
+ }
+
+ protected static void convertOptionRef(IToolChain toolChain, ITool tool, Element optRef)
+ throws CoreException {
+ String optId = optRef.getAttribute(IOption.ID);
+ if (optId == null) return;
+
+ optId = getNewOptionId(toolChain, tool, optId);
// Get the option from the new tool
- IOption newOpt = newTool.getOptionById(newOptionId);
+ IOption newOpt = tool.getOptionById(optId);
if (newOpt == null) {
- // TODO flag warning condition to user
- return;
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject12.4",optId), null)); //$NON-NLS-1$
}
+
+ IConfiguration configuration = toolChain.getParent();
+
try {
switch (newOpt.getValueType()) {
case IOption.BOOLEAN:
Boolean bool = new Boolean(optRef.getAttribute(IOption.DEFAULT_VALUE));
- newConfig.setOption(newOpt, bool.booleanValue());
+ configuration.setOption(tool, newOpt, bool.booleanValue());
break;
case IOption.STRING:
case IOption.ENUMERATED:
@@ -289,7 +306,7 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
String name = (String) optRef.getAttribute(IOption.DEFAULT_VALUE);
// Convert it to the ID
String idValue = newOpt.getEnumeratedId(name);
- newConfig.setOption(newOpt, idValue != null ? idValue : name);
+ configuration.setOption(tool, newOpt, idValue != null ? idValue : name);
break;
case IOption.STRING_LIST:
case IOption.INCLUDE_PATH:
@@ -307,29 +324,23 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
}
}
}
- newConfig.setOption(newOpt, (String[])values.toArray(new String[values.size()]));
+ configuration.setOption(tool, newOpt, (String[])values.toArray(new String[values.size()]));
break;
}
} catch (BuildException e) {
- // TODO flag error to user
- return;
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject12.5",e.getMessage()), e)); //$NON-NLS-1$
}
}
- protected static ITarget convertTarget(IProject project, Element oldTarget, IProgressMonitor monitor) {
- // What we want to create
- ITarget newTarget = null;
- ITarget newParent = null;
+
+ protected static String getNewProjectId(String oldId){
// The type of target we are converting from/to
int type = -1;
// Use the Cygwin or generic target form
boolean posix = false;
-
- // Get the parent
- String id = oldTarget.getAttribute(ITarget.PARENT);
-
- // Figure out the new target definition to use for that type
- StringTokenizer idTokens = new StringTokenizer(id, ID_SEPARATOR);
+
+ StringTokenizer idTokens = new StringTokenizer(oldId, ID_SEPARATOR);
while (idTokens.hasMoreTokens()) {
String token = idTokens.nextToken();
if (token.equals(ID_LINUX) || token.equals(ID_SOLARIS)) {
@@ -354,42 +365,69 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
case TYPE_STATIC :
defID += ID_STATIC;
break;
- }
-
+ }
+ return defID;
+ }
+
+ protected static IManagedProject convertTarget(IProject project, Element oldTarget, IProgressMonitor monitor) throws CoreException{
+ // What we want to create
+ IManagedProject newProject = null;
+ IProjectType newParent = null;
+
+ // Get the parent
+ String id = oldTarget.getAttribute(ITarget.PARENT);
+ String parentID = getNewProjectId(id);
+
// Get the new target definitions we need for the conversion
- newParent = ManagedBuildManager.getTarget(project, defID);
+ newParent = ManagedBuildManager.getProjectType(parentID);
+
if (newParent == null) {
- // Return null and let the caller deal with the error reporting
- return null;
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject12.6",parentID), null)); //$NON-NLS-1$
}
try {
// Create a new target based on the new parent
- newTarget = ManagedBuildManager.createTarget(project, newParent);
- newTarget.setArtifactName(oldTarget.getAttribute(ITarget.ARTIFACT_NAME));
+ newProject = ManagedBuildManager.createManagedProject(project, newParent);
// Create new configurations
- NodeList configNodes = oldTarget.getElementsByTagName(IConfiguration.CONFIGURATION_ELEMENT_NAME);
+ NodeList configNodes = oldTarget.getElementsByTagName(IConfigurationV2.CONFIGURATION_ELEMENT_NAME);
for (int configIndex = 0; configIndex < configNodes.getLength(); ++configIndex) {
- convertConfiguration(newTarget, newParent, (Element) configNodes.item(configIndex), monitor);
+ try{
+ convertConfiguration(newProject, newParent, (Element) configNodes.item(configIndex), monitor);
+ }
+ catch(CoreException e){
+
+ }
+ }
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ IConfiguration[] newConfigs = newProject.getConfigurations();
+ if (newConfigs.length > 0) {
+ info.setDefaultConfiguration(newConfigs[0]);
+ info.setSelectedConfiguration(newConfigs[0]);
+ }
+ else{
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject12.7",newProject.getName()), null)); //$NON-NLS-1$
}
} catch (BuildException e) {
- // Probably just a mismatch between option value and option
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject12.8",new String[]{newProject.getName(),e.getMessage()}), null)); //$NON-NLS-1$
}
monitor.worked(1);
- return newTarget;
+ return newProject;
}
- protected static void convertToolRef(IConfiguration newConfig, Element oldToolRef, IProgressMonitor monitor) {
- String oldToolId = oldToolRef.getAttribute(IToolReference.ID);
+ protected static String getNewToolId(IToolChain toolChain, String oldId)
+ throws CoreException {
// All known tools have id NEW_TOOL_ROOT.[c|cpp].[compiler|linker|archiver]
- String newToolId = NEW_TOOL_ROOT;
+ String toolId = NEW_TOOL_ROOT;
boolean cppFlag = true;
int toolType = -1;
// Figure out what kind of tool the ref pointed to
- StringTokenizer idTokens = new StringTokenizer(oldToolId, ID_SEPARATOR);
+ StringTokenizer idTokens = new StringTokenizer(oldId, ID_SEPARATOR);
while (idTokens.hasMoreTokens()) {
String token = idTokens.nextToken();
if(token.equals(TOOL_LANG_C)) {
@@ -408,27 +446,76 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
}
// Now complete the new tool id
- newToolId += ID_SEPARATOR + (cppFlag ? "cpp" : "c") + ID_SEPARATOR; //$NON-NLS-1$ //$NON-NLS-2$
+ toolId += ID_SEPARATOR + (cppFlag ? "cpp" : "c") + ID_SEPARATOR; //$NON-NLS-1$ //$NON-NLS-2$
switch (toolType) {
case TOOL_TYPE_COMPILER:
- newToolId += TOOL_NAME_COMPILER;
+ toolId += TOOL_NAME_COMPILER;
break;
case TOOL_TYPE_LINKER:
- newToolId += TOOL_NAME_LINKER;
+ toolId += TOOL_NAME_LINKER;
break;
case TOOL_TYPE_ARCHIVER:
- newToolId += TOOL_NAME_ARCHIVER;
+ toolId += TOOL_NAME_ARCHIVER;
break;
}
+ IConfiguration configuration = toolChain.getParent();
+ ITool tools[] = configuration.getTools();
+ if(tools == null) {
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getResourceString("UpdateManagedProject12.9"), null)); //$NON-NLS-1$
+ }
+
+ for(int i = 0; i < tools.length; i++){
+ ITool curTool = tools[i];
+ ITool parent = curTool.getSuperClass();
+ String curToolId = curTool.getId();
+
+ if(parent == null)
+ continue;
+
+ parent = parent.getSuperClass();
+ if(parent == null)
+ continue;
+
+ String parentId = parent.getId();
+ if(!parentId.equals(toolId))
+ continue;
+
+ try{
+ Integer.decode(curToolId.substring(curToolId.lastIndexOf('.')+1)); //$NON-NLS-1$
+ }
+ catch(IndexOutOfBoundsException e){
+ continue;
+ }
+ catch(NumberFormatException e){
+ continue;
+ }
+ return curTool.getId();
+ }
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject12.10",toolId), null)); //$NON-NLS-1$
+ }
+
+ protected static void convertToolRef(IToolChain toolChain, Element oldToolRef, IProgressMonitor monitor)
+ throws CoreException {
+ String toolId = oldToolRef.getAttribute(IToolReference.ID);
+
+ toolId = getNewToolId(toolChain, toolId);
+
+ IConfiguration configuration = toolChain.getParent();
+
// Get the new tool out of the configuration
- ITool newTool = newConfig.getToolById(newToolId);
+ ITool newTool = configuration.getTool(toolId);
// Check that this is not null
+ if(newTool == null)
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject12.11",toolId), null)); //$NON-NLS-1$
// The ref may or may not contain overridden options
NodeList optRefs = oldToolRef.getElementsByTagName(ITool.OPTION_REF);
for (int refIndex = optRefs.getLength() - 1; refIndex >= 0; --refIndex) {
- convertOptionRef(newConfig, newTool, (Element) optRefs.item(refIndex));
+ convertOptionRef(toolChain, newTool, (Element) optRefs.item(refIndex));
}
monitor.worked(1);
}
@@ -438,7 +525,7 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
* @param project the <code>IProject</code> that needs to be upgraded
* @throws CoreException
*/
- protected static void doProjectUpdate(IProgressMonitor monitor, IProject project) throws CoreException {
+ static void doProjectUpdate(IProgressMonitor monitor, IProject project) throws CoreException {
String[] projectName = new String[]{project.getName()};
IFile settingsFile = project.getFile(ManagedBuildManager.SETTINGS_FILE_NAME);
if (!settingsFile.exists()) {
@@ -447,10 +534,10 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
}
// Backup the file
- monitor.beginTask(ManagedBuilderUIMessages.getFormattedString("ManagedBuildConvert.12x.monitor.message.backup", projectName), 1); //$NON-NLS-1$
- backupFile(settingsFile, monitor, project);
+ monitor.beginTask(ConverterMessages.getFormattedString("UpdateManagedProject12.0", projectName), 1); //$NON-NLS-1$
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
-
+ UpdateManagedProjectManager.backupFile(settingsFile, "_12backup", monitor, project); ; //$NON-NLS-1$
+
//Now convert each target to the new format
try {
// Load the old build file
@@ -462,119 +549,29 @@ public class UpdateManagedProjectAction implements IWorkbenchWindowActionDelegat
NodeList targetNodes = document.getElementsByTagName(ITarget.TARGET_ELEMENT_NAME);
// This is a guess, but typically the project has 1 target, 2 configs, and 6 tool defs
int listSize = targetNodes.getLength();
- monitor.beginTask(ManagedBuilderUIMessages.getFormattedString("ManagedBuildConvert.12x.monitor.message.project", projectName), listSize * 9); //$NON-NLS-1$
+ monitor.beginTask(ConverterMessages.getFormattedString("UpdateManagedProject12.1", projectName), listSize * 9); //$NON-NLS-1$
for (int targIndex = 0; targIndex < listSize; ++targIndex) {
Element oldTarget = (Element) targetNodes.item(targIndex);
String oldTargetId = oldTarget.getAttribute(ITarget.ID);
- ITarget newTarget = convertTarget(project, oldTarget, monitor);
+ IManagedProject newProject = convertTarget(project, oldTarget, monitor);
// Remove the old target
- if (newTarget != null) {
+ if (newProject != null) {
info.removeTarget(oldTargetId);
monitor.worked(9);
}
}
// Upgrade the version
((ManagedBuildInfo)info).setVersion(ManagedBuildManager.getBuildInfoVersion().toString());
- } catch (ParserConfigurationException e) {
- ManagedBuilderUIPlugin.log(e);
- } catch (FactoryConfigurationError e) {
- ManagedBuilderUIPlugin.log(e);
- } catch (SAXException e) {
- ManagedBuilderUIPlugin.log(e);
- } catch (IOException e) {
- ManagedBuilderUIPlugin.log(e);
+ }catch (CoreException e){
+ throw e;
+ }catch (Exception e) {
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ e.getMessage(), e));
} finally {
ManagedBuildManager.saveBuildInfo(project, false);
monitor.done();
}
}
- /**
- * Determines which projects in the workspace are still using
- * the settings format defined in CDT 1.2.x.
- *
- * @return an array of <code>IProject</code> that need to have their
- * project settings updated to the CDT 2.0 format
- */
- public static IProject[] getVersion12Projects() {
- IProject[] projects = ManagedBuilderUIPlugin.getWorkspace().getRoot().getProjects();
- Vector result = new Vector();
- for (int index = projects.length - 1; index >=0 ; --index) {
- if (projects[index].isAccessible()) {
- IProjectDescription description;
- try {
- description = projects[index].getDescription();
- } catch (CoreException e) {
- // This can only mean that something really bad has happened
- continue;
- }
- // Make sure it has a managed nature
- if (description == null || !description.hasNature(ManagedCProjectNature.MNG_NATURE_ID)) {
- continue;
- }
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(projects[index]);
- if (info != null && info.getVersion()== null) {
- // This is a pre-2.0 file (no version info)
- result.add(projects[index]);
- }
- }
- }
-
- return (IProject[]) result.toArray(new IProject[result.size()]);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
- */
- public void dispose() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- // TODO Auto-generated method stub
-
- }
-
- static public void run(boolean fork, IRunnableContext context, final IProject project) {
- try {
- context.run(fork, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- doProjectUpdate(monitor, project);
- }
- };
- ManagedBuilderUIPlugin.getWorkspace().run(runnable, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } catch (OperationCanceledException e) {
- throw new InterruptedException(e.getMessage());
- }
- }
- });
- } catch (InterruptedException e) {
- return;
- } catch (InvocationTargetException e) {
- CCorePlugin.log(e); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- // TODO Auto-generated method stub
-
- }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java
new file mode 100644
index 00000000000..e77227b51de
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java
@@ -0,0 +1,428 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.projectconverter;
+
+
+import java.io.InputStream;
+import java.util.Vector;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.eclipse.cdt.managedbuilder.core.BuildException;
+import org.eclipse.cdt.managedbuilder.core.IBuilder;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IConfigurationV2;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.IOption;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.ITarget;
+import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.IToolReference;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
+import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+class UpdateManagedProject20 {
+ private static final String ID_SEPARATOR = "."; //$NON-NLS-1$
+
+ /**
+ * @param monitor the monitor to allow users to cancel the long-running operation
+ * @param project the <code>IProject</code> that needs to be upgraded
+ * @throws CoreException
+ */
+ static void doProjectUpdate(IProgressMonitor monitor, IProject project) throws CoreException {
+ String[] projectName = new String[]{project.getName()};
+ IFile settingsFile = project.getFile(ManagedBuildManager.SETTINGS_FILE_NAME);
+ if (!settingsFile.exists()) {
+ monitor.done();
+ return;
+ }
+
+ // Backup the file
+ monitor.beginTask(ConverterMessages.getFormattedString("UpdateManagedProject20.0", projectName), 1); //$NON-NLS-1$
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ UpdateManagedProjectManager.backupFile(settingsFile, "_20backup", monitor, project); //$NON-NLS-1$
+
+ try {
+ // Load the old build file
+ InputStream stream = settingsFile.getContents();
+ DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Document document = parser.parse(stream);
+
+ // Clone the target based on the proper target definition
+ NodeList targetNodes = document.getElementsByTagName(ITarget.TARGET_ELEMENT_NAME);
+ // This is a guess, but typically the project has 1 target, 2 configs, and 6 tool defs
+ int listSize = targetNodes.getLength();
+ monitor.beginTask(ConverterMessages.getFormattedString("UpdateManagedProject20.1", projectName), listSize * 9); //$NON-NLS-1$
+ for (int targIndex = 0; targIndex < listSize; ++targIndex) {
+ Element oldTarget = (Element) targetNodes.item(targIndex);
+ String oldTargetId = oldTarget.getAttribute(ITarget.ID);
+ IManagedProject newProject = convertTarget(project, oldTarget, monitor);
+
+ // Remove the old target
+ if (newProject != null) {
+ info.removeTarget(oldTargetId);
+ monitor.worked(9);
+ }
+ }
+ // Upgrade the version
+ ((ManagedBuildInfo)info).setVersion(ManagedBuildManager.getBuildInfoVersion().toString());
+ }catch (CoreException e){
+ throw e;
+ }catch (Exception e) {
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ e.getMessage(), e));
+ } finally {
+ ManagedBuildManager.saveBuildInfo(project, false);
+ monitor.done();
+ }
+
+ }
+
+ protected static IManagedProject convertTarget(IProject project, Element oldTarget, IProgressMonitor monitor)
+ throws CoreException{
+ // What we want to create
+ IManagedProject newProject = null;
+ IProjectType newParent = null;
+
+ // Get the parent
+ String parentID = oldTarget.getAttribute(ITarget.PARENT);
+
+ String targetID = oldTarget.getAttribute(ITarget.ID);
+
+ // Get the new target definitions we need for the conversion
+ newParent = ManagedBuildManager.getProjectType(parentID);
+
+ if (newParent == null) {
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject20.9",parentID), null)); //$NON-NLS-1$
+ }
+
+ try {
+ // Create a new ManagedProject based on the new parent
+ newProject = ManagedBuildManager.createManagedProject(project, newParent);
+
+ // Create new configurations
+ NodeList configNodes = oldTarget.getElementsByTagName(IConfigurationV2.CONFIGURATION_ELEMENT_NAME);
+ for (int configIndex = 0; configIndex < configNodes.getLength(); ++configIndex) {
+ try{
+ convertConfiguration(newProject, newParent, (Element) configNodes.item(configIndex), monitor);
+ }
+ catch(CoreException e){
+ //TODO: implement logging
+ //should we continue or fail ??
+ }
+ }
+
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ IConfiguration[] newConfigs = newProject.getConfigurations();
+ if (newConfigs.length > 0) {
+ info.setDefaultConfiguration(newConfigs[0]);
+ info.setSelectedConfiguration(newConfigs[0]);
+ }
+ else{
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject20.10",newProject.getName()), null)); //$NON-NLS-1$
+ }
+ } catch (BuildException e) {
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject20.11",new String[]{newProject.getName(),e.getMessage()}), null)); //$NON-NLS-1$
+ }
+
+ monitor.worked(1);
+ return newProject;
+ }
+
+ protected static void convertConfiguration(IManagedProject newProject, IProjectType newParent, Element oldConfig, IProgressMonitor monitor)
+ throws CoreException {
+ IConfiguration newParentConfig = null;
+ IConfiguration newConfig = null;
+
+ // Figure out what the original parent of the config is
+ String parentId = oldConfig.getAttribute(IConfigurationV2.PARENT);
+
+ newParentConfig = newParent.getConfiguration(parentId);
+ if (newParentConfig == null) {
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject20.2", parentId), null)); //$NON-NLS-1$
+ }
+ // Generate a random number for the new config id
+ int randomElement = ManagedBuildManager.getRandomNumber();
+ String newConfigId = parentId + ID_SEPARATOR + randomElement;
+ // Create the new configuration
+ newConfig = newProject.createConfiguration(newParentConfig, newConfigId);
+
+ if(oldConfig.hasAttribute(IConfigurationV2.NAME))
+ newConfig.setName(oldConfig.getAttribute(IConfigurationV2.NAME));
+
+ Element targetEl = (Element)oldConfig.getParentNode();
+
+ if(targetEl.hasAttribute(ITarget.ARTIFACT_NAME))
+ newConfig.setArtifactName(targetEl.getAttribute(ITarget.ARTIFACT_NAME));
+
+ if(targetEl.hasAttribute(ITarget.ERROR_PARSERS))
+ newConfig.setErrorParserIds(targetEl.getAttribute(ITarget.ERROR_PARSERS));
+
+ if(targetEl.hasAttribute(ITarget.CLEAN_COMMAND))
+ newConfig.setCleanCommand(targetEl.getAttribute(ITarget.CLEAN_COMMAND));
+
+ if(targetEl.hasAttribute(ITarget.EXTENSION))
+ newConfig.setArtifactExtension(targetEl.getAttribute(ITarget.EXTENSION));
+
+ // Convert the tool references
+
+ IToolChain toolChain = newConfig.getToolChain();
+
+ if(targetEl.hasAttribute(ITarget.OS_LIST)){
+ String oses = targetEl.getAttribute(ITarget.OS_LIST);
+ String osList[] = oses.split(","); //$NON-NLS-1$
+ for (int i = 0; i < osList.length; ++i) {
+ osList[i]=osList[i].trim();
+ }
+ toolChain.setOSList(osList);
+ }
+
+ if(targetEl.hasAttribute(ITarget.ARCH_LIST)){
+ String archs = targetEl.getAttribute(ITarget.ARCH_LIST);
+ String archList[] = archs.split(","); //$NON-NLS-1$
+ for (int i = 0; i < archList.length; ++i) {
+ archList[i]=archList[i].trim();
+ }
+ toolChain.setArchList(archList);
+ }
+
+ if(targetEl.hasAttribute(ITarget.BINARY_PARSER)){
+ String binaryParser = targetEl.getAttribute(ITarget.BINARY_PARSER);
+ ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
+ if(targetPlatform.isExtensionElement()){
+ int nnn = ManagedBuildManager.getRandomNumber();
+ String subId = targetPlatform.getId() + "." + nnn; //$NON-NLS-1$
+ String builderName = targetPlatform.getName() + "." + newConfig.getName(); //$NON-NLS-1$
+ toolChain.createTargetPlatform(targetPlatform,subId,builderName,false);
+ }
+ targetPlatform.setBinaryParserId(binaryParser);
+ }
+
+ if(targetEl.hasAttribute(ITarget.MAKE_COMMAND)){
+ String makeCommand = targetEl.getAttribute(ITarget.MAKE_COMMAND);
+ IBuilder builder = toolChain.getBuilder();
+ if (builder.isExtensionElement()) {
+ int nnn = ManagedBuildManager.getRandomNumber();
+ String subId = builder.getId() + "." + nnn; //$NON-NLS-1$
+ String builderName = builder.getName() + "." + newConfig.getName(); //$NON-NLS-1$
+ builder = toolChain.createBuilder(builder, subId, builderName, false);
+ }
+ builder.setCommand(makeCommand);
+ }
+
+ if(targetEl.hasAttribute(ITarget.MAKE_ARGS)){
+ String makeArguments = targetEl.getAttribute(ITarget.MAKE_ARGS);
+ IBuilder builder = toolChain.getBuilder();
+ if (builder.isExtensionElement()) {
+ int nnn = ManagedBuildManager.getRandomNumber();
+ String subId = builder.getId() + "." + nnn; //$NON-NLS-1$
+ String builderName = builder.getName() + "." + newConfig.getName(); //$NON-NLS-1$
+ builder = toolChain.createBuilder(builder, subId, builderName, false);
+ }
+ builder.setArguments(makeArguments);
+ }
+
+ NodeList toolRefNodes = oldConfig.getElementsByTagName(IConfigurationV2.TOOLREF_ELEMENT_NAME);
+ for (int refIndex = 0; refIndex < toolRefNodes.getLength(); ++refIndex) {
+ try{
+ convertToolRef(toolChain, (Element) toolRefNodes.item(refIndex), monitor);
+ }
+ catch(CoreException e){
+ newProject.removeConfiguration(newConfigId);
+ throw e;
+ }
+ }
+
+ monitor.worked(1);
+ }
+
+ protected static void convertToolRef(IToolChain toolChain, Element oldToolRef, IProgressMonitor monitor)
+ throws CoreException {
+ if(!oldToolRef.hasAttribute(IToolReference.ID)) {
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getResourceString("UpdateManagedProject20.3"), null)); //$NON-NLS-1$
+ }
+
+ String toolId = oldToolRef.getAttribute(IToolReference.ID);
+ IConfiguration configuration = toolChain.getParent();
+
+ ITool tools[] = configuration.getTools();
+ if(tools == null) {
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getResourceString("UpdateManagedProject20.4"), null)); //$NON-NLS-1$
+ }
+
+ ITool tool = null;
+ for(int i = 0; i < tools.length; i++){
+ ITool curTool = tools[i];
+ ITool parent = curTool.getSuperClass();
+ String curToolId = curTool.getId();
+
+ if(parent == null)
+ continue;
+
+ parent = parent.getSuperClass();
+ if(parent == null)
+ continue;
+
+ String parentId = parent.getId();
+ if(!parentId.equals(toolId))
+ continue;
+
+ try{
+ Integer.decode(curToolId.substring(curToolId.lastIndexOf('.')+1)); //$NON-NLS-1$
+ }
+ catch(IndexOutOfBoundsException e){
+ continue;
+ }
+ catch(NumberFormatException e){
+ continue;
+ }
+ tool = curTool;
+ break;
+ }
+
+ if(tool == null){
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject20.5",toolId), null)); //$NON-NLS-1$
+ }
+
+ //the tool found, proceed with conversion ...
+
+ if(oldToolRef.hasAttribute(IToolReference.COMMAND))
+ tool.setToolCommand(oldToolRef.getAttribute(IToolReference.COMMAND));
+
+ if(oldToolRef.hasAttribute(IToolReference.OUTPUT_FLAG))
+ tool.setOutputFlag(oldToolRef.getAttribute(IToolReference.OUTPUT_FLAG));
+
+ if(oldToolRef.hasAttribute(IToolReference.OUTPUT_PREFIX))
+ tool.setOutputPrefix(oldToolRef.getAttribute(IToolReference.OUTPUT_PREFIX));
+
+
+ if(oldToolRef.hasAttribute(IToolReference.OUTPUTS)){
+ String outputs = oldToolRef.getAttribute(IToolReference.OUTPUTS);
+ tool.setOutputExtensions(outputs);
+ }
+
+ NodeList optRefs = oldToolRef.getElementsByTagName(ITool.OPTION_REF);
+ for (int refIndex = optRefs.getLength() - 1; refIndex >= 0; --refIndex) {
+ convertOptionRef(toolChain, tool, (Element) optRefs.item(refIndex), monitor);
+ }
+
+ monitor.worked(1);
+ }
+
+ protected static void convertOptionRef(IToolChain toolChain, ITool tool, Element optRef, IProgressMonitor monitor)
+ throws CoreException {
+
+ if(!optRef.hasAttribute(IOption.ID)){
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getResourceString("UpdateManagedProject20.6"), null)); //$NON-NLS-1$
+ }
+
+ String optId = optRef.getAttribute(IOption.ID);
+
+ IConfiguration configuration = toolChain.getParent();
+
+ IOption options[] = tool.getOptions();
+ IOption option = null;
+
+ for(int i = 0; i < options.length; i++){
+ IOption curOption = options[i];
+ IOption parent = curOption.getSuperClass();
+ String curOptionId = curOption.getId();
+
+ if(parent == null)
+ continue;
+
+ String parentId = parent.getId();
+ if(!parentId.equals(optId))
+ continue;
+
+ option = curOption;
+ break;
+ }
+
+ if(option == null)
+ option = tool.getOptionById(optId);
+
+ if(option == null){
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject20.7",optId), null)); //$NON-NLS-1$
+ }
+
+ try{
+ int type = option.getValueType();
+
+ switch(type){
+ case IOption.BOOLEAN:{
+ if(optRef.hasAttribute(IOption.DEFAULT_VALUE)){
+ Boolean bool = new Boolean(optRef.getAttribute(IOption.DEFAULT_VALUE));
+ configuration.setOption(tool,option,bool.booleanValue());
+ }
+ break;
+ }
+ case IOption.ENUMERATED:
+ case IOption.STRING:{
+ if(optRef.hasAttribute(IOption.DEFAULT_VALUE))
+ configuration.setOption(tool,option,optRef.getAttribute(IOption.DEFAULT_VALUE));
+ break;
+ }
+ case IOption.STRING_LIST:
+ case IOption.INCLUDE_PATH:
+ case IOption.PREPROCESSOR_SYMBOLS:
+ case IOption.LIBRARIES:
+ case IOption.OBJECTS:{
+ Vector values = new Vector();
+ NodeList nodes = optRef.getElementsByTagName(IOption.LIST_VALUE);
+ for (int j = 0; j < nodes.getLength(); ++j) {
+ Node node = nodes.item(j);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Boolean isBuiltIn = new Boolean(((Element)node).getAttribute(IOption.LIST_ITEM_BUILTIN));
+ if (!isBuiltIn.booleanValue()) {
+ values.add(((Element)node).getAttribute(IOption.LIST_ITEM_VALUE));
+ }
+ }
+ }
+ configuration.setOption(tool,option,(String[])values.toArray(new String[values.size()]));
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ catch(BuildException e){
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject20.8",e.getMessage()), e)); //$NON-NLS-1$
+ }
+
+ }
+}
+
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProjectManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProjectManager.java
new file mode 100644
index 00000000000..4a8d46c16dd
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProjectManager.java
@@ -0,0 +1,295 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.projectconverter;
+
+import java.util.HashMap;
+
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
+import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.PluginVersionIdentifier;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.IOverwriteQuery;
+
+public class UpdateManagedProjectManager {
+ static private HashMap fUpdateManagers = new HashMap();
+ static private IOverwriteQuery fBackupFileOverwriteQuery = null;
+ static private IOverwriteQuery fOpenQuestionQuery = null;
+ static private IOverwriteQuery fUpdateProjectQuery = null;
+
+ private ManagedBuildInfo fConvertedInfo= null;
+ private boolean fIsInfoReadOnly = false;
+ final private IProject fProject;
+
+ private UpdateManagedProjectManager(IProject project){
+ fProject = project;
+ }
+
+ public static void setBackupFileOverwriteQuery(IOverwriteQuery backupFileOverwriteQuery){
+ fBackupFileOverwriteQuery = backupFileOverwriteQuery;
+ }
+/*
+ public static void setOpenQuestionQuery(IOverwriteQuery openQuestionQuery){
+ fOpenQuestionQuery = openQuestionQuery;
+ }
+*/
+ public static void setUpdateProjectQuery(IOverwriteQuery updateProjectQuery){
+ fUpdateProjectQuery = updateProjectQuery;
+ }
+
+ private static boolean getBooleanFromQueryAnswer(String answer){
+ if(IOverwriteQuery.ALL.equalsIgnoreCase(answer) ||
+ IOverwriteQuery.YES.equalsIgnoreCase(answer))
+ return true;
+ else
+ return false;
+ }
+
+ synchronized static private UpdateManagedProjectManager getUpdateManager(IProject project){
+ UpdateManagedProjectManager mngr = getExistingUpdateManager(project);
+ if(mngr == null)
+ mngr = createUpdateManager(project);
+ return mngr;
+ }
+
+ static private UpdateManagedProjectManager getExistingUpdateManager(IProject project){
+ return (UpdateManagedProjectManager)fUpdateManagers.get(project.getName());
+ }
+
+ static private UpdateManagedProjectManager createUpdateManager(IProject project){
+ UpdateManagedProjectManager mngr = new UpdateManagedProjectManager(project);
+ fUpdateManagers.put(project.getName(),mngr);
+ return mngr;
+ }
+
+ static private void removeUpdateManager(IProject project){
+ UpdateManagedProjectManager mngr = getExistingUpdateManager(project);
+ if(mngr == null)
+ return;
+ fUpdateManagers.remove(project.getName());
+ }
+
+ static protected PluginVersionIdentifier getManagedBuildInfoVersion(String version){
+ if(version == null)
+ version = "1.2"; //$NON-NLS-1$
+ return new PluginVersionIdentifier(version);
+ }
+
+ static public boolean isCompatibleProject(IManagedBuildInfo info) {
+ if(info == null)
+ return false;
+
+ PluginVersionIdentifier projVersion = getManagedBuildInfoVersion(info.getVersion());
+
+ PluginVersionIdentifier compVersion = ManagedBuildManager.getBuildInfoVersion();
+
+ if(projVersion.isEquivalentTo(compVersion))
+ return true;
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * Create a back-up file
+ *
+ * @param settingsFile
+ * @param suffix
+ * @param monitor
+ * @param project
+ */
+ static void backupFile(IFile settingsFile, String suffix, IProgressMonitor monitor, IProject project){
+ UpdateManagedProjectManager mngr = getExistingUpdateManager(project);
+ if(mngr == null || mngr.fIsInfoReadOnly)
+ return;
+ IContainer destFolder = (IContainer)project;
+ IFile dstFile = destFolder.getFile(new Path(settingsFile.getName()+suffix));
+ mngr.backupFile(settingsFile, dstFile, monitor, project, fBackupFileOverwriteQuery);
+ }
+
+ /* (non-Javadoc)
+ * Create a back-up file
+ *
+ * @param srcFile
+ * @param dstFile
+ * @param monitor
+ * @param project
+ * @param query
+ */
+ private void backupFile(IFile srcFile, IFile dstFile, IProgressMonitor monitor, IProject project, IOverwriteQuery query){
+ try{
+ if (dstFile.exists()) {
+ boolean shouldUpdate;
+ if(query != null)
+ shouldUpdate = getBooleanFromQueryAnswer(query.queryOverwrite(dstFile.getFullPath().toString()));
+ else
+ shouldUpdate = openQuestion(ConverterMessages.getResourceString("UpdateManagedProjectManager.0"), //$NON-NLS-1$
+ ConverterMessages.getFormattedString("UpdateManagedProjectManager.1", new String[] {dstFile.getName(),project.getName()})); //$NON-NLS-1$
+
+ if (shouldUpdate) {
+ dstFile.delete(true, monitor);
+ } else {
+// monitor.setCanceled(true);
+ throw new OperationCanceledException(ConverterMessages.getFormattedString("UpdateManagedProjectManager.2", project.getName())); //$NON-NLS-1$
+ }
+ }
+ srcFile.copy(dstFile.getFullPath(), true, monitor);
+ }
+ catch(Exception e){
+ fIsInfoReadOnly = true;
+ }
+ }
+
+ private void restoreFile(String backupFileName, String restoreFileName, IProgressMonitor monitor, IProject project){
+ IContainer destFolder = (IContainer)project;
+ IFile restoreFile = destFolder.getFile(new Path(restoreFileName));
+ IFile backupFile = destFolder.getFile(new Path(backupFileName));
+
+ try{
+ if (restoreFile.exists())
+ restoreFile.delete(true, monitor);
+ backupFile.copy(restoreFile.getFullPath(), true, monitor);
+ }
+ catch(Exception e){
+ fIsInfoReadOnly = true;
+ }
+ }
+
+ static private boolean openQuestion(final String title, final String message){
+ if(fOpenQuestionQuery != null)
+ return getBooleanFromQueryAnswer(fOpenQuestionQuery.queryOverwrite(message));
+
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if(window == null){
+ IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
+ window = windows[0];
+ }
+
+ final Shell shell = window.getShell();
+ final boolean [] answer = new boolean[1];
+ shell.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ answer[0] = MessageDialog.openQuestion(shell,title,message);
+ }
+ });
+ return answer[0];
+ }
+
+ /**
+ * returns ManagedBuildInfo for the current project
+ * if converter is currently running
+ * @param project project for which ManagedBuildInfo is needed
+ * @return the pointer to the project ManagedBuildInfo or null
+ * if converter is no running
+ */
+ static public ManagedBuildInfo getConvertedManagedBuildInfo(IProject project){
+ UpdateManagedProjectManager mngr = getExistingUpdateManager(project);
+ if(mngr == null)
+ return null;
+ return mngr.getConvertedManagedBuildInfo();
+ }
+
+ private ManagedBuildInfo getConvertedManagedBuildInfo(){
+ return fConvertedInfo;
+ }
+
+ private void doProjectUpdate(ManagedBuildInfo info)
+ throws CoreException {
+ fConvertedInfo = info;
+ NullProgressMonitor monitor = new NullProgressMonitor();
+ IFile settingsFile = fProject.getFile(ManagedBuildManager.SETTINGS_FILE_NAME);
+ IFile backupFile = fProject.getFile(ManagedBuildManager.SETTINGS_FILE_NAME + "_initial"); //$NON-NLS-1$
+ if(isCompatibleProject(info))
+ return;
+
+ try {
+ if (!settingsFile.exists())
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getResourceString("UpdateManagedProjectManager.6"),null)); //$NON-NLS-1$
+
+
+ backupFile(settingsFile, backupFile, monitor, fProject, new IOverwriteQuery(){
+ public String queryOverwrite(String file) {
+ return ALL;
+ }
+ });
+
+ PluginVersionIdentifier version = getManagedBuildInfoVersion(info.getVersion());
+
+ boolean shouldUpdate;
+ if(fUpdateProjectQuery != null)
+ shouldUpdate = getBooleanFromQueryAnswer(fUpdateProjectQuery.queryOverwrite(fProject.getFullPath().toString()));
+ else
+ shouldUpdate = openQuestion(ConverterMessages.getResourceString("UpdateManagedProjectManager.3"), //$NON-NLS-1$
+ ConverterMessages.getFormattedString("UpdateManagedProjectManager.4", new String[]{fProject.getName(),version.toString(),ManagedBuildManager.getBuildInfoVersion().toString()}) //$NON-NLS-1$
+ );
+
+ if (!shouldUpdate)
+ fIsInfoReadOnly = true;
+
+ if(version.isEquivalentTo(new PluginVersionIdentifier(1,2,0))){
+ UpdateManagedProject12.doProjectUpdate(monitor, fProject);
+ version = getManagedBuildInfoVersion(info.getVersion());
+ }
+ if(version.isEquivalentTo(new PluginVersionIdentifier(2,0,0))){
+ UpdateManagedProject20.doProjectUpdate(monitor, fProject);
+ version = getManagedBuildInfoVersion(info.getVersion());
+ }
+
+ if(!isCompatibleProject(info)){
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProjectManager.5", //$NON-NLS-1$
+ new String [] {
+ ManagedBuildManager.getBuildInfoVersion().toString(),
+ version.toString(),
+ info.getManagedProject().getId()
+ }
+ ),null));
+ }
+ } catch (CoreException e) {
+ fIsInfoReadOnly = true;
+ throw e;
+ } finally{
+ if(fIsInfoReadOnly){
+ restoreFile(backupFile.getName(), settingsFile.getName(), monitor, fProject);
+ info.setReadOnly(true);
+ }
+ }
+ }
+
+ /**
+ * updates the managed project
+ *
+ * @param project the project to be updated
+ * @param info the ManagedBuildInfo for the current project
+ * @throws CoreException if conversion failed
+ */
+ static public void updateProject(IProject project, ManagedBuildInfo info)
+ throws CoreException{
+ try{
+ getUpdateManager(project).doProjectUpdate(info);
+ } finally {
+ removeUpdateManager(project);
+ }
+ }
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.properties b/build/org.eclipse.cdt.managedbuilder.ui/plugin.properties
index 624440fdfb0..3f89dfce555 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.properties
+++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.properties
@@ -21,6 +21,10 @@ MngCCWizard.description=Create a new C++ project and let Eclipse create and mana
MngBuildProp.name=C/C++ Build
MngOtherProp.name= Error/Binary Parsers
+#The Resource Property page
+MngResourceProp.name=C/C++ Build
+
+
# Build Model Names
TargetName.gnu=GNU
TargetName.gnu.exe=Executable (Gnu)
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
index a1a083f7af2..ba3d1dc6933 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
+++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml
@@ -65,37 +65,43 @@
</filter>
</page>
</extension>
+
<extension
point="org.eclipse.ui.propertyPages">
<page
- objectClass="org.eclipse.core.resources.IProject"
+ objectClass="org.eclipse.core.resources.IFile"
adaptable="true"
- name="%MngOtherProp.name"
- class="org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderPropertyPage"
- id="org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderProperties">
- <filter
- name="nature"
- value="org.eclipse.cdt.managedbuilder.core.managedBuildNature">
- </filter>
+ name="%MngResourceProp.name"
+ nameFilter="*.c"
+ class="org.eclipse.cdt.managedbuilder.ui.properties.ResourceBuildPropertyPage"
+ id="org.eclipse.cdt.managedbuilder.ui.properties.ResourceBuildProperties">
</page>
</extension>
+
<extension
- point="org.eclipse.ui.startup">
- <startup
- class="org.eclipse.cdt.managedbuilder.internal.ui.ManagedMakeStartup">
- </startup>
+ point="org.eclipse.ui.propertyPages">
+ <page
+ objectClass="org.eclipse.core.resources.IFile"
+ adaptable="true"
+ name="%MngResourceProp.name"
+ nameFilter="*.cpp"
+ class="org.eclipse.cdt.managedbuilder.ui.properties.ResourceBuildPropertyPage"
+ id="org.eclipse.cdt.managedbuilder.ui.properties.ResourceBuildProperties">
+ </page>
</extension>
+
<!-- Managed Make Builder Tool Specifications -->
<extension
id="cdt.managed.build.info"
name="Managed Build Tools Description"
- point="org.eclipse.cdt.managedbuilder.core.ManagedBuildInfo">
+ point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
<managedBuildRevision
- fileVersion="2.0.0">
+ fileVersion="2.1.0">
</managedBuildRevision>
<tool
natureFilter="cnature"
sources="o"
+ outputs=""
name="%ToolName.linker.gnu.c"
outputFlag="-o"
command="gcc"
@@ -230,6 +236,7 @@
<tool
natureFilter="ccnature"
sources="o"
+ outputs=""
name="%ToolName.linker.gnu.cpp"
outputFlag="-o"
command="g++"
@@ -355,6 +362,7 @@
</tool>
<tool
natureFilter="both"
+ isAbstract="true"
sources="o"
name="%ToolName.archiver.gnu"
outputs="a"
@@ -697,1144 +705,1851 @@
id="macosx.cpp.link.option.shared">
</option>
</tool>
- <target
- name="%TargetName.gnu"
- id="cdt.managedbuild.target.gnu"
- cleanCommand="rm -rf"
- isTest="false"
- errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
- isAbstract="true"
- makeCommand="make"
- binaryParser="org.eclipse.cdt.core.ELF"
- makeArguments="-k">
- <tool
- sources="c"
- name="%ToolName.compiler.gnu.c"
- id="cdt.managedbuild.tool.gnu.c.compiler"
- command="gcc"
- dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator"
- headerExtensions="h"
- natureFilter="cnature"
- outputs="o"
- outputFlag="-o">
- <optionCategory
- owner="cdt.managedbuild.tool.gnu.c.compiler"
- name="%OptionCategory.Preproc"
- id="gnu.c.compiler.category.preprocessor">
- </optionCategory>
- <option
- defaultValue="false"
- name="%Option.Posix.Nostdinc"
- category="gnu.c.compiler.category.preprocessor"
- command="-nostdinc"
- id="gnu.c.compiler.option.preprocessor.nostdinc"
- valueType="boolean">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.PreprocOnly"
- category="gnu.c.compiler.category.preprocessor"
- command="-E"
- id="gnu.c.compiler.option.preprocessor.preprocess"
- valueType="boolean">
- </option>
- <optionCategory
- owner="cdt.managedbuild.tool.gnu.c.compiler"
- name="%OptionCategory.Symbols"
- id="gnu.c.compiler.category.symbols">
- </optionCategory>
- <option
- name="%Option.Posix.DefSym"
- category="gnu.c.compiler.category.symbols"
- command="-D"
- id="gnu.c.compiler.option.preprocessor.def.symbols"
- valueType="definedSymbols">
- </option>
- <option
- name="%Option.Posix.UndefSym"
- category="gnu.c.compiler.category.symbols"
- command="-U"
- id="gnu.c.compiler.option.preprocessor.undef.symbol"
- valueType="stringList">
- </option>
- <optionCategory
- owner="cdt.managedbuild.tool.gnu.c.compiler"
- name="%OptionCategory.Dirs"
- id="gnu.c.compiler.category.dirs">
- </optionCategory>
- <option
- name="%Option.Posix.InclPaths"
- category="gnu.c.compiler.category.dirs"
- command="-I"
- id="gnu.c.compiler.option.include.paths"
- valueType="includePath"
- browseType="directory">
- </option>
- <optionCategory
- owner="cdt.managedbuild.tool.gnu.c.compiler"
- name="%OptionCategory.Optimize"
- id="gnu.c.compiler.category.optimization">
- </optionCategory>
- <option
- name="%Option.Posix.OptLevel"
- category="gnu.c.compiler.category.optimization"
- id="gnu.c.compiler.option.optimization.level"
- valueType="enumerated">
- <enumeratedOptionValue
- name="%Option.Posix.Optimize.None"
- isDefault="false"
- command="-O0"
- id="gnu.c.optimization.level.none">
- </enumeratedOptionValue>
- <enumeratedOptionValue
- name="%Option.Posix.Optimize.Optimize"
- command="-O1"
- id="gnu.c.optimization.level.optimize">
- </enumeratedOptionValue>
- <enumeratedOptionValue
- name="%Option.Posix.Optimize.More"
- isDefault="true"
- command="-O2"
- id="gnu.c.optimization.level.more">
- </enumeratedOptionValue>
- <enumeratedOptionValue
- name="%Option.Posix.Optimize.Most"
- command="-O3"
- id="gnu.c.optimization.level.most">
- </enumeratedOptionValue>
- </option>
- <option
- name="%Option.Posix.Optimize.Flags"
- category="gnu.c.compiler.category.optimization"
- id="gnu.c.compiler.option.optimization.flags"
- valueType="string">
- </option>
- <optionCategory
- owner="cdt.managedbuild.tool.gnu.c.compiler"
- name="%OptionCategory.Debug"
- id="gnu.c.compiler.category.debug">
- </optionCategory>
- <option
- name="%Option.Posix.DebugLevel"
- category="gnu.c.compiler.category.debug"
- id="gnu.c.compiler.option.debugging.level"
- valueType="enumerated">
- <enumeratedOptionValue
- name="%Option.Posix.Debug.None"
- isDefault="false"
- id="gnu.c.debugging.level.none">
- </enumeratedOptionValue>
- <enumeratedOptionValue
- name="%Option.Posix.Debug.Min"
- command="-g1"
- id="gnu.c.debugging.level.minimal">
- </enumeratedOptionValue>
- <enumeratedOptionValue
- name="%Option.Posix.Debug.Def"
- isDefault="true"
- command="-g"
- id="gnu.c.debugging.level.default">
- </enumeratedOptionValue>
- <enumeratedOptionValue
- name="%Option.Posix.Debug.Max"
- isDefault="false"
- command="-g3"
- id="gnu.c.debugging.level.max">
- </enumeratedOptionValue>
- </option>
- <option
- name="%Option.Posix.Debug.Other"
- category="gnu.c.compiler.category.debug"
- id="gnu.c.compiler.option.debugging.other"
- valueType="string">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Debug.gprof"
- category="gnu.c.compiler.category.debug"
- command="-pg"
- id="gnu.c.compiler.option.debugging.gprof"
- valueType="boolean">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Debug.prof"
- category="gnu.c.compiler.category.debug"
- command="-p"
- id="gnu.c.compiler.option.debugging.prof"
- valueType="boolean">
- </option>
- <optionCategory
- owner="cdt.managedbuild.tool.gnu.c.compiler"
- name="%OptionCategory.Warn"
- id="gnu.c.compiler.category.warnings">
- </optionCategory>
- <option
- defaultValue="false"
- name="%Option.Posix.Warn.Syntax"
- category="gnu.c.compiler.category.warnings"
- command="-fsyntax-only"
- id="gnu.c.compiler.option.warnings.syntax"
- valueType="boolean">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Warn.Pedandic"
- category="gnu.c.compiler.category.warnings"
- command="-pedantic"
- id="gnu.c.compiler.option.warnings.pedantic"
- valueType="boolean">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Warn.PedErrors"
- category="gnu.c.compiler.category.warnings"
- command="-pedantic-errors"
- id="gnu.c.compiler.option.warnings.pedantic.error"
- valueType="boolean">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Warn.nowarn"
- category="gnu.c.compiler.category.warnings"
- command="-w"
- id="gnu.c.compiler.option.warnings.nowarn"
- valueType="boolean">
- </option>
- <option
- defaultValue="true"
- name="%Option.Posix.Warn.allwarn"
- category="gnu.c.compiler.category.warnings"
- command="-Wall"
- id="gnu.c.compiler.option.warnings.allwarn"
- valueType="boolean">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Warn.toerrs"
- category="gnu.c.compiler.category.warnings"
- command="-Werror"
- id="gnu.c.compiler.option.warnings.toerrors"
- valueType="boolean">
- </option>
- <optionCategory
- owner="cdt.managedbuild.tool.gnu.c.compiler"
- name="%OptionCategory.Misc"
- id="gnu.c.compiler.category.other">
- </optionCategory>
- <option
- defaultValue="-c -fmessage-length=0"
- name="%Option.OtherFlags"
- category="gnu.c.compiler.category.other"
- id="gnu.c.compiler.option.misc.other"
- valueType="string">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Verbose"
- category="gnu.c.compiler.category.other"
- command="-v"
- id="gnu.c.compiler.option.misc.verbose"
- valueType="boolean">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Ansi"
- category="gnu.c.compiler.category.other"
- command="-ansi"
- id="gnu.c.compiler.option.misc.ansi"
- valueType="boolean">
- </option>
- </tool>
- <tool
- sources="c,C,cc,cxx,cpp"
- name="%ToolName.compiler.gnu.cpp"
- id="cdt.managedbuild.tool.gnu.cpp.compiler"
- command="g++"
- dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator"
- headerExtensions="h,H,hpp"
- natureFilter="ccnature"
- outputs="o"
- outputFlag="-o">
- <optionCategory
- owner="cdt.managedbuild.tool.gnu.cpp.compiler"
- name="%OptionCategory.Preproc"
- id="gnu.cpp.compiler.category.preprocessor">
- </optionCategory>
- <option
- defaultValue="false"
- name="%Option.Posix.Nostdinc"
- category="gnu.cpp.compiler.category.preprocessor"
- command="-nostdinc"
- id="gnu.cpp.compiler.option.preprocessor.nostdinc"
- valueType="boolean">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.PreprocOnly"
- category="gnu.cpp.compiler.category.preprocessor"
- command="-E"
- id="gnu.cpp.compiler.option.preprocessor.preprocess"
- valueType="boolean">
- </option>
- <option
- name="%Option.Posix.DefSym"
- category="gnu.cpp.compiler.category.preprocessor"
- command="-D"
- id="gnu.cpp.compiler.option.preprocessor.def"
- valueType="definedSymbols">
- </option>
- <option
- name="%Option.Posix.UndefSym"
- category="gnu.cpp.compiler.category.preprocessor"
- command="-U"
- id="gnu.cpp.compiler.option.preprocessor.undef"
- valueType="stringList">
- </option>
- <optionCategory
- owner="cdt.managedbuild.tool.gnu.cpp.compiler"
- name="%OptionCategory.Dirs"
- id="gnu.cpp.compiler.category.dirs">
- </optionCategory>
- <option
- name="%Option.Posix.InclPaths"
- category="gnu.cpp.compiler.category.dirs"
- command="-I"
- id="gnu.cpp.compiler.option.include.paths"
- valueType="includePath"
- browseType="directory">
- </option>
- <optionCategory
- owner="cdt.managedbuild.tool.gnu.cpp.compiler"
- name="%OptionCategory.Optimize"
- id="gnu.cpp.compiler.category.optimization">
- </optionCategory>
- <option
- name="%Option.Posix.OptLevel"
- category="gnu.cpp.compiler.category.optimization"
- id="gnu.cpp.compiler.option.optimization.level"
- valueType="enumerated">
- <enumeratedOptionValue
- name="%Option.Posix.Optimize.None"
- command="-O0"
- id="gnu.cpp.compiler.optimization.level.none">
- </enumeratedOptionValue>
- <enumeratedOptionValue
- name="%Option.Posix.Optimize.Optimize"
- command="-O1"
- id="gnu.cpp.compiler.optimization.level.optimize">
- </enumeratedOptionValue>
- <enumeratedOptionValue
- name="%Option.Posix.Optimize.More"
- isDefault="true"
- command="-O2"
- id="gnu.cpp.compiler.optimization.level.more">
- </enumeratedOptionValue>
- <enumeratedOptionValue
- name="%Option.Posix.Optimize.Most"
- command="-O3"
- id="gnu.cpp.compiler.optimization.level.most">
- </enumeratedOptionValue>
- </option>
- <option
- name="%Option.Posix.Optimize.Flags"
- category="gnu.cpp.compiler.category.optimization"
- id="gnu.cpp.compiler.option.optimization.flags"
- valueType="string">
- </option>
- <optionCategory
- owner="cdt.managedbuild.tool.gnu.cpp.compiler"
- name="%OptionCategory.Debug"
- id="gnu.cpp.compiler.category.debug">
- </optionCategory>
- <option
- name="%Option.Posix.DebugLevel"
- category="gnu.cpp.compiler.category.debug"
- id="gnu.cpp.compiler.option.debugging.level"
- valueType="enumerated">
- <enumeratedOptionValue
- name="%Option.Posix.Debug.None"
- isDefault="false"
- id="gnu.cpp.compiler.debugging.level.none">
- </enumeratedOptionValue>
- <enumeratedOptionValue
- name="%Option.Posix.Debug.Min"
- command="-g1"
- id="gnu.cpp.compiler.debugging.level.minimal">
- </enumeratedOptionValue>
- <enumeratedOptionValue
- name="%Option.Posix.Debug.Def"
- isDefault="true"
- command="-g"
- id="gnu.cpp.compiler.debugging.level.default">
- </enumeratedOptionValue>
- <enumeratedOptionValue
- name="%Option.Posix.Debug.Max"
- isDefault="false"
- command="-g3"
- id="gnu.cpp.compiler.debugging.level.max">
- </enumeratedOptionValue>
- </option>
- <option
- name="%Option.Posix.Debug.Other"
- category="gnu.cpp.compiler.category.debug"
- id="gnu.cpp.compiler.option.debugging.other"
- valueType="string">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Debug.prof"
- category="gnu.cpp.compiler.category.debug"
- command="-p"
- id="gnu.cpp.compiler.option.debugging.prof"
- valueType="boolean">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Debug.gprof"
- category="gnu.cpp.compiler.category.debug"
- command="-pg"
- id="gnu.cpp.compiler.option.debugging.gprof"
- valueType="boolean">
- </option>
- <optionCategory
- owner="cdt.managedbuild.tool.gnu.cpp.compiler"
- name="%OptionCategory.Warn"
- id="gnu.cpp.compiler.category.warnings">
- </optionCategory>
- <option
- defaultValue="false"
- name="%Option.Posix.Warn.Syntax"
- category="gnu.cpp.compiler.category.warnings"
- command="-fsyntax-only"
- id="gnu.cpp.compiler.option.warnings.syntax"
- valueType="boolean">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Warn.Pedandic"
- category="gnu.cpp.compiler.category.warnings"
- command="-pedantic"
- id="gnu.cpp.compiler.option.warnings.pedantic"
- valueType="boolean">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Warn.PedErrors"
- category="gnu.cpp.compiler.category.warnings"
- command="-pedantic-errors"
- id="gnu.cpp.compiler.option.warnings.pedantic.error"
- valueType="boolean">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Warn.nowarn"
- category="gnu.cpp.compiler.category.warnings"
- command="-w"
- id="gnu.cpp.compiler.option.warnings.nowarn"
- valueType="boolean">
- </option>
- <option
- defaultValue="true"
- name="%Option.Posix.Warn.allwarn"
- category="gnu.cpp.compiler.category.warnings"
- command="-Wall"
- id="gnu.cpp.compiler.option.warnings.allwarn"
- valueType="boolean">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Warn.toerrs"
- category="gnu.cpp.compiler.category.warnings"
- command="-Werror"
- id="gnu.cpp.compiler.option.warnings.toerrors"
- valueType="boolean">
- </option>
- <optionCategory
- owner="cdt.managedbuild.tool.gnu.cpp.compiler"
- name="%OptionCategory.Misc"
- id="gnu.cpp.compiler.category.other">
- </optionCategory>
- <option
- defaultValue="-c -fmessage-length=0"
- name="%Option.OtherFlags"
- category="gnu.cpp.compiler.category.other"
- id="gnu.cpp.compiler.option.other.other"
- valueType="string">
- </option>
- <option
- defaultValue="false"
- name="%Option.Posix.Verbose"
- category="gnu.cpp.compiler.category.other"
- command="-v"
- id="gnu.cpp.compiler.option.other.verbose"
- valueType="boolean">
- </option>
- </tool>
- <toolReference
- outputs="o"
- id="cdt.managedbuild.tool.gnu.assembler"/>
- </target>
- <target
- isAbstract="false"
- osList="solaris,linux,hpux,aix,qnx"
- scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+
+ <tool
+ name="%ToolName.compiler.gnu.c"
+ id="cdt.managedbuild.tool.gnu.c.compiler"
+ isAbstract="true"
+ sources="c"
+ command="gcc"
+ dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator"
+ headerExtensions="h"
+ natureFilter="cnature"
+ outputs="o"
+ outputFlag="-o">
+ <optionCategory
+ owner="cdt.managedbuild.tool.gnu.c.compiler"
+ name="%OptionCategory.Preproc"
+ id="gnu.c.compiler.category.preprocessor">
+ </optionCategory>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Nostdinc"
+ category="gnu.c.compiler.category.preprocessor"
+ command="-nostdinc"
+ id="gnu.c.compiler.option.preprocessor.nostdinc"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.PreprocOnly"
+ category="gnu.c.compiler.category.preprocessor"
+ command="-E"
+ id="gnu.c.compiler.option.preprocessor.preprocess"
+ valueType="boolean">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.gnu.c.compiler"
+ name="%OptionCategory.Symbols"
+ id="gnu.c.compiler.category.symbols">
+ </optionCategory>
+ <option
+ name="%Option.Posix.DefSym"
+ category="gnu.c.compiler.category.symbols"
+ command="-D"
+ id="gnu.c.compiler.option.preprocessor.def.symbols"
+ valueType="definedSymbols">
+ </option>
+ <option
+ name="%Option.Posix.UndefSym"
+ category="gnu.c.compiler.category.symbols"
+ command="-U"
+ id="gnu.c.compiler.option.preprocessor.undef.symbol"
+ valueType="stringList">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.gnu.c.compiler"
+ name="%OptionCategory.Dirs"
+ id="gnu.c.compiler.category.dirs">
+ </optionCategory>
+ <option
+ name="%Option.Posix.InclPaths"
+ category="gnu.c.compiler.category.dirs"
+ command="-I"
+ id="gnu.c.compiler.option.include.paths"
+ valueType="includePath"
+ browseType="directory">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.gnu.c.compiler"
+ name="%OptionCategory.Optimize"
+ id="gnu.c.compiler.category.optimization">
+ </optionCategory>
+ <option
+ name="%Option.Posix.OptLevel"
+ category="gnu.c.compiler.category.optimization"
+ id="gnu.c.compiler.option.optimization.level"
+ valueType="enumerated">
+ <enumeratedOptionValue
+ name="%Option.Posix.Optimize.None"
+ isDefault="false"
+ command="-O0"
+ id="gnu.c.optimization.level.none">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="%Option.Posix.Optimize.Optimize"
+ command="-O1"
+ id="gnu.c.optimization.level.optimize">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="%Option.Posix.Optimize.More"
+ isDefault="true"
+ command="-O2"
+ id="gnu.c.optimization.level.more">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="%Option.Posix.Optimize.Most"
+ command="-O3"
+ id="gnu.c.optimization.level.most">
+ </enumeratedOptionValue>
+ </option>
+ <option
+ name="%Option.Posix.Optimize.Flags"
+ category="gnu.c.compiler.category.optimization"
+ id="gnu.c.compiler.option.optimization.flags"
+ valueType="string">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.gnu.c.compiler"
+ name="%OptionCategory.Debug"
+ id="gnu.c.compiler.category.debug">
+ </optionCategory>
+ <option
+ name="%Option.Posix.DebugLevel"
+ category="gnu.c.compiler.category.debug"
+ id="gnu.c.compiler.option.debugging.level"
+ valueType="enumerated">
+ <enumeratedOptionValue
+ name="%Option.Posix.Debug.None"
+ isDefault="false"
+ id="gnu.c.debugging.level.none">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="%Option.Posix.Debug.Min"
+ command="-g1"
+ id="gnu.c.debugging.level.minimal">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="%Option.Posix.Debug.Def"
+ isDefault="true"
+ command="-g"
+ id="gnu.c.debugging.level.default">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="%Option.Posix.Debug.Max"
+ isDefault="false"
+ command="-g3"
+ id="gnu.c.debugging.level.max">
+ </enumeratedOptionValue>
+ </option>
+ <option
+ name="%Option.Posix.Debug.Other"
+ category="gnu.c.compiler.category.debug"
+ id="gnu.c.compiler.option.debugging.other"
+ valueType="string">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Debug.gprof"
+ category="gnu.c.compiler.category.debug"
+ command="-pg"
+ id="gnu.c.compiler.option.debugging.gprof"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Debug.prof"
+ category="gnu.c.compiler.category.debug"
+ command="-p"
+ id="gnu.c.compiler.option.debugging.prof"
+ valueType="boolean">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.gnu.c.compiler"
+ name="%OptionCategory.Warn"
+ id="gnu.c.compiler.category.warnings">
+ </optionCategory>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Warn.Syntax"
+ category="gnu.c.compiler.category.warnings"
+ command="-fsyntax-only"
+ id="gnu.c.compiler.option.warnings.syntax"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Warn.Pedandic"
+ category="gnu.c.compiler.category.warnings"
+ command="-pedantic"
+ id="gnu.c.compiler.option.warnings.pedantic"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Warn.PedErrors"
+ category="gnu.c.compiler.category.warnings"
+ command="-pedantic-errors"
+ id="gnu.c.compiler.option.warnings.pedantic.error"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Warn.nowarn"
+ category="gnu.c.compiler.category.warnings"
+ command="-w"
+ id="gnu.c.compiler.option.warnings.nowarn"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="true"
+ name="%Option.Posix.Warn.allwarn"
+ category="gnu.c.compiler.category.warnings"
+ command="-Wall"
+ id="gnu.c.compiler.option.warnings.allwarn"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Warn.toerrs"
+ category="gnu.c.compiler.category.warnings"
+ command="-Werror"
+ id="gnu.c.compiler.option.warnings.toerrors"
+ valueType="boolean">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.gnu.c.compiler"
+ name="%OptionCategory.Misc"
+ id="gnu.c.compiler.category.other">
+ </optionCategory>
+ <option
+ defaultValue="-c -fmessage-length=0"
+ name="%Option.OtherFlags"
+ category="gnu.c.compiler.category.other"
+ id="gnu.c.compiler.option.misc.other"
+ valueType="string">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Verbose"
+ category="gnu.c.compiler.category.other"
+ command="-v"
+ id="gnu.c.compiler.option.misc.verbose"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Ansi"
+ category="gnu.c.compiler.category.other"
+ command="-ansi"
+ id="gnu.c.compiler.option.misc.ansi"
+ valueType="boolean">
+ </option>
+ </tool>
+ <tool
+ name="%ToolName.compiler.gnu.cpp"
+ id="cdt.managedbuild.tool.gnu.cpp.compiler"
+ isAbstract="true"
+ sources="c,C,cc,cxx,cpp"
+ command="g++"
+ dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator"
+ headerExtensions="h,H,hpp"
+ natureFilter="ccnature"
+ outputs="o"
+ outputFlag="-o">
+ <optionCategory
+ owner="cdt.managedbuild.tool.gnu.cpp.compiler"
+ name="%OptionCategory.Preproc"
+ id="gnu.cpp.compiler.category.preprocessor">
+ </optionCategory>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Nostdinc"
+ category="gnu.cpp.compiler.category.preprocessor"
+ command="-nostdinc"
+ id="gnu.cpp.compiler.option.preprocessor.nostdinc"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.PreprocOnly"
+ category="gnu.cpp.compiler.category.preprocessor"
+ command="-E"
+ id="gnu.cpp.compiler.option.preprocessor.preprocess"
+ valueType="boolean">
+ </option>
+ <option
+ name="%Option.Posix.DefSym"
+ category="gnu.cpp.compiler.category.preprocessor"
+ command="-D"
+ id="gnu.cpp.compiler.option.preprocessor.def"
+ valueType="definedSymbols">
+ </option>
+ <option
+ name="%Option.Posix.UndefSym"
+ category="gnu.cpp.compiler.category.preprocessor"
+ command="-U"
+ id="gnu.cpp.compiler.option.preprocessor.undef"
+ valueType="stringList">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.gnu.cpp.compiler"
+ name="%OptionCategory.Dirs"
+ id="gnu.cpp.compiler.category.dirs">
+ </optionCategory>
+ <option
+ name="%Option.Posix.InclPaths"
+ category="gnu.cpp.compiler.category.dirs"
+ command="-I"
+ id="gnu.cpp.compiler.option.include.paths"
+ valueType="includePath"
+ browseType="directory">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.gnu.cpp.compiler"
+ name="%OptionCategory.Optimize"
+ id="gnu.cpp.compiler.category.optimization">
+ </optionCategory>
+ <option
+ name="%Option.Posix.OptLevel"
+ category="gnu.cpp.compiler.category.optimization"
+ id="gnu.cpp.compiler.option.optimization.level"
+ valueType="enumerated">
+ <enumeratedOptionValue
+ name="%Option.Posix.Optimize.None"
+ command="-O0"
+ id="gnu.cpp.compiler.optimization.level.none">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="%Option.Posix.Optimize.Optimize"
+ command="-O1"
+ id="gnu.cpp.compiler.optimization.level.optimize">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="%Option.Posix.Optimize.More"
+ isDefault="true"
+ command="-O2"
+ id="gnu.cpp.compiler.optimization.level.more">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="%Option.Posix.Optimize.Most"
+ command="-O3"
+ id="gnu.cpp.compiler.optimization.level.most">
+ </enumeratedOptionValue>
+ </option>
+ <option
+ name="%Option.Posix.Optimize.Flags"
+ category="gnu.cpp.compiler.category.optimization"
+ id="gnu.cpp.compiler.option.optimization.flags"
+ valueType="string">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.gnu.cpp.compiler"
+ name="%OptionCategory.Debug"
+ id="gnu.cpp.compiler.category.debug">
+ </optionCategory>
+ <option
+ name="%Option.Posix.DebugLevel"
+ category="gnu.cpp.compiler.category.debug"
+ id="gnu.cpp.compiler.option.debugging.level"
+ valueType="enumerated">
+ <enumeratedOptionValue
+ name="%Option.Posix.Debug.None"
+ isDefault="false"
+ id="gnu.cpp.compiler.debugging.level.none">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="%Option.Posix.Debug.Min"
+ command="-g1"
+ id="gnu.cpp.compiler.debugging.level.minimal">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="%Option.Posix.Debug.Def"
+ isDefault="true"
+ command="-g"
+ id="gnu.cpp.compiler.debugging.level.default">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="%Option.Posix.Debug.Max"
+ isDefault="false"
+ command="-g3"
+ id="gnu.cpp.compiler.debugging.level.max">
+ </enumeratedOptionValue>
+ </option>
+ <option
+ name="%Option.Posix.Debug.Other"
+ category="gnu.cpp.compiler.category.debug"
+ id="gnu.cpp.compiler.option.debugging.other"
+ valueType="string">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Debug.prof"
+ category="gnu.cpp.compiler.category.debug"
+ command="-p"
+ id="gnu.cpp.compiler.option.debugging.prof"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Debug.gprof"
+ category="gnu.cpp.compiler.category.debug"
+ command="-pg"
+ id="gnu.cpp.compiler.option.debugging.gprof"
+ valueType="boolean">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.gnu.cpp.compiler"
+ name="%OptionCategory.Warn"
+ id="gnu.cpp.compiler.category.warnings">
+ </optionCategory>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Warn.Syntax"
+ category="gnu.cpp.compiler.category.warnings"
+ command="-fsyntax-only"
+ id="gnu.cpp.compiler.option.warnings.syntax"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Warn.Pedandic"
+ category="gnu.cpp.compiler.category.warnings"
+ command="-pedantic"
+ id="gnu.cpp.compiler.option.warnings.pedantic"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Warn.PedErrors"
+ category="gnu.cpp.compiler.category.warnings"
+ command="-pedantic-errors"
+ id="gnu.cpp.compiler.option.warnings.pedantic.error"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Warn.nowarn"
+ category="gnu.cpp.compiler.category.warnings"
+ command="-w"
+ id="gnu.cpp.compiler.option.warnings.nowarn"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="true"
+ name="%Option.Posix.Warn.allwarn"
+ category="gnu.cpp.compiler.category.warnings"
+ command="-Wall"
+ id="gnu.cpp.compiler.option.warnings.allwarn"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Warn.toerrs"
+ category="gnu.cpp.compiler.category.warnings"
+ command="-Werror"
+ id="gnu.cpp.compiler.option.warnings.toerrors"
+ valueType="boolean">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.gnu.cpp.compiler"
+ name="%OptionCategory.Misc"
+ id="gnu.cpp.compiler.category.other">
+ </optionCategory>
+ <option
+ defaultValue="-c -fmessage-length=0"
+ name="%Option.OtherFlags"
+ category="gnu.cpp.compiler.category.other"
+ id="gnu.cpp.compiler.option.other.other"
+ valueType="string">
+ </option>
+ <option
+ defaultValue="false"
+ name="%Option.Posix.Verbose"
+ category="gnu.cpp.compiler.category.other"
+ command="-v"
+ id="gnu.cpp.compiler.option.other.verbose"
+ valueType="boolean">
+ </option>
+ </tool>
+
+ <projectType
+ isAbstract="false"
isTest="false"
- makefileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator"
name="%TargetName.gnu.exe"
- id="cdt.managedbuild.target.gnu.exe"
- parent="cdt.managedbuild.target.gnu">
+ id="cdt.managedbuild.target.gnu.exe">
<configuration
name="%ConfigName.Dbg"
- id="cdt.managedbuild.config.gnu.exe.debug">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.none"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.max"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.none"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.max"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ id="cdt.managedbuild.config.gnu.exe.debug"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.exe.debug"
+ name="%ToolChainName.Dbg"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.exe.debug"
+ name="%PlatformName.Dbg"
+ binaryParser="org.eclipse.cdt.core.ELF"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.exe.debug"
+ name="%BuilderName.Dbg"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.exe.debug.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.none"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.exe.debug.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.max"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.exe.debug.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.none"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.exe.debug.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.max"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.linker.exe.debug"
+ superClass="cdt.managedbuild.tool.gnu.c.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug"
+ superClass="cdt.managedbuild.tool.gnu.cpp.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.exe.debug"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
<configuration
name="%ConfigName.Rel"
- id="cdt.managedbuild.config.gnu.exe.release">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.most"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.none"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.most"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.none"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ id="cdt.managedbuild.config.gnu.exe.release"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.exe.release"
+ name="%ToolChainName.Rel"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.exe.release"
+ name="%PlatformName.Rel"
+ binaryParser="org.eclipse.cdt.core.ELF"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.exe.release"
+ name="%BuilderName.Rel"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.exe.release"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.exe.release.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.most"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.exe.release.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.none"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.exe.release.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.most"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.exe.release.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.none"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.linker.exe.release"
+ superClass="cdt.managedbuild.tool.gnu.c.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release"
+ superClass="cdt.managedbuild.tool.gnu.cpp.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.exe.release"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.linker">
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.linker">
- </toolReference>
- </target>
- <target
+ </projectType>
+
+ <projectType
+ isAbstract="false"
isTest="false"
- osList="solaris,linux,hpux,aix,qnx"
- scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
- makefileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator"
name="%TargetName.gnu.so"
- parent="cdt.managedbuild.target.gnu"
- defaultExtension="so"
- isAbstract="false"
id="cdt.managedbuild.target.gnu.so">
<configuration
name="%ConfigName.Dbg"
+ cleanCommand="rm -rf"
+ artifactExtension="so"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
id="cdt.managedbuild.config.gnu.so.debug">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.none"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.max"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.none"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.max"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.so.debug"
+ name="%ToolChainName.Dbg"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.so.debug"
+ name="%PlatformName.Dbg"
+ binaryParser="org.eclipse.cdt.core.ELF"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.so.debug"
+ name="%BuilderName.Dbg"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.so.debug"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.so.debug.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.none"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.so.debug.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.max"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.so.debug.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.none"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.so.debug.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.max"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.linker.so.debug"
+ outputs="so"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.gnu.c.linker">
+ <option
+ id="gnu.c.link.so.debug.option.shared"
+ defaultValue="true"
+ superClass="gnu.c.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug"
+ outputs="so"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.gnu.cpp.linker">
+ <option
+ id="gnu.cpp.link.so.debug.option.shared"
+ defaultValue="true"
+ superClass="gnu.cpp.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.so.debug"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
<configuration
name="%ConfigName.Rel"
+ cleanCommand="rm -rf"
+ artifactExtension="so"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
id="cdt.managedbuild.config.gnu.so.release">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.most"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.none"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.most"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.none"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- </configuration>
- <toolReference
- outputs="so"
- outputPrefix="lib"
- id="cdt.managedbuild.tool.gnu.c.linker">
- <optionReference
- defaultValue="true"
- id="gnu.c.link.option.shared"/>
- </toolReference>
- <toolReference
- outputs="so"
- outputPrefix="lib"
- id="cdt.managedbuild.tool.gnu.cpp.linker">
- <optionReference
- defaultValue="true"
- id="gnu.cpp.link.option.shared"/>
- </toolReference>
- </target>
- <target
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.so.release"
+ name="%ToolChainName.Rel"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.so.release"
+ name="%PlatformName.Rel"
+ binaryParser="org.eclipse.cdt.core.ELF"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.so.release"
+ name="%BuilderName.Rel"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.so.release"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.so.release.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.most"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.so.release.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.none"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.so.release"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.so.release.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.most"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.so.release.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.none"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.linker.so.release"
+ outputs="so"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.gnu.c.linker">
+ <option
+ id="gnu.c.link.so.release.option.shared"
+ defaultValue="true"
+ superClass="gnu.c.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.linker.so.release"
+ outputs="so"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.gnu.cpp.linker">
+ <option
+ id="gnu.cpp.link.so.release.option.shared"
+ defaultValue="true"
+ superClass="gnu.cpp.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.so.release"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
+ </configuration>
+ </projectType>
+
+ <projectType
isTest="false"
- osList="solaris,linux,hpux,aix,qnx"
- scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
- makefileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator"
name="%TargetName.gnu.lib"
- parent="cdt.managedbuild.target.gnu"
- defaultExtension="a"
isAbstract="false"
- id="cdt.managedbuild.target.gnu.lib">
+ id="cdt.managedbuild.target.gnu.lib">
<configuration
- name="%ConfigName.Dbg"
- id="cdt.managedbuild.config.gnu.lib.debug">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.none"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.max"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.none"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.max"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ name="%ConfigName.Dbg"
+ artifactExtension="a"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
+ id="cdt.managedbuild.config.gnu.lib.debug">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.lib.debug"
+ name="%ToolChainName.Dbg"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.lib.debug"
+ name="%PlatformName.Dbg"
+ binaryParser="org.eclipse.cdt.core.ELF"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.lib.debug"
+ name="%BuilderName.Dbg"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.lib.debug"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.lib.debug.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.none"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.lib.debug.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.max"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.debug"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.lib.debug.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.none"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.lib.debug.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.max"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.archiver.lib.debug"
+ outputs="a"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.gnu.archiver">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.lib.debug"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
<configuration
name="%ConfigName.Rel"
+ artifactExtension="a"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
id="cdt.managedbuild.config.gnu.lib.release">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.most"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.none"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.most"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.none"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- </configuration>
- <toolReference
- outputs="a"
- outputPrefix="lib"
- id="cdt.managedbuild.tool.gnu.archiver">
- </toolReference>
- </target>
- <target
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.lib.release"
+ name="%ToolChainName.Rel"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.lib.release"
+ name="%PlatformName.Rel"
+ binaryParser="org.eclipse.cdt.core.ELF"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.lib.debug"
+ name="%BuilderName.Rel"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.lib.release"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.lib.release.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.most"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.lib.release.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.none"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.lib.release"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.lib.release.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.most"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.lib.release.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.none"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.archiver.lib.release"
+ outputs="a"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.gnu.archiver">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.lib.release"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
+ </configuration>
+ </projectType>
+
+ <projectType
name="%TargetName.cygw.exe"
id="cdt.managedbuild.target.gnu.cygwin.exe"
isTest="false"
- defaultExtension="exe"
- scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector"
- makefileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator"
- isAbstract="false"
- binaryParser="org.eclipse.cdt.core.PE"
- parent="cdt.managedbuild.target.gnu"
- osList="win32">
+ isAbstract="false">
<configuration
name="%ConfigName.Dbg"
+ artifactExtension="exe"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
id="cdt.managedbuild.config.gnu.cygwin.exe.debug">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.none"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.max"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.none"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.max"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.cygwin.exe.debug"
+ name="%ToolChainName.Dbg"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector"
+ osList="win32"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.cygwin.exe.debug"
+ name="%PlatformName.Dbg"
+ binaryParser="org.eclipse.cdt.core.PE"
+ osList="win32"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.cygwin.exe.debug"
+ name="%BuilderName.Dbg"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.cygwin.exe.debug.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.none"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.cygwin.exe.debug.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.max"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.debug"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.cygwin.exe.debug.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.none"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.cygwin.exe.debug.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.max"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.debug"
+ outputs="exe"
+ superClass="cdt.managedbuild.tool.gnu.c.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.debug"
+ outputs="exe"
+ superClass="cdt.managedbuild.tool.gnu.cpp.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.debug"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
<configuration
name="%ConfigName.Rel"
+ artifactExtension="exe"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
id="cdt.managedbuild.config.gnu.cygwin.exe.release">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.most"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.none"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.most"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.none"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.cygwin.exe.release"
+ name="%ToolChainName.Rel"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector"
+ osList="win32"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.cygwin.exe.release"
+ name="%PlatformName.Rel"
+ binaryParser="org.eclipse.cdt.core.PE"
+ osList="win32"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.cygwin.exe.release"
+ name="%BuilderName.Rel"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.release"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.cygwin.exe.release.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.most"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.cygwin.exe.release.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.none"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.exe.release"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.cygwin.exe.release.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.most"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.cygwin.exe.release.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.none"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.release"
+ outputs="exe"
+ superClass="cdt.managedbuild.tool.gnu.c.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.release"
+ outputs="exe"
+ superClass="cdt.managedbuild.tool.gnu.cpp.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.release"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
- <toolReference
- outputs="exe"
- id="cdt.managedbuild.tool.gnu.c.linker">
- </toolReference>
- <toolReference
- outputs="exe"
- id="cdt.managedbuild.tool.gnu.cpp.linker">
- </toolReference>
- <!--toolReference id="cdt.managedbuild.tool.gnu.windres"/-->
- </target>
- <target
+ </projectType>
+
+ <projectType
name="%TargetName.cygw.so"
id="cdt.managedbuild.target.gnu.cygwin.so"
- isTest="false"
- defaultExtension="dll"
- scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector"
- makefileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator"
isAbstract="false"
- binaryParser="org.eclipse.cdt.core.PE"
- parent="cdt.managedbuild.target.gnu"
- osList="win32">
+ isTest="false">
<configuration
name="%ConfigName.Dbg"
+ cleanCommand="rm -rf"
+ artifactExtension="dll"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
id="cdt.managedbuild.config.gnu.cygwin.so.debug">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.none"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.max"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.none"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.max"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.cygwin.so.debug"
+ name="%ToolChainName.Dbg"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector"
+ osList="win32"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.cygwin.so.debug"
+ name="%PlatformName.Dbg"
+ binaryParser="org.eclipse.cdt.core.PE"
+ osList="win32"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.cygwin.so.debug"
+ name="%BuilderName.Dbg"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.so.debug"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.cygwin.so.debug.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.none"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.cygwin.so.debug.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.max"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.so.debug"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.cygwin.so.debug.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.none"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.cygwin.so.debug.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.max"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.linker.cygwin.so.debug"
+ outputs="dll,a.dll"
+ superClass="cdt.managedbuild.tool.gnu.c.linker">
+ <option
+ id="gnu.c.link.cygwin.so.debug.option.shared"
+ defaultValue="true"
+ superClass="gnu.c.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.so.debug"
+ outputs="dll,a.dll"
+ superClass="cdt.managedbuild.tool.gnu.cpp.linker">
+ <option
+ id="gnu.cpp.link.cygwin.so.debug.option.shared"
+ defaultValue="true"
+ superClass="gnu.cpp.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.cygwin.so.debug"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
<configuration
name="%ConfigName.Rel"
- id="cdt.managedbuild.config.gnu.cygwin.so.release">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.most"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.none"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.most"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.none"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ cleanCommand="rm -rf"
+ artifactExtension="dll"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
+ id="cdt.managedbuild.config.gnu.cygwin.so.release">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.cygwin.so.release"
+ name="%ToolChainName.Rel"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector"
+ osList="win32"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.cygwin.so.release"
+ name="%PlatformName.Rel"
+ binaryParser="org.eclipse.cdt.core.PE"
+ osList="win32"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.cygwin.so.release"
+ name="%BuilderName.Rel"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.so.release"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.cygwin.so.release.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.most"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.cygwin.so.release.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.none"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.so.release"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.cygwin.so.release.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.most"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.cygwin.so.release.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.none"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.linker.cygwin.so.release"
+ outputs="dll,a.dll"
+ superClass="cdt.managedbuild.tool.gnu.c.linker">
+ <option
+ id="gnu.c.link.cygwin.so.release.option.shared"
+ defaultValue="true"
+ superClass="gnu.c.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.so.release"
+ outputs="dll,a.dll"
+ superClass="cdt.managedbuild.tool.gnu.cpp.linker">
+ <option
+ id="gnu.cpp.link.cygwin.so.release.option.shared"
+ defaultValue="true"
+ superClass="gnu.cpp.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.cygwin.so.release"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
- <toolReference
- outputs="dll,a.dll"
- id="cdt.managedbuild.tool.gnu.c.linker">
- <optionReference
- defaultValue="true"
- id="gnu.c.link.option.shared"/>
- </toolReference>
- <toolReference
- outputs="dll,a.dll"
- id="cdt.managedbuild.tool.gnu.cpp.linker">
- <optionReference
- defaultValue="true"
- id="gnu.cpp.link.option.shared"/>
- </toolReference>
- </target>
- <target
+ </projectType>
+
+ <projectType
name="%TargetName.cygw.lib"
id="cdt.managedbuild.target.gnu.cygwin.lib"
isTest="false"
- makefileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator"
- defaultExtension="a"
- scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector"
- isAbstract="false"
- binaryParser="org.eclipse.cdt.core.PE"
- parent="cdt.managedbuild.target.gnu"
- osList="win32">
+ isAbstract="false">
<configuration
name="%ConfigName.Dbg"
+ artifactExtension="a"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
id="cdt.managedbuild.config.gnu.cygwin.lib.debug">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.none"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.max"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.none"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.max"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.cygwin.lib.debug"
+ name="%ToolChainName.Dbg"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector"
+ osList="win32"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.cygwin.lib.debug"
+ name="%PlatformName.Dbg"
+ binaryParser="org.eclipse.cdt.core.PE"
+ osList="win32"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.cygwin.lib.debug"
+ name="%BuilderName.Dbg"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.debug"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.cygwin.lib.debug.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.none"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.cygwin.lib.debug.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.max"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.lib.debug"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.cygwin.lib.debug.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.none"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.cygwin.lib.debug.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.max"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.debug"
+ outputPrefix="lib"
+ outputs="a"
+ superClass="cdt.managedbuild.tool.gnu.archiver">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.cygwin.lib.debug"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
<configuration
name="%ConfigName.Rel"
+ artifactExtension="a"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
id="cdt.managedbuild.config.gnu.cygwin.lib.release">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.most"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.none"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.most"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.none"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- </configuration>
- <toolReference
- outputPrefix="lib"
- outputs="a"
- id="cdt.managedbuild.tool.gnu.archiver">
- </toolReference>
- </target>
- <target
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.cygwin.lib.release"
+ name="%ToolChainName.Rel"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector"
+ osList="win32"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.cygwin.lib.release"
+ name="%PlatformName.Rel"
+ binaryParser="org.eclipse.cdt.core.PE"
+ osList="win32"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.cygwin.lib.release"
+ name="%BuilderName.Rel"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.lib.release"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.cygwin.lib.release.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.most"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.cygwin.lib.release.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.none"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.lib.release"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.cygwin.lib.release.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.most"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.cygwin.lib.release.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.none"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.release"
+ outputPrefix="lib"
+ outputs="a"
+ superClass="cdt.managedbuild.tool.gnu.archiver">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.cygwin.lib.release"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
+ </configuration>
+ </projectType>
+
+ <projectType
name="%TargetName.macosx.exe"
id="cdt.managedbuild.target.macosx.exe"
isTest="false"
- scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
- makefileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator"
- isAbstract="false"
- binaryParser="org.eclipse.cdt.core.MachO"
- parent="cdt.managedbuild.target.gnu"
- osList="macosx">
+ isAbstract="false">
<configuration
name="%ConfigName.Dbg"
+ artifactExtension="exe"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
id="cdt.managedbuild.config.gnu.macosx.exe.debug">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.none"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.max"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.none"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.max"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.macosx.exe.debug"
+ name="%ToolChainName.Dbg"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="macosx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.macosx.exe.debug"
+ name="%PlatformName.Dbg"
+ binaryParser="org.eclipse.cdt.core.MachO"
+ osList="macosx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.macosx.exe.debug"
+ name="%BuilderName.Dbg"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.debug"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.macosx.exe.debug.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.none"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.macosx.exe.debug.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.max"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.exe.debug"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compilermacosx.exe.debug.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.none"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.macosx.exe.debug.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.max"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.macosx.c.linker.macosx.exe.debug"
+ outputs="exe"
+ superClass="cdt.managedbuild.tool.macosx.c.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.macosx.cpp.linker.macosx.exe.debug"
+ outputs="exe"
+ superClass="cdt.managedbuild.tool.macosx.cpp.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.macosx.exe.debug"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
<configuration
name="%ConfigName.Rel"
+ artifactExtension="exe"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
id="cdt.managedbuild.config.macosx.exe.release">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.most"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.none"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.most"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.none"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.macosx.exe.release"
+ name="%ToolChainName.Rel"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="macosx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.macosx.exe.release"
+ name="%PlatformName.Rel"
+ binaryParser="org.eclipse.cdt.core.MachO"
+ osList="macosx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.macosx.exe.release"
+ name="%BuilderName.Rel"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.macosx.exe.release"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.macosx.exe.release.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.most"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.macosx.exe.release.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.none"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.exe.release"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.macosx.exe.release.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.most"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.macosx.exe.release.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.none"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.macosx.c.linker.macosx.exe.release"
+ outputs="exe"
+ superClass="cdt.managedbuild.tool.macosx.c.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.macosx.cpp.linker.macosx.exe.release"
+ outputs="exe"
+ superClass="cdt.managedbuild.tool.macosx.cpp.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.macosx.exe.release"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
- <toolReference
- outputs="exe"
- id="cdt.managedbuild.tool.macosx.c.linker">
- </toolReference>
- <toolReference
- outputs="exe"
- id="cdt.managedbuild.tool.macosx.cpp.linker">
- </toolReference>
- </target>
- <target
+ </projectType>
+
+ <projectType
name="%TargetName.macosx.so"
id="cdt.managedbuild.target.macosx.so"
isTest="false"
- defaultExtension="dylib"
- scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
- makefileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator"
- isAbstract="false"
- binaryParser="org.eclipse.cdt.core.MachO"
- parent="cdt.managedbuild.target.gnu"
- osList="macosx">
+ isAbstract="false">
<configuration
name="%ConfigName.Dbg"
+ artifactExtension="dylib"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
id="cdt.managedbuild.config.macosx.so.debug">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.none"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.max"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.none"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.max"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.macosx.so.debug"
+ name="%ToolChainName.Dbg"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="macosx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.macosx.so.debug"
+ name="%PlatformName.Dbg"
+ binaryParser="org.eclipse.cdt.core.MachO"
+ osList="macosx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.macosx.so.debug"
+ name="%BuilderName.Dbg"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.macosx.so.debug"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.macosx.so.debug.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.none"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.macosx.so.debug.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.max"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.so.debug"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.macosx.so.debug.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.none"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.macosx.so.debug.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.max"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.macosx.c.linker.macosx.so.debug"
+ outputs="dylib"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.macosx.c.linker">
+ <option
+ id="macosx.c.link.macosx.so.debug.option.shared"
+ defaultValue="true"
+ superClass="macosx.c.link.option.shared">
+ </option>
+ <option
+ id="macosx.c.link.macosx.so.debug.option.nostart"
+ defaultValue="true"
+ superClass="macosx.c.link.option.nostart">
+ </option>
+ <option
+ id="macosx.c.link.macosx.so.debug.option.nodeflibs"
+ defaultValue="true"
+ superClass="macosx.c.link.option.nodeflibs">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.macosx.cpp.linker.macosx.so.debug"
+ outputs="dylib"
+ superClass="cdt.managedbuild.tool.macosx.cpp.linker">
+ <option
+ id="macosx.cpp.link.macosx.so.debug.option.shared"
+ defaultValue="true"
+ superClass="macosx.cpp.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.macosx.so.debug"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
<configuration
name="%ConfigName.Rel"
+ artifactExtension="dylib"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
id="cdt.managedbuild.config.macosx.so.release">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.most"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.none"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.most"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.none"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.macosx.so.release"
+ name="%ToolChainName.Rel"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="macosx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.macosx.so.release"
+ name="%PlatformName.Rel"
+ binaryParser="org.eclipse.cdt.core.MachO"
+ osList="macosx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.macosx.so.release"
+ name="%BuilderName.Rel"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.macosx.so.release"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.macosx.so.release.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.most"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.macosx.so.release.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.none"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.so.release"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.macosx.so.release.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.most"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.macosx.so.release.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.none"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.macosx.c.linker.macosx.so.release"
+ outputs="dylib"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.macosx.c.linker">
+ <option
+ id="macosx.c.link.macosx.so.release.option.shared"
+ defaultValue="true"
+ superClass="macosx.c.link.option.shared">
+ </option>
+ <option
+ id="macosx.c.link.macosx.so.release.option.nostart"
+ defaultValue="true"
+ superClass="macosx.c.link.option.nostart">
+ </option>
+ <option
+ id="macosx.c.link.macosx.so.release.option.nodeflibs"
+ defaultValue="true"
+ superClass="macosx.c.link.option.nodeflibs">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.macosx.cpp.linker.macosx.so.release"
+ outputs="dylib"
+ superClass="cdt.managedbuild.tool.macosx.cpp.linker">
+ <option
+ id="macosx.cpp.link.macosx.so.release.option.shared"
+ defaultValue="true"
+ superClass="macosx.cpp.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.macosx.so.release"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
- <toolReference
- outputs="dylib"
- outputPrefix="lib"
- id="cdt.managedbuild.tool.macosx.c.linker">
- <optionReference
- defaultValue="true"
- id="macosx.c.link.option.shared"/>
- <optionReference
- defaultValue="true"
- id="macosx.c.link.option.nostart"/>
- <optionReference
- defaultValue="true"
- id="macosx.c.link.option.nodeflibs"/>
- </toolReference>
- <toolReference
- outputs="dylib"
- id="cdt.managedbuild.tool.macosx.cpp.linker">
- <optionReference
- defaultValue="true"
- id="macosx.cpp.link.option.shared"/>
- </toolReference>
- </target>
- <target
+ </projectType>
+
+ <projectType
name="%TargetName.macosx.lib"
id="cdt.managedbuild.target.macosx.lib"
isTest="false"
- makefileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator"
- defaultExtension="a"
- scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
- isAbstract="false"
- binaryParser="org.eclipse.cdt.core.MachO"
- parent="cdt.managedbuild.target.gnu"
- osList="macosx">
+ isAbstract="false">
<configuration
name="%ConfigName.Dbg"
+ artifactExtension="a"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
id="cdt.managedbuild.config.macosx.lib.debug">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.none"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.max"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.none"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.max"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.macosx.lib.debug"
+ name="%ToolChainName.Dbg"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="macosx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.macosx.lib.debug"
+ name="%PlatformName.Dbg"
+ binaryParser="org.eclipse.cdt.core.MachO"
+ osList="macosx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.macosx.lib.debug"
+ name="%BuilderName.Dbg"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.macosx.lib.debug"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.macosx.lib.debug.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.none"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.macosx.lib.debug.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.max"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.lib.debug"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.macosx.lib.debug.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.none"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.macosx.lib.debug.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.max"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.toolmacosx.lib.debug.gnu.archiver"
+ outputPrefix="lib"
+ outputs="a"
+ superClass="cdt.managedbuild.tool.gnu.archiver">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.macosx.lib.debug"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
</configuration>
<configuration
name="%ConfigName.Rel"
- id="cdt.managedbuild.config.macosxlib.release">
- <toolReference
- id="cdt.managedbuild.tool.gnu.c.compiler">
- <optionReference
- defaultValue="gnu.c.optimization.level.most"
- id="gnu.c.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.c.debugging.level.none"
- id="gnu.c.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- <toolReference
- id="cdt.managedbuild.tool.gnu.cpp.compiler">
- <optionReference
- defaultValue="gnu.cpp.compiler.optimization.level.most"
- id="gnu.cpp.compiler.option.optimization.level">
- </optionReference>
- <optionReference
- defaultValue="gnu.cpp.compiler.debugging.level.none"
- id="gnu.cpp.compiler.option.debugging.level">
- </optionReference>
- </toolReference>
- </configuration>
- <toolReference
- outputPrefix="lib"
- outputs="a"
- id="cdt.managedbuild.tool.gnu.archiver">
- </toolReference>
- </target>
+ artifactExtension="a"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
+ id="cdt.managedbuild.config.macosx.lib.release">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.macosx.lib.release"
+ name="%ToolChainName.Rel"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="macosx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.gnu.platform.macosx.lib.release"
+ name="%PlatformName.Rel"
+ binaryParser="org.eclipse.cdt.core.MachO"
+ osList="macosx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.gnu.builder.macosx.lib.release"
+ name="%BuilderName.Rel"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.gnu.c.compiler.macosx.lib.release"
+ superClass="cdt.managedbuild.tool.gnu.c.compiler">
+ <option
+ id="gnu.c.compiler.macosx.lib.release.option.optimization.level"
+ defaultValue="gnu.c.optimization.level.most"
+ superClass="gnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.c.compiler.macosx.lib.release.option.debugging.level"
+ defaultValue="gnu.c.debugging.level.none"
+ superClass="gnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.lib.release"
+ superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
+ <option
+ id="gnu.cpp.compiler.macosx.lib.release.option.optimization.level"
+ defaultValue="gnu.cpp.compiler.optimization.level.most"
+ superClass="gnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="gnu.cpp.compiler.macosx.lib.release.option.debugging.level"
+ defaultValue="gnu.cpp.compiler.debugging.level.none"
+ superClass="gnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.toolmacosx.lib.release.gnu.archiver"
+ outputPrefix="lib"
+ outputs="a"
+ superClass="cdt.managedbuild.tool.gnu.archiver">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.gnu.assembler.macosx.lib.release"
+ superClass="cdt.managedbuild.tool.gnu.assembler">
+ </tool>
+ </toolChain>
+ </configuration>
+ </projectType>
</extension>
-
</plugin>
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildSettingsBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildSettingsBlock.java
new file mode 100644
index 00000000000..c56976a4295
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/BuildSettingsBlock.java
@@ -0,0 +1,497 @@
+/**********************************************************************
+ * Copyright (c) 2002,2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Move to Make plugin
+ * Intel Corp - Use in Managed Make system
+***********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.ui;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.IBuilder;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.ui.properties.BuildPropertyPage;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleAdapter;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Label;
+
+public class BuildSettingsBlock extends AbstractCOptionPage {
+
+ /*
+ * String constants
+ */
+ private static final String PREFIX = "BuildSettingsBlock"; //$NON-NLS-1$
+ private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
+ private static final String SETTINGS_LABEL = LABEL + ".Settings"; //$NON-NLS-1$
+ private static final String GROUP = LABEL + ".makecmdgroup"; //$NON-NLS-1$
+ private static final String DEF_BTN = LABEL + ".makecmddef"; //$NON-NLS-1$
+ private static final String OUTPUT_GROUP = LABEL + ".output.group"; //$NON-NLS-1$
+ private static final String OUTPUT_EXT = LABEL + ".output.extension"; //$NON-NLS-1$
+ private static final String OUTPUT_NAME = LABEL + ".output.name"; //$NON-NLS-1$
+
+ private static final String EMPTY_STRING = new String();
+
+ /*
+ * Dialog widgets
+ */
+ protected Text buildArtifactExt;
+ protected Text buildArtifactName;
+ protected Button makeCommandDefault;
+ protected Text makeCommandEntry;
+
+ /*
+ * Bookeeping variables
+ */
+ private BuildPropertyPage parent;
+ // The name of the build artifact
+ private String artifactExt;
+ private String artifactName;
+ // The make command associated with the target
+ private String makeCommand;
+ // State of the check box on exit
+ private boolean useDefaultMake;
+ // Has the page been changed?
+ private boolean dirty = false;
+
+ private ModifyListener widgetModified = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ setDirty(true);
+ }
+ };
+
+
+ /*
+ * Constructor
+ */
+ public BuildSettingsBlock(BuildPropertyPage parent)
+ {
+ super(ManagedBuilderUIMessages.getResourceString(SETTINGS_LABEL));
+ super.setContainer(parent);
+ this.parent = parent;
+ }
+
+ public void createControl(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NULL);
+ comp.setFont(parent.getFont());
+ comp.setLayout(new GridLayout(1, true));
+ comp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ setControl(comp);
+
+ // Create a group for the build output
+ createBuildArtifactGroup(comp);
+
+ // Create the make command group area
+ createMakeCommandGroup(comp);
+ }
+
+ /* (non-Javadoc)
+ * Creates the group that contains the build artifact name controls.
+ */
+ private void createBuildArtifactGroup(Composite parent) {
+ final Group outputGroup = new Group(parent, SWT.NONE);
+ outputGroup.setFont(parent.getFont());
+ outputGroup.setText(ManagedBuilderUIMessages.getResourceString(OUTPUT_GROUP));
+ outputGroup.setLayout(new GridLayout(3, false));
+ outputGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // Three labels
+ final Label nameLabel = new Label(outputGroup, SWT.LEFT);
+ nameLabel.setFont(outputGroup.getFont());
+ nameLabel.setText(ManagedBuilderUIMessages.getResourceString(OUTPUT_NAME));
+ nameLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ final Label placeHolder = new Label(outputGroup, SWT.CENTER);
+ placeHolder.setText(new String());
+ placeHolder.setLayoutData(new GridData());
+
+ final Label extLabel = new Label(outputGroup, SWT.LEFT);
+ extLabel.setFont(outputGroup.getFont());
+ extLabel.setText(ManagedBuilderUIMessages.getResourceString(OUTPUT_EXT));
+ extLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // Now we need two text widgets separated by a label
+ buildArtifactName = new Text(outputGroup, SWT.SINGLE | SWT.BORDER);
+ buildArtifactName.setFont(outputGroup.getFont());
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
+ buildArtifactName.setLayoutData(data);
+ buildArtifactName.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent event) {
+ buildArtifactName = null;
+ }
+ });
+ buildArtifactName.getAccessible().addAccessibleListener(new AccessibleAdapter(){
+ public void getName(AccessibleEvent e) {
+ e.result = ManagedBuilderUIMessages.getResourceString(OUTPUT_NAME);
+ }
+ });
+ buildArtifactName.addModifyListener(widgetModified);
+
+ final Label dotLabel = new Label(outputGroup, SWT.CENTER);
+ dotLabel.setFont(outputGroup.getFont());
+ dotLabel.setText(new String(".")); //$NON-NLS-1$
+ dotLabel.setLayoutData(new GridData());
+
+ buildArtifactExt = new Text(outputGroup, SWT.SINGLE | SWT.BORDER);
+ buildArtifactExt.setFont(outputGroup.getFont());
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = (IDialogConstants.ENTRY_FIELD_WIDTH / 2);
+ buildArtifactExt.setLayoutData(data);
+ buildArtifactExt.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ buildArtifactExt = null;
+ }
+ });
+ buildArtifactExt.getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ public void getName(AccessibleEvent e) {
+ e.result = ManagedBuilderUIMessages.getResourceString(OUTPUT_EXT);
+ }
+ });
+ buildArtifactExt.addModifyListener(widgetModified);
+ }
+
+ /* (non-Javadoc)
+ * Creates the group control for the make command
+ * @param parent
+ */
+ private void createMakeCommandGroup(Composite parent) {
+ final Group makeCommandGroup = new Group(parent, SWT.NONE);
+ makeCommandGroup.setFont(parent.getFont());
+ makeCommandGroup.setText(ManagedBuilderUIMessages.getResourceString(GROUP));
+ makeCommandGroup.setLayout(new GridLayout(1, true));
+ makeCommandGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ makeCommandDefault = new Button(makeCommandGroup, SWT.CHECK | SWT.LEFT);
+ makeCommandDefault.setFont(makeCommandGroup.getFont());
+ makeCommandDefault.setText(ManagedBuilderUIMessages.getResourceString(DEF_BTN));
+ makeCommandDefault.setBackground(makeCommandGroup.getBackground());
+ makeCommandDefault.setForeground(makeCommandGroup.getForeground());
+ makeCommandDefault.addSelectionListener(new SelectionAdapter () {
+ public void widgetSelected(SelectionEvent e) {
+ handleUseDefaultPressed();
+ setDirty(true);
+ }
+ });
+ makeCommandDefault.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent event) {
+ makeCommandDefault = null;
+ }
+ });
+
+ makeCommandEntry = new Text(makeCommandGroup, SWT.SINGLE | SWT.BORDER);
+ makeCommandEntry.setFont(makeCommandGroup.getFont());
+ makeCommandEntry.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ makeCommandEntry.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent event) {
+ makeCommandEntry = null;
+ }
+ });
+ makeCommandEntry.addModifyListener(widgetModified);
+ }
+
+ protected void initializeValues() {
+ setValues();
+ }
+
+ public void updateValues() {
+ setValues();
+ useDefaultMake = !parent.getSelectedConfiguration().hasOverriddenBuildCommand();
+ makeCommandDefault.setSelection(useDefaultMake);
+ makeCommandEntry.setEditable(!makeCommandDefault.getSelection());
+ }
+
+ protected void setValues() {
+ artifactName = parent.getSelectedConfiguration().getArtifactName();
+ buildArtifactName.setText(artifactName);
+ artifactExt = parent.getSelectedConfiguration().getArtifactExtension();
+ buildArtifactExt.setText(artifactExt);
+ makeCommand = parent.getSelectedConfiguration().getBuildCommand();
+ String makeArgs = parent.getSelectedConfiguration().getBuildArguments();
+ if (makeArgs != null) {
+ makeCommand += " " + makeArgs; //$NON-NLS-1$
+ }
+ makeCommandEntry.setText(makeCommand);
+
+ setDirty(false);
+ }
+
+ public void removeValues(String id) {
+ // Nothing to do...
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
+ */
+ public void performDefaults() {
+ IConfiguration config = parent.getSelectedConfiguration();
+ config.setArtifactName(config.getManagedProject().getDefaultArtifactName());
+ config.setArtifactExtension(null);
+ IBuilder builder = config.getToolChain().getBuilder();
+ if (!builder.isExtensionElement()) {
+ config.getToolChain().removeLocalBuilder();
+ }
+ setValues();
+ makeCommandDefault.setSelection(true);
+ makeCommandEntry.setEditable(false);
+
+ setDirty(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(IProgressMonitor)
+ */
+ public void performApply(IProgressMonitor monitor) throws CoreException {
+ useDefaultMake = makeCommandDefault.getSelection();
+ makeCommand = makeCommandEntry.getText().trim();
+ artifactName = buildArtifactName.getText().trim();
+ artifactExt = buildArtifactExt.getText().trim();
+
+ IConfiguration selectedConfiguration = parent.getSelectedConfiguration();
+ IBuilder builder = selectedConfiguration.getToolChain().getBuilder();
+ boolean setBuilderValues = false;
+
+ // Set the build output name
+ if (!selectedConfiguration.getArtifactName().equals(artifactName)) {
+ setBuilderValues = true;
+ }
+ // Set the build output extension
+ if (!selectedConfiguration.getArtifactExtension().equals(artifactExt)) {
+ setBuilderValues = true;
+ }
+ // Set the new make command
+ String makeCommandOnly = null;
+ String makeArguments = null;
+ if (useDefaultMake) {
+ if (!builder.isExtensionElement()) {
+ setBuilderValues = true;
+ }
+ } else {
+ // Parse for command and arguments
+ String rawCommand = makeCommand;
+ makeCommandOnly = parseMakeCommand(rawCommand);
+ if (!selectedConfiguration.getBuildCommand().equals(makeCommandOnly)) {
+ setBuilderValues = true;
+ }
+ makeArguments = parseMakeArgs(rawCommand);
+ if (!selectedConfiguration.getBuildArguments().equals(makeArguments)) {
+ setBuilderValues = true;
+ }
+ }
+
+ if (setBuilderValues) {
+ // If the configuration does not already have a "local" builder, we
+ // need to create it.
+ if (builder.isExtensionElement()) {
+ IToolChain tc = selectedConfiguration.getToolChain();
+ int nnn = ManagedBuildManager.getRandomNumber();
+ String subId = builder.getId() + "." + nnn; //$NON-NLS-1$
+ String name = builder.getName() + "." + selectedConfiguration.getName(); //$NON-NLS-1$
+ tc.createBuilder(builder, subId, name, false);
+ }
+
+ // Set the builder values
+ selectedConfiguration.setArtifactName(artifactName);
+ selectedConfiguration.setArtifactExtension(artifactExt);
+ selectedConfiguration.setBuildCommand(makeCommandOnly);
+ selectedConfiguration.setBuildArguments(makeArguments);
+ }
+
+ setDirty(false);
+ }
+
+ /* (non-Javadoc)
+ * @param rawCommand
+ * @return
+ */
+ private String parseMakeArgs(String rawCommand) {
+ StringBuffer result = new StringBuffer();
+
+ // Parse out the command
+ String actualCommand = parseMakeCommand(rawCommand);
+
+ // The flags and targets are anything not in the command
+ String arguments = rawCommand.substring(actualCommand.length());
+
+ // If there aren't any, we can stop
+ if (arguments.length() == 0) {
+ return result.toString().trim();
+ }
+
+ String[] tokens = arguments.trim().split("\\s"); //$NON-NLS-1$
+ /*
+ * Cases to consider
+ * --<flag> Sensible, modern single flag. Add to result and continue.
+ * -<flags> Flags in single token, add to result and stop
+ * -<flag_with_arg> ARG Flag with argument. Add next token if valid arg.
+ * -<mixed_flags> ARG Mix of flags, one takes arg. Add next token if valid arg.
+ * -<flag_with_arg>ARG Corrupt case where next token should be arg but isn't
+ * -<flags> [target].. Flags with no args, another token, add flags and stop.
+ */
+ Pattern flagPattern = Pattern.compile("C|f|I|j|l|O|W"); //$NON-NLS-1$
+ // Look for a '-' followed by 1 or more flags with no args and exactly 1 that expects args
+ Pattern mixedFlagWithArg = Pattern.compile("-[^CfIjloW]*[CfIjloW]{1}.+"); //$NON-NLS-1$
+ for (int i = 0; i < tokens.length; ++i) {
+ String currentToken = tokens[i];
+ if (currentToken.startsWith("--")) { //$NON-NLS-1$
+ result.append(currentToken);
+ result.append(" "); //$NON-NLS-1$
+ } else if (currentToken.startsWith("-")) { //$NON-NLS-1$
+ // Is there another token
+ if (i + 1 >= tokens.length) {
+ //We are done
+ result.append(currentToken);
+ } else {
+ String nextToken = tokens[i + 1];
+ // Are we expecting arguments
+ Matcher flagMatcher = flagPattern.matcher(currentToken);
+ if (!flagMatcher.find()) {
+ // Evalutate whether the next token should be added normally
+ result.append(currentToken);
+ result.append(" "); //$NON-NLS-1$
+ } else {
+ // Look for the case where there is no space between flag and arg
+ if (mixedFlagWithArg.matcher(currentToken).matches()) {
+ // Add this single token and keep going
+ result.append(currentToken);
+ result.append(" "); //$NON-NLS-1$
+ } else {
+ // Add this token and the next one right now
+ result.append(currentToken);
+ result.append(" "); //$NON-NLS-1$
+ result.append(nextToken);
+ result.append(" "); //$NON-NLS-1$
+ // Skip the next token the next time through, though
+ ++i;
+ }
+ }
+ }
+ }
+ }
+
+ return result.toString().trim();
+ }
+
+ /* (non-Javadoc)
+ *
+ * @param string
+ * @return
+ */
+ private String parseMakeCommand(String rawCommand) {
+ StringBuffer command = new StringBuffer();
+ boolean hasSpace = false;
+
+ // Try to separate out the command from the arguments
+ String[] result = rawCommand.split("\\s"); //$NON-NLS-1$
+
+ /*
+ * Here are the cases to consider:
+ * cmd First segment is last segment, assume is command
+ * cmd [flags] First segment is the command
+ * path/cmd [flags] Same as above
+ * path with space/make [flags] Must append each segment up-to flags as command
+ */
+ for (int i = 0; i < result.length; ++i) {
+ // Get the segment
+ String cmdSegment = result[i];
+ // If there is not another segment, we found the end
+ if (i + 1 >= result.length) {
+ command.append(cmdSegment);
+ } else {
+ // See if the next segment is the start of the flags
+ String nextSegment = result[i + 1];
+ if (nextSegment.startsWith("-")) { //$NON-NLS-1$
+ // we have found the end of the command
+ command.append(cmdSegment);
+ break;
+ } else {
+ command.append(cmdSegment);
+ // Add the whitespace back
+ command.append(" "); //$NON-NLS-1$
+ hasSpace = true;
+ }
+ }
+ }
+
+// if (hasSpace == true) {
+// return "\"" + command.toString().trim() + "\"";
+// } else {
+ return command.toString().trim();
+// }
+ }
+
+ public IPreferenceStore getPreferenceStore() {
+ return null;
+ }
+ /* (non-Javadoc)
+ * Initialize the "Use default command" field
+ */
+ public void setVisible(boolean visible) {
+ if (visible) {
+ useDefaultMake = !parent.getSelectedConfiguration().hasOverriddenBuildCommand();
+ makeCommandDefault.setSelection(useDefaultMake);
+ makeCommandEntry.setEditable(!makeCommandDefault.getSelection());
+ }
+ super.setVisible(visible);
+ }
+
+ /* (non-Javadoc)
+ * Event handler for the use default check box in the make command group
+ */
+ protected void handleUseDefaultPressed() {
+ // If the state of the button is unchecked, then we want to enable the edit widget
+ boolean checked = makeCommandDefault.getSelection();
+ if (checked == true) {
+ // TODO: This should NOT change the configuration immediately -
+ // it should set an intermediate variable and wait for OK/Apply
+ parent.getSelectedConfiguration().setBuildCommand(null);
+ parent.getSelectedConfiguration().setBuildArguments(null);
+ makeCommandEntry.setEditable(false);
+ } else {
+ makeCommandEntry.setEditable(true);
+ }
+ setValues();
+ }
+
+ /**
+ * Sets the "dirty" state
+ */
+ public void setDirty(boolean b) {
+ dirty = b;
+ }
+
+ /**
+ * Returns the "dirty" state
+ */
+ public boolean isDirty() {
+ return dirty;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ErrorParserBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ErrorParserBlock.java
index 58008294ad9..e45477eba68 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ErrorParserBlock.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ErrorParserBlock.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * Copyright (c) 2002,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -12,75 +12,119 @@
package org.eclipse.cdt.managedbuilder.internal.ui;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.ui.wizards.NewManagedProjectOptionPage;
import org.eclipse.cdt.managedbuilder.ui.wizards.NewManagedProjectWizard;
import org.eclipse.cdt.ui.dialogs.AbstractErrorParserBlock;
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.preference.IPreferenceStore;
public class ErrorParserBlock extends AbstractErrorParserBlock {
public ErrorParserBlock() {
- super(null);
+ super();
}
- protected String[] getErrorParserIDs(ITarget target) {
- // Get the list of error parsers specified with this Target
- String[] errorParsers = target.getErrorParserList();
+ protected String[] getErrorParserIDs(IConfiguration config) {
+ // Get the list of error parsers specified with this Configuration
+ String[] errorParsers = config.getErrorParserList();
if (errorParsers != null) {
return errorParsers;
}
else {
- // If no error parsers are specified by the target, the default is
+ // If no error parsers are specified by the configuration, the default is
// all error parsers
return CCorePlugin.getDefault().getAllErrorParsersIDs();
}
}
protected String[] getErrorParserIDs(IProject project) {
- ITarget target = ManagedBuildManager.getSelectedTarget(project);
- if (target == null) {
+ IConfiguration config = ManagedBuildManager.getSelectedConfiguration(project);
+ if (config == null) {
// This case occurs when modifying the properties of an existing
// managed build project, and the user selects the error parsers
// page before the "C/C++ Build" page.
// Get the build information
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
- target = info.getDefaultTarget();
+ config = info.getDefaultConfiguration();
}
- if (target != null) {
- return getErrorParserIDs(target);
+ if (config != null) {
+ return getErrorParserIDs(config);
} else {
return CCorePlugin.getDefault().getAllErrorParsersIDs();
}
}
protected String[] getErrorParserIDs() {
- // Get the currently selected target from the page's container
+ // Get the currently selected configuration from the page's container
// This is invoked by the managed builder new project wizard before the
// project is created.
ICOptionContainer container = getContainer();
if (container instanceof NewManagedProjectOptionPage) {
NewManagedProjectOptionPage parent = (NewManagedProjectOptionPage)getContainer();
NewManagedProjectWizard wizard = (NewManagedProjectWizard)parent.getWizard();
- ITarget target = wizard.getSelectedTarget();
- return getErrorParserIDs(target);
+ // TODO: This is wrong since the Wizard does not have a selected configuration!
+ IProjectType proj = wizard.getSelectedProjectType();
+ IConfiguration[] configs = proj.getConfigurations();
+ if (configs.length > 0)
+ return getErrorParserIDs(configs[0]);
+ else
+ return new String[0];
}
return CCorePlugin.getDefault().getAllErrorParsersIDs();
}
public void saveErrorParsers(IProject project, String[] parsers) {
- ITarget target = ManagedBuildManager.getSelectedTarget(project);
- if (target != null) {
+ IConfiguration config = ManagedBuildManager.getSelectedConfiguration(project);
+ if (config != null) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < parsers.length; i++) {
if (i > 0) buf.append(';');
buf.append(parsers[i]);
}
- target.setErrorParserIds(buf.toString());
+ config.setErrorParserIds(buf.toString());
}
}
+
+ public IPreferenceStore getPreferenceStore() {
+ return null;
+ }
+
+ protected void setValues() {
+ super.setValues();
+
+ // TODO: This reset belongs in AbstractErrorParserBlock.java?
+ // Reset the "dirty" flag
+ listDirty = false;
+ }
+
+ public void performApply(IProgressMonitor monitor) throws CoreException {
+ super.performApply(monitor);
+
+ // TODO: This reset belongs in AbstractErrorParserBlock.java?
+ // Reset the "dirty" flag
+ listDirty = false;
+
+ }
+
+ /**
+ * Sets the "dirty" state
+ */
+ public void setDirty(boolean b) {
+ listDirty = b;
+ }
+
+ /**
+ * Returns the "dirty" state
+ */
+ public boolean isDirty() {
+ return listDirty;
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuildOptionBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuildOptionBlock.java
new file mode 100644
index 00000000000..5cb78b16089
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedBuildOptionBlock.java
@@ -0,0 +1,271 @@
+/**********************************************************************
+ * Copyright (c) 2002,2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+ * **********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.ui;
+
+import java.util.Iterator;
+
+import org.eclipse.cdt.ui.dialogs.BinaryParserBlock;
+import org.eclipse.cdt.ui.dialogs.ICOptionPage;
+import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
+import org.eclipse.cdt.managedbuilder.ui.properties.BuildPropertyPage;
+import org.eclipse.cdt.managedbuilder.ui.properties.ResourceBuildPropertyPage;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.ui.help.WorkbenchHelp;
+
+public class ManagedBuildOptionBlock extends TabFolderOptionBlock {
+
+ private ToolsSettingsBlock toolsSettingsBlock;
+ private BuildSettingsBlock buildSettingsBlock;
+ private ErrorParserBlock errParserBlock;
+ private BinaryParserBlock binaryParserBlock;
+ private Object element;
+
+ /**
+ * @param parent
+ */
+ public ManagedBuildOptionBlock(BuildPropertyPage parent) {
+ super(parent, false);
+ }
+
+ public ManagedBuildOptionBlock(ResourceBuildPropertyPage resParent) {
+ super(resParent, false);
+ }
+
+ public BuildPropertyPage getBuildPropertyPage() {
+ return (BuildPropertyPage)fParent;
+ }
+
+ public ResourceBuildPropertyPage getResourceBuildPropertyPage() {
+ return (ResourceBuildPropertyPage)fParent;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock#addTabs()
+ */
+ protected void addTabs() {
+
+ if (element instanceof IProject) {
+ addTab(toolsSettingsBlock = new ToolsSettingsBlock((BuildPropertyPage) fParent, element));
+ addTab(buildSettingsBlock = new BuildSettingsBlock((BuildPropertyPage) fParent));
+ addTab(errParserBlock = new ErrorParserBlock());
+ addTab(binaryParserBlock = new BinaryParserBlock());
+ } else if (element instanceof IFile) {
+ addTab(toolsSettingsBlock = new ToolsSettingsBlock((ResourceBuildPropertyPage) fParent, element));
+ }
+ }
+
+ public ToolsSettingsBlock getToolsSettingsBlock() {
+ return toolsSettingsBlock;
+ }
+
+ public BuildSettingsBlock getBuildSettingsBlock() {
+ return buildSettingsBlock;
+ }
+
+ public BinaryParserBlock getBinaryParserBlock() {
+ return binaryParserBlock;
+ }
+
+ public ErrorParserBlock getErrorParserBlock() {
+ return errParserBlock;
+ }
+
+ public Control createContents(Composite parent, Object element) {
+ this.element = element;
+ Control control = super.createContents( parent );
+ ((GridLayout)((Composite)control).getLayout()).marginWidth = 1;
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ ((Composite)control).setLayoutData(gd);
+
+ // TODO
+ //if (getToolsSettingsBlock() != null)
+ // WorkbenchHelp.setHelp(getToolsSettingsBlock().getControl(), ManagedBuilderHelpContextIds.MAN_PROJ_ERROR_PARSER);
+ if (getErrorParserBlock() != null)
+ WorkbenchHelp.setHelp(getErrorParserBlock().getControl(), ManagedBuilderHelpContextIds.MAN_PROJ_ERROR_PARSER);
+
+ return control;
+ }
+
+ protected void initializeValues() {
+ if (getToolsSettingsBlock()!= null) {
+ getToolsSettingsBlock().initializeValues();
+ }
+ if (getBuildSettingsBlock()!= null) {
+ getBuildSettingsBlock().initializeValues();
+ }
+ if (getErrorParserBlock()!= null) {
+ // TODO
+ //getErrorParserBlock().initializeValues();
+ }
+ if (getBinaryParserBlock()!= null) {
+ // TODO
+ //getBinaryParserBlock().initializeValues();
+ }
+ }
+
+ public void updateValues() {
+ if (element instanceof IProject) {
+ if (getToolsSettingsBlock() != null) {
+ getToolsSettingsBlock().updateValues();
+ }
+ if (getBuildSettingsBlock() != null) {
+ getBuildSettingsBlock().updateValues();
+ }
+ if (getErrorParserBlock() != null) {
+ getErrorParserBlock().updateValues();
+ }
+ if (getBinaryParserBlock() != null) {
+ // TODO
+ //getBinaryParserBlock().updateValues();
+ }
+ } else if( element instanceof IFile) {
+ if (getToolsSettingsBlock() != null) {
+ getToolsSettingsBlock().updateValues();
+ }
+ }
+ }
+
+ public void setValues() {
+ if (element instanceof IProject) {
+ if (getToolsSettingsBlock() != null) {
+ getToolsSettingsBlock().updateValues();
+ }
+ if (getBuildSettingsBlock() != null) {
+ getBuildSettingsBlock().setValues();
+ }
+ if (getErrorParserBlock() != null) {
+ // TODO
+ //getErrorParserBlock().setValues();
+ }
+ if (getBinaryParserBlock() != null) {
+ // TODO
+ //getBinaryParserBlock().setValues();
+ }
+ } else if (element instanceof IFile) {
+ if (getToolsSettingsBlock() != null) {
+ getToolsSettingsBlock().updateValues();
+ }
+ }
+ }
+
+ public void removeValues(String id) {
+ if (element instanceof IProject) {
+ if (getToolsSettingsBlock() != null) {
+ getToolsSettingsBlock().removeValues(id);
+ }
+ if (getBuildSettingsBlock() != null) {
+ getBuildSettingsBlock().removeValues(id);
+ }
+ if (getErrorParserBlock() != null) {
+ // TODO
+ //getErrorParserBlock().removeValues(id);
+ }
+ if (getBinaryParserBlock() != null) {
+ // TODO
+ //getBinaryParserBlock().removeValues(id);
+ }
+ } else if (element instanceof IFile) {
+ if (getToolsSettingsBlock()!= null) {
+ getToolsSettingsBlock().removeValues(id);
+ }
+ }
+ }
+
+ public IPreferenceStore getPreferenceStore()
+ {
+ if (element instanceof IProject) {
+ if (getCurrentPage() instanceof ToolsSettingsBlock) {
+ return toolsSettingsBlock.getPreferenceStore();
+ }
+ if (getCurrentPage() instanceof BuildSettingsBlock) {
+ return buildSettingsBlock.getPreferenceStore();
+ }
+ if (getCurrentPage() instanceof ErrorParserBlock) {
+ return errParserBlock.getPreferenceStore();
+ }
+ if (getCurrentPage() instanceof BinaryParserBlock) {
+ return null;
+ }
+ } else if( element instanceof IFile) {
+ if (getCurrentPage() instanceof ToolsSettingsBlock) {
+ return toolsSettingsBlock.getPreferenceStore();
+ }
+ }
+ return null;
+ }
+
+ public IPreferenceStore getToolSettingsPreferenceStore()
+ {
+ return toolsSettingsBlock.getPreferenceStore();
+ }
+
+ public void update() {
+ super.update();
+ ICOptionPage tab = getCurrentPage();
+ // Currently, other settings are per-config, while binary parser settings are per-project
+ if (tab instanceof BinaryParserBlock) {
+ ((BuildPropertyPage)fParent).enableConfigSelection(false);
+ } else {
+ if(element instanceof IProject) {
+ ((BuildPropertyPage)fParent).enableConfigSelection(true);
+ } else if ( element instanceof IFile) {
+ ((ResourceBuildPropertyPage)fParent).enableConfigSelection(true);
+ }
+ }
+ }
+
+ /**
+ * Sets the dirty state of the contained pages
+ */
+ public void setDirty(boolean b) {
+ Iterator iter = getOptionPages().iterator();
+ while (iter.hasNext()) {
+ ICOptionPage tab = (ICOptionPage)iter.next();
+ if (tab instanceof BuildSettingsBlock) {
+ ((BuildSettingsBlock)tab).setDirty(b);
+ } else if (tab instanceof ToolsSettingsBlock) {
+ ((ToolsSettingsBlock)tab).setDirty(b);
+ } else if (tab instanceof ErrorParserBlock) {
+ ((ErrorParserBlock)tab).setDirty(b);
+ } else if (tab instanceof BinaryParserBlock) {
+ //TODO ManagedBuildSystem needs its own binary parser block
+ }
+ }
+ }
+
+ /**
+ * Returns <code> true <code/> if any of the pages are dirty
+ * @return boolean
+ */
+ public boolean isDirty() {
+ Iterator iter = getOptionPages().iterator();
+ while (iter.hasNext()) {
+ ICOptionPage tab = (ICOptionPage)iter.next();
+ if (tab instanceof BuildSettingsBlock) {
+ if (((BuildSettingsBlock)tab).isDirty()) return true;
+ } else if (tab instanceof ToolsSettingsBlock) {
+ if (((ToolsSettingsBlock)tab).isDirty()) return true;
+ } else if (tab instanceof ErrorParserBlock) {
+ if (((ErrorParserBlock)tab).isDirty()) return true;
+ } else if (tab instanceof BinaryParserBlock) {
+ //TODO ManagedBuildSystem needs its own binary parser block
+ }
+
+ }
+ return false;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedMakeStartup.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedMakeStartup.java
deleted file mode 100644
index e4954e03d6a..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedMakeStartup.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.cdt.managedbuilder.internal.ui;
-
-import org.eclipse.cdt.managedbuilder.ui.actions.UpdateManagedProjectAction;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IStartup;
-
-/**
- *
- */
-public class ManagedMakeStartup implements IStartup {
- /* (non-Javadoc)
- * @see org.eclipse.ui.IStartup#earlyStartup()
- */
- public void earlyStartup() {
- // Get any 1.2 projects from the workspace
- final IProject[] projects = UpdateManagedProjectAction.getVersion12Projects();
- if (projects.length > 0) {
- Display.getDefault().asyncExec(new Runnable() {
- // Start the process that will update the 1.2 projects
- public void run() {
- Shell shell = ManagedBuilderUIPlugin.getDefault().getShell();
- for (int index = projects.length - 1; index >= 0; --index) {
- IProject project = projects[index];
- boolean shouldUpdate = MessageDialog.openQuestion(shell,
- ManagedBuilderUIMessages.getResourceString("ManagedBuilderStartup.update.12x.title"), //$NON-NLS-1$
- ManagedBuilderUIMessages.getFormattedString("ManagedBuilderStartup.update.12x.message", new String[]{project.getName()})); //$NON-NLS-1$
- // Go for it
- if (shouldUpdate) {
- ProgressMonitorDialog pd = new ProgressMonitorDialog(shell);
- UpdateManagedProjectAction.run(false, pd, project);
- }
- }
-
- }
- });
- }
- }
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedProjectOptionBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedProjectOptionBlock.java
index 02cc74db91f..8579d0b4571 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedProjectOptionBlock.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ManagedProjectOptionBlock.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.internal.ui;
-
/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * Copyright (c) 2002,2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -10,10 +8,13 @@ package org.eclipse.cdt.managedbuilder.internal.ui;
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.ui;
import org.eclipse.cdt.ui.dialogs.BinaryParserBlock;
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.help.WorkbenchHelp;
@@ -27,7 +28,7 @@ public class ManagedProjectOptionBlock extends TabFolderOptionBlock {
* @param parent
*/
public ManagedProjectOptionBlock(ICOptionContainer parent) {
- super(parent);
+ super(parent, false);
}
/* (non-Javadoc)
@@ -49,9 +50,27 @@ public class ManagedProjectOptionBlock extends TabFolderOptionBlock {
public Control createContents(Composite parent) {
Control control = super.createContents( parent );
+ ((GridLayout)((Composite)control).getLayout()).marginWidth = 1;
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ ((Composite)control).setLayoutData(gd);
+
if (getErrorParserBlock()!= null)
WorkbenchHelp.setHelp(getErrorParserBlock().getControl(), ManagedBuilderHelpContextIds.MAN_PROJ_ERROR_PARSER);
return control;
}
+
+ public void updateValues() {
+ if (getErrorParserBlock()!= null) {
+ getErrorParserBlock().updateValues();
+ }
+ if (getBinaryParserBlock()!= null) {
+ // TODO
+ //getBinaryParserBlock().updateValues();
+ }
+ }
+
+ public void update() {
+ super.update();
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
index 86749492e38..706c7b43a46 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
@@ -3,16 +3,9 @@
# All Rights Reserved.
#########################################
-# ------- 1.2 Project Update Messages -------
-ManagedBuilderStartup.update.12x.title=Update Managed Builder Project
-ManagedBuilderStartup.update.12x.message=The project {0} has been detected in your workspace.\n Its build settings are stored in a format that is no longer supported.\n Would you like to convert them now?
-ManagedBuilderStartup.update.exception.error=Error
-ManagedBuilderStartup.update.exception.message=Error updating project {0}
-ManagedBuildConvert.12x.monitor.message.project=Updating build settings for project {0}
-ManagedBuildConvert.12x.monitor.message.backup=Backing up the settings file for {0}
-ManagedBuildConvert.12x.warning.title=Backup File Already Exists
-ManagedBuildConvert.12x.warning.message=A backup file already exists for the project {0}.\n Shall I try to convert the project anyway?
-ManagedBuildConvert.12x.cancelled.message=The update operation has been cancelled.\n The build system will not be able to read the project settings until you update the project.
+# ------- Project Update Messages -------
+ManagedBuilderStartup.update.20x.title=Update Managed Builder Project
+ManagedBuilderStartup.update.20x.message=The project {0} has been detected in your workspace.\n Its build settings are stored in a format that is no longer supported.\n Would you like to convert them now?
# ------- NewProjectCreationPluginPage-------
MngMakeProjectWizard.op_error=Managed Make Error
@@ -36,12 +29,12 @@ MngCCWizardSettings.title=Managed Make C++ Settings
MngCCWizardSettings.description=Define the Managed Make C++ build settings.
# -- Strings for the platform selection page --
-MngMakeProjectWizard.config.title=Select a Target
+MngMakeProjectWizard.config.title=Select a type of project
MngMakeProjectWizard.config.desc=Select the platform and configurations you wish to deploy on
-PlatformBlock.tip.platform=Select the target of the build goal
-PlatformBlock.label.platform=Build Target:
+PlatformBlock.tip.platform=Select the type of project for the build goal
+PlatformBlock.label.platform=Project Type:
PlatformBlock.label.configs=Configurations:
-PlatformBlock.label.showall=Show All Targets
+PlatformBlock.label.showall=Show All Project Types
PlatformBlock.message.error.noconfigs=You must select at least one configuration
# -- Strings for the additional options tab
@@ -49,14 +42,12 @@ MngMakeProjectWizard.options.title=Additional Project Settings
MngMakeProjectWizard.options.desc=Define the inter-project dependencies, if any.
# ----------- Configuration Selection Page -----------
-BuildPropertyPage.label.Platform=Platform:
+BuildPropertyPage.label.Platform=Project Type:
BuildPropertyPage.label.Configuration=Configuration:
BuildPropertyPage.label.Active=Active configuration
-BuildPropertyPage.label.Settings=Configuration settings
+BuildPropertyPage.label.Settings=Configuration Settings
BuildPropertyPage.label.AddConfButton=Manage...
BuildPropertyPage.selection.configuration.all=All configurations
-BuildPropertyPage.label.ToolTree=Tools
-BuildPropertyPage.label.ToolOptions=Options
BuildPropertyPage.tip.platform=Select a platform for the project
BuildPropertyPage.tip.config=Select the configuration to edit
BuildPropertyPage.tip.addconf=Add configurations for the platform
@@ -64,6 +55,37 @@ BuildPropertyPage.tip.remconf=Remove configurations for the platform
BuildPropertyPage.manage.title=Manage
BuildPropertyPage.error.Unknown_tree_element=Unknown type of element in tree of type {0}
BuildPropertyPage.error.version_low=The project settings are stored in an earlier format.\nYou must upgrade the project before the settings can be upgraded.
+BuildPropertyPage.defaults.title=Reset Configuration Tools
+BuildPropertyPage.defaults.message=This action will reset all of the tools in the selected configuration to their default settings.\n\nDo you want to proceed?
+BuildPropertyPage.changes.save.title=Apply Configuration Changes
+BuildPropertyPage.changes.save.question=You have made changes to the {0} configuration.\n\nDo you want to apply these changes before switching to the {1} configuration?
+BuildPropertyPage.changes.save.error=The configuration changes could not be applied.
+
+#--------------- Resource Configuration Selection Page --------------
+ResourceBuildPropertyPage.defaults.title=Reset Resource Configuration Tool
+ResourceBuildPropertyPage.defaults.message=This action will reset all options of the tool in the current resource configuration to their default settings.\n\nDo you want to proceed?
+
+# ----------- Tools Settings Block -----------
+ToolsSettingsBlock.label.Settings=Tool Settings
+ToolsSettingsBlock.label.ToolTree=Tools
+ToolsSettingsBlock.label.ToolOptions=Options
+
+# ----------- Build Settings Block -----------
+BuildSettingsBlock.label.Settings=Build Settings
+BuildSettingsBlock.label.makecmdgroup=Make command
+BuildSettingsBlock.label.makecmddef=Use default command
+BuildSettingsBlock.label.output.group=Build output
+BuildSettingsBlock.label.output.name=Artifact name:
+BuildSettingsBlock.label.output.extension=Artifact extension:
+
+# ------------Resource Configuration Selection Page
+ResourceBuildPropertyPage.label.ActiveResource=Active Resource configuration
+ResourceBuildPropertyPage.label.ResourceSettings=Resource Configuration settings
+ResourceBuildPropertyPage.label.Configuration=Configuration:
+ResourceBuildPropertyPage.label.ExcludeCheckBox= Exclude from build
+ResourceBuildPropertyPage.selection.configuration.all=All configurations
+ResourceBuildPropertyPage.label.ToolTree=Tools
+ResourceBuildPropertyPage.label.ToolOptions=Options
# ----------- Entry Dialog -----------
BrowseEntryDialog.error.Folder_name_invalid = Folder name invalid
@@ -81,11 +103,6 @@ NewConfiguration.error.title=Error
NewConfiguration.error.duplicateName=A configuration named "{0}" already exists.
# ----------- Target/Config management dialog -----------------
-ManageConfig.label.makecmdgroup=Make command
-ManageConfig.label.makecmddef=Use default command
-ManageConfig.label.output.group=Build output
-ManageConfig.label.output.name=Artifact name:
-ManageConfig.label.output.extension=Artifact extension:
ManageConfig.label.configs=Manage configurations
ManageConfig.label.restore=Restore
ManageConfig.label.configs.current=Current:
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ToolsSettingsBlock.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ToolsSettingsBlock.java
new file mode 100644
index 00000000000..2da2a71f429
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ToolsSettingsBlock.java
@@ -0,0 +1,639 @@
+/**********************************************************************
+ * Copyright (c) 2002,2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Move to Make plugin
+ * Intel Corp - Use in Managed Make system
+***********************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.ui;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage;
+import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
+import org.eclipse.cdt.managedbuilder.ui.properties.BuildOptionSettingsPage;
+import org.eclipse.cdt.managedbuilder.ui.properties.BuildPropertyPage;
+import org.eclipse.cdt.managedbuilder.ui.properties.BuildSettingsPage;
+import org.eclipse.cdt.managedbuilder.ui.properties.BuildToolSettingsPage;
+import org.eclipse.cdt.managedbuilder.ui.properties.BuildToolsSettingsStore;
+import org.eclipse.cdt.managedbuilder.ui.properties.ResourceBuildPropertyPage;
+import org.eclipse.cdt.managedbuilder.ui.properties.ToolListContentProvider;
+import org.eclipse.cdt.managedbuilder.ui.properties.ToolListLabelProvider;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Shell;
+
+public class ToolsSettingsBlock extends AbstractCOptionPage {
+
+ /*
+ * String constants
+ */
+ private static final String PREFIX = "ToolsSettingsBlock"; //$NON-NLS-1$
+ private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
+ private static final String SETTINGS_LABEL = LABEL + ".Settings"; //$NON-NLS-1$
+ private static final String TREE_LABEL = LABEL + ".ToolTree"; //$NON-NLS-1$
+ private static final String OPTIONS_LABEL = LABEL + ".ToolOptions"; //$NON-NLS-1$
+ private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 20, 30 };
+
+ /*
+ * Dialog widgets
+ */
+ private TreeViewer optionList;
+ private SashForm sashForm;
+ private Group sashGroup;
+ private Composite settingsPageContainer;
+ private ScrolledComposite containerSC;
+
+ /*
+ * Bookeeping variables
+ */
+ private Map configToPageListMap;
+ private BuildToolsSettingsStore settingsStore;
+ private Map settingsStoreMap;
+ private BuildPropertyPage parent;
+ private ResourceBuildPropertyPage resParent;
+ private BuildSettingsPage currentSettingsPage;
+ private IOptionCategory selectedCategory;
+ private ToolListContentProvider provider;
+ private ITool selectedTool;
+ private Object element;
+
+ /**
+ * The minimum page size; 200 by 200 by default.
+ *
+ * @see #setMinimumPageSize
+ */
+ private Point minimumPageSize = new Point(200, 200);
+
+ /**
+ * Layout for the page container.
+ *
+ */
+ private class PageLayout extends Layout {
+ public void layout(Composite composite, boolean force) {
+ Rectangle rect = composite.getClientArea();
+ Control[] children = composite.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ children[i].setSize(rect.width, rect.height);
+ }
+ }
+ public Point computeSize(Composite composite, int wHint, int hHint, boolean force) {
+ if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) {
+ return new Point(wHint, hHint);
+ }
+ int x = minimumPageSize.x;
+ int y = minimumPageSize.y;
+
+ Control[] children = composite.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ Point size = children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
+ x = Math.max(x, size.x);
+ y = Math.max(y, size.y);
+ }
+ if (wHint != SWT.DEFAULT) {
+ x = wHint;
+ }
+ if (hHint != SWT.DEFAULT) {
+ y = hHint;
+ }
+ return new Point(x, y);
+ }
+ }
+
+ /*
+ * Constructor
+ */
+ public ToolsSettingsBlock(BuildPropertyPage parent, Object element)
+ {
+ super(ManagedBuilderUIMessages.getResourceString(SETTINGS_LABEL));
+ super.setContainer(parent);
+ this.parent = parent;
+ configToPageListMap = new HashMap();
+ this.element = element;
+ }
+
+ public ToolsSettingsBlock(ResourceBuildPropertyPage resParent, Object element)
+ {
+ super(ManagedBuilderUIMessages.getResourceString(SETTINGS_LABEL));
+ super.setContainer((ICOptionContainer) resParent);
+ this.resParent = resParent;
+ configToPageListMap = new HashMap();
+ this.element = element;
+ }
+
+ public void createControl(Composite parent) {
+
+ // Create the sash form
+ sashForm = new SashForm(parent, SWT.NONE);
+ sashForm.setOrientation(SWT.HORIZONTAL);
+ sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 5;
+ layout.marginWidth = 5;
+ sashForm.setLayout(layout);
+
+ setControl(sashForm);
+ createSelectionArea(sashForm);
+ createEditArea(sashForm);
+ initializeSashForm();
+
+ //WorkbenchHelp.setHelp(composite, ManagedBuilderHelpContextIds.MAN_PROJ_BUILD_PROP);
+ }
+
+ protected void createSelectionArea (Composite parent) {
+ // Create a label and list viewer
+ Composite composite = ControlFactory.createComposite(parent, 1);
+ optionList = new TreeViewer(composite, SWT.SINGLE|SWT.H_SCROLL|SWT.V_SCROLL|SWT.BORDER);
+ optionList.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ handleOptionSelection();
+ }
+ });
+ optionList.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
+ optionList.setLabelProvider(new ToolListLabelProvider());
+ }
+
+ /* (non-Javadoc)
+ * Method displayOptionsForTool.
+ * @param toolReference
+ */
+ private void displayOptionsForCategory(IOptionCategory category) {
+ // Do nothing if the selected category is is unchanged
+ if (category == selectedCategory) {
+ return;
+ }
+ selectedTool = null;
+ selectedCategory = category;
+
+ // Cache the current build setting page
+ BuildSettingsPage oldPage = currentSettingsPage;
+ currentSettingsPage = null;
+
+ // Create a new settings page if necessary
+ List pages = getPagesForConfig();
+ ListIterator iter = pages.listIterator();
+ while (iter.hasNext()) {
+ BuildSettingsPage page = (BuildSettingsPage) iter.next();
+ if (page instanceof BuildOptionSettingsPage &&
+ ((BuildOptionSettingsPage)page).isForCategory(category)) {
+ currentSettingsPage = page;
+ break;
+ }
+ }
+ if (currentSettingsPage == null) {
+ if ( this.element instanceof IProject) {
+ currentSettingsPage = new BuildOptionSettingsPage(parent.getSelectedConfiguration(), category);
+ pages.add(currentSettingsPage);
+ currentSettingsPage.setContainer(parent);
+ } else if ( this.element instanceof IFile) {
+ currentSettingsPage = new BuildOptionSettingsPage(resParent.getCurrentResourceConfig(), category);
+ pages.add(currentSettingsPage);
+ currentSettingsPage.setContainer(resParent);
+ }
+ if (currentSettingsPage.getControl() == null) {
+ currentSettingsPage.createControl(settingsPageContainer);
+ }
+ }
+
+ // Make all the other pages invisible
+ Control[] children = settingsPageContainer.getChildren();
+ Control currentControl = currentSettingsPage.getControl();
+ for (int i = 0; i < children.length; i++) {
+ if (children[i] != currentControl)
+ children[i].setVisible(false);
+ }
+ currentSettingsPage.setVisible(true);
+
+ // save the last page build options.
+ // If the last page is tool page then parse all the options
+ // and put it in the appropriate preference store.
+ if (oldPage != null){
+ if(oldPage instanceof BuildOptionSettingsPage) {
+ ((BuildOptionSettingsPage)oldPage).storeSettings();
+ }
+ else if(oldPage instanceof BuildToolSettingsPage) {
+ ((BuildToolSettingsPage)oldPage).storeSettings();
+ //((BuildToolSettingsPage)oldPage).parseAllOptions();
+ }
+ }
+ //update the field editors in the current page
+ if(currentSettingsPage instanceof BuildOptionSettingsPage)
+ ((BuildOptionSettingsPage)currentSettingsPage).updateFields();
+
+ if (oldPage != null)
+ oldPage.setVisible(false);
+
+ // Set the size of the scrolled area
+ containerSC.setMinSize(currentSettingsPage.computeSize());
+ settingsPageContainer.layout();
+ }
+
+ /* (non-Javadoc)
+ * @param tool
+ */
+ private void displayOptionsForTool(ITool tool) {
+ if (tool == selectedTool) {
+ return;
+ }
+ // Unselect the category
+ selectedCategory = null;
+ // record that the tool selection has changed
+ selectedTool = tool;
+
+ // Cache the current build setting page
+ BuildSettingsPage oldPage = currentSettingsPage;
+ currentSettingsPage = null;
+
+ // Create a new page if we need one
+ List pages = getPagesForConfig();
+ ListIterator iter = pages.listIterator();
+ while (iter.hasNext()) {
+ BuildSettingsPage page = (BuildSettingsPage) iter.next();
+ if (page instanceof BuildToolSettingsPage &&
+ ((BuildToolSettingsPage)page).isForTool(tool)) {
+ currentSettingsPage = page;
+ break;
+ }
+ }
+ if (currentSettingsPage == null) {
+ if ( this.element instanceof IProject) {
+ currentSettingsPage = new BuildToolSettingsPage(parent.getSelectedConfiguration(), tool);
+ pages.add(currentSettingsPage);
+ currentSettingsPage.setContainer(parent);
+ } else if(this.element instanceof IFile) {
+ currentSettingsPage = new BuildToolSettingsPage(resParent.getCurrentResourceConfig(), tool);
+ pages.add(currentSettingsPage);
+ currentSettingsPage.setContainer(resParent);
+ }
+ if (currentSettingsPage.getControl() == null) {
+ currentSettingsPage.createControl(settingsPageContainer);
+ }
+ }
+ // Make all the other pages invisible
+ Control[] children = settingsPageContainer.getChildren();
+ Control currentControl = currentSettingsPage.getControl();
+ for (int i = 0; i < children.length; i++) {
+ if (children[i] != currentControl)
+ children[i].setVisible(false);
+ }
+
+ // Make the current page visible
+ currentSettingsPage.setVisible(true);
+
+ // save the last page build options.
+ // If the last page is tool page then parse all the options
+ // and put it in the appropriate preference store.
+ if (oldPage != null){
+ if(oldPage instanceof BuildOptionSettingsPage) {
+ ((BuildOptionSettingsPage)oldPage).storeSettings();
+ }
+ else if(oldPage instanceof BuildToolSettingsPage) {
+ ((BuildToolSettingsPage)oldPage).storeSettings();
+ //((BuildToolSettingsPage)oldPage).parseAllOptions();
+ }
+ }
+ //update the field editor that displays all the build options
+ if(currentSettingsPage instanceof BuildToolSettingsPage)
+ ((BuildToolSettingsPage)currentSettingsPage).updateAllOptionField();
+
+ if (oldPage != null)
+ oldPage.setVisible(false);
+
+ // Set the size of the scrolled area
+ containerSC.setMinSize(currentSettingsPage.computeSize());
+ settingsPageContainer.layout();
+ }
+
+ /* (non-Javadoc)
+ * Add the tabs relevant to the project to edit area tab folder.
+ */
+ protected void createEditArea(Composite parent) {
+ containerSC = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
+ containerSC.setExpandHorizontal(true);
+ containerSC.setExpandVertical(true);
+
+ // Add a container for the build settings page
+ settingsPageContainer = new Composite(containerSC, SWT.NULL);
+ settingsPageContainer.setLayout(new PageLayout());
+
+ containerSC.setContent(settingsPageContainer);
+ containerSC.setMinSize(settingsPageContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ settingsPageContainer.layout();
+ }
+
+ /*
+ * (non-javadoc)
+ * Initialize the relative weights (widths) of the 2 sides of the sash.
+ */
+ protected void initializeSashForm() {
+ sashForm.setWeights(DEFAULT_SASH_WEIGHTS);
+ }
+
+ protected void initializeValues() {
+ setValues();
+ }
+
+ public void updateValues() {
+ setValues();
+ }
+
+ protected void setValues() {
+
+ if (provider == null) {
+// IResource element = parent.getProject();
+ IResource resource = (IResource) element;
+ provider = new ToolListContentProvider(resource.getType());
+ optionList.setContentProvider(provider);
+ }
+ if ( element instanceof IProject ) {
+ optionList.setInput(parent.getSelectedConfiguration());
+ } else if ( element instanceof IFile){
+ optionList.setInput(resParent.getCurrentResourceConfig());
+ }
+
+ optionList.expandAll();
+
+ // Create (or retrieve) the settings store for the configuration/resource configuration
+ BuildToolsSettingsStore store = null;
+ if ( element instanceof IProject ) {
+ store = (BuildToolsSettingsStore) getSettingsStoreMap().get(parent.getSelectedConfiguration().getId());
+ if (store == null) {
+ store = new BuildToolsSettingsStore(parent.getSelectedConfiguration());
+ getSettingsStoreMap().put(parent.getSelectedConfiguration().getId(), store);
+ }
+ } else if ( element instanceof IFile) {
+ store = (BuildToolsSettingsStore) getSettingsStoreMap().get(resParent.getCurrentResourceConfig().getId());
+ if (store == null) {
+ store = new BuildToolsSettingsStore(resParent.getCurrentResourceConfig());
+ getSettingsStoreMap().put(resParent.getCurrentResourceConfig().getId(), store);
+ }
+ }
+ settingsStore = store;
+
+ // Select the first tool in the list
+ Object[] elements = null;
+ Object primary = null;
+ if( element instanceof IProject){
+ elements = provider.getElements(parent.getSelectedConfiguration());
+ } else if ( element instanceof IFile) {
+ elements = provider.getElements(resParent.getCurrentResourceConfig());
+ }
+ primary = elements.length > 0 ? elements[0] : null;
+
+ if (primary != null) {
+ optionList.setSelection(new StructuredSelection(primary));
+ }
+ }
+
+ public void removeValues(String id) {
+ getSettingsStoreMap().remove(id);
+ }
+
+ private void handleOptionSelection() {
+ // Get the selection from the tree list
+ IStructuredSelection selection = (IStructuredSelection) optionList.getSelection();
+
+ // Set the option page based on the selection
+ Object element = selection.getFirstElement();
+ if (element instanceof ITool) {
+ displayOptionsForTool((ITool)element);
+ } else if (element instanceof IOptionCategory) {
+ displayOptionsForCategory((IOptionCategory)element);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
+ */
+ public void performDefaults() {
+ if ( element instanceof IProject) {
+ performDefaults( (IProject)element);
+ } else if ( element instanceof IFile) {
+ performDefaults( (IFile)element);
+ }
+ return;
+ }
+
+ public void performDefaults(IProject project) {
+ // TODO: Should this reset all tools of the configuration, or just
+ // the currently selected tool category? Right now it is all tools.
+
+ // Display a "Confirm" dialog box, since:
+ // 1. The defaults are immediately applied
+ // 2. The action cannot be undone
+ Shell shell = ManagedBuilderUIPlugin.getDefault().getShell();
+ boolean shouldDefault = MessageDialog.openConfirm(shell,
+ ManagedBuilderUIMessages.getResourceString("BuildPropertyPage.defaults.title"), //$NON-NLS-1$
+ ManagedBuilderUIMessages.getResourceString("BuildPropertyPage.defaults.message")); //$NON-NLS-1$
+ if (!shouldDefault) return;
+
+ // Empty the page list
+ List pages = getPagesForConfig();
+ pages.clear();
+
+ // Get the build manager to reset build info for project
+ ManagedBuildManager.resetConfiguration(parent.getProject(), parent.getSelectedConfiguration());
+
+ // Recreate the settings store for the configuration
+ settingsStore = new BuildToolsSettingsStore(parent.getSelectedConfiguration());
+
+ // Write out the build model info
+ ManagedBuildManager.setDefaultConfiguration(parent.getProject(), parent.getSelectedConfiguration());
+ ManagedBuildManager.saveBuildInfo(parent.getProject(), false);
+
+ // Reset the category or tool selection and run selection event handler
+ selectedCategory = null;
+ selectedTool = null;
+ handleOptionSelection();
+
+ setDirty(false);
+ }
+
+ public void performDefaults(IFile file) {
+ // TODO: Should this reset all options of the tool in current resource configuration, or just
+ // the currently selected tool category? Right now it is all options.
+
+ // Display a "Confirm" dialog box, since:
+ // 1. The defaults are immediately applied
+ // 2. The action cannot be undone
+ Shell shell = ManagedBuilderUIPlugin.getDefault().getShell();
+ boolean shouldDefault = MessageDialog.openConfirm(shell,
+ ManagedBuilderUIMessages.getResourceString("ResourceBuildPropertyPage.defaults.title"), //$NON-NLS-1$
+ ManagedBuilderUIMessages.getResourceString("ResourceBuildPropertyPage.defaults.message")); //$NON-NLS-1$
+ if (!shouldDefault) return;
+
+ // Empty the page list
+ List pages = getPagesForConfig();
+ pages.clear();
+
+ // Get the build manager to reset build info for project
+ ManagedBuildManager.resetResourceConfiguration(resParent.getProject(), resParent.getCurrentResourceConfig());
+
+ // Recreate the settings store for the configuration
+ settingsStore = new BuildToolsSettingsStore(resParent.getCurrentResourceConfig());
+
+ // Write out the build model info
+ ManagedBuildManager.setDefaultConfiguration(resParent.getProject(), resParent.getSelectedConfiguration());
+ ManagedBuildManager.saveBuildInfo(resParent.getProject(), false);
+
+ // Reset the category or tool selection and run selection event handler
+ selectedCategory = null;
+ selectedTool = null;
+ handleOptionSelection();
+
+ setDirty(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(IProgressMonitor)
+ */
+ public void performApply(IProgressMonitor monitor) throws CoreException {
+
+ // Force each settings page to update
+ List pages = getPagesForConfig();
+ // Make sure we have something to work on
+ if (pages == null) {
+ // Nothing to do
+ return;
+ }
+ ListIterator iter = pages.listIterator();
+ while (iter.hasNext()) {
+ BuildSettingsPage page = (BuildSettingsPage) iter.next();
+ if (page == null) continue;
+ if (page instanceof BuildToolSettingsPage) {
+ // if the currentsettings page is not the tool settings page
+ // then update the all build options field editor based on the
+ // build options in other options settings page.
+ if (!(currentSettingsPage instanceof BuildToolSettingsPage))
+ ((BuildToolSettingsPage)page).updateAllOptionField();
+ ((BuildToolSettingsPage)page).performOk();
+ } else if (page instanceof BuildOptionSettingsPage) {
+ ((BuildOptionSettingsPage)page).performOk();
+ }
+ }
+
+ setDirty(false);
+ }
+
+ /* (non-Javadoc)
+ * Answers the list of settings pages for the selected configuration
+ * @return
+ */
+ private List getPagesForConfig() {
+ List pages = null;
+ if ( element instanceof IProject) {
+// Make sure that something was selected
+ if (parent.getSelectedConfiguration() == null) {
+ return null;
+ }
+ pages = (List) configToPageListMap.get(parent.getSelectedConfiguration().getId());
+ } else if (element instanceof IFile) {
+ if ( resParent.getCurrentResourceConfig() == null ) {
+ return null;
+ }
+ pages = (List) configToPageListMap.get(resParent.getCurrentResourceConfig().getId());
+ }
+
+ if (pages == null) {
+ pages = new ArrayList();
+ if ( element instanceof IProject) {
+ configToPageListMap.put(parent.getSelectedConfiguration().getId(), pages);
+ } else if ( element instanceof IFile) {
+ configToPageListMap.put(resParent.getCurrentResourceConfig().getId(), pages);
+ }
+ }
+ return pages;
+ }
+
+ public IPreferenceStore getPreferenceStore() {
+ return settingsStore;
+ }
+
+ /* (non-Javadoc)
+ * Safe accessor method
+ *
+ * @return Returns the Map of configurations to preference stores.
+ */
+ protected Map getSettingsStoreMap() {
+ if (settingsStoreMap == null) {
+ settingsStoreMap = new HashMap();
+ }
+ return settingsStoreMap;
+ }
+
+ /**
+ * Sets the "dirty" state
+ */
+ public void setDirty(boolean b) {
+ // Set each settings page
+ List pages = getPagesForConfig();
+ // Make sure we have something to work on
+ if (pages == null) {
+ // Nothing to do
+ return;
+ }
+ ListIterator iter = pages.listIterator();
+ while (iter.hasNext()) {
+ BuildSettingsPage page = (BuildSettingsPage) iter.next();
+ if (page == null) continue;
+ page.setDirty(b);
+ }
+ }
+
+ /**
+ * Returns the "dirty" state
+ */
+ public boolean isDirty() {
+ // Check each settings page
+ List pages = getPagesForConfig();
+ // Make sure we have something to work on
+ if (pages == null) {
+ // Nothing to do
+ return false;
+ }
+ ListIterator iter = pages.listIterator();
+ while (iter.hasNext()) {
+ BuildSettingsPage page = (BuildSettingsPage) iter.next();
+ if (page == null) continue;
+ if (page.isDirty()) return true;
+ }
+ return false;
+ }
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionComboFieldEditor.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionComboFieldEditor.java
index b40376a977d..68c594dec43 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionComboFieldEditor.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionComboFieldEditor.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * Copyright (c) 2002,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -10,9 +8,12 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.properties;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
@@ -70,6 +71,16 @@ public class BuildOptionComboFieldEditor extends FieldEditor {
selectorData.horizontalSpan = numColumns - 1;
selectorData.grabExcessHorizontalSpace = true;
optionSelector.setLayoutData(selectorData);
+ optionSelector.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ String oldValue = selected;
+ String name = optionSelector.getText();
+ int index = optionSelector.getSelectionIndex();
+ selected = index == -1 ? new String() : optionSelector.getItem(index);
+ setPresentsDefaultValue(false);
+ fireValueChanged(VALUE, oldValue, selected);
+ }
+ });
}
/* (non-Javadoc)
@@ -101,7 +112,7 @@ public class BuildOptionComboFieldEditor extends FieldEditor {
protected void doStore() {
// Save the selected item in the store
int index = optionSelector.getSelectionIndex();
- String selected = index == -1 ? new String() : optionSelector.getItem(index);
+ selected = index == -1 ? new String() : optionSelector.getItem(index);
getPreferenceStore().setValue(getPreferenceName(), selected);
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsPage.java
index 2603c2abb0b..3d5f40eb75f 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsPage.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsPage.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
/**********************************************************************
- * Copyright (c) 2003,2004 IBM Rational Software Corporation and others.
+ * Copyright (c) 2003,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -10,13 +8,19 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.properties;
-import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collection;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
@@ -24,15 +28,23 @@ import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.graphics.Point;
public class BuildOptionSettingsPage extends BuildSettingsPage {
- private ArrayList fieldsList = new ArrayList();
+ private Map fieldsMap = new HashMap();
private IOptionCategory category;
+ private boolean isItResourceConfigPage;
- BuildOptionSettingsPage(IConfiguration configuration, IOptionCategory category) {
+ public BuildOptionSettingsPage(IConfiguration configuration, IOptionCategory category) {
// Cache the configuration and option category this page is created for
super(configuration);
this.category = category;
+ isItResourceConfigPage = false;
}
+ public BuildOptionSettingsPage(IResourceConfiguration resConfig, IOptionCategory category) {
+ // Cache the configuration and option category this page is created for
+ super(resConfig);
+ this.category = category;
+ isItResourceConfigPage = true;
+ }
/* (non-Javadoc)
* @see org.eclipse.jface.preference.IPreferencePage#computeSize()
*/
@@ -48,60 +60,70 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
super.createFieldEditors();
// Iterate over the options in the category and create a field editor
// for each
- IOption[] options = category.getOptions(configuration);
+ Object[][] options;
+ if ( isItResourceConfigPage ) {
+ options = category.getOptions(resConfig);
+ } else {
+ options = category.getOptions(configuration);
+ }
+
for (int index = 0; index < options.length; ++index) {
// Get the option
- IOption opt = options[index];
- // Figure out which type the option is and add a proper field
- // editor for it
- switch (opt.getValueType()) {
- case IOption.STRING :
- StringFieldEditor stringField = new StringFieldEditor(opt
- .getId(), opt.getName(), getFieldEditorParent());
- addField(stringField);
- fieldsList.add(stringField);
- break;
- case IOption.BOOLEAN :
- BooleanFieldEditor booleanField = new BooleanFieldEditor(
- opt.getId(), opt.getName(), getFieldEditorParent());
- addField(booleanField);
- fieldsList.add(booleanField);
- break;
- case IOption.ENUMERATED :
- String selId;
- String sel;
- try {
- selId = opt.getSelectedEnum();
- sel = opt.getEnumName(selId);
- } catch (BuildException e) {
- // If we get this exception, then the option type is
- // wrong
+ ITool tool = (ITool)options[index][0];
+ if (tool == null) break; // The array may not be full
+ IOption opt = (IOption)options[index][1];
+ try {
+ // Figure out which type the option is and add a proper field
+ // editor for it
+ switch (opt.getValueType()) {
+ case IOption.STRING :
+ StringFieldEditor stringField = new StringFieldEditor(
+ opt.getId(), opt.getName(), getFieldEditorParent());
+ addField(stringField);
+ fieldsMap.put(opt.getId(), stringField);
+ break;
+ case IOption.BOOLEAN :
+ BooleanFieldEditor booleanField = new BooleanFieldEditor(
+ opt.getId(), opt.getName(), getFieldEditorParent());
+ addField(booleanField);
+ fieldsMap.put(opt.getId(),booleanField);
+ break;
+ case IOption.ENUMERATED :
+ String selId;
+ String sel;
+ try {
+ selId = opt.getSelectedEnum();
+ sel = opt.getEnumName(selId);
+ } catch (BuildException e) {
+ // If we get this exception, then the option type is
+ // wrong
+ break;
+ }
+ BuildOptionComboFieldEditor comboField = new BuildOptionComboFieldEditor(
+ opt.getId(), opt.getName(), opt
+ .getApplicableValues(), sel,
+ getFieldEditorParent());
+ addField(comboField);
+ fieldsMap.put(opt.getId(), comboField);
break;
- }
- BuildOptionComboFieldEditor comboField = new BuildOptionComboFieldEditor(
- opt.getId(), opt.getName(), opt
- .getApplicableValues(), sel,
- getFieldEditorParent());
- addField(comboField);
- fieldsList.add(comboField);
- break;
- case IOption.INCLUDE_PATH :
- case IOption.STRING_LIST :
- case IOption.PREPROCESSOR_SYMBOLS :
- case IOption.LIBRARIES :
- case IOption.OBJECTS :
- FileListControlFieldEditor listField =
- new FileListControlFieldEditor(
- opt.getId(),
- opt.getName(),
- getFieldEditorParent(),
- opt.getBrowseType());
- addField(listField);
- fieldsList.add(listField);
- break;
- default :
- break;
- }
+ case IOption.INCLUDE_PATH :
+ case IOption.STRING_LIST :
+ case IOption.PREPROCESSOR_SYMBOLS :
+ case IOption.LIBRARIES :
+ case IOption.OBJECTS :
+ FileListControlFieldEditor listField =
+ new FileListControlFieldEditor(
+ opt.getId(),
+ opt.getName(),
+ getFieldEditorParent(),
+ opt.getBrowseType());
+ addField(listField);
+ fieldsMap.put(opt.getId(), listField);
+ break;
+ default :
+ break;
+ }
+ } catch (BuildException e) {}
}
}
@@ -126,46 +148,92 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
// Write the field editor contents out to the preference store
boolean ok = super.performOk();
// Write the preference store values back to the build model
- IOption[] options = category.getOptions(configuration);
+
+ Object[][] options;
+ if (isItResourceConfigPage){
+ options = category.getOptions(resConfig);
+ } else {
+ options = category.getOptions(configuration);
+ }
+
for (int i = 0; i < options.length; i++) {
- IOption option = options[i];
-
- // Transfer value from preference store to options
- switch (option.getValueType()) {
- case IOption.BOOLEAN :
- boolean boolVal = getPreferenceStore().getBoolean(
- option.getId());
- ManagedBuildManager.setOption(configuration, option,
- boolVal);
- break;
- case IOption.ENUMERATED :
- String enumVal = getPreferenceStore().getString(
- option.getId());
- String enumId = option.getEnumeratedId(enumVal);
- ManagedBuildManager.setOption(configuration, option,
- (enumId.length() > 0) ? enumId : enumVal);
- break;
- case IOption.STRING :
- String strVal = getPreferenceStore().getString(
- option.getId());
- ManagedBuildManager
- .setOption(configuration, option, strVal);
- break;
- case IOption.STRING_LIST :
- case IOption.INCLUDE_PATH :
- case IOption.PREPROCESSOR_SYMBOLS :
- case IOption.LIBRARIES :
- case IOption.OBJECTS :
- String listStr = getPreferenceStore().getString(
- option.getId());
- String[] listVal = BuildToolsSettingsStore
- .parseString(listStr);
- ManagedBuildManager.setOption(configuration, option,
- listVal);
- break;
- default :
- break;
- }
+ ITool tool = (ITool)options[i][0];
+ if (tool == null) break; // The array may not be full
+ IOption option = (IOption)options[i][1];
+ try {
+ // Transfer value from preference store to options
+ IOption setOption;
+ switch (option.getValueType()) {
+ case IOption.BOOLEAN :
+ boolean boolVal = getToolSettingsPreferenceStore().getBoolean(option.getId());
+ if(isItResourceConfigPage) {
+ setOption = ManagedBuildManager.setOption(resConfig, tool, option, boolVal);
+ } else {
+ setOption = ManagedBuildManager.setOption(configuration, tool, option, boolVal);
+ }
+ // Reset the preference store since the Id may have changed
+ if (setOption != option) {
+ getToolSettingsPreferenceStore().setValue(setOption.getId(), boolVal);
+ FieldEditor fe = (FieldEditor)fieldsMap.get(option.getId());
+ fe.setPreferenceName(setOption.getId());
+ }
+ break;
+ case IOption.ENUMERATED :
+ String enumVal = getToolSettingsPreferenceStore().getString(option.getId());
+ String enumId = option.getEnumeratedId(enumVal);
+ if(isItResourceConfigPage) {
+ setOption = ManagedBuildManager.setOption(resConfig, tool, option,
+ (enumId != null && enumId.length() > 0) ? enumId : enumVal);
+ } else {
+ setOption = ManagedBuildManager.setOption(configuration, tool, option,
+ (enumId != null && enumId.length() > 0) ? enumId : enumVal);
+ }
+ // Reset the preference store since the Id may have changed
+ if (setOption != option) {
+ getToolSettingsPreferenceStore().setValue(setOption.getId(), enumVal);
+ FieldEditor fe = (FieldEditor)fieldsMap.get(option.getId());
+ fe.setPreferenceName(setOption.getId());
+ }
+ break;
+ case IOption.STRING :
+ String strVal = getToolSettingsPreferenceStore().getString(option.getId());
+ if(isItResourceConfigPage){
+ setOption = ManagedBuildManager.setOption(resConfig, tool, option, strVal);
+ } else {
+ setOption = ManagedBuildManager.setOption(configuration, tool, option, strVal);
+ }
+
+ // Reset the preference store since the Id may have changed
+ if (setOption != option) {
+ getToolSettingsPreferenceStore().setValue(setOption.getId(), strVal);
+ FieldEditor fe = (FieldEditor)fieldsMap.get(option.getId());
+ fe.setPreferenceName(setOption.getId());
+ }
+ break;
+ case IOption.STRING_LIST :
+ case IOption.INCLUDE_PATH :
+ case IOption.PREPROCESSOR_SYMBOLS :
+ case IOption.LIBRARIES :
+ case IOption.OBJECTS :
+ String listStr = getToolSettingsPreferenceStore().getString(option.getId());
+ String[] listVal = BuildToolsSettingsStore.parseString(listStr);
+ if( isItResourceConfigPage){
+ setOption = ManagedBuildManager.setOption(resConfig, tool, option, listVal);
+ }else {
+ setOption = ManagedBuildManager.setOption(configuration, tool, option, listVal);
+ }
+
+ // Reset the preference store since the Id may have changed
+ if (setOption != option) {
+ getToolSettingsPreferenceStore().setValue(setOption.getId(), listStr);
+ FieldEditor fe = (FieldEditor)fieldsMap.get(option.getId());
+ fe.setPreferenceName(setOption.getId());
+ }
+ break;
+ default :
+ break;
+ }
+ } catch (BuildException e) {}
}
return ok;
}
@@ -174,9 +242,13 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
* Update field editors in this page when the page is loaded.
*/
public void updateFields() {
- for (int i = 0; i < fieldsList.size(); i++) {
- FieldEditor editor = (FieldEditor) fieldsList.get(i);
- editor.loadDefault();
+ Collection fieldsList = fieldsMap.values();
+ Iterator iter = fieldsList.iterator();
+ while (iter.hasNext()) {
+ FieldEditor editor = (FieldEditor) iter.next();
+ // TODO: Why was loadDefault called before load? It results in String fields
+ // setting the "dirty" flag
+ //editor.loadDefault();
editor.load();
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java
index bcecbe7b6e7..9e4dfcff147 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java
@@ -1,5 +1,3 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
/**********************************************************************
* Copyright (c) 2002,2004 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -10,43 +8,36 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.properties;
-import java.util.ArrayList;
-import java.util.HashMap;
+import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Random;
import java.util.Set;
import java.util.SortedMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
+import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuildOptionBlock;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderHelpContextIds;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferencePageContainer;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
@@ -59,137 +50,104 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
import org.eclipse.ui.dialogs.PropertyPage;
import org.eclipse.ui.help.WorkbenchHelp;
-public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropertyPage, IPreferencePageContainer {
+public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropertyPage,
+ IPreferencePageContainer, ICOptionContainer {
/*
* String constants
*/
private static final String PREFIX = "BuildPropertyPage"; //$NON-NLS-1$
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
- private static final String NAME_LABEL = LABEL + ".NameText"; //$NON-NLS-1$
- private static final String BUILD_TOOLS_LABEL = LABEL + ".BuildToolTree"; //$NON-NLS-1$
private static final String PLATFORM_LABEL = LABEL + ".Platform"; //$NON-NLS-1$
private static final String CONFIG_LABEL = LABEL + ".Configuration"; //$NON-NLS-1$
private static final String ALL_CONFS = PREFIX + ".selection.configuration.all"; //$NON-NLS-1$
private static final String ACTIVE_LABEL = LABEL + ".Active"; //$NON-NLS-1$
private static final String SETTINGS_LABEL = LABEL + ".Settings"; //$NON-NLS-1$
- private static final String TREE_LABEL = LABEL + ".ToolTree"; //$NON-NLS-1$
- private static final String OPTIONS_LABEL = LABEL + ".ToolOptions"; //$NON-NLS-1$
private static final String ADD_CONF = LABEL + ".AddConfButton"; //$NON-NLS-1$
private static final String TIP = PREFIX + ".tip"; //$NON-NLS-1$
private static final String PLAT_TIP = TIP + ".platform"; //$NON-NLS-1$
private static final String CONF_TIP = TIP + ".config"; //$NON-NLS-1$
private static final String ADD_TIP = TIP + ".addconf"; //$NON-NLS-1$
private static final String MANAGE_TITLE = PREFIX + ".manage.title"; //$NON-NLS-1$
- private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 20, 30 };
private static final String ID_SEPARATOR = "."; //$NON-NLS-1$
+ private static final String MSG_CLOSEDPROJECT = "MngMakeProjectPropertyPage.closedproject"; //$NON-NLS-1$
/*
* Dialog widgets
*/
- private Combo targetSelector;
+ private Combo projectTypeSelector;
private Combo configSelector;
private Button manageConfigs;
- private TreeViewer optionList;
- private SashForm sashForm;
- private Group sashGroup;
- private Composite settingsPageContainer;
- private ScrolledComposite containerSC;
/*
* Bookeeping variables
*/
- private ITarget [] targets;
- private ITarget selectedTarget;
- private IConfiguration [] configurations;
+ private IProjectType[] projectTypes;
+ private IProjectType selectedProjectType;
+ private IConfiguration[] configurations;
private IConfiguration selectedConfiguration;
- private BuildSettingsPage currentSettingsPage;
- private Map configToPageListMap;
- private BuildToolsSettingsStore settingsStore;
- private Map settingsStoreMap;
- private IOptionCategory selectedCategory;
private Point lastShellSize;
- private ITool selectedTool;
-
- /**
- * The minimum page size; 200 by 200 by default.
- *
- * @see #setMinimumPageSize
- */
- private Point minimumPageSize = new Point(200, 200);
- private ToolListContentProvider provider;
-
- /**
- * Layout for the page container.
- *
- */
- private class PageLayout extends Layout {
- public void layout(Composite composite, boolean force) {
- Rectangle rect = composite.getClientArea();
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- children[i].setSize(rect.width, rect.height);
- }
- }
- public Point computeSize(Composite composite, int wHint, int hHint, boolean force) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) {
- return new Point(wHint, hHint);
- }
- int x = minimumPageSize.x;
- int y = minimumPageSize.y;
-
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- Point size = children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
- x = Math.max(x, size.x);
- y = Math.max(y, size.y);
- }
- if (wHint != SWT.DEFAULT) {
- x = wHint;
- }
- if (hHint != SWT.DEFAULT) {
- y = hHint;
- }
- return new Point(x, y);
- }
- }
+ protected ManagedBuildOptionBlock fOptionBlock;
+ protected boolean displayedConfig = false;
/**
* Default constructor
*/
public BuildPropertyPage() {
- configToPageListMap = new HashMap();
+ super();
}
+ public void setContainer(IPreferencePageContainer preferencePageContainer) {
+ super.setContainer(preferencePageContainer);
+ if (fOptionBlock == null) {
+ fOptionBlock = new ManagedBuildOptionBlock(this);
+ }
+ }
+
protected Control createContents(Composite parent) {
// Create the container we return to the property page editor
Composite composite = new Composite(parent, SWT.NULL);
composite.setFont(parent.getFont());
- composite.setLayout(new GridLayout(1, true));
+ GridLayout compositeLayout = new GridLayout();
+ compositeLayout.numColumns = 1;
+ compositeLayout.marginHeight = 0;
+ compositeLayout.marginWidth = 0;
+ composite.setLayout( compositeLayout );
+
+ IProject project = getProject();
+ if (!project.isOpen()) {
+ contentForClosedProject(composite);
+ } else {
+ contentForCProject(composite);
+ }
+
+ return composite;
+ }
+
+ private void contentForCProject(Composite parent) {
GridData gd;
// Initialize the key data
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
if (info.getVersion() == null) {
// Display a message page instead of the properties control
- final Label invalidInfo = new Label(composite, SWT.LEFT);
- invalidInfo.setFont(composite.getFont());
+ final Label invalidInfo = new Label(parent, SWT.LEFT);
+ invalidInfo.setFont(parent.getFont());
invalidInfo.setText(ManagedBuilderUIMessages.getResourceString("BuildPropertyPage.error.version_low")); //$NON-NLS-1$
invalidInfo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_CENTER, true, true));
- return composite;
+ return;
}
- targets = ManagedBuildManager.getTargets(getProject());
- ITarget defaultTarget = info.getDefaultTarget();
-
+ projectTypes = ManagedBuildManager.getDefinedProjectTypes();
+ IProjectType defaultProjectType = info.getManagedProject().getProjectType();
// Add a config selection area
- Group configGroup = ControlFactory.createGroup(composite, ManagedBuilderUIMessages.getResourceString(ACTIVE_LABEL), 1);
+ Group configGroup = ControlFactory.createGroup(parent, ManagedBuilderUIMessages.getResourceString(ACTIVE_LABEL), 1);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.grabExcessHorizontalSpace = true;
configGroup.setLayoutData(gd);
@@ -200,13 +158,15 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
configGroup.setLayout(form);
Label platformLabel = ControlFactory.createLabel(configGroup, ManagedBuilderUIMessages.getResourceString(PLATFORM_LABEL));
- targetSelector = ControlFactory.createSelectCombo(configGroup, getPlatformNames(), defaultTarget.getName());
- targetSelector.addListener(SWT.Selection, new Listener () {
+ projectTypeSelector = ControlFactory.createSelectCombo(configGroup, getPlatformNames(), defaultProjectType.getName());
+ // Note: Changing the project type is not currently handled, so this widget is disabled
+ projectTypeSelector.setEnabled(false);
+ projectTypeSelector.addListener(SWT.Selection, new Listener () {
public void handleEvent(Event e) {
- handleTargetSelection();
+ handleProjectTypeSelection();
}
});
- targetSelector.setToolTipText(ManagedBuilderUIMessages.getResourceString(PLAT_TIP));
+ projectTypeSelector.setToolTipText(ManagedBuilderUIMessages.getResourceString(PLAT_TIP));
Label configLabel = ControlFactory.createLabel(configGroup, ManagedBuilderUIMessages.getResourceString(CONFIG_LABEL));
configSelector = new Combo(configGroup, SWT.READ_ONLY|SWT.DROP_DOWN);
configSelector.addListener(SWT.Selection, new Listener () {
@@ -225,7 +185,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
// Now do the form layout for the widgets
FormData fd = new FormData();
// Anchor the labels in the centre of their respective combos
- fd.top = new FormAttachment(targetSelector, 0, SWT.CENTER);
+ fd.top = new FormAttachment(projectTypeSelector, 0, SWT.CENTER);
platformLabel.setLayoutData(fd);
fd = new FormData();
fd.top = new FormAttachment(configSelector, 0, SWT.CENTER);
@@ -234,7 +194,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
fd = new FormData();
fd.left = new FormAttachment(configSelector, 0, SWT.LEFT);
fd.right = new FormAttachment(100, 0);
- targetSelector.setLayoutData(fd);
+ projectTypeSelector.setLayoutData(fd);
// Anchor button right to combo and left to group
fd = new FormData();
fd.top = new FormAttachment(configSelector, 0, SWT.CENTER);
@@ -247,201 +207,105 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
fd.top = new FormAttachment(55,0);
fd.right = new FormAttachment(manageConfigs, -5 , SWT.LEFT);
configSelector.setLayoutData(fd);
-
- // Create the sash form
- sashGroup = ControlFactory.createGroup(composite, ManagedBuilderUIMessages.getResourceString(SETTINGS_LABEL), 1);
- sashGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
- sashForm = new SashForm(sashGroup, SWT.NONE);
- sashForm.setOrientation(SWT.HORIZONTAL);
- sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 5;
- layout.marginWidth = 5;
- sashForm.setLayout(layout);
- createSelectionArea(sashForm);
- createEditArea(sashForm);
- initializeSashForm();
+ // Create the Tools Settings, Build Settings, ... Tabbed pane
+ Group tabGroup = ControlFactory.createGroup(parent, ManagedBuilderUIMessages.getResourceString(SETTINGS_LABEL), 1);
+ gd = new GridData(GridData.FILL_BOTH);
+ tabGroup.setLayoutData(gd);
+ fOptionBlock.createContents(tabGroup, getElement());
// Do not call this until the widgets are constructed
- handleTargetSelection();
+ handleProjectTypeSelection();
- WorkbenchHelp.setHelp(composite, ManagedBuilderHelpContextIds.MAN_PROJ_BUILD_PROP);
- return composite;
+ WorkbenchHelp.setHelp(parent, ManagedBuilderHelpContextIds.MAN_PROJ_BUILD_PROP);
}
-
- /* (non-Javadoc)
- * Add the tabs relevant to the project to edit area tab folder.
- */
- protected void createEditArea(Composite parent) {
- containerSC = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
- containerSC.setExpandHorizontal(true);
- containerSC.setExpandVertical(true);
-
- // Add a container for the build settings page
- settingsPageContainer = new Composite(containerSC, SWT.NULL);
- settingsPageContainer.setLayout(new PageLayout());
- containerSC.setContent(settingsPageContainer);
- containerSC.setMinSize(settingsPageContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- settingsPageContainer.layout();
- }
-
- protected void createSelectionArea (Composite parent) {
- // Create a label and list viewer
- Composite composite = ControlFactory.createComposite(parent, 1);
- optionList = new TreeViewer(composite, SWT.SINGLE|SWT.H_SCROLL|SWT.V_SCROLL|SWT.BORDER);
- optionList.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleOptionSelection();
- }
- });
- optionList.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
- optionList.setLabelProvider(new ToolListLabelProvider());
+ private void contentForClosedProject(Composite parent) {
+ Label label = new Label(parent, SWT.LEFT);
+ label.setText(ManagedBuilderUIMessages.getResourceString(MSG_CLOSEDPROJECT));
+ label.setFont(parent.getFont());
+
+ noDefaultAndApplyButton();
}
- /* (non-Javadoc)
- * Method displayOptionsForTool.
- * @param toolReference
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
*/
- private void displayOptionsForCategory(IOptionCategory category) {
- // Do nothing if the selected category is is unchanged
- if (category == selectedCategory) {
- return;
- }
- selectedTool = null;
- selectedCategory = category;
-
- // Cache the current build setting page
- BuildSettingsPage oldPage = currentSettingsPage;
- currentSettingsPage = null;
-
- // Create a new settings page if necessary
- List pages = getPagesForConfig();
- ListIterator iter = pages.listIterator();
- while (iter.hasNext()) {
- BuildSettingsPage page = (BuildSettingsPage) iter.next();
- if (page instanceof BuildOptionSettingsPage &&
- ((BuildOptionSettingsPage)page).isForCategory(category)) {
- currentSettingsPage = page;
- break;
- }
- }
- if (currentSettingsPage == null) {
- currentSettingsPage = new BuildOptionSettingsPage(selectedConfiguration, category);
- pages.add(currentSettingsPage);
- currentSettingsPage.setContainer(this);
- if (currentSettingsPage.getControl() == null) {
- currentSettingsPage.createControl(settingsPageContainer);
- }
- }
-
- // Make all the other pages invisible
- Control[] children = settingsPageContainer.getChildren();
- Control currentControl = currentSettingsPage.getControl();
- for (int i = 0; i < children.length; i++) {
- if (children[i] != currentControl)
- children[i].setVisible(false);
- }
- currentSettingsPage.setVisible(true);
-
- // save the last page build options.
- // If the last page is tool page then parse all the options
- // and put it in the appropriate preference store.
- if (oldPage != null){
- if(oldPage instanceof BuildOptionSettingsPage) {
- ((BuildOptionSettingsPage)oldPage).storeSettings();
- }
- else if(oldPage instanceof BuildToolSettingsPage) {
- ((BuildToolSettingsPage)oldPage).storeSettings();
- ((BuildToolSettingsPage)oldPage).parseAllOptions();
+ public boolean performOk() {
+
+ // If the user did not visit this page, then there is nothing to do.
+ if (!displayedConfig) return true;
+
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ fOptionBlock.performApply(monitor);
}
+ };
+ IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(runnable);
+ try {
+ new ProgressMonitorDialog(getShell()).run(false, true, op);
+ } catch (InvocationTargetException e) {
+ Throwable e1 = e.getTargetException();
+ ManagedBuilderUIPlugin.errorDialog(getShell(), ManagedBuilderUIMessages.getResourceString("ManagedProjectPropertyPage.internalError"),e1.toString(), e1); //$NON-NLS-1$
+ return false;
+ } catch (InterruptedException e) {
+ // cancelled
+ return false;
}
- //update the field editors in the current page
- if(currentSettingsPage instanceof BuildOptionSettingsPage)
- ((BuildOptionSettingsPage)currentSettingsPage).updateFields();
-
- if (oldPage != null)
- oldPage.setVisible(false);
- // Set the size of the scrolled area
- containerSC.setMinSize(currentSettingsPage.computeSize());
- settingsPageContainer.layout();
+ // Write out the build model info
+ ManagedBuildManager.setDefaultConfiguration(getProject(), getSelectedConfiguration());
+ ManagedBuildManager.saveBuildInfo(getProject(), false);
+ return true;
}
- /* (non-Javadoc)
- * @param tool
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/
- private void displayOptionsForTool(ITool tool) {
- if (tool == selectedTool) {
- return;
- }
- // Unselect the category
- selectedCategory = null;
- // record that the tool selection has changed
- selectedTool = tool;
-
- // Cache the current build setting page
- BuildSettingsPage oldPage = currentSettingsPage;
- currentSettingsPage = null;
-
- // Create a new page if we need one
- List pages = getPagesForConfig();
- ListIterator iter = pages.listIterator();
- while (iter.hasNext()) {
- BuildSettingsPage page = (BuildSettingsPage) iter.next();
- if (page instanceof BuildToolSettingsPage &&
- ((BuildToolSettingsPage)page).isForTool(tool)) {
- currentSettingsPage = page;
- break;
- }
- }
- if (currentSettingsPage == null) {
- currentSettingsPage = new BuildToolSettingsPage(selectedConfiguration, tool);
- pages.add(currentSettingsPage);
- currentSettingsPage.setContainer(this);
- if (currentSettingsPage.getControl() == null) {
- currentSettingsPage.createControl(settingsPageContainer);
- }
- }
- // Make all the other pages invisible
- Control[] children = settingsPageContainer.getChildren();
- Control currentControl = currentSettingsPage.getControl();
- for (int i = 0; i < children.length; i++) {
- if (children[i] != currentControl)
- children[i].setVisible(false);
- }
-
- // Make the current page visible
- currentSettingsPage.setVisible(true);
-
- // save the last page build options.
- // If the last page is tool page then parse all the options
- // and put it in the appropriate preference store.
- if (oldPage != null){
- if(oldPage instanceof BuildOptionSettingsPage) {
- ((BuildOptionSettingsPage)oldPage).storeSettings();
- }
- else if(oldPage instanceof BuildToolSettingsPage) {
- ((BuildToolSettingsPage)oldPage).storeSettings();
- ((BuildToolSettingsPage)oldPage).parseAllOptions();
- }
+ protected void performDefaults() {
+ fOptionBlock.performDefaults();
+ super.performDefaults();
+ }
+
+ private String [] getPlatformNames() {
+ String [] names = new String[projectTypes.length];
+ for (int index = 0; index < projectTypes.length; ++index) {
+ names[index] = projectTypes[index].getName();
}
- //update the field editor that displays all the build options
- if(currentSettingsPage instanceof BuildToolSettingsPage)
- ((BuildToolSettingsPage)currentSettingsPage).updateAllOptionField();
+ return names;
+ }
- if (oldPage != null)
- oldPage.setVisible(false);
+ /* (non-Javadoc)
+ * @return
+ */
+ public IProjectType getSelectedProjectType() {
+ return selectedProjectType;
+ }
- // Set the size of the scrolled area
- containerSC.setMinSize(currentSettingsPage.computeSize());
- settingsPageContainer.layout();
+ private void populateConfigurations() {
+ // If the config select widget is not there yet, just stop
+ if (configSelector == null) return;
+
+ // Find the configurations defined for the platform
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
+ configurations = info.getManagedProject().getConfigurations();
+ if (configurations.length == 0) return;
+
+ // Clear and replace the contents of the selector widget
+ configSelector.removeAll();
+ configSelector.setItems(getConfigurationNames());
+
+ // Make sure the active configuration is selected
+ IConfiguration defaultConfig = info.getDefaultConfiguration();
+ int index = configSelector.indexOf(defaultConfig.getName());
+ configSelector.select(index == -1 ? 0 : index);
+ handleConfigSelection();
}
/* (non-Javadoc)
- * @return an array of names for the configurations defined for the chosen target
+ * @return an array of names for the configurations defined for the chosen
*/
private String [] getConfigurationNames () {
String [] names = new String[configurations.length /*+ 1*/];
@@ -451,6 +315,17 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
// names[names.length - 1] = ManagedBuilderUIPlugin.getResourceString(ALL_CONFS);
return names;
}
+
+ public void enableConfigSelection (boolean enable) {
+ configSelector.setEnabled(enable);
+ }
+
+ /* (non-Javadoc)
+ * @return
+ */
+ public IConfiguration getSelectedConfiguration() {
+ return selectedConfiguration;
+ }
/* (non-Javadoc)
* @return
@@ -465,71 +340,76 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
}
/* (non-Javadoc)
- * Answers the list of settings pages for the selected configuration
- * @return
+ * @see org.eclipse.jface.preference.IPreferencePageContainer#getPreferenceStore()
*/
- private List getPagesForConfig() {
- // Make sure that something was selected
- if (selectedConfiguration == null) {
- return null;
- }
- List pages = (List) configToPageListMap.get(selectedConfiguration.getId());
- if (pages == null) {
- pages = new ArrayList();
- configToPageListMap.put(selectedConfiguration.getId(), pages);
- }
- return pages;
+ public IPreferenceStore getPreferenceStore()
+ {
+ return fOptionBlock.getPreferenceStore();
}
-
- private String [] getPlatformNames() {
- String [] names = new String[targets.length];
- for (int index = 0; index < targets.length; ++index) {
- names[index] = targets[index].getName();
- }
- return names;
+
+ /* (non-Javadoc)
+ * Return the IPreferenceStore of the Tool Settings block
+ */
+ public IPreferenceStore getToolSettingsPreferenceStore()
+ {
+ return fOptionBlock.getToolSettingsPreferenceStore();
}
/* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferencePageContainer#getPreferenceStore()
+ * @see org.eclipse.cdt.ui.dialog.ICOptionContainer.getPreferences()
*/
- public IPreferenceStore getPreferenceStore()
+ public Preferences getPreferences()
{
- return settingsStore;
+ return null;
}
- private IProject getProject() {
+ public IProject getProject() {
Object element= getElement();
if (element != null && element instanceof IProject) {
return (IProject)element;
}
return null;
}
-
- /* (non-Javadoc)
- * @return
- */
- public ITarget getSelectedTarget() {
- return selectedTarget;
+
+ public void updateContainer() {
+ fOptionBlock.update();
+ setValid(fOptionBlock.isValid());
+ setErrorMessage(fOptionBlock.getErrorMessage());
}
- /* (non-Javadoc)
- * @return
- */
- protected IConfiguration getSelectedConfiguration() {
- return selectedConfiguration;
+ public boolean isValid() {
+ updateContainer();
+ return super.isValid();
}
- /* (non-Javadoc)
- * Safe accessor method
- *
- * @return Returns the Map of configurations to preference stores.
+ /**
+ * @see DialogPage#setVisible(boolean)
*/
- protected Map getSettingsStoreMap() {
- if (settingsStoreMap == null) {
- settingsStoreMap = new HashMap();
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ fOptionBlock.setVisible(visible);
+ if (visible) {
+ fOptionBlock.updateValues();
+ displayedConfig = true;
}
- return settingsStoreMap;
}
+
+ /**
+ * @see org.eclipse.jface.preference.IPreferencePageContainer#updateButtons()
+ */
+ public void updateButtons() {
+ }
+ /**
+ * @see org.eclipse.jface.preference.IPreferencePageContainer#updateMessage()
+ */
+ public void updateMessage() {
+ }
+ /**
+ * @see org.eclipse.jface.preference.IPreferencePageContainer#updateTitle()
+ */
+ public void updateTitle() {
+ }
+
/*
* Event Handlers
*/
@@ -537,7 +417,7 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
// If there is nothing in config selection widget just bail
if (configSelector.getItemCount() == 0) return;
- // Check if the user has selected the "all" configuration
+ // TODO: Check if the user has selected the "all" configuration
int selectionIndex = configSelector.getSelectionIndex();
if (selectionIndex == -1) return;
String configName = configSelector.getItem(selectionIndex);
@@ -546,95 +426,58 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
return;
} else {
// Cache the selected config
- selectedConfiguration = configurations[selectionIndex];
- }
-
- if (provider == null) {
- provider = new ToolListContentProvider();
- optionList.setContentProvider(provider);
- }
- optionList.setInput(selectedConfiguration);
- optionList.expandAll();
-
- // Create (or retrieve) the settings store for the configuration
- BuildToolsSettingsStore store = (BuildToolsSettingsStore) getSettingsStoreMap().get(selectedConfiguration.getId());
- if (store == null) {
- store = new BuildToolsSettingsStore(selectedConfiguration);
- getSettingsStoreMap().put(selectedConfiguration.getId(), store);
- }
- settingsStore = store;
-
- // Select the first tool in the list
- Object[] elements = provider.getElements(selectedConfiguration);
- Object primary = elements.length > 0 ? elements[0] : null;
-
-/* if (primary != null && primary instanceof ITool) {
- // set the tool as primary selection in the tree hence it displays all the build options.
- ITool tool = (ITool)primary;
- IOptionCategory top = tool.getTopOptionCategory();
- IOption[] topOpts = top.getOptions(selectedConfiguration);
- if (topOpts != null && topOpts.length == 0) {
- // Get the children categories and start looking
- IOptionCategory[] children = top.getChildCategories();
- for (int i = 0; i < children.length; i++) {
- IOptionCategory category = children[i];
- IOption[] catOpts = category.getOptions(selectedConfiguration);
- if (catOpts != null && catOpts.length > 0) {
- primary = category;
- break;
- }
- }
+ IConfiguration newConfig = configurations[selectionIndex];
+ if (newConfig != selectedConfiguration) {
+ // If the user has changed values, and is now switching configurations, prompt for saving
+ if (selectedConfiguration != null) {
+ if (fOptionBlock.isDirty()) {
+ Shell shell = ManagedBuilderUIPlugin.getDefault().getShell();
+ boolean shouldApply = MessageDialog.openQuestion(shell,
+ ManagedBuilderUIMessages.getResourceString("BuildPropertyPage.changes.save.title"), //$NON-NLS-1$
+ ManagedBuilderUIMessages.getFormattedString("BuildPropertyPage.changes.save.question", //$NON-NLS-1$
+ new String[] {selectedConfiguration.getName(), newConfig.getName()}));
+ if (shouldApply) {
+ if (performOk()) {
+ fOptionBlock.setDirty(false);
+ } else {
+ MessageDialog.openWarning(shell,
+ ManagedBuilderUIMessages.getResourceString("BuildPropertyPage.changes.save.title"), //$NON-NLS-1$
+ ManagedBuilderUIMessages.getResourceString("BuildPropertyPage.changes.save.error")); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ // Set the new selected configuration
+ selectedConfiguration = newConfig;
+ ManagedBuildManager.setSelectedConfiguration(getProject(), selectedConfiguration);
+ // TODO: Set the appropriate error parsers...
+ // TODO: Binary parsers too?
+ fOptionBlock.updateValues();
}
}
-*/
- if (primary != null) {
- optionList.setSelection(new StructuredSelection(primary));
- }
}
// Event handler for the manage configuration button event
private void handleManageConfig () {
- ManageConfigDialog manageDialog = new ManageConfigDialog(getShell(), ManagedBuilderUIMessages.getResourceString(MANAGE_TITLE), selectedTarget);
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
+ ManageConfigDialog manageDialog = new ManageConfigDialog(getShell(), ManagedBuilderUIMessages.getResourceString(MANAGE_TITLE), info.getManagedProject());
if (manageDialog.open() == ManageConfigDialog.OK) {
boolean updateConfigs = false;
- // Get the build output name
- String newBuildOutput = manageDialog.getBuildArtifactName();
- if (!selectedTarget.getArtifactName().equals(newBuildOutput)) {
- selectedTarget.setArtifactName(newBuildOutput);
- }
- String newBuildExt = manageDialog.getBuildArtifaceExtension();
- if (!selectedTarget.getArtifactExtension().equals(newBuildExt)) {
- selectedTarget.setArtifactExtension(newBuildExt);
- }
-
- // Get the new make command
- if (manageDialog.useDefaultMakeCommand()) {
- // This is a cheap assignment to null so do it to be doubly sure
- selectedTarget.resetMakeCommand();
- } else {
- // Parse for command and arguments
- String rawCommand = manageDialog.getMakeCommand();
- String makeCommand = parseMakeCommand(rawCommand);
- selectedTarget.setMakeCommand(makeCommand);
- String makeArguments = parseMakeArgs(rawCommand);
- selectedTarget.setMakeArguments(makeArguments);
- }
-
// Check to see if any configurations have to be deleted
List deletedConfigs = manageDialog.getDeletedConfigIds();
Iterator iter = deletedConfigs.listIterator();
while (iter.hasNext()) {
String id = (String)iter.next();
- // Remove the configurations from the target
- selectedTarget.removeConfiguration(id);
+ // Remove the configurations from the project
+ info.getManagedProject().removeConfiguration(id);
// Remove any settings stores
- getSettingsStoreMap().remove(id);
+ fOptionBlock.removeValues(id);
// Clean up the UI
- configurations = selectedTarget.getConfigurations();
+ configurations = info.getManagedProject().getConfigurations();
configSelector.removeAll();
configSelector.setItems(getConfigurationNames());
configSelector.select(0);
@@ -645,16 +488,11 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
SortedMap newConfigs = manageDialog.getNewConfigs();
Set keys = newConfigs.keySet();
Iterator keyIter = keys.iterator();
- Random r = new Random();
- r.setSeed(System.currentTimeMillis());
while (keyIter.hasNext()) {
String name = (String) keyIter.next();
IConfiguration parent = (IConfiguration) newConfigs.get(name);
if (parent != null) {
- int id = r.nextInt();
- if (id < 0) {
- id *= -1;
- }
+ int id = ManagedBuildManager.getRandomNumber();
// Create ID for the new component based on the parent ID and random component
String newId = parent.getId();
@@ -667,10 +505,16 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
}
}
newId += ID_SEPARATOR + id;
- IConfiguration newConfig = selectedTarget.createConfiguration(parent, newId);
+ IConfiguration newConfig;
+ if (parent.isExtensionElement()) {
+ newConfig = info.getManagedProject().createConfiguration(parent, newId);
+ } else {
+ newConfig = info.getManagedProject().createConfigurationClone(parent, newId);
+ }
newConfig.setName(name);
+ newConfig.setArtifactName(info.getManagedProject().getDefaultArtifactName());
// Update the config lists
- configurations = selectedTarget.getConfigurations();
+ configurations = info.getManagedProject().getConfigurations();
configSelector.removeAll();
configSelector.setItems(getConfigurationNames());
configSelector.select(configSelector.indexOf(name));
@@ -684,22 +528,9 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
return;
}
- private void handleOptionSelection() {
- // Get the selection from the tree list
- IStructuredSelection selection = (IStructuredSelection) optionList.getSelection();
-
- // Set the option page based on the selection
- Object element = selection.getFirstElement();
- if (element instanceof ITool) {
- displayOptionsForTool((ITool)element);
- } else if (element instanceof IOptionCategory) {
- displayOptionsForCategory((IOptionCategory)element);
- }
- }
-
- private void handleTargetSelection() {
+ private void handleProjectTypeSelection() {
// Is there anything in the selector widget
- if (targetSelector.getItemCount() == 0) {
+ if (projectTypeSelector.getItemCount() == 0) {
manageConfigs.setEnabled(false);
return;
}
@@ -708,233 +539,10 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert
manageConfigs.setEnabled(true);
// Cache the platform at the selection index
- selectedTarget = targets[targetSelector.getSelectionIndex()];
- ManagedBuildManager.setSelectedTarget(getProject(), selectedTarget);
+ selectedProjectType = projectTypes[projectTypeSelector.getSelectionIndex()];
+ ManagedBuildManager.setSelectedConfiguration(getProject(), selectedConfiguration);
// Update the contents of the configuration widget
populateConfigurations();
}
-
- /*
- * (non-javadoc)
- * Initialize the relative weights (widths) of the 2 sides of the sash.
- */
- protected void initializeSashForm() {
- sashForm.setWeights(DEFAULT_SASH_WEIGHTS);
- }
-
- /* (non-Javadoc)
- * @param rawCommand
- * @return
- */
- private String parseMakeArgs(String rawCommand) {
- StringBuffer result = new StringBuffer();
-
- // Parse out the command
- String actualCommand = parseMakeCommand(rawCommand);
-
- // The flags and targets are anything not in the command
- String arguments = rawCommand.substring(actualCommand.length());
-
- // If there aren't any, we can stop
- if (arguments.length() == 0) {
- return result.toString().trim();
- }
-
- String[] tokens = arguments.trim().split("\\s"); //$NON-NLS-1$
- /*
- * Cases to consider
- * --<flag> Sensible, modern single flag. Add to result and continue.
- * -<flags> Flags in single token, add to result and stop
- * -<flag_with_arg> ARG Flag with argument. Add next token if valid arg.
- * -<mixed_flags> ARG Mix of flags, one takes arg. Add next token if valid arg.
- * -<flag_with_arg>ARG Corrupt case where next token should be arg but isn't
- * -<flags> [target].. Flags with no args, another token, add flags and stop.
- */
- Pattern flagPattern = Pattern.compile("C|f|I|j|l|O|W"); //$NON-NLS-1$
- // Look for a '-' followed by 1 or more flags with no args and exactly 1 that expects args
- Pattern mixedFlagWithArg = Pattern.compile("-[^CfIjloW]*[CfIjloW]{1}.+"); //$NON-NLS-1$
- for (int i = 0; i < tokens.length; ++i) {
- String currentToken = tokens[i];
- if (currentToken.startsWith("--")) { //$NON-NLS-1$
- result.append(currentToken);
- result.append(" "); //$NON-NLS-1$
- } else if (currentToken.startsWith("-")) { //$NON-NLS-1$
- // Is there another token
- if (i + 1 >= tokens.length) {
- //We are done
- result.append(currentToken);
- } else {
- String nextToken = tokens[i + 1];
- // Are we expecting arguments
- Matcher flagMatcher = flagPattern.matcher(currentToken);
- if (!flagMatcher.find()) {
- // Evalutate whether the next token should be added normally
- result.append(currentToken);
- result.append(" "); //$NON-NLS-1$
- } else {
- // Look for the case where there is no space between flag and arg
- if (mixedFlagWithArg.matcher(currentToken).matches()) {
- // Add this single token and keep going
- result.append(currentToken);
- result.append(" "); //$NON-NLS-1$
- } else {
- // Add this token and the next one right now
- result.append(currentToken);
- result.append(" "); //$NON-NLS-1$
- result.append(nextToken);
- result.append(" "); //$NON-NLS-1$
- // Skip the next token the next time through, though
- ++i;
- }
- }
- }
- }
- }
-
- return result.toString().trim();
- }
-
- /* (non-Javadoc)
- *
- * @param string
- * @return
- */
- private String parseMakeCommand(String rawCommand) {
- StringBuffer command = new StringBuffer();
- boolean hasSpace = false;
-
- // Try to separate out the command from the arguments
- String[] result = rawCommand.split("\\s"); //$NON-NLS-1$
-
- /*
- * Here are the cases to consider:
- * cmd First segment is last segment, assume is command
- * cmd [flags] First segment is the command
- * path/cmd [flags] Same as above
- * path with space/make [flags] Must append each segment up-to flags as command
- */
- for (int i = 0; i < result.length; ++i) {
- // Get the segment
- String cmdSegment = result[i];
- // If there is not another segment, we found the end
- if (i + 1 >= result.length) {
- command.append(cmdSegment);
- } else {
- // See if the next segment is the start of the flags
- String nextSegment = result[i + 1];
- if (nextSegment.startsWith("-")) { //$NON-NLS-1$
- // we have found the end of the command
- command.append(cmdSegment);
- break;
- } else {
- command.append(cmdSegment);
- // Add the whitespace back
- command.append(" "); //$NON-NLS-1$
- hasSpace = true;
- }
- }
- }
-
-// if (hasSpace == true) {
-// return "\"" + command.toString().trim() + "\"";
-// } else {
- return command.toString().trim();
-// }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- // Empty the page list
- List pages = getPagesForConfig();
- pages.clear();
-
- // Get the build manager to reset build info for project
- ManagedBuildManager.resetConfiguration(getProject(), getSelectedConfiguration());
-
- // Recreate the settings store for the configuration
- settingsStore = new BuildToolsSettingsStore(getSelectedConfiguration());
-
- // Write out the build model info
- ManagedBuildManager.setDefaultConfiguration(getProject(), getSelectedConfiguration());
- ManagedBuildManager.saveBuildInfo(getProject(), false);
-
- // Reset the category or tool selection and run selection event handler
- selectedCategory = null;
- selectedTool = null;
- handleOptionSelection();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- // Force each settings page to update
- List pages = getPagesForConfig();
- // Make sure we have something to work on
- if (pages == null) {
- // Nothing to do
- return true;
- }
- ListIterator iter = pages.listIterator();
- while (iter.hasNext()) {
- BuildSettingsPage page = (BuildSettingsPage) iter.next();
- if (page == null) continue;
- if (page instanceof BuildToolSettingsPage) {
- // if the currentsettings page is not the tool settings page
- // then update the all build options field editor based on the
- // build options in other options settings page.
- if (!(currentSettingsPage instanceof BuildToolSettingsPage))
- ((BuildToolSettingsPage)page).updateAllOptionField();
- ((BuildToolSettingsPage)page).performOk();
- } else if (page instanceof BuildOptionSettingsPage) {
- ((BuildOptionSettingsPage)page).performOk();
- }
- }
-
- // Write out the build model info
- ManagedBuildManager.setDefaultConfiguration(getProject(), getSelectedConfiguration());
- ManagedBuildManager.saveBuildInfo(getProject(), false);
- return true;
- }
-
- private void populateConfigurations() {
- // If the config select widget is not there yet, just stop
- if (configSelector == null) return;
-
- // Find the configurations defined for the platform
- configurations = selectedTarget.getConfigurations();
- if (configurations.length == 0) return;
-
- // Clear and replace the contents of the selector widget
- configSelector.removeAll();
- configSelector.setItems(getConfigurationNames());
-
- // Make sure the active configuration is selected
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
- IConfiguration defaultConfig = info.getDefaultConfiguration(selectedTarget);
- int index = configSelector.indexOf(defaultConfig.getName());
- configSelector.select(index == -1 ? 0 : index);
- handleConfigSelection();
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferencePageContainer#updateButtons()
- */
- public void updateButtons() {
- }
- /**
- * @see org.eclipse.jface.preference.IPreferencePageContainer#updateMessage()
- */
- public void updateMessage() {
- }
- /**
- * @see org.eclipse.jface.preference.IPreferencePageContainer#updateTitle()
- */
- public void updateTitle() {
- }
} \ No newline at end of file
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildSettingsPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildSettingsPage.java
index 2d9c5181631..c9aa6233f0a 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildSettingsPage.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildSettingsPage.java
@@ -1,5 +1,3 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
/**********************************************************************
* Copyright (c) 2004 IBM Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -10,13 +8,20 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.properties;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
+import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferencePageContainer;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.PropertyChangeEvent;
-public class BuildSettingsPage extends FieldEditorPreferencePage {
+public abstract class BuildSettingsPage extends FieldEditorPreferencePage {
protected IConfiguration configuration;
+ protected IResourceConfiguration resConfig;
+ private boolean dirty = false;
/**
* @param style
@@ -28,13 +33,56 @@ public class BuildSettingsPage extends FieldEditorPreferencePage {
configuration = config;
}
+ protected BuildSettingsPage(IResourceConfiguration resConfig) {
+ // Must be a grid layout and we don't want another set of buttons
+ super(GRID);
+ noDefaultAndApplyButton();
+ this.resConfig = resConfig;
+ }
/* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
*/
protected void createFieldEditors() {
// Get the preference store for the build settings
- IPreferenceStore settings = getPreferenceStore();
+ IPreferenceStore settings = getToolSettingsPreferenceStore();
setPreferenceStore(settings);
}
+ /**
+ * Return the tool settings preference store
+ */
+ protected IPreferenceStore getToolSettingsPreferenceStore() {
+ IPreferencePageContainer container = getContainer();
+ if (container instanceof BuildPropertyPage) {
+ return ((BuildPropertyPage)container).getToolSettingsPreferenceStore();
+ } else if ( container instanceof ResourceBuildPropertyPage) {
+ return ((ResourceBuildPropertyPage)container).getToolSettingsPreferenceStore();
+ }
+ return null;
+ }
+
+ /**
+ * Method called when the value of a dialog field changes
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ super.propertyChange(event);
+ if (event.getProperty().equals(FieldEditor.VALUE)) {
+ setDirty(true);
+ }
+ }
+
+ /**
+ * Sets the "dirty" state
+ */
+ public void setDirty(boolean b) {
+ dirty = b;
+ }
+
+ /**
+ * Returns the "dirty" state
+ */
+ public boolean isDirty() {
+ return dirty;
+ }
+
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java
index bc1cd780e04..091f0c8b25c 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolSettingsPage.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
/**********************************************************************
- * Copyright (c) 2004 IBM Rational Software Corporation and others.
+ * Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -10,6 +8,8 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.properties;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -20,10 +20,13 @@ import java.util.Vector;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
import org.eclipse.cdt.managedbuilder.core.IOption;
+import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.internal.core.ToolReference;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.graphics.Point;
@@ -49,16 +52,27 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
private ITool tool;
// Map that holds all user object options and its values
private HashMap userObjsMap;
+
+ private boolean isItResourceConfigPage;
- BuildToolSettingsPage(IConfiguration configuration, ITool tool) {
+ public BuildToolSettingsPage(IConfiguration configuration, ITool tool) {
// Cache the configuration and tool this page is for
super(configuration);
this.tool = tool;
allOptionsId = tool.getId() + ".allOptions"; //$NON-NLS-1$
stringOptionsMap = new HashMap();
userObjsMap = new HashMap();
+ isItResourceConfigPage = false;
+ }
+ public BuildToolSettingsPage(IResourceConfiguration resConfig, ITool tool) {
+ // Cache the configuration and tool this page is for
+ super(resConfig);
+ this.tool = tool;
+ allOptionsId = tool.getId() + ".allOptions"; //$NON-NLS-1$
+ stringOptionsMap = new HashMap();
+ userObjsMap = new HashMap();
+ isItResourceConfigPage = true;
}
-
/* (non-Javadoc)
* @see org.eclipse.jface.preference.IPreferencePage#computeSize()
*/
@@ -83,7 +97,8 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
// Add a field editor that displays over all build options
allOptionFieldEditor = new MultiLineTextFieldEditor(allOptionsId,
ALL_OPTIONS, getFieldEditorParent());
- getPreferenceStore().setValue(allOptionsId, ""); //$NON-NLS-1$
+ allOptionFieldEditor.getTextControl().setEditable(false);
+ getToolSettingsPreferenceStore().setValue(allOptionsId, ""); //$NON-NLS-1$
addField(allOptionFieldEditor);
}
@@ -157,6 +172,15 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
return output;
}
+
+ /**
+ * Look for $(VALUE) in the command string
+ */
+ private String evaluateCommand( String command, String values ) {
+ if( command == null ) return values.trim();
+ if( command.indexOf( "$(" ) > 0 ) return command.replaceAll( "\\$\\([value|Value|VALUE]\\)", values.trim() ).trim(); //$NON-NLS-1$ //$NON-NLS-2$
+ else return (new String(command + values)).trim();
+ }
/**
* Returns all the build options string
@@ -165,54 +189,45 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
* @throws BuildException
*/
private String getToolFlags() throws BuildException {
- ITool[] tools = configuration.getTools();
- for (int i = 0; i < tools.length; ++i) {
- if (tools[i] instanceof ToolReference) {
- if (((ToolReference) tools[i]).references(tool)) {
- tool = tools[i];
- break;
- }
- } else if (tools[i].equals(tool))
- break;
- }
StringBuffer buf = new StringBuffer();
+ ArrayList flags = new ArrayList();
// get the options for this tool
IOption[] options = tool.getOptions();
String listStr = ""; //$NON-NLS-1$
String[] listVal = null;
for (int k = 0; k < options.length; k++) {
IOption option = options[k];
+ buf.setLength( 0 );
switch (option.getValueType()) {
case IOption.BOOLEAN :
String boolCmd;
- if (getPreferenceStore().getBoolean(option.getId())) {
+ if (getToolSettingsPreferenceStore().getBoolean(option.getId())) {
boolCmd = option.getCommand();
} else {
// Note: getCommandFalse is new with CDT 2.0
boolCmd = option.getCommandFalse();
}
if (boolCmd != null && boolCmd.length() > 0) {
- buf.append(boolCmd + ITool.WHITE_SPACE);
+ buf.append(boolCmd);
}
break;
case IOption.ENUMERATED :
- String enumCommand = getPreferenceStore().getString(
+ String enumCommand = getToolSettingsPreferenceStore().getString(
option.getId());
if (enumCommand.indexOf(DEFAULT_SEPERATOR) != -1)
enumCommand = option.getSelectedEnum();
String enum = option.getEnumCommand(enumCommand);
if (enum.length() > 0) {
- buf.append(enum + ITool.WHITE_SPACE);
+ buf.append(enum);
}
break;
case IOption.STRING :
String strCmd = option.getCommand();
- String val = getPreferenceStore().getString(option.getId());
+ String val = getToolSettingsPreferenceStore().getString(option.getId());
// add this string option value to the list
stringOptionsMap.put(option, val);
if (val.length() > 0) {
- if (strCmd != null) buf.append(strCmd);
- buf.append(val + ITool.WHITE_SPACE);
+ buf.append(evaluateCommand( strCmd, val ));
}
break;
case IOption.STRING_LIST :
@@ -221,23 +236,30 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
case IOption.LIBRARIES :
case IOption.OBJECTS :
String cmd = option.getCommand();
- listStr = getPreferenceStore().getString(option.getId());
+ listStr = getToolSettingsPreferenceStore().getString(option.getId());
if (cmd == null)
userObjsMap.put(option, listStr);
listVal = BuildToolsSettingsStore.parseString(listStr);
for (int j = 0; j < listVal.length; j++) {
String temp = listVal[j];
- if (cmd != null)
- buf.append(cmd + temp + ITool.WHITE_SPACE);
- else
- buf.append(temp + ITool.WHITE_SPACE);
+ buf.append( evaluateCommand( cmd, temp ) + ITool.WHITE_SPACE);
}
break;
default :
break;
}
+ if( buf.toString().trim().length() > 0 ) flags.add( buf.toString().trim() );
+ }
+
+ String outputName = "temp"; //$NON-NLS-1$
+ if (tool.getInputExtensions().get(0) != null) {
+ outputName += tool.getInputExtensions().get(0);
}
- return buf.toString().trim();
+ String[] f = new String[ flags.size() ];
+ IManagedCommandLineGenerator gen = tool.getCommandLineGenerator();
+ IManagedCommandLineInfo info = gen.generateCommandLineInfo( tool, tool.getToolCommand(), (String[])flags.toArray( f ),
+ tool.getOutputFlag(), tool.getOutputPrefix(), outputName, new String[0], tool.getCommandLinePattern() );
+ return info.getFlags();
}
/**
@@ -259,18 +281,8 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
* field editor and stores the options to the corresponding option fields.
*/
public void parseAllOptions() {
- ITool[] tools = configuration.getTools();
- for (int i = 0; i < tools.length; ++i) {
- if (tools[i] instanceof ToolReference) {
- if (((ToolReference) tools[i]).references(tool)) {
- tool = tools[i];
- break;
- }
- } else if (tools[i].equals(tool))
- break;
- }
// Get the all build options string from all options field
- String alloptions = getPreferenceStore().getString(allOptionsId);
+ String alloptions = getToolSettingsPreferenceStore().getString(allOptionsId);
// list that holds the options for the option type other than
// boolean,string and enumerated
List optionsList = new ArrayList();
@@ -302,53 +314,55 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
// if the value does not exist in string option or user objects
// option
if (!optionValueExist) {
- // check whether the option value is already exist
- // and also change the preference store based on
- // the option value
- switch (opt.getValueType()) {
- case IOption.BOOLEAN :
- String boolCommand;
- boolCommand = opt.getCommand();
- if (boolCommand != null && boolCommand.equals(optionValue)) {
- getPreferenceStore()
- .setValue(opt.getId(), true);
- optionValueExist = true;
- }
- boolCommand = opt.getCommandFalse();
- if (boolCommand != null && boolCommand.equals(optionValue)) {
- getPreferenceStore()
- .setValue(opt.getId(), false);
- optionValueExist = true;
- }
- break;
- case IOption.ENUMERATED :
- String enum = ""; //$NON-NLS-1$
- String[] enumValues = opt.getApplicableValues();
- for (int i = 0; i < enumValues.length; i++) {
- if (opt.getEnumCommand(enumValues[i]).equals(
- optionValue)) {
- enum = enumValues[i];
+ try {
+ // check whether the option value is already exist
+ // and also change the preference store based on
+ // the option value
+ switch (opt.getValueType()) {
+ case IOption.BOOLEAN :
+ String boolCommand;
+ boolCommand = opt.getCommand();
+ if (boolCommand != null && boolCommand.equals(optionValue)) {
+ getToolSettingsPreferenceStore()
+ .setValue(opt.getId(), true);
optionValueExist = true;
}
- }
- if (!enum.equals("")) //$NON-NLS-1$
- getPreferenceStore()
- .setValue(opt.getId(), enum);
- break;
- case IOption.STRING_LIST :
- case IOption.INCLUDE_PATH :
- case IOption.PREPROCESSOR_SYMBOLS :
- case IOption.LIBRARIES :
- if (opt.getCommand() != null
- && optionValue.startsWith(opt
- .getCommand())) {
- optionsList.add(optionValue);
- optionValueExist = true;
- }
- break;
- default :
- break;
- }
+ boolCommand = opt.getCommandFalse();
+ if (boolCommand != null && boolCommand.equals(optionValue)) {
+ getToolSettingsPreferenceStore()
+ .setValue(opt.getId(), false);
+ optionValueExist = true;
+ }
+ break;
+ case IOption.ENUMERATED :
+ String enum = ""; //$NON-NLS-1$
+ String[] enumValues = opt.getApplicableValues();
+ for (int i = 0; i < enumValues.length; i++) {
+ if (opt.getEnumCommand(enumValues[i]).equals(
+ optionValue)) {
+ enum = enumValues[i];
+ optionValueExist = true;
+ }
+ }
+ if (!enum.equals("")) //$NON-NLS-1$
+ getToolSettingsPreferenceStore()
+ .setValue(opt.getId(), enum);
+ break;
+ case IOption.STRING_LIST :
+ case IOption.INCLUDE_PATH :
+ case IOption.PREPROCESSOR_SYMBOLS :
+ case IOption.LIBRARIES :
+ if (opt.getCommand() != null
+ && optionValue.startsWith(opt
+ .getCommand())) {
+ optionsList.add(optionValue);
+ optionValueExist = true;
+ }
+ break;
+ default :
+ break;
+ }
+ } catch (BuildException e) {}
}
}
// If the parsed string does not match with any previous option
@@ -373,7 +387,7 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
if (alloptions.indexOf(vals[t]) != -1)
buf.append(vals[t] + ITool.WHITE_SPACE);
}
- getPreferenceStore().setValue(((IOption) key).getId(),
+ getToolSettingsPreferenceStore().setValue(((IOption) key).getId(),
buf.toString().trim());
}
}
@@ -394,7 +408,7 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
String listArr[] = new String[list.size()];
list.toArray(listArr);
String liststr = BuildToolsSettingsStore.createList(listArr);
- getPreferenceStore().setValue(((IOption) key).getId(), liststr);
+ getToolSettingsPreferenceStore().setValue(((IOption) key).getId(), liststr);
}
}
// Now update the preference store with parsed options
@@ -405,52 +419,54 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
String name = opt.getId();
String listStr = ""; //$NON-NLS-1$
String[] listVal = null;
- switch (opt.getValueType()) {
- case IOption.BOOLEAN :
- ArrayList optsList = new ArrayList(optionsArr);
- if (opt.getCommand() != null
- && opt.getCommand().length() > 0
- && !optsList.contains(opt.getCommand()))
- getPreferenceStore().setValue(opt.getId(), false);
- if (opt.getCommandFalse() != null
- && opt.getCommandFalse().length() > 0
- && !optsList.contains(opt.getCommandFalse()))
- getPreferenceStore().setValue(opt.getId(), true);
- break;
- case IOption.STRING :
- // TODO create a lst of valid default string options for the tool
- if (getDefaultOptionNames().contains(opt.getName())) {
- String newOptions = getPreferenceStore().getString(
- opt.getId());
- if (addnOptions.length() > 0) {
- newOptions = newOptions + ITool.WHITE_SPACE
- + addnOptions.toString().trim();
+ try {
+ switch (opt.getValueType()) {
+ case IOption.BOOLEAN :
+ ArrayList optsList = new ArrayList(optionsArr);
+ if (opt.getCommand() != null
+ && opt.getCommand().length() > 0
+ && !optsList.contains(opt.getCommand()))
+ getToolSettingsPreferenceStore().setValue(opt.getId(), false);
+ if (opt.getCommandFalse() != null
+ && opt.getCommandFalse().length() > 0
+ && !optsList.contains(opt.getCommandFalse()))
+ getToolSettingsPreferenceStore().setValue(opt.getId(), true);
+ break;
+ case IOption.STRING :
+ // TODO create a lst of valid default string options for the tool
+ if (getDefaultOptionNames().contains(opt.getName())) {
+ String newOptions = getToolSettingsPreferenceStore().getString(
+ opt.getId());
+ if (addnOptions.length() > 0) {
+ newOptions = newOptions + ITool.WHITE_SPACE
+ + addnOptions.toString().trim();
+ }
+ getToolSettingsPreferenceStore().setValue(opt.getId(), newOptions);
}
- getPreferenceStore().setValue(opt.getId(), newOptions);
- }
- break;
- case IOption.STRING_LIST :
- case IOption.INCLUDE_PATH :
- case IOption.PREPROCESSOR_SYMBOLS :
- case IOption.LIBRARIES :
- ArrayList newList = new ArrayList();
- for (int i = 0; i < optionsList.size(); i++) {
- if (opt.getCommand() != null
- && ((String) optionsList.get(i)).startsWith(opt
- .getCommand())) {
- newList.add(((String) optionsList.get(i))
- .substring(opt.getCommand().length()));
+ break;
+ case IOption.STRING_LIST :
+ case IOption.INCLUDE_PATH :
+ case IOption.PREPROCESSOR_SYMBOLS :
+ case IOption.LIBRARIES :
+ ArrayList newList = new ArrayList();
+ for (int i = 0; i < optionsList.size(); i++) {
+ if (opt.getCommand() != null
+ && ((String) optionsList.get(i)).startsWith(opt
+ .getCommand())) {
+ newList.add(((String) optionsList.get(i))
+ .substring(opt.getCommand().length()));
+ }
}
- }
- String[] strlist = new String[newList.size()];
- newList.toArray(strlist);
- newList.clear();
- getPreferenceStore().setValue(opt.getId(),
- BuildToolsSettingsStore.createList(strlist));
- break;
- default :
- break;
- }
+ String[] strlist = new String[newList.size()];
+ newList.toArray(strlist);
+ newList.clear();
+ getToolSettingsPreferenceStore().setValue(opt.getId(),
+ BuildToolsSettingsStore.createList(strlist));
+ break;
+ default :
+ break;
+ }
+ } catch (BuildException e) {}
}
}
@@ -462,61 +478,84 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
boolean result = super.performOk();
//parse and store all build options in the corresponding preference store
- parseAllOptions();
+ //parseAllOptions();
// Write the preference store values back to the build model
- ITool[] tools = configuration.getTools();
- for (int i = 0; i < tools.length; ++i) {
- if (tools[i] instanceof ToolReference) {
- if (((ToolReference) tools[i]).references(tool)) {
- tool = tools[i];
- break;
- }
- } else if (tools[i].equals(tool)) {
- break;
- }
+ IOptionCategory category = (IOptionCategory)tool;
+ Object[][] options;
+ if ( isItResourceConfigPage ) {
+ options = category.getOptions(resConfig);
+ } else {
+ options = category.getOptions(configuration);
}
- IOption[] options = tool.getOptions();
+ if ( options == null)
+ return true;
+
for (int i = 0; i < options.length; i++) {
- IOption option = options[i];
- // Transfer value from preference store to options
- switch (option.getValueType()) {
- case IOption.BOOLEAN :
- boolean boolVal = getPreferenceStore().getBoolean(option.getId());
- ManagedBuildManager.setOption(configuration, option, boolVal);
- break;
- case IOption.ENUMERATED :
- String enumVal = getPreferenceStore().getString(option.getId());
- String enumId = option.getEnumeratedId(enumVal);
- ManagedBuildManager.setOption(configuration, option,
+ ITool tool = (ITool)options[i][0];
+ if (tool == null) break; // The array may not be full
+ IOption option = (IOption)options[i][1];
+ try {
+ // Transfer value from preference store to options
+ IOption setOption;
+ switch (option.getValueType()) {
+ case IOption.BOOLEAN :
+ boolean boolVal = getToolSettingsPreferenceStore().getBoolean(option.getId());
+ setOption = ManagedBuildManager.setOption(configuration, tool, option, boolVal);
+ // Reset the preference store since the Id may have changed
+ if (setOption != option) {
+ getToolSettingsPreferenceStore().setValue(setOption.getId(), boolVal);
+ }
+ break;
+ case IOption.ENUMERATED :
+ String enumVal = getToolSettingsPreferenceStore().getString(option.getId());
+ String enumId = option.getEnumeratedId(enumVal);
+ setOption = ManagedBuildManager.setOption(configuration, tool, option,
(enumId != null && enumId.length() > 0) ? enumId : enumVal);
- break;
- case IOption.STRING :
- String strVal = getPreferenceStore().getString(option.getId());
- ManagedBuildManager.setOption(configuration, option, strVal);
- break;
- case IOption.STRING_LIST :
- case IOption.INCLUDE_PATH :
- case IOption.PREPROCESSOR_SYMBOLS :
- case IOption.LIBRARIES :
- case IOption.OBJECTS :
- String listStr = getPreferenceStore().getString(option.getId());
- String[] listVal = BuildToolsSettingsStore.parseString(listStr);
- ManagedBuildManager.setOption(configuration, option, listVal);
- break;
- default :
- break;
- }
+ // Reset the preference store since the Id may have changed
+ if (setOption != option) {
+ getToolSettingsPreferenceStore().setValue(setOption.getId(), enumVal);
+ }
+ break;
+ case IOption.STRING :
+ String strVal = getToolSettingsPreferenceStore().getString(option.getId());
+ setOption = ManagedBuildManager.setOption(configuration, tool, option, strVal);
+ // Reset the preference store since the Id may have changed
+ if (setOption != option) {
+ getToolSettingsPreferenceStore().setValue(setOption.getId(), strVal);
+ }
+ break;
+ case IOption.STRING_LIST :
+ case IOption.INCLUDE_PATH :
+ case IOption.PREPROCESSOR_SYMBOLS :
+ case IOption.LIBRARIES :
+ case IOption.OBJECTS :
+ String listStr = getToolSettingsPreferenceStore().getString(option.getId());
+ String[] listVal = BuildToolsSettingsStore.parseString(listStr);
+ setOption = ManagedBuildManager.setOption(configuration, tool, option, listVal);
+ // Reset the preference store since the Id may have changed
+ if (setOption != option) {
+ getToolSettingsPreferenceStore().setValue(setOption.getId(), listStr);
+ }
+ break;
+ default :
+ break;
+ }
+ } catch (BuildException e) {}
}
// Get the actual value out of the field editor
- String command = getPreferenceStore().getString(tool.getId());
+ String command = getToolSettingsPreferenceStore().getString(tool.getId());
if (command.length() == 0) {
return result;
}
// Ask the build system manager to change the tool command
- ManagedBuildManager.setToolCommand(configuration, tool, command);
+ if ( isItResourceConfigPage ) {
+ ManagedBuildManager.setToolCommand(resConfig, tool, command);
+ } else {
+ ManagedBuildManager.setToolCommand(configuration, tool, command);
+ }
return result;
}
@@ -534,7 +573,7 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
public void updateAllOptionField() {
try {
if (getToolFlags() != null) {
- getPreferenceStore().setValue(allOptionsId, getToolFlags());
+ getToolSettingsPreferenceStore().setValue(allOptionsId, getToolFlags());
allOptionFieldEditor.load();
}
} catch (BuildException e) {
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java
index 9507da90b54..1aa7a628db2 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildToolsSettingsStore.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * Copyright (c) 2002,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -10,6 +8,7 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.properties;
import java.util.HashMap;
import java.util.Map;
@@ -18,6 +17,7 @@ import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
@@ -32,7 +32,10 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
private Map settingsMap;
private boolean dirtyFlag;
private IConfiguration owner;
-
+
+ private IResourceConfiguration resConfigOwner;
+// private IFile file;
+
/**
*
*/
@@ -47,11 +50,22 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
public BuildToolsSettingsStore (IConfiguration config) {
this();
owner = config;
+ resConfigOwner = null;
// Now populate the options map
populateSettingsMap();
}
-
+ public BuildToolsSettingsStore(IResourceConfiguration resConfig) {
+ this();
+ // owner = resConfig.getParent();
+ owner = null;
+ resConfigOwner = resConfig;
+ populateSettingsMap();
+ }
+ /**
+ *
+ */
+
/* (non-Javadoc)
* @see org.eclipse.jface.preference.IPreferenceStore#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
*/
@@ -213,86 +227,98 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
getOptionsForCategory(children[i]);
}
// Else get the options for this category and add them to the map
- IOption [] options = cat.getOptions(owner);
+ Object[][] options;
+ if(resConfigOwner != null) {
+ options = cat.getOptions(resConfigOwner);
+ } else {
+ options = cat.getOptions(owner);
+ }
+
+ if ( options == null)
+ return;
for (int j = 0; j < options.length; ++j) {
- IOption opt = options[j];
+ ITool tool = (ITool)options[j][0];
+ if (tool == null) break; // The array may not be full
+ IOption opt = (IOption)options[j][1];
String name = opt.getId();
Object value;
- // Switch on the type of option
- switch (opt.getValueType()) {
- case IOption.BOOLEAN :
- try {
- value = new Boolean(opt.getBooleanValue());
- } catch (BuildException e) {
- // Exception occurs if there's an option value type mismatch
+ try {
+ // Switch on the type of option
+ switch (opt.getValueType()) {
+ case IOption.BOOLEAN :
+ try {
+ value = new Boolean(opt.getBooleanValue());
+ } catch (BuildException e) {
+ // Exception occurs if there's an option value type mismatch
+ break;
+ }
+ getSettingsMap().put(name, value);
+ break;
+
+ case IOption.ENUMERATED :
+ try{
+ String selId;
+ selId = opt.getSelectedEnum();
+ value = opt.getEnumName(selId);
+ } catch (BuildException e) {
+ break;
+ }
+ getSettingsMap().put(name, value);
break;
- }
- getSettingsMap().put(name, value);
- break;
-
- case IOption.ENUMERATED :
- try{
- String selId;
- selId = opt.getSelectedEnum();
- value = opt.getEnumName(selId);
- } catch (BuildException e) {
+
+ case IOption.STRING :
+ try {
+ value = opt.getStringValue();
+ } catch (BuildException e) {
+ break;
+ }
+ getSettingsMap().put(name, value);
break;
- }
- getSettingsMap().put(name, value);
- break;
-
- case IOption.STRING :
- try {
- value = opt.getStringValue();
- } catch (BuildException e) {
+
+ case IOption.STRING_LIST :
+ try {
+ value = createList(opt.getStringListValue());
+ } catch (BuildException e) {
+ break;
+ }
+ getSettingsMap().put(name, value);
break;
- }
- getSettingsMap().put(name, value);
- break;
-
- case IOption.STRING_LIST :
- try {
- value = createList(opt.getStringListValue());
- } catch (BuildException e) {
+ case IOption.INCLUDE_PATH :
+ try {
+ value = createList(opt.getIncludePaths());
+ } catch (BuildException e) {
+ break;
+ }
+ getSettingsMap().put(name, value);
break;
- }
- getSettingsMap().put(name, value);
- break;
- case IOption.INCLUDE_PATH :
- try {
- value = createList(opt.getIncludePaths());
- } catch (BuildException e) {
+ case IOption.PREPROCESSOR_SYMBOLS :
+ try {
+ value = createList(opt.getDefinedSymbols());
+ } catch (BuildException e) {
+ break;
+ }
+ getSettingsMap().put(name, value);
break;
- }
- getSettingsMap().put(name, value);
- break;
- case IOption.PREPROCESSOR_SYMBOLS :
- try {
- value = createList(opt.getDefinedSymbols());
- } catch (BuildException e) {
+ case IOption.LIBRARIES :
+ try {
+ value = createList(opt.getLibraries());
+ } catch (BuildException e) {
+ break;
+ }
+ getSettingsMap().put(name, value);
break;
- }
- getSettingsMap().put(name, value);
- break;
- case IOption.LIBRARIES :
- try {
- value = createList(opt.getLibraries());
- } catch (BuildException e) {
+ case IOption.OBJECTS :
+ try {
+ value = createList(opt.getUserObjects());
+ } catch (BuildException e) {
+ break;
+ }
+ getSettingsMap().put(name, value);
break;
- }
- getSettingsMap().put(name, value);
- break;
- case IOption.OBJECTS :
- try {
- value = createList(opt.getUserObjects());
- } catch (BuildException e) {
+ default :
break;
- }
- getSettingsMap().put(name, value);
- break;
- default :
- break;
- }
+ }
+ } catch (BuildException e) {}
}
}
@@ -340,7 +366,16 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
*/
private void populateSettingsMap() {
// Each configuration has a list of tools
- ITool [] tools = owner.getTools();
+ ITool [] tools;
+
+ // If resConfigOwner is not null, get the resource specific tools.
+
+ if ( resConfigOwner != null) {
+ tools = resConfigOwner.getTools();
+ } else {
+ tools = owner.getFilteredTools();
+ }
+
for (int index = 0; index < tools.length; ++index) {
// Add the tool to the map
ITool tool = tools[index];
@@ -468,4 +503,16 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
}
+ /**
+ * @return Returns the resConfigOwner.
+ */
+ public IResourceConfiguration getResConfigOwner() {
+ return resConfigOwner;
+ }
+ /**
+ * @param resConfigOwner The resConfigOwner to set.
+ */
+ public void setResConfigOwner(IResourceConfiguration resConfigOwner) {
+ this.resConfigOwner = resConfigOwner;
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ManageConfigDialog.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ManageConfigDialog.java
index f2ab6057607..3cd684bfd79 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ManageConfigDialog.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ManageConfigDialog.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
/**********************************************************************
- * Copyright (c) 2002,2004 Rational Software Corporation and others.
+ * Copyright (c) 2002,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -10,21 +8,19 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.properties;
import java.util.ArrayList;
import java.util.SortedMap;
import java.util.TreeMap;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
@@ -38,7 +34,6 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
public class ManageConfigDialog extends Dialog {
// String constants
@@ -49,41 +44,27 @@ public class ManageConfigDialog extends Dialog {
private static final String PREFIX = "ManageConfig"; //$NON-NLS-1$
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
private static final String RESTORE = LABEL + ".restore"; //$NON-NLS-1$
- private static final String GROUP = LABEL + ".makecmdgroup"; //$NON-NLS-1$
- private static final String DEF_BTN = LABEL + ".makecmddef"; //$NON-NLS-1$
- private static final String OUTPUT_GROUP = LABEL + ".output.group"; //$NON-NLS-1$
- private static final String OUTPUT_EXT = LABEL + ".output.extension"; //$NON-NLS-1$
- private static final String OUTPUT_NAME = LABEL + ".output.name"; //$NON-NLS-1$
private static final String CONFIGS = LABEL + ".configs"; //$NON-NLS-1$
private static final String CURRENT_CONFIGS = CONFIGS + ".current"; //$NON-NLS-1$
private static final String DELETED_CONFIGS = CONFIGS + ".deleted"; //$NON-NLS-1$
private static final String CONF_DLG = LABEL + ".new.config.dialog"; //$NON-NLS-1$
- // The name of the build artifact
- private String artifactExt;
- private String artifactName;
+ private static final String EMPTY_STRING = new String();
+
// The list of configurations to delete
private SortedMap deletedConfigs;
// Map of configuration names and ids
private SortedMap existingConfigs;
- // The make command associated with the target
- private String makeCommand;
// The target the configs belong to
- private ITarget managedTarget;
+ private IManagedProject managedProject;
// Map of new configurations chosen by the user
private SortedMap newConfigs;
// The title of the dialog.
private String title = ""; //$NON-NLS-1$
- // State of the check box on exit
- private boolean useDefaultMake;
// Widgets
- protected Text buildArtifactExt;
- protected Text buildArtifactName;
protected List currentConfigList;
protected List deletedConfigList;
- protected Button makeCommandDefault;
- protected Text makeCommandEntry;
protected Button newBtn;
protected Button okBtn;
protected Button removeBtn;
@@ -92,20 +73,14 @@ public class ManageConfigDialog extends Dialog {
/**
* @param parentShell
*/
- protected ManageConfigDialog(Shell parentShell, String title, ITarget target) {
+ protected ManageConfigDialog(Shell parentShell, String title, IManagedProject proj) {
super(parentShell);
this.title = title;
- this.managedTarget = target;
-
- setMakeCommand();
-
- // Get the name of the build artifact
- artifactExt = managedTarget.getArtifactExtension();
- artifactName = managedTarget.getArtifactName();
+ this.managedProject = proj;
// Get the defined configurations from the target
getExistingConfigs().clear();
- IConfiguration [] configs = managedTarget.getConfigurations();
+ IConfiguration [] configs = managedProject.getConfigurations();
for (int i = 0; i < configs.length; i++) {
IConfiguration configuration = configs[i];
getExistingConfigs().put(configuration.getName(), configuration.getId());
@@ -114,22 +89,6 @@ public class ManageConfigDialog extends Dialog {
getDeletedConfigs().clear();
getNewConfigs().clear();
}
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
- */
- protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- useDefaultMake = makeCommandDefault.getSelection();
- makeCommand = makeCommandEntry.getText().trim();
- artifactName = buildArtifactName.getText().trim();
- artifactExt = buildArtifactExt.getText().trim();
- } else {
- useDefaultMake = true;
- artifactName = managedTarget.getArtifactName();
- }
- super.buttonPressed(buttonId);
- }
/* (non-Javadoc)
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
@@ -139,72 +98,6 @@ public class ManageConfigDialog extends Dialog {
if (title != null)
shell.setText(title);
}
-
- /* (non-Javadoc)
- * Creates the group that contains the build artifact name controls.
- */
- private void createBuildArtifactGroup(Composite parent) {
- final Group outputGroup = new Group(parent, SWT.NONE);
- outputGroup.setFont(parent.getFont());
- outputGroup.setText(ManagedBuilderUIMessages.getResourceString(OUTPUT_GROUP));
- outputGroup.setLayout(new GridLayout(3, false));
- outputGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Three labels
- final Label nameLabel = new Label(outputGroup, SWT.LEFT);
- nameLabel.setFont(outputGroup.getFont());
- nameLabel.setText(ManagedBuilderUIMessages.getResourceString(OUTPUT_NAME));
- nameLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- final Label placeHolder = new Label(outputGroup, SWT.CENTER);
- placeHolder.setText(new String());
- placeHolder.setLayoutData(new GridData());
-
- final Label extLabel = new Label(outputGroup, SWT.LEFT);
- extLabel.setFont(outputGroup.getFont());
- extLabel.setText(ManagedBuilderUIMessages.getResourceString(OUTPUT_EXT));
- extLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Now we need two text widgets separated by a label
- buildArtifactName = new Text(outputGroup, SWT.SINGLE | SWT.BORDER);
- buildArtifactName.setFont(outputGroup.getFont());
- buildArtifactName.setText(artifactName);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- buildArtifactName.setLayoutData(data);
- buildArtifactName.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- buildArtifactName = null;
- }
- });
- buildArtifactName.getAccessible().addAccessibleListener(new AccessibleAdapter(){
- public void getName(AccessibleEvent e) {
- e.result = ManagedBuilderUIMessages.getResourceString(OUTPUT_NAME);
- }
- });
-
- final Label dotLabel = new Label(outputGroup, SWT.CENTER);
- dotLabel.setFont(outputGroup.getFont());
- dotLabel.setText(new String(".")); //$NON-NLS-1$
- dotLabel.setLayoutData(new GridData());
-
- buildArtifactExt = new Text(outputGroup, SWT.SINGLE | SWT.BORDER);
- buildArtifactExt.setFont(outputGroup.getFont());
- buildArtifactExt.setText(artifactExt);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = (IDialogConstants.ENTRY_FIELD_WIDTH / 2);
- buildArtifactExt.setLayoutData(data);
- buildArtifactExt.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- buildArtifactExt = null;
- }
- });
- buildArtifactExt.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- public void getName(AccessibleEvent e) {
- e.result = ManagedBuilderUIMessages.getResourceString(OUTPUT_EXT);
- }
- });
- }
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
@@ -325,12 +218,6 @@ public class ManageConfigDialog extends Dialog {
comp.setLayout(new GridLayout(1, true));
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
- // Create a group for the build output
- createBuildArtifactGroup(comp);
-
- // Create the make command group area
- createMakeCommandGroup(comp);
-
// Make the configuration management area
createConfigListGroup(comp);
@@ -341,64 +228,6 @@ public class ManageConfigDialog extends Dialog {
return comp;
}
- /* (non-Javadoc)
- * Creates the group control for the make command
- * @param parent
- */
- private void createMakeCommandGroup(Composite parent) {
- final Group makeCommandGroup = new Group(parent, SWT.NONE);
- makeCommandGroup.setFont(parent.getFont());
- makeCommandGroup.setText(ManagedBuilderUIMessages.getResourceString(GROUP));
- makeCommandGroup.setLayout(new GridLayout(1, true));
- makeCommandGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- makeCommandDefault = new Button(makeCommandGroup, SWT.CHECK | SWT.LEFT);
- makeCommandDefault.setFont(makeCommandGroup.getFont());
- makeCommandDefault.setText(ManagedBuilderUIMessages.getResourceString(DEF_BTN));
- setButtonLayoutData(makeCommandDefault);
- makeCommandDefault.setBackground(makeCommandGroup.getBackground());
- makeCommandDefault.setForeground(makeCommandGroup.getForeground());
- makeCommandDefault.setSelection(!managedTarget.hasOverridenMakeCommand());
- makeCommandDefault.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- handleUseDefaultPressed();
- }
- });
- makeCommandDefault.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- makeCommandDefault = null;
- }
- });
-
- makeCommandEntry = new Text(makeCommandGroup, SWT.SINGLE | SWT.BORDER);
- makeCommandEntry.setFont(makeCommandGroup.getFont());
- makeCommandEntry.setEditable(!makeCommandDefault.getSelection());
- makeCommandEntry.setText(makeCommand);
- makeCommandEntry.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- makeCommandEntry.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- makeCommandEntry = null;
- }
- });
- }
-
- /**
- * Answers the extension for the build artifact.
- * @return
- */
- public String getBuildArtifaceExtension() {
- return artifactExt;
- }
-
- /**
- * Answers the value in the build artifact entry widget.
- *
- * @return
- */
- public String getBuildArtifactName() {
- return artifactName;
- }
-
private String [] getConfigurationNames() {
return (String[]) getExistingConfigs().keySet().toArray(new String[getExistingConfigs().size()]);
}
@@ -432,15 +261,6 @@ public class ManageConfigDialog extends Dialog {
}
/**
- * Answers the value in the make command entry widget.
- *
- * @return
- */
- public String getMakeCommand() {
- return makeCommand;
- }
-
- /**
* Answers a map of configuration names to <code>IConfiguration</code>.
* The name is selected by the user and should be unique for the target
* it will be added to. The configuration is the what the new
@@ -456,28 +276,18 @@ public class ManageConfigDialog extends Dialog {
}
/*
- * @return the <code>IProject</code> associated with the target
+ * @return the <code>IProject</code> associated with the managed project
*/
private IProject getProject() {
- return managedTarget.getOwner().getProject();
+ return (IProject)managedProject.getOwner();
}
/*
* Event handler for the add button
*/
protected void handleNewPressed() {
- // Find the defined target
- ITarget parentTarget = null;
- ITarget [] targets = ManagedBuildManager.getDefinedTargets(getProject());
- for (int i = 0; i < targets.length; i++) {
- ITarget target = targets[i];
- if (target.getId().equals(managedTarget.getParent().getId())) {
- parentTarget = target;
- break;
- }
- }
NewConfigurationDialog dialog = new NewConfigurationDialog(getShell(),
- managedTarget,
+ managedProject,
ManagedBuilderUIMessages.getResourceString(CONF_DLG));
if (dialog.open() == NewConfigurationDialog.OK) {
// Get the new name and configuration to base the new config on
@@ -535,7 +345,7 @@ public class ManageConfigDialog extends Dialog {
// If this was a new config (it won't be in the existing list) then add it back there
if (!getExistingConfigs().containsKey(selectedConfigName)) {
- IConfiguration restoredConfig = managedTarget.getConfiguration(selectedConfigId);
+ IConfiguration restoredConfig = managedProject.getConfiguration(selectedConfigId);
getNewConfigs().put(selectedConfigName, restoredConfig);
}
@@ -551,46 +361,10 @@ public class ManageConfigDialog extends Dialog {
}
}
- /* (non-Javadoc)
- * Event handler for the use default check box in the make command group
- */
- protected void handleUseDefaultPressed() {
- // If the state of the button is unchecked, then we want to enable the edit widget
- boolean checked = makeCommandDefault.getSelection();
- if (checked == true) {
- managedTarget.resetMakeCommand();
- setMakeCommand();
- makeCommandEntry.setText(makeCommand);
- makeCommandEntry.setEditable(false);
- } else {
- makeCommandEntry.setEditable(true);
- }
- }
-
- /*
- *
- */
- private void setMakeCommand() {
- // Figure out the make command
- makeCommand = managedTarget.getMakeCommand();
- String makeArgs = managedTarget.getMakeArguments();
- if (makeArgs.length() > 0) {
- makeCommand += " " + makeArgs; //$NON-NLS-1$
- }
- }
-
private void updateButtons() {
// Disable the remove button if there is only 1 configuration
removeBtn.setEnabled(currentConfigList.getItemCount() > 1);
// Enable the restore button if there is anything in the deleted list
restoreBtn.setEnabled(deletedConfigList.getItemCount() > 0);
}
-
- /**
- * Answers <code>true</code> if the user has left the use default check box selected.
- * @return
- */
- public boolean useDefaultMakeCommand () {
- return useDefaultMake;
- }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ManagedBuilderPropertyPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ManagedBuilderPropertyPage.java
deleted file mode 100644
index a8d27fab4a6..00000000000
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ManagedBuilderPropertyPage.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Intel Corp - use in Managed Make system
- *******************************************************************************/
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedProjectOptionBlock;
-import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
-import org.eclipse.cdt.managedbuilder.internal.ui.ErrorParserBlock;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
-import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferencePageContainer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-public class ManagedBuilderPropertyPage extends PropertyPage implements ICOptionContainer {
-
- protected ManagedProjectOptionBlock fOptionBlock;
- protected ITarget displayedTarget;
-
- private static final String MSG_CLOSEDPROJECT = "MngMakeProjectPropertyPage.closedproject"; //$NON-NLS-1$
-
- public ManagedBuilderPropertyPage() {
- super();
- }
-
- public void setContainer(IPreferencePageContainer preferencePageContainer) {
- super.setContainer(preferencePageContainer);
- if (fOptionBlock == null) {
- fOptionBlock = new ManagedProjectOptionBlock(this);
- }
- }
-
- protected Control createContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new FillLayout());
-
- IProject project = getProject();
- if (!project.isOpen()) {
- contentForClosedProject(composite);
- } else {
- contentForCProject(composite);
- }
-
- return composite;
- }
-
- private void contentForCProject(Composite parent) {
- fOptionBlock.createContents(parent);
- // WorkbenchHelp.setHelp(parent, ICMakeHelpContextIds.PROJECT_PROPERTY_PAGE);
- }
-
- private void contentForClosedProject(Composite parent) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(ManagedBuilderUIMessages.getResourceString(MSG_CLOSEDPROJECT));
- label.setFont(parent.getFont());
-
- noDefaultAndApplyButton();
- }
-
- /**
- * @see PreferencePage#performOk
- */
- public boolean performOk() {
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- fOptionBlock.performApply(monitor);
- }
- };
-
- // If the user did not come to this page when the current selected target
- // was the selected target, then there is nothing to do. The page was either
- // never visited, or was visited for another target.
- ITarget target = getSelectedTarget();
- if (target != displayedTarget) return true;
-
- IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(runnable);
- try {
- new ProgressMonitorDialog(getShell()).run(false, true, op);
- } catch (InvocationTargetException e) {
- Throwable e1 = e.getTargetException();
- ManagedBuilderUIPlugin.errorDialog(getShell(), ManagedBuilderUIMessages.getResourceString("ManagedProjectPropertyPage.internalError"),e1.toString(), e1); //$NON-NLS-1$
- return false;
- } catch (InterruptedException e) {
- // cancelled
- return false;
- }
-
- // Write out the build model info
- IProject project = getProject();
- ManagedBuildManager.saveBuildInfo(project, false);
- return true;
- }
-
- public IProject getProject() {
- Object element = getElement();
- if (element instanceof IProject) {
- return (IProject) element;
- }
- return null;
- }
-
- /**
- * @see DialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- fOptionBlock.setVisible(visible);
- if (visible) {
- ErrorParserBlock errorParsers = fOptionBlock.getErrorParserBlock();
- errorParsers.updateValues();
- displayedTarget = getSelectedTarget();
- }
- }
-
- protected ITarget getSelectedTarget() {
- // If the selected target is not yet set, set it to the default target
- // The selected target is needed for saving error parser information
- IProject project = getProject();
- ITarget target = ManagedBuildManager.getSelectedTarget(project);
- if (target == null) {
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
- target = info.getDefaultTarget();
- ManagedBuildManager.setSelectedTarget(project, target);
- }
- return target;
- }
-
- public void updateContainer() {
- fOptionBlock.update();
- setValid(fOptionBlock.isValid());
- setErrorMessage(fOptionBlock.getErrorMessage());
- }
-
- protected void performDefaults() {
- fOptionBlock.performDefaults();
- super.performDefaults();
- }
-
- public boolean isValid() {
- updateContainer();
- return super.isValid();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.ui.dialogs.ICOptionContainer#getPreferences()
- */
- public Preferences getPreferences() {
- return null;
- }
-
-}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/NewConfigurationDialog.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/NewConfigurationDialog.java
index 082e15c71ea..0d15f977758 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/NewConfigurationDialog.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/NewConfigurationDialog.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
/**********************************************************************
- * Copyright (c) 2003,2004 IBM Rational Software Corporation and others.
+ * Copyright (c) 2003,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -10,9 +8,11 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.properties;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -59,7 +59,7 @@ public class NewConfigurationDialog extends Dialog {
private IConfiguration[] defaultConfigs;
private IConfiguration[] definedConfigs;
private IConfiguration parentConfig;
- private ITarget target;
+ private IManagedProject managedProject;
private String newName;
private String title = ""; //$NON-NLS-1$
@@ -67,21 +67,21 @@ public class NewConfigurationDialog extends Dialog {
/**
* @param parentShell
*/
- protected NewConfigurationDialog(Shell parentShell, ITarget managedTarget, String title) {
+ protected NewConfigurationDialog(Shell parentShell, IManagedProject managedProject, String title) {
super(parentShell);
this.title = title;
setShellStyle(getShellStyle()|SWT.RESIZE);
newName = new String();
parentConfig = null;
- this.target = managedTarget;
+ this.managedProject = managedProject;
// The default behaviour is to clone the settings
clone = true;
// Populate the list of default and defined configurations
- definedConfigs = target.getConfigurations();
- ITarget grandparent = target.getParent();
- defaultConfigs = grandparent.getConfigurations();
+ definedConfigs = managedProject.getConfigurations();
+ IProjectType projectType = managedProject.getProjectType();
+ defaultConfigs = projectType.getConfigurations();
}
/* (non-Javadoc)
@@ -242,7 +242,7 @@ public class NewConfigurationDialog extends Dialog {
}
/*
- * Returns the array of configuration names defined for all targets
+ * Returns the array of configuration names defined for all projects
* of this type in the plugin manifest. This list will be used to
* populate the the configurations to copy default settings from.
*/
@@ -256,7 +256,7 @@ public class NewConfigurationDialog extends Dialog {
}
/*
- * Returns the array of configuration names defined for this target.
+ * Returns the array of configuration names defined for this managed project.
* This list will be used to populate the list of configurations to
* clone.
*/
@@ -285,11 +285,11 @@ public class NewConfigurationDialog extends Dialog {
* @return
*/
protected boolean isDuplicateName(String newName) {
- // Return true if there is already a config of that name defined on the target
- IConfiguration [] configs = target.getConfigurations();
+ // Return true if there is already a config of that name defined
+ IConfiguration [] configs = managedProject.getConfigurations();
for (int index = 0; index < configs.length; index++) {
IConfiguration configuration = configs[index];
- if (configuration.getName() == newName) {
+ if (configuration.getName().equals(newName)) {
return true;
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ResourceBuildPropertyPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ResourceBuildPropertyPage.java
new file mode 100644
index 00000000000..1d52e20fd44
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ResourceBuildPropertyPage.java
@@ -0,0 +1,487 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.properties;
+
+import java.lang.reflect.InvocationTargetException;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuildOptionBlock;
+import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderHelpContextIds;
+import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
+import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin;
+import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.preference.IPreferencePageContainer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.eclipse.ui.help.WorkbenchHelp;
+
+
+public class ResourceBuildPropertyPage extends PropertyPage implements
+ IWorkbenchPropertyPage, IPreferencePageContainer, ICOptionContainer {
+ /*
+ * String constants
+ */
+ private static final String PREFIX = "ResourceBuildPropertyPage"; //$NON-NLS-1$
+ private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
+ private static final String NAME_LABEL = LABEL + ".NameText"; //$NON-NLS-1$
+ private static final String CONFIG_LABEL = LABEL + ".Configuration"; //$NON-NLS-1$
+ private static final String ALL_CONFS = PREFIX + ".selection.configuration.all"; //$NON-NLS-1$
+ private static final String ACTIVE_RESOURCE_LABEL = LABEL + ".ActiveResource"; //$NON-NLS-1$
+ private static final String RESOURCE_SETTINGS_LABEL = LABEL + ".ResourceSettings"; //$NON-NLS-1$
+ private static final String TREE_LABEL = LABEL + ".ToolTree"; //$NON-NLS-1$
+ private static final String OPTIONS_LABEL = LABEL + ".ToolOptions"; //$NON-NLS-1$
+ private static final String EXCLUDE_CHECKBOX = LABEL + ".ExcludeCheckBox"; //$NON-NLS-1$
+ private static final String TIP = PREFIX + ".tip"; //$NON-NLS-1$
+ private static final String RESOURCE_PLAT_TIP = TIP + ".ResourcePlatform"; //$NON-NLS-1$
+ private static final String CONF_TIP = TIP + ".config"; //$NON-NLS-1$
+ private static final String EXCLUDE_TIP = TIP + ".excludecheck"; //$NON-NLS-1$
+ private static final String MANAGE_TITLE = PREFIX + ".manage.title"; //$NON-NLS-1$
+ private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 20, 30 };
+ private static final String ID_SEPARATOR = "."; //$NON-NLS-1$
+
+ /*
+ * Dialog widgets
+ */
+
+ private Combo configSelector;
+
+// private Point lastShellSize;
+ private Button excludedCheckBox;
+ private boolean isExcluded = false;
+
+ /*
+ * Bookeeping variables
+ */
+
+
+ private IConfiguration[] configurations;
+ private IConfiguration selectedConfiguration;
+ private IResourceConfiguration currentResourceConfig;
+ private Point lastShellSize;
+ protected ManagedBuildOptionBlock fOptionBlock;
+ protected boolean displayedConfig = false;
+ /**
+ * Default constructor
+ */
+ public ResourceBuildPropertyPage() {
+ // super();
+ }
+
+ public void setContainer(IPreferencePageContainer preferencePageContainer) {
+ super.setContainer(preferencePageContainer);
+ if (fOptionBlock == null) {
+ fOptionBlock = new ManagedBuildOptionBlock(this);
+ }
+ }
+
+ protected Control createContents(Composite parent) {
+ GridData gd;
+
+// Create the container we return to the property page editor
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setFont(parent.getFont());
+ GridLayout compositeLayout = new GridLayout();
+ compositeLayout.numColumns = 1;
+ compositeLayout.marginHeight = 0;
+ compositeLayout.marginWidth = 0;
+ composite.setLayout( compositeLayout );
+
+// Initialize the key data
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
+ if (info.getVersion() == null) {
+ // Display a message page instead of the properties control
+ final Label invalidInfo = new Label(composite, SWT.LEFT);
+ invalidInfo.setFont(composite.getFont());
+ invalidInfo.setText(ManagedBuilderUIMessages.getResourceString("ResourceBuildPropertyPage.error.version_low")); //$NON-NLS-1$
+ invalidInfo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING,GridData.VERTICAL_ALIGN_CENTER, true, true));
+ return composite;
+ }
+
+ // Add a config selection area
+ Group configGroup = ControlFactory.createGroup(composite, ManagedBuilderUIMessages.getResourceString(ACTIVE_RESOURCE_LABEL), 1);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.grabExcessHorizontalSpace = true;
+ configGroup.setLayoutData(gd);
+ // Use the form layout inside the group composite
+ FormLayout form = new FormLayout();
+ form.marginHeight = 5;
+ form.marginWidth = 5;
+ configGroup.setLayout(form);
+
+ excludedCheckBox = ControlFactory.createCheckBox(configGroup, ManagedBuilderUIMessages.getResourceString(EXCLUDE_CHECKBOX));
+ excludedCheckBox.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event e) {
+ handleIsExcluded();
+ }
+ });
+ excludedCheckBox.setToolTipText(ManagedBuilderUIMessages.getResourceString(EXCLUDE_TIP));
+
+ FormData fd = new FormData();
+ fd = new FormData();
+ fd.left = new FormAttachment(excludedCheckBox, 0, SWT.CENTER);
+ excludedCheckBox.setLayoutData(fd);
+
+ Label configLabel = ControlFactory.createLabel(configGroup, ManagedBuilderUIMessages.getResourceString(CONFIG_LABEL));
+ configSelector = new Combo(configGroup, SWT.READ_ONLY | SWT.DROP_DOWN);
+ configSelector.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event e) {
+ handleConfigSelection();
+ }
+ });
+ configSelector.setToolTipText(ManagedBuilderUIMessages.getResourceString(CONF_TIP));
+
+ // Now do the form layout for the widgets
+
+ fd = new FormData();
+ fd.top = new FormAttachment(excludedCheckBox, 15, SWT.DEFAULT);
+
+ configLabel.setLayoutData(fd);
+
+ fd = new FormData();
+ fd.top = new FormAttachment(excludedCheckBox, 15, SWT.DEFAULT);
+ fd.left = new FormAttachment(configLabel, 5, SWT.DEFAULT);
+ fd.right = new FormAttachment(80, -20);
+ configSelector.setLayoutData(fd);
+
+// Create the Tools Settings, Build Settings, ... Tabbed pane
+ Group tabGroup = ControlFactory.createGroup(composite, ManagedBuilderUIMessages.getResourceString(RESOURCE_SETTINGS_LABEL), 1);
+ gd = new GridData(GridData.FILL_BOTH);
+ tabGroup.setLayoutData(gd);
+ fOptionBlock.createContents(tabGroup, getElement());
+
+// Update the contents of the configuration widget
+ populateConfigurations();
+ WorkbenchHelp.setHelp(composite,ManagedBuilderHelpContextIds.MAN_PROJ_BUILD_PROP);
+ return composite;
+ }
+
+ private void handleIsExcluded() {
+
+ // Check whether the check box is selected or not.
+ boolean isSelected = excludedCheckBox.getSelection();
+ setExcluded(isSelected);
+ }
+
+ /*
+ * (non-Javadoc) @return an array of names for the configurations defined
+ * for the chosen
+ */
+ private String[] getConfigurationNames() {
+ String[] names = new String[configurations.length];
+ for (int index = 0; index < configurations.length; ++index) {
+ names[index] = configurations[index].getName();
+ }
+ return names;
+ }
+
+ protected Point getLastShellSize() {
+ if (lastShellSize == null) {
+ Shell shell = getShell();
+ if (shell != null)
+ lastShellSize = shell.getSize();
+ }
+ return lastShellSize;
+ }
+
+ public IProject getProject() {
+ Object element = getElement();
+ if (element != null && element instanceof IFile) {
+ IFile file = (IFile) element;
+ return (IProject) file.getProject();
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc) @return
+ */
+ public IConfiguration getSelectedConfiguration() {
+ return selectedConfiguration;
+ }
+
+ /*
+ * Event Handlers
+ */
+ private void handleConfigSelection() {
+ // If there is nothing in config selection widget just bail
+ if (configSelector.getItemCount() == 0)
+ return;
+
+ // Check if the user has selected the "all" configuration
+ int selectionIndex = configSelector.getSelectionIndex();
+ if (selectionIndex == -1)
+ return;
+ String configName = configSelector.getItem(selectionIndex);
+ if (configName.equals(ManagedBuilderUIMessages
+ .getResourceString(ALL_CONFS))) {
+ // This is the all config
+ return;
+ } else {
+ IConfiguration newConfig = configurations[selectionIndex];
+ if (newConfig != selectedConfiguration) {
+ // If the user has changed values, and is now switching configurations, prompt for saving
+ if (selectedConfiguration != null) {
+ if (fOptionBlock.isDirty()) {
+ Shell shell = ManagedBuilderUIPlugin.getDefault().getShell();
+ boolean shouldApply = MessageDialog.openQuestion(shell,
+ ManagedBuilderUIMessages.getResourceString("BuildPropertyPage.changes.save.title"), //$NON-NLS-1$
+ ManagedBuilderUIMessages.getFormattedString("BuildPropertyPage.changes.save.question", //$NON-NLS-1$
+ new String[] {selectedConfiguration.getName(), newConfig.getName()}));
+ if (shouldApply) {
+ if (performOk()) {
+ fOptionBlock.setDirty(false);
+ } else {
+ MessageDialog.openWarning(shell,
+ ManagedBuilderUIMessages.getResourceString("BuildPropertyPage.changes.save.title"), //$NON-NLS-1$
+ ManagedBuilderUIMessages.getResourceString("BuildPropertyPage.changes.save.error")); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ // Set the new selected configuration
+ selectedConfiguration = newConfig;
+ ManagedBuildManager.setSelectedConfiguration(getProject(), selectedConfiguration);
+ // Set the current Resource Configuration
+ setCurrentResourceConfig(findCurrentResourceConfig());
+
+ isExcluded = getCurrentResourceConfig().isExcluded();
+ fOptionBlock.updateValues();
+ excludedCheckBox.setSelection(isExcluded);
+ }
+ }
+ return;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+
+
+ protected void performDefaults() {
+ fOptionBlock.performDefaults();
+ excludedCheckBox.setSelection(getCurrentResourceConfig().isExcluded());
+ super.performDefaults();
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+
+ // If the user did not visit this page, then there is nothing to do.
+ if (!displayedConfig) return true;
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ fOptionBlock.performApply(monitor);
+ }
+ };
+ IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(runnable);
+ try {
+ new ProgressMonitorDialog(getShell()).run(false, true, op);
+ } catch (InvocationTargetException e) {
+ Throwable e1 = e.getTargetException();
+ ManagedBuilderUIPlugin.errorDialog(getShell(), ManagedBuilderUIMessages.getResourceString("ManagedProjectPropertyPage.internalError"),e1.toString(), e1); //$NON-NLS-1$
+ return false;
+ } catch (InterruptedException e) {
+ // cancelled
+ return false;
+ }
+
+ // Write out the build model info
+ ManagedBuildManager.setDefaultConfiguration(getProject(), getSelectedConfiguration());
+ if ( getCurrentResourceConfig().isExcluded() != isExcluded() ) {
+ getCurrentResourceConfig().setExclude(isExcluded());
+ selectedConfiguration.setRebuildState(true);
+ }
+
+ ManagedBuildManager.saveBuildInfo(getProject(), false);
+ return true;
+ }
+
+ private void populateConfigurations() {
+
+ ManagedBuildManager.setSelectedConfiguration(getProject(), selectedConfiguration);
+ // If the config select widget is not there yet, just stop
+ if (configSelector == null)
+ return;
+
+ // Find the configurations defined for the platform
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
+ configurations = info.getManagedProject().getConfigurations();
+ if (configurations.length == 0)
+ return;
+
+ // Clear and replace the contents of the selector widget
+ configSelector.removeAll();
+ configSelector.setItems(getConfigurationNames());
+
+ // Make sure the active configuration is selected
+ IConfiguration defaultConfig = info.getDefaultConfiguration();
+ int index = configSelector.indexOf(defaultConfig.getName());
+ configSelector.select(index == -1 ? 0 : index);
+ handleConfigSelection();
+
+ }
+
+
+ /**
+ * @return Returns the currentResourceConfig.
+ */
+ public IResourceConfiguration getCurrentResourceConfig() {
+ return currentResourceConfig;
+ }
+
+ /**
+ * @param currentResourceConfig
+ * The currentResourceConfig to set.
+ */
+ public void setCurrentResourceConfig(
+ IResourceConfiguration currentResourceConfig) {
+ if (currentResourceConfig != null)
+ this.currentResourceConfig = currentResourceConfig;
+ else {
+ IFile file = (IFile) getElement();
+
+ // create a new resource configuration for this resource.
+ this.currentResourceConfig = selectedConfiguration.createResourceConfiguration(file);
+ }
+ }
+
+ // Check whether a resource configuration already exists for the current
+ // resource in selectedConfiguration.
+ // if so, return the resource configuration, otherwise return null.
+
+ public IResourceConfiguration findCurrentResourceConfig() {
+
+ IResourceConfiguration resConfigElement = null;
+
+ // Check if the selected configuration has any resourceConfigurations.
+ if (selectedConfiguration.getResourceConfigurations().length == 0)
+ return null;
+
+ IResourceConfiguration[] resourceConfigurations = selectedConfiguration
+ .getResourceConfigurations();
+ IFile file = (IFile) getElement();
+
+ // Check whether a resource configuration is already exists for the
+ // selected file.
+ for (int i = 0; i < resourceConfigurations.length; i++) {
+ resConfigElement = resourceConfigurations[i];
+ if (file.getFullPath().toString().equals(
+ resConfigElement.getResourcePath())) {
+ return resConfigElement;
+ }
+ }
+
+ return null;
+ }
+ /**
+ * @see org.eclipse.jface.preference.IPreferencePageContainer#updateButtons()
+ */
+ public void updateButtons() {
+ }
+ /**
+ * @see org.eclipse.jface.preference.IPreferencePageContainer#updateMessage()
+ */
+ public void updateMessage() {
+ }
+ /**
+ * @see org.eclipse.jface.preference.IPreferencePageContainer#updateTitle()
+ */
+ public void updateTitle() {
+ }
+
+ public void updateContainer() {
+ fOptionBlock.update();
+ setValid(fOptionBlock.isValid());
+ setErrorMessage(fOptionBlock.getErrorMessage());
+ }
+
+ public boolean isValid() {
+ updateContainer();
+ return super.isValid();
+ }
+
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ fOptionBlock.setVisible(visible);
+ if (visible) {
+ fOptionBlock.updateValues();
+ displayedConfig = true;
+ }
+ }
+
+ public IPreferenceStore getPreferenceStore()
+ {
+ return fOptionBlock.getPreferenceStore();
+ }
+
+ /* (non-Javadoc)
+ * Return the IPreferenceStore of the Tool Settings block
+ */
+ public IPreferenceStore getToolSettingsPreferenceStore()
+ {
+ return fOptionBlock.getToolSettingsPreferenceStore();
+ }
+ public Preferences getPreferences()
+ {
+ return null;
+ }
+ public void enableConfigSelection (boolean enable) {
+ configSelector.setEnabled(enable);
+ }
+ /**
+ * @return Returns the isExcluded.
+ */
+ public boolean isExcluded() {
+ return isExcluded;
+ }
+ /**
+ * @param isExcluded The isExcluded to set.
+ */
+ public void setExcluded(boolean isExcluded) {
+ this.isExcluded = isExcluded;
+ }
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListContentProvider.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListContentProvider.java
index 88acea5bb02..f67a93c39e2 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListContentProvider.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListContentProvider.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * Copyright (c) 2002,2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -11,16 +9,22 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
* Timesys - Initial API and implementation
* IBM Rational Software
* *********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.properties;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
public class ToolListContentProvider implements ITreeContentProvider{
+ public static final int FILE = 0x1;
+ public static final int PROJECT = 0x4;
private static Object[] EMPTY_ARRAY = new Object[0];
- private IConfiguration root;
+ private IConfiguration configRoot;
+ private IResourceConfiguration resConfigRoot;
+ private int elementType;
/**
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
@@ -28,6 +32,9 @@ public class ToolListContentProvider implements ITreeContentProvider{
public void dispose() {
}
+ public ToolListContentProvider(int elementType) {
+ this.elementType = elementType;
+ }
/**
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
*/
@@ -36,7 +43,11 @@ public class ToolListContentProvider implements ITreeContentProvider{
if (parentElement instanceof IConfiguration) {
IConfiguration config = (IConfiguration)parentElement;
// the categories are all accessed through the tools
- return config.getTools();
+ return config.getFilteredTools();
+ } else if( parentElement instanceof IResourceConfiguration) {
+ // If parent is a resource configuration, return a list of its tools
+ IResourceConfiguration resConfig = (IResourceConfiguration)parentElement;
+ return resConfig.getTools();
} else if (parentElement instanceof ITool) {
// If this is a tool, return the categories it contains
ITool tool = (ITool)parentElement;
@@ -67,7 +78,10 @@ public class ToolListContentProvider implements ITreeContentProvider{
IOptionCategory parent = cat.getOwner();
// Then we need to get the configuration we belong to
if (parent == null) {
- return root;
+ if(elementType == FILE)
+ return resConfigRoot;
+ else
+ return configRoot;
}
return parent;
}
@@ -85,7 +99,14 @@ public class ToolListContentProvider implements ITreeContentProvider{
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- root = (IConfiguration) newInput;
+ if(elementType == FILE) {
+ resConfigRoot = (IResourceConfiguration)newInput;
+ configRoot = null;
+ }
+ else if(elementType == PROJECT) {
+ configRoot = (IConfiguration) newInput;
+ resConfigRoot = null;
+ }
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListLabelProvider.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListLabelProvider.java
index b2f85d94b27..e9d00a093d0 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListLabelProvider.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListLabelProvider.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.ui.properties;
-
/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * Copyright (c) 2002,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -10,6 +8,7 @@ package org.eclipse.cdt.managedbuilder.ui.properties;
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.properties;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITool;
@@ -18,7 +17,7 @@ import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
-class ToolListLabelProvider extends LabelProvider {
+public class ToolListLabelProvider extends LabelProvider {
private final Image IMG_TOOL = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_BUILD_TOOL);
private final Image IMG_CAT = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_BUILD_CAT);
private static final String TREE_LABEL = "BuildPropertyPage.label.ToolTree"; //$NON-NLS-1$
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
index 950908890d4..2f47bf7a7db 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/CProjectPlatformPage.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.ui.wizards;
-
/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * Copyright (c) 2002,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -10,14 +8,16 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.wizards;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderHelpContextIds;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
@@ -45,7 +45,7 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.help.WorkbenchHelp;
/**
- * Class that implements the target and configuration selection page in the new
+ * Class that implements the project type and configuration selection page in the new
* project wizard for managed builder projects.
*
* @since 1.2
@@ -65,11 +65,11 @@ public class CProjectPlatformPage extends WizardPage {
protected NewManagedProjectWizard parentWizard;
protected Combo platformSelection;
private ArrayList selectedConfigurations;
- protected ITarget selectedTarget;
+ protected IProjectType selectedProjectType;
protected Button showAll;
protected CheckboxTableViewer tableViewer;
- protected String[] targetNames;
- protected ArrayList targets;
+ protected String[] projectTypeNames;
+ protected ArrayList projectTypes;
/**
* Constructor.
@@ -79,7 +79,7 @@ public class CProjectPlatformPage extends WizardPage {
public CProjectPlatformPage(String pageName, NewManagedProjectWizard parentWizard) {
super(pageName);
setPageComplete(false);
- selectedTarget = null;
+ selectedProjectType = null;
selectedConfigurations = new ArrayList(0);
this.parentWizard = parentWizard;
}
@@ -141,14 +141,14 @@ public class CProjectPlatformPage extends WizardPage {
WorkbenchHelp.setHelp(composite, ManagedBuilderHelpContextIds.MAN_PROJ_PLATFORM_HELP);
// Create the widgets
- createTargetSelectGroup(composite);
+ createTypeSelectGroup(composite);
createConfigSelectionGroup(composite);
createShowAllGroup(composite);
- // Select the first target in the list
- populateTargets();
+ // Select the first project type in the list
+ populateTypes();
platformSelection.select(0);
- handleTargetSelection();
+ handleTypeSelection();
// Do the nasty
setErrorMessage(null);
@@ -168,9 +168,9 @@ public class CProjectPlatformPage extends WizardPage {
showAll.setText(ManagedBuilderUIMessages.getResourceString(SHOWALL_LABEL));
showAll.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
- populateTargets();
+ populateTypes();
platformSelection.select(0);
- handleTargetSelection();
+ handleTypeSelection();
}
});
showAll.addDisposeListener(new DisposeListener() {
@@ -180,7 +180,7 @@ public class CProjectPlatformPage extends WizardPage {
});
}
- private void createTargetSelectGroup(Composite parent) {
+ private void createTypeSelectGroup(Composite parent) {
// Create the group composite
Composite composite = new Composite(parent, SWT.NULL);
composite.setFont(parent.getFont());
@@ -197,7 +197,7 @@ public class CProjectPlatformPage extends WizardPage {
platformSelection.setToolTipText(ManagedBuilderUIMessages.getResourceString(TARGET_TIP));
platformSelection.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
- handleTargetSelection();
+ handleTypeSelection();
}
});
platformSelection.addDisposeListener(new DisposeListener() {
@@ -227,13 +227,13 @@ public class CProjectPlatformPage extends WizardPage {
}
/**
- * Returns the name of the selected platform.
+ * Returns the selected project type.
*
- * @return String containing platform name or <code>null</code> if an invalid selection
+ * @return IProjectType Selected type or <code>null</code> if an invalid selection
* has been made.
*/
- public ITarget getSelectedTarget() {
- return selectedTarget;
+ public IProjectType getSelectedProjectType() {
+ return selectedProjectType;
}
private void handleConfigurationSelectionChange() {
@@ -250,16 +250,16 @@ public class CProjectPlatformPage extends WizardPage {
* @return <code>true</code> if all controls are valid, and
* <code>false</code> if at least one is invalid
*/
- protected void handleTargetSelection() {
+ protected void handleTypeSelection() {
/*
- * The index in the combo is the offset into the target list
+ * The index in the combo is the offset into the project type list
*/
int index;
if (platformSelection != null
&& (index = platformSelection.getSelectionIndex()) != -1) {
- if (selectedTarget != (ITarget) targets.get(index)) {
- selectedTarget = (ITarget) targets.get(index);
- parentWizard.updateTargetProperties();
+ if (selectedProjectType != (IProjectType) projectTypes.get(index)) {
+ selectedProjectType = (IProjectType) projectTypes.get(index);
+ parentWizard.updateProjectTypeProperties();
}
}
populateConfigurations();
@@ -271,59 +271,66 @@ public class CProjectPlatformPage extends WizardPage {
* By default, all the configurations are selected.
*/
private void populateConfigurations() {
- // Make the root of the content provider the new target
- tableViewer.setInput(selectedTarget);
+ // Make the root of the content provider the new project type
+ tableViewer.setInput(selectedProjectType);
tableViewer.setAllChecked(true);
handleConfigurationSelectionChange();
}
/* (non-Javadoc)
- * Extracts the names from the targets that are valid for the wizard
+ * Extracts the names from the project types that are valid for the wizard
* session and populates the combo widget with them.
*/
- private void populateTargetNames() {
- targetNames = new String[targets.size()];
- ListIterator iter = targets.listIterator();
+ private void populateTypeNames() {
+ projectTypeNames = new String[projectTypes.size()];
+ ListIterator iter = projectTypes.listIterator();
int index = 0;
while (iter.hasNext()) {
- targetNames[index++] = ((ITarget) iter.next()).getName();
+ projectTypeNames[index++] = ((IProjectType) iter.next()).getName();
}
// Now setup the combo
platformSelection.removeAll();
- platformSelection.setItems(targetNames);
+ platformSelection.setItems(projectTypeNames);
}
/* (non-Javadoc)
- * Collects all the valid targets for the platform Eclipse is running on
+ * Collects all the valid project types for the platform Eclipse is running on
*/
- private void populateTargets() {
+ private void populateTypes() {
// Get a list of platforms defined by plugins
- ITarget[] allTargets = ManagedBuildManager.getDefinedTargets(null);
- targets = new ArrayList();
+ IProjectType[] allProjectTypes = ManagedBuildManager.getDefinedProjectTypes();
+ projectTypes = new ArrayList();
String os = Platform.getOS();
String arch = Platform.getOSArch();
- // Add all of the concrete targets to the target list
- for (int index = 0; index < allTargets.length; ++index) {
- ITarget target = allTargets[index];
- if (!target.isAbstract() && !target.isTestTarget()) {
+ // Add all of the concrete project types to the list
+ for (int index = 0; index < allProjectTypes.length; ++index) {
+ IProjectType type = allProjectTypes[index];
+ if (!type.isAbstract() && !type.isTestProjectType()) {
// If the check box is selected show all the targets
if (showAll != null && showAll.getSelection() == true) {
- targets.add(target);
+ projectTypes.add(type);
} else {
// Apply the OS and ARCH filters to determine if the target should be shown
- List targetOSList = Arrays.asList(target.getTargetOSList());
- if (targetOSList.contains("all") || targetOSList.contains(os)) { //$NON-NLS-1$
- List targetArchList = Arrays.asList(target.getTargetArchList());
- if (targetArchList.contains("all") || targetArchList.contains(arch)) { //$NON-NLS-1$
- targets.add(target);
+ // Determine if the project type has any configuration with a tool-chain
+ // that supports this OS & Architecture.
+ IConfiguration[] configs = type.getConfigurations();
+ for (int j = 0; j < configs.length; ++j) {
+ IToolChain tc = configs[j].getToolChain();
+ List osList = Arrays.asList(tc.getOSList());
+ if (osList.contains("all") || osList.contains(os)) { //$NON-NLS-1$
+ List archList = Arrays.asList(tc.getArchList());
+ if (archList.contains("all") || archList.contains(arch)) { //$NON-NLS-1$
+ projectTypes.add(type);
+ break;
+ }
}
}
}
}
}
- targets.trimToSize();
- populateTargetNames();
+ projectTypes.trimToSize();
+ populateTypeNames();
}
/**
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConfigurationContentProvider.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConfigurationContentProvider.java
index 27db61034bd..c800b9f43c1 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConfigurationContentProvider.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/ConfigurationContentProvider.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.ui.wizards;
-
/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * Copyright (c) 2002,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -10,9 +8,10 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.wizards;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
@@ -20,7 +19,7 @@ public class ConfigurationContentProvider implements IStructuredContentProvider
// The contents of the parent of the table is a list of configurations
public Object[] getElements(Object parent) {
// The content is a list of configurations
- IConfiguration[] configs = ((ITarget) parent).getConfigurations();
+ IConfiguration[] configs = ((IProjectType) parent).getConfigurations();
return (configs.length == 0) ? new Object[0] : configs;
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java
index c2198773196..35cc4d7397a 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.ui.wizards;
-
/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * Copyright (c) 2002,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -10,6 +8,7 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.wizards;
import java.util.Iterator;
import java.util.List;
@@ -43,7 +42,7 @@ public class NewManagedProjectOptionPage extends NewCProjectWizardOptionPage {
parent = parentPage;
}
- public void updateTargetProperties() {
+ public void updateProjectTypeProperties() {
// Update the error parser list
if (errorParsers != null) {
errorParsers.updateValues();
@@ -55,8 +54,13 @@ public class NewManagedProjectOptionPage extends NewCProjectWizardOptionPage {
*/
protected void addTabs() {
addTab(new ReferenceBlock());
- errorParsers = new ErrorParserBlock();
- addTab(errorParsers);
+ // NOTE: The setting of error parsers is commented out here
+ // because they need to be set per-configuration.
+ // The other tabs on this page are per-project.
+ // Error parsers can be selected per configuration in the
+ // project properties
+ //errorParsers = new ErrorParserBlock();
+ //addTab(errorParsers);
addTab(indexBlock = new IndexerBlock());
}
@@ -112,9 +116,9 @@ public class NewManagedProjectOptionPage extends NewCProjectWizardOptionPage {
return ManagedBuilderUIPlugin.getDefault().getPluginPreferences();
}
- public void updateTargetProperties() {
+ public void updateProjectTypeProperties() {
// Update the error parser list
- optionBlock.updateTargetProperties();
+ optionBlock.updateProjectTypeProperties();
}
public void setupHelpContextIds(){
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java
index 2fa2b165860..3ca45f48be2 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java
@@ -1,7 +1,5 @@
-package org.eclipse.cdt.managedbuilder.ui.wizards;
-
/**********************************************************************
- * Copyright (c) 2002,2004 Rational Software Corporation and others.
+ * Copyright (c) 2002,2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -10,14 +8,16 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
* Contributors:
* IBM Rational Software - Initial API and implementation
* **********************************************************************/
-
-import java.util.Random;
+package org.eclipse.cdt.managedbuilder.ui.wizards;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.managedbuilder.core.BuildException;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ITarget;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
@@ -55,7 +55,7 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
protected static final String SETTINGS_DESC = "MngMakeWizardSettings.description"; //$NON-NLS-1$
// Wizard pages
- protected CProjectPlatformPage targetConfigurationPage;
+ protected CProjectPlatformPage projectConfigurationPage;
protected NewManagedProjectOptionPage optionPage;
public NewManagedProjectWizard() {
@@ -71,10 +71,10 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
super.addPages();
// Add the configuration selection page
- targetConfigurationPage = new CProjectPlatformPage(PREFIX, this);
- targetConfigurationPage.setTitle(ManagedBuilderUIMessages.getResourceString(CONF_TITLE));
- targetConfigurationPage.setDescription(ManagedBuilderUIMessages.getResourceString(CONF_DESC));
- addPage(targetConfigurationPage);
+ projectConfigurationPage = new CProjectPlatformPage(PREFIX, this);
+ projectConfigurationPage.setTitle(ManagedBuilderUIMessages.getResourceString(CONF_TITLE));
+ projectConfigurationPage.setDescription(ManagedBuilderUIMessages.getResourceString(CONF_DESC));
+ addPage(projectConfigurationPage);
// Add the options (tabbed) page
optionPage = new NewManagedProjectOptionPage(PREFIX, this);
@@ -97,9 +97,9 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
optionPage.setupHelpContextIds();
}
}
- public void updateTargetProperties() {
+ public void updateProjectTypeProperties() {
// Update the error parser list
- optionPage.updateTargetProperties();
+ optionPage.updateProjectTypeProperties();
}
protected void doRun(IProgressMonitor monitor) throws CoreException {
@@ -120,40 +120,42 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
ManagedBuilderUIPlugin.log(e);
}
- // Add the target to the project
- ITarget newTarget = null;
+ // Add the ManagedProject to the project
+ IManagedProject newManagedProject = null;
try {
ManagedBuildManager.createBuildInfo(newProject);
- ITarget parent = targetConfigurationPage.getSelectedTarget();
- newTarget = ManagedBuildManager.createTarget(newProject, parent);
- if (newTarget != null) {
- ICDescriptor desc = null;
- try {
- desc = CCorePlugin.getDefault().getCProjectDescription(newProject, true);
- desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
- desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, newTarget.getBinaryParserId());
- } catch (CoreException e) {
- ManagedBuilderUIPlugin.log(e);
- }
- newTarget.setArtifactName(getBuildGoalName());
- IConfiguration [] selectedConfigs = targetConfigurationPage.getSelectedConfigurations();
- Random r = new Random();
- r.setSeed(System.currentTimeMillis());
+ IProjectType parent = projectConfigurationPage.getSelectedProjectType();
+ newManagedProject = ManagedBuildManager.createManagedProject(newProject, parent);
+ if (newManagedProject != null) {
+ IConfiguration [] selectedConfigs = projectConfigurationPage.getSelectedConfigurations();
for (int i = 0; i < selectedConfigs.length; i++) {
IConfiguration config = selectedConfigs[i];
- int id = r.nextInt();
- if (id < 0) {
- id *= -1;
- }
- newTarget.createConfiguration(config, config.getId() + "." + id); //$NON-NLS-1$
+ int id = ManagedBuildManager.getRandomNumber();
+ IConfiguration newConfig = newManagedProject.createConfiguration(config, config.getId() + "." + id); //$NON-NLS-1$
+ newConfig.setArtifactName(newManagedProject.getDefaultArtifactName());
}
// Now add the first config in the list as the default
- IConfiguration[] newConfigs = newTarget.getConfigurations();
+ IConfiguration[] newConfigs = newManagedProject.getConfigurations();
if (newConfigs.length > 0) {
ManagedBuildManager.setDefaultConfiguration(newProject, newConfigs[0]);
+ ManagedBuildManager.setSelectedConfiguration(newProject, newConfigs[0]);
}
- ManagedBuildManager.setSelectedTarget(newProject, newTarget);
ManagedBuildManager.setNewProjectVersion(newProject);
+ ICDescriptor desc = null;
+ try {
+ desc = CCorePlugin.getDefault().getCProjectDescription(newProject, true);
+ desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
+ // TODO: The binary parser setting is currently per-project in the rest of CDT.
+ // In the MBS, it is per-coonfiguration. For now, select the binary parser of the
+ // first configuration.
+ if (newConfigs.length > 0) {
+ IToolChain tc = newConfigs[0].getToolChain();
+ ITargetPlatform targetPlatform = tc.getTargetPlatform();
+ desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, targetPlatform.getBinaryParserId());
+ }
+ } catch (CoreException e) {
+ ManagedBuilderUIPlugin.log(e);
+ }
}
} catch (BuildException e) {
ManagedBuilderUIPlugin.log(e);
@@ -170,19 +172,6 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
monitor.done();
}
- /**
- * @return
- */
- private String getBuildGoalName() {
- String name = new String();
- // Check for spaces
- String[] tokens = newProject.getName().split("\\s"); //$NON-NLS-1$
- for (int index = 0; index < tokens.length; ++index) {
- name += tokens[index];
- }
- return name;
- }
-
/* (non-Javadoc)
* @see org.eclipse.cdt.ui.wizards.NewCProjectWizard#doRunPrologue(org.eclipse.core.runtime.IProgressMonitor)
*/
@@ -211,8 +200,8 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
return ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID;
}
- public ITarget getSelectedTarget() {
- return targetConfigurationPage.getSelectedTarget();
+ public IProjectType getSelectedProjectType() {
+ return projectConfigurationPage.getSelectedProjectType();
}
}

Back to the top