1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Second set of changes for multiple input & output

Gnu definitions are updated to use new schema elements
This commit is contained in:
Leo Treggiari 2005-05-09 03:37:42 +00:00
parent 05adf9b805
commit 5bde16a1f9
50 changed files with 1831 additions and 454 deletions

View file

@ -1,8 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="tests"/>
<classpathentry kind="src" path="suite"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="tests">
<attributes>
</attributes>
</classpathentry>
<classpathentry kind="src" path="suite">
<attributes>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
</attributes>
</classpathentry>
<classpathentry excluding="tests/|suite/" kind="src" path="">
<attributes>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<attributes>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -16,6 +16,7 @@
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.ui.ide"/>
<import plugin="org.eclipse.compare"/>
</requires>
<!-- Managed Make Builder Tool Specifications - CDT 2.0 format -->
@ -1203,8 +1204,8 @@
<projectType
isAbstract="false"
isTest="true"
name="testgnu.exe"
id="cdt.managedbuild.target.testgnu.exe">
name="testgnu21.exe"
id="cdt.managedbuild.target.testgnu21.exe">
<configuration
name="Dbg"
id="cdt.managedbuild.config.testgnu.exe.debug"
@ -1343,8 +1344,8 @@
<projectType
isAbstract="false"
isTest="true"
name="testgnu.so"
id="cdt.managedbuild.target.testgnu.so">
name="testgnu21.so"
id="cdt.managedbuild.target.testgnu21.so">
<configuration
name="Debug"
cleanCommand="rm -rf"
@ -1511,9 +1512,9 @@
<projectType
isTest="true"
name="testgnu.lib"
name="testgnu21.lib"
isAbstract="false"
id="cdt.managedbuild.target.testgnu.lib">
id="cdt.managedbuild.target.testgnu21.lib">
<configuration
name="Dbg"
artifactExtension="a"

View file

@ -0,0 +1,43 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
ROOT := ..
-include $(ROOT)/makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include $(SUBDIRS:%=%/subdir.mk)
-include objects.mk
ifneq ($(strip $(DEPS)),)
-include $(DEPS)
endif
-include $(ROOT)/makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: lib.a
# Tool invocations
lib.a: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: archiver.gnu'
@echo ar -r lib.a $(OBJS) $(USER_OBJS) $(LIBS)
@ar -r lib.a $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(OBJS)$(DEPS) lib.a
-@echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include $(ROOT)/makefile.targets

View file

@ -0,0 +1,7 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
LIBS :=
USER_OBJS :=

View file

@ -0,0 +1,15 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
C_SRCS :=
S_UPPER_SRCS :=
O_SRCS :=
S_SRCS :=
OBJS :=
DEPS :=
# Every subdirectory with source files must be described here
SUBDIRS := \
. \

View file

@ -0,0 +1,34 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
$(ROOT)/f1.c \
$(ROOT)/f2.c
OBJS += \
${addprefix ./, \
f1.o \
f2.o \
}
DEPS += \
${addprefix ./, \
f1.d \
f2.d \
}
# Each subdirectory must supply rules for building sources it contributes
%.o: $(ROOT)/%.c
@echo 'Building file: $<'
@echo 'Invoking: compiler.gnu.c'
@echo gcc -O0 -g3 -Wall -c -fmessage-length=0 -o$@ $<
@gcc -O0 -g3 -Wall -c -fmessage-length=0 -o$@ $< && \
echo -n $(@:%.o=%.d) $(dir $@) > $(@:%.o=%.d) && \
gcc -MM -MG -P -w -O0 -g3 -Wall -c -fmessage-length=0 $< >> $(@:%.o=%.d)
@echo 'Finished building: $<'
@echo ' '

View file

@ -0,0 +1,8 @@
#include <stdio.h>
#include "test_ar.h"
void f1_ar()
{
printf ( "Hello from f1_ar.\n" ) ;
return ;
}

View file

@ -0,0 +1,8 @@
#include <stdio.h>
#include "test_ar.h"
void f2_ar()
{
printf ( "Hello from f2_ar.\n" ) ;
return ;
}

View file

@ -0,0 +1,2 @@
void f1_ar() ;
void f2_ar() ;

View file

@ -0,0 +1,8 @@
#include <stdio.h>
#include "test_ar.h"
void f1_ar()
{
printf ( "Hello from f1_ar.\n" ) ;
return ;
}

View file

@ -0,0 +1,8 @@
#include <stdio.h>
#include "test_ar.h"
void f2_ar()
{
printf ( "Hello from f2_ar.\n" ) ;
return ;
}

View file

@ -0,0 +1,2 @@
void f1_ar() ;
void f2_ar() ;

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004 Intel Corporation and others.
* Copyright (c) 2004, 2005 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
@ -11,6 +11,8 @@
package org.eclipse.cdt.managedbuilder.testplugin;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.zip.ZipFile;
@ -18,23 +20,37 @@ import java.util.zip.ZipFile;
import junit.framework.Assert;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
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.IFile;
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.IStatus;
import org.eclipse.core.runtime.Path;
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;
//import org.eclipse.compare.structuremergeviewer.Differencer;
//import org.eclipse.compare.ResourceNode;;
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.
@ -43,12 +59,15 @@ public class ManagedBuildTestHelper {
* @return
* @throws CoreException
*/
static public IProject createProject(String name) throws CoreException {
static public IProject createProject(String name, IPath location, String projectId, String projectTypeId) throws CoreException {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject newProjectHandle = root.getProject(name);
IProject project = null;
if (!newProjectHandle.exists()) {
if (projectId.equals(ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID)) {
project = createNewManagedProject(newProjectHandle, name, location, projectId, projectTypeId);
} else {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceDescription workspaceDesc = workspace.getDescription();
workspaceDesc.setAutoBuilding(false);
@ -56,6 +75,7 @@ public class ManagedBuildTestHelper {
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;
@ -94,15 +114,20 @@ public class ManagedBuildTestHelper {
}
}
static public IProject createProject(String projectName, File zip) throws CoreException, InvocationTargetException, IOException {
static public IProject createProject(String projectName, File zip, IPath location, String projectTypeId) 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);
IPath destPath = (location != null) ?
location :
project.getFullPath();
if (zip != null) {
importFilesFromZip(new ZipFile(zip), destPath, null);
}
return createProject(projectName);
return createProject(projectName, location, ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID, projectTypeId);
}
static public void importFilesFromZip(ZipFile srcZipFile, IPath destPath, IProgressMonitor monitor) throws InvocationTargetException {
@ -116,6 +141,234 @@ public class ManagedBuildTestHelper {
op.run(monitor);
} catch (InterruptedException e) {
// should not happen
Assert.assertTrue(false);
}
}
static public IProject createNewManagedProject(IProject newProjectHandle, String name, IPath location,
String projectId, String projectTypeId) throws CoreException {
// Create the base project
IProject project = null;
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceDescription workspaceDesc = workspace.getDescription();
workspaceDesc.setAutoBuilding(false);
workspace.setDescription(workspaceDesc);
IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
if (location != null) {
description.setLocation(location);
}
project = CCorePlugin.getDefault().createCProject(description, newProjectHandle, new NullProgressMonitor(), projectId);
// Add the managed build nature and builder
addManagedBuildNature(project);
// Find the base project type definition
IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
IProjectType projType = ManagedBuildManager.getProjectType(projectTypeId);
Assert.assertNotNull(projType);
// Create the managed-project (.cdtbuild) for our project that builds an executable.
IManagedProject newProject = null;
try {
newProject = ManagedBuildManager.createManagedProject(project, projType);
} catch (Exception e) {
Assert.fail("Failed to create managed project for: " + project.getName());
}
Assert.assertEquals(newProject.getName(), projType.getName());
Assert.assertFalse(newProject.equals(projType));
ManagedBuildManager.setNewProjectVersion(project);
// Copy over the configs
IConfiguration defaultConfig = null;
IConfiguration[] configs = projType.getConfigurations();
for (int i = 0; i < configs.length; ++i) {
// Make the first configuration the default
if (i == 0) {
defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i);
} else {
newProject.createConfiguration(configs[i], projType.getId() + "." + i);
}
}
ManagedBuildManager.setDefaultConfiguration(project, defaultConfig);
// Initialize the path entry container
IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project);
if (initResult.getCode() != IStatus.OK) {
Assert.fail("Initializing build information failed for: " + project.getName() + " because: " + initResult.getMessage());
}
return project;
}
static public void addManagedBuildNature (IProject project) {
// Create the buildinformation object for the project
IManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
info.setValid(true);
// Add the managed build nature
try {
ManagedCProjectNature.addManagedNature(project, new NullProgressMonitor());
ManagedCProjectNature.addManagedBuilder(project, new NullProgressMonitor());
} catch (CoreException e) {
Assert.fail("Test failed on adding managed build nature or builder: " + e.getLocalizedMessage());
}
// Associate the project with the managed builder so the clients can get proper information
ICDescriptor desc = null;
try {
desc = CCorePlugin.getDefault().getCProjectDescription(project, true);
desc.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
} catch (CoreException e) {
Assert.fail("Test failed on adding managed builder as scanner info provider: " + e.getLocalizedMessage());
}
try {
desc.saveProjectData();
} catch (CoreException e) {
Assert.fail("Test failed on saving the ICDescriptor data: " + e.getLocalizedMessage()); }
}
static public void compareBenchmarks(IProject project, IPath testDir, IPath[] files) {
try {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (Exception e) {
Assert.fail("File " + files[0].lastSegment() + " - project refresh failed.");
}
for (int i=0; i<files.length; i++) {
IPath testFile = testDir.append(files[i]);
IPath benchmarkFile = Path.fromOSString("Benchmarks/" + files[i]);
StringBuffer testBuffer = readContentsStripLineEnds(project, testFile);
StringBuffer benchmarkBuffer = readContentsStripLineEnds(project, benchmarkFile);
if (!testBuffer.toString().equals(benchmarkBuffer.toString())) {
Assert.fail("File " + testFile.lastSegment() + " does not match its benchmark.");
}
}
}
static public StringBuffer readContentsStripLineEnds(IProject project, IPath path) {
StringBuffer buff = new StringBuffer();
IFile file = project.getFile(path);
IWorkspaceRoot root = project.getWorkspace().getRoot();
IPath fullPath = root.getLocation();
fullPath = fullPath.append(file.getFullPath());
try {
FileReader input = null;
try {
input = new FileReader(fullPath.toFile());
} catch (Exception e) {
Assert.fail("File " + fullPath.toString() + " could not be read.");
}
//InputStream input = file.getContents(true);
int c;
do {
c = input.read();
if (c == -1) break;
if (c != '\r' && c != '\n') {
buff.append((char)c);
}
} while (c != -1);
input.close();
} catch (Exception e) {
Assert.fail("File " + file.toString() + " could not be read.");
}
return buff;
}
static public IPath copyFilesToTempDir(IPath srcDir, IPath tmpSubDir, IPath[] files) {
IPath tmpSrcDir = null;
String userDirStr = System.getProperty("user.home");
if (userDirStr != null) {
IPath userDir = Path.fromOSString(userDirStr);
tmpSrcDir = userDir.append(tmpSubDir);
if (userDir.toString().equalsIgnoreCase(tmpSrcDir.toString())) {
Assert.fail("Temporary sub-directory cannot be the empty string.");
} else {
File tmpSrcDirFile = tmpSrcDir.toFile();
if (tmpSrcDirFile.exists()) {
// Make sure that this is the expected directory before we delete it...
if (tmpSrcDir.lastSegment().equals(tmpSubDir.lastSegment())) {
deleteDirectory(tmpSrcDirFile);
} else {
Assert.fail("Temporary directory " + tmpSrcDirFile.toString() + " already exists.");
}
}
boolean succeed = tmpSrcDirFile.mkdir();
if (succeed) {
for (int i=0; i<files.length; i++) {
IPath file = files[i];
IPath srcFile = srcDir.append(file);
FileReader srcReader = null;
try {
srcReader = new FileReader(srcFile.toFile());
} catch (Exception e) {
Assert.fail("File " + file.toString() + " could not be read.");
}
if (file.segmentCount() > 1) {
IPath newDir = tmpSrcDir;
do {
IPath dir = file.uptoSegment(1);
newDir = newDir.append(dir);
file = file.removeFirstSegments(1);
succeed = newDir.toFile().mkdir();
} while (file.segmentCount() > 1);
}
IPath destFile = tmpSrcDir.append(files[i]);
FileWriter writer = null;
try {
writer = new FileWriter(destFile.toFile());
} catch (Exception e) {
Assert.fail("File " + files[i].toString() + " could not be written.");
}
try {
int c;
do {
c = srcReader.read();
if (c == -1) break;
writer.write(c);
} while (c != -1);
srcReader.close();
writer.close();
} catch (Exception e) {
Assert.fail("File " + file.toString() + " could not be copied.");
}
}
}
}
}
return tmpSrcDir;
}
static public void deleteTempDir(IPath tmpSubDir, IPath[] files) {
IPath tmpSrcDir = null;
String userDirStr = System.getProperty("user.home");
if (userDirStr != null) {
IPath userDir = Path.fromOSString(userDirStr);
tmpSrcDir = userDir.append(tmpSubDir);
if (userDir.toString().equalsIgnoreCase(tmpSrcDir.toString())) {
Assert.fail("Temporary sub-directory cannot be the empty string.");
} else {
File tmpSrcDirFile = tmpSrcDir.toFile();
if (!tmpSrcDirFile.exists()) {
Assert.fail("Temporary directory " + tmpSrcDirFile.toString() + " does not exist.");
} else {
boolean succeed;
for (int i=0; i<files.length; i++) {
// Delete the file
IPath thisFile = tmpSrcDir.append(files[i]);
succeed = thisFile.toFile().delete();
}
// Delete the dir
succeed = tmpSrcDirFile.delete();
}
}
}
}
static private void deleteDirectory(File dir) {
File[] toDelete = dir.listFiles();
for (int i=0; i<toDelete.length; i++) {
File fileToDelete = toDelete[i];
if (fileToDelete.isDirectory()) {
deleteDirectory(fileToDelete);
}
fileToDelete.delete();
}
}
}

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* Copyright (c) 2004, 2005 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
@ -16,6 +16,7 @@ import org.eclipse.cdt.managedbuild.core.tests.ManagedBuildCoreTests20;
import org.eclipse.cdt.managedbuild.core.tests.ManagedCommandLineGeneratorTest;
import org.eclipse.cdt.managedbuild.core.tests.ManagedProjectUpdateTests;
import org.eclipse.cdt.managedbuild.core.tests.ResourceBuildCoreTests;
import org.eclipse.cdt.managedbuild.core.tests.ManagedProject21MakefileTests;
import junit.framework.Test;
import junit.framework.TestSuite;
@ -38,6 +39,7 @@ public class AllManagedBuildTests {
suite.addTest(ManagedProjectUpdateTests.suite());
suite.addTest(ManagedCommandLineGeneratorTest.suite());
suite.addTest(ResourceBuildCoreTests.suite());
suite.addTest(ManagedProject21MakefileTests.suite());
//$JUnit-END$
return suite;
}

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* Copyright (c) 2004, 2005 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
@ -18,6 +18,7 @@ import junit.framework.TestCase;
import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.MakeProjectNature;
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigNature;
import org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector;
@ -25,6 +26,7 @@ import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@ -48,7 +50,7 @@ public class ScannerConfigDiscoveryTests extends TestCase {
protected void setUp() throws Exception {
fMonitor = new NullProgressMonitor();
fCProject = ManagedBuildTestHelper.createProject("SCD");
fCProject = ManagedBuildTestHelper.createProject("SCD", (IPath)null, MakeCorePlugin.MAKE_PROJECT_ID, null);
fCFile = fCProject.getProject().getFile("main.c");
if (!fCFile.exists()) {
fCFile.create(new ByteArrayInputStream(" \n".getBytes()), false, fMonitor);

View file

@ -54,11 +54,11 @@ public class ManagedBuildCoreTests extends TestCase {
*/
public void testLoadManifest() throws Exception {
IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
exeType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.exe");
exeType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.exe");
checkExeProjectType(exeType);
dllType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.so");
dllType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.so");
checkSoProjectType(dllType);
libType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.lib");
libType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.lib");
checkLibProjectType(libType);
}

View file

@ -20,7 +20,6 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.parser.CodeReader;
import org.eclipse.cdt.core.parser.IParser;
import org.eclipse.cdt.core.parser.IScanner;
@ -62,6 +61,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
/*
* These tests exercise CDT 2.0 manifest file functionality
@ -505,7 +505,7 @@ public class ManagedBuildCoreTests20 extends TestCase {
try {
project = createProject(projectName);
// Now associate the builder with the project
addManagedBuildNature(project);
ManagedBuildTestHelper.addManagedBuildNature(project);
IProjectDescription description = project.getDescription();
// Make sure it has a managed nature
if (description != null) {
@ -731,34 +731,6 @@ public class ManagedBuildCoreTests20 extends TestCase {
assertEquals(4, i);
}
private void addManagedBuildNature (IProject project) {
// Create the buildinformation object for the project
IManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
info.setValid(true);
// Add the managed build nature
try {
ManagedCProjectNature.addManagedNature(project, new NullProgressMonitor());
ManagedCProjectNature.addManagedBuilder(project, new NullProgressMonitor());
} catch (CoreException e) {
fail("Test failed on adding managed build nature or builder: " + e.getLocalizedMessage());
}
// Associate the project with the managed builder so the clients can get proper information
ICDescriptor desc = null;
try {
desc = CCorePlugin.getDefault().getCProjectDescription(project, true);
desc.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
} catch (CoreException e) {
fail("Test failed on adding managed builder as scanner info provider: " + e.getLocalizedMessage());
}
try {
desc.saveProjectData();
} catch (CoreException e) {
fail("Test failed on saving the ICDescriptor data: " + e.getLocalizedMessage()); }
}
/**
* Tests the tool settings through the interface the makefile generator
* uses.
@ -1772,7 +1744,7 @@ public class ManagedBuildCoreTests20 extends TestCase {
try {
project = createProject(projectName2);
// Now associate the builder with the project
addManagedBuildNature(project);
ManagedBuildTestHelper.addManagedBuildNature(project);
IProjectDescription description = project.getDescription();
// Make sure it has a managed nature
if (description != null) {

View file

@ -0,0 +1,307 @@
/**********************************************************************
* Copyright (c) 2005 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
**********************************************************************/
/**********************************************************************
* These tests are for a 2.1 style tool integration. That is, the
* tool integration does not use any 3.0 elements or attributes,
* including InputType, OutputType, etc.
**********************************************************************/
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.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.ui.dialogs.IOverwriteQuery;
public class ManagedProject21MakefileTests extends TestCase {
public static final String MBS_TEMP_DIR = "MBSTemp";
static boolean pathVariableCreated = false;
public ManagedProject21MakefileTests(String name) {
super(name);
}
public static Test suite() {
TestSuite suite = new TestSuite(ManagedProject21MakefileTests.class.getName());
suite.addTest(new ManagedProject21MakefileTests("testSingleFileExe"));
suite.addTest(new ManagedProject21MakefileTests("testTwoFileSO"));
suite.addTest(new ManagedProject21MakefileTests("testMultiResConfig"));
//suite.addTest(new ManagedProject21MakefileTests("testLinkedLib"));
//suite.addTest(new ManagedProject21MakefileTests("testLinkedFolder"));
return suite;
}
private IProject[] createProject(String projName, IPath location, String projectTypeId, boolean containsZip){
File testDir = CTestPlugin.getFileInPlugin(new Path("resources/test21Projects/" + projName));
if(testDir == null) {
fail("Test project directory " + testDir.getName() + " is missing.");
return null;
}
ArrayList projectList = null;
if (containsZip) {
File projectZips[] = testDir.listFiles(new FileFilter(){
public boolean accept(File pathname){
if(pathname.isDirectory())
return false;
return true;
}
});
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], location, projectTypeId);
if(project != null)
projectList.add(project);
}
catch(Exception e){
}
}
if(projectList.size() == 0) {
fail("No projects found in test project directory " + testDir.getName() + ". The .zip file may be missing or corrupt.");
return null;
}
} else {
try{
IProject project = ManagedBuildTestHelper.createProject(projName, null, location, projectTypeId);
if(project != null)
projectList = new ArrayList(1);
projectList.add(project);
} catch(Exception e){}
}
return (IProject[])projectList.toArray(new IProject[projectList.size()]);
}
private IProject[] createProjects(String projName, IPath location, String projectTypeId, boolean containsZip) {
// In case the projects need to be updated...
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(queryALL);
UpdateManagedProjectManager.setUpdateProjectQuery(queryALL);
IProject projects[] = createProject(projName, location, projectTypeId, containsZip);
return projects;
}
private void buildProjects(IProject projects[], IPath[] files) {
if(projects == null || projects.length == 0)
return;
for(int i = 0; i < projects.length; i++){
IProject curProject = projects[i];
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(curProject);
//check whether the managed build info is converted
boolean isCompatible = UpdateManagedProjectManager.isCompatibleProject(info);
assertTrue(isCompatible);
if(isCompatible){
// Build the project in order to generate the maekfiles
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());
}
//compare the generated makefiles to their benchmarks
if (files != null && files.length > 0) {
if (i == 0) {
String configName = info.getDefaultConfiguration().getName();
IPath buildDir = Path.fromOSString(configName);
ManagedBuildTestHelper.compareBenchmarks(curProject, buildDir, files);
}
}
}
}
for(int i = 0; i < projects.length; i++)
ManagedBuildTestHelper.removeProject(projects[i].getName());
}
private void createPathVariable(IPath tmpDir) {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
workspace = ResourcesPlugin.getWorkspace();
IPathVariableManager pathMan = workspace.getPathVariableManager();
String name = MBS_TEMP_DIR;
try {
if (pathMan.validateName(name).isOK() && pathMan.validateValue(tmpDir).isOK()) {
pathMan.setValue(name, tmpDir);
} else {
fail("could not create the path variable " + name);
}
} catch (Exception e) {fail("could not create the path variable " + name);}
}
private void createFileLink(IProject project, IPath tmpDir, String linkName, String fileName) {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
String name = MBS_TEMP_DIR;
if (!pathVariableCreated) {
createPathVariable(tmpDir);
pathVariableCreated = true;
}
try {
// Now we can create a linked resource relative to the defined path variable:
IFile linkF1 = project.getFile(linkName);
IPath location = new Path("MBSTemp/" + fileName);
if (workspace.validateLinkLocation(linkF1, location).isOK()) {
linkF1.createLink(location, IResource.NONE, null);
} else {
fail("could not create the link to " + name);
}
} catch (Exception e) {fail("could not create the link to " + name);}
}
/* (non-Javadoc)
* tests 2.1 style tool integration for a single file executable
*/
public void testSingleFileExe(){
IPath[] makefiles = {
Path.fromOSString("makefile"),
Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk")};
IProject[] projects = createProjects("singleFileExe", null, null, true);
buildProjects(projects, makefiles);
}
/* (non-Javadoc)
* tests 2.1 style tool integration for a two file SO
*/
public void testTwoFileSO(){
IPath[] makefiles = {
Path.fromOSString("makefile"),
Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk")};
IProject[] projects = createProjects("twoFileSO", null, null, true);
buildProjects(projects, makefiles);
}
/* (non-Javadoc)
* tests 2.1 style tool integration for multiple source files & a resource configuration
*/
public void testMultiResConfig(){
IPath[] makefiles = {
Path.fromOSString("makefile"),
Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk"),
Path.fromOSString("source1/subdir.mk"),
Path.fromOSString("source2/subdir.mk"),
Path.fromOSString("source2/source21/subdir.mk")};
IProject[] projects = createProjects("multiResConfig", null, null, true);
buildProjects(projects, makefiles);
}
/* (non-Javadoc)
* tests 2.1 style tool integration for linked files
*/
public void testLinkedLib(){
IPath[] makefiles = {
Path.fromOSString("makefile"),
Path.fromOSString("objects.mk"),
//Path.fromOSString("subdir.mk") // Can't compare this yet since it contains absolute paths!
Path.fromOSString("sources.mk")};
IPath[] linkedFiles = {
Path.fromOSString("f1.c"),
Path.fromOSString("f2.c"),
Path.fromOSString("test_ar.h")};
File srcDirFile = CTestPlugin.getFileInPlugin(new Path("resources/test21Projects/linkedLib/"));
IPath srcDir = Path.fromOSString(srcDirFile.toString());
IPath tmpSubDir = Path.fromOSString("CDTMBSTest");
IPath tmpDir = ManagedBuildTestHelper.copyFilesToTempDir(srcDir, tmpSubDir, linkedFiles);
try {
IProject[] projects = createProjects("linkedLib", null, "cdt.managedbuild.target.testgnu21.lib", true);
// There should be only one project. Add our linked files to it.
IProject project = projects[0];
createFileLink(project, tmpDir, "f1.c", "f1.c");
createFileLink(project, tmpDir, "f2link.c", "f2.c");
createFileLink(project, tmpDir, "test_ar.h", "test_ar.h");
// Build the project
buildProjects(projects, makefiles);
} finally {ManagedBuildTestHelper.deleteTempDir(tmpSubDir, linkedFiles);}
}
/* (non-Javadoc)
* tests 2.1 style tool integration for a linked folder
*/
public void testLinkedFolder(){
IPath[] makefiles = {
Path.fromOSString("makefile"),
Path.fromOSString("objects.mk"),
Path.fromOSString("subdir.mk"),
Path.fromOSString("sources.mk")};
IPath[] linkedFiles = {
Path.fromOSString("f1.c"),
Path.fromOSString("f2.c"),
Path.fromOSString("test_ar.h"),
Path.fromOSString("Benchmarks/makefile"),
Path.fromOSString("Benchmarks/objects.mk"),
Path.fromOSString("Benchmarks/subdir.mk"),
Path.fromOSString("Benchmarks/sources.mk")};
File srcDirFile = CTestPlugin.getFileInPlugin(new Path("resources/test21Projects/linkedFolder/"));
IPath srcDir = Path.fromOSString(srcDirFile.toString());
IPath tmpSubDir = Path.fromOSString("CDTMBSTest");
IPath tmpDir = ManagedBuildTestHelper.copyFilesToTempDir(srcDir, tmpSubDir, linkedFiles);
if (!pathVariableCreated) {
createPathVariable(tmpDir);
pathVariableCreated = true;
}
try {
IPath location = Path.fromOSString(MBS_TEMP_DIR);
IProject[] projects = createProjects("linkedFolder", location, "cdt.managedbuild.target.testgnu21.lib", false);
// Build the project
buildProjects(projects, makefiles);
} finally {ManagedBuildTestHelper.deleteTempDir(tmpSubDir, linkedFiles);}
}
}

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004 Intel Corporation and others.
* Copyright (c) 2004, 2005 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
@ -26,6 +26,7 @@ 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.IPath;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.ui.dialogs.IOverwriteQuery;
@ -40,8 +41,10 @@ public class ManagedProjectUpdateTests extends TestCase {
suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate12_Update"));
suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate20_Update"));
suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate21_Update"));
suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate12_NoUpdate"));
suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate20_NoUpdate"));
suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate21_NoUpdate"));
return suite;
}
@ -75,7 +78,7 @@ public class ManagedProjectUpdateTests extends TestCase {
projectName = projectName.substring(0,projectName.length()-".zip".length());
if(projectName.length() == 0)
continue;
IProject project = ManagedBuildTestHelper.createProject(projectName,projectZips[i]);
IProject project = ManagedBuildTestHelper.createProject(projectName, projectZips[i], null, null);
if(project != null)
projectList.add(project);
}
@ -89,7 +92,8 @@ public class ManagedProjectUpdateTests extends TestCase {
return (IProject[])projectList.toArray(new IProject[projectList.size()]);
}
private void doTestProjectUpdate(String version, boolean updateProject, boolean overwriteBackupFiles){
private void doTestProjectUpdate(String version, boolean updateProject, boolean overwriteBackupFiles,
IPath[] files){
IOverwriteQuery queryALL = new IOverwriteQuery(){
public String queryOverwrite(String file) {
return ALL;
@ -99,8 +103,8 @@ public class ManagedProjectUpdateTests extends TestCase {
return NO_ALL;
}};
UpdateManagedProjectManager.setBackupFileOverwriteQuery(updateProject ? queryALL : queryNOALL);
UpdateManagedProjectManager.setUpdateProjectQuery(overwriteBackupFiles ? queryALL : queryNOALL);
UpdateManagedProjectManager.setBackupFileOverwriteQuery(overwriteBackupFiles ? queryALL : queryNOALL);
UpdateManagedProjectManager.setUpdateProjectQuery(updateProject ? queryALL : queryNOALL);
IProject projects[] = createVersionProjects(version);
if(projects == null || projects.length == 0)
@ -132,6 +136,15 @@ public class ManagedProjectUpdateTests extends TestCase {
catch(OperationCanceledException e){
fail("the project \"" + curProject.getName() + "\" build was cancelled, exception message: " + e.getMessage());
}
//compare the generated makefiles to their benchmarks
if (files != null && files.length > 0) {
if (i == 0) {
String configName = info.getDefaultConfiguration().getName();
IPath buildDir = Path.fromOSString(configName);
ManagedBuildTestHelper.compareBenchmarks(curProject, buildDir, files);
}
}
}
}
@ -144,7 +157,12 @@ public class ManagedProjectUpdateTests extends TestCase {
* in case when user chooses to update the project
*/
public void testProjectUpdate12_Update(){
doTestProjectUpdate("1.2",true,true);
IPath[] makefiles = {
Path.fromOSString("makefile"),
Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk")};
doTestProjectUpdate("1.2", true, true, makefiles);
}
/* (non-Javadoc)
@ -152,7 +170,26 @@ public class ManagedProjectUpdateTests extends TestCase {
* in case when user chooses to update the project
*/
public void testProjectUpdate20_Update(){
doTestProjectUpdate("2.0",true,true);
IPath[] makefiles = {
Path.fromOSString("makefile"),
Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk")};
doTestProjectUpdate("2.0", true, true, makefiles);
}
/* (non-Javadoc)
* tests project v2.1 update
* in case when user chooses to update the project
*/
public void testProjectUpdate21_Update(){
IPath[] makefiles = {
Path.fromOSString("makefile"),
Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk"),
Path.fromOSString("Functions/subdir.mk")};
doTestProjectUpdate("2.1", true, true, makefiles);
}
/* (non-Javadoc)
@ -160,7 +197,7 @@ public class ManagedProjectUpdateTests extends TestCase {
* in case when user chooses not to update the project
*/
public void testProjectUpdate12_NoUpdate(){
doTestProjectUpdate("1.2",false,true);
doTestProjectUpdate("1.2", false, true, null);
}
/* (non-Javadoc)
@ -168,6 +205,14 @@ public class ManagedProjectUpdateTests extends TestCase {
* in case when user chooses not to update the project
*/
public void testProjectUpdate20_NoUpdate(){
doTestProjectUpdate("2.0",false,true);
doTestProjectUpdate("2.0", false, true, null);
}
/* (non-Javadoc)
* tests project v2.1 update
* in case when user chooses not to update the project
*/
public void testProjectUpdate21_NoUpdate(){
doTestProjectUpdate("2.1", false, true, null);
}
}

View file

@ -17,7 +17,6 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
@ -31,6 +30,7 @@ import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
@ -84,7 +84,7 @@ public class ResourceBuildCoreTests extends TestCase {
project = createProject(projectName);
// Now associate the builder with the project
addManagedBuildNature(project);
ManagedBuildTestHelper.addManagedBuildNature(project);
IProjectDescription description = project.getDescription();
// Make sure it has a managed nature
if (description != null) {
@ -97,7 +97,7 @@ public class ResourceBuildCoreTests extends TestCase {
// Find the base project type definition
IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
IProjectType projType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.exe");
IProjectType projType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.exe");
assertNotNull(projType);
// Create the managed-project (.cdtbuild) for our project that builds an executable.
@ -271,7 +271,7 @@ public class ResourceBuildCoreTests extends TestCase {
project = createProject(projectName);
// Now associate the builder with the project
addManagedBuildNature(project);
ManagedBuildTestHelper.addManagedBuildNature(project);
IProjectDescription description = project.getDescription();
// Make sure it has a managed nature
if (description != null) {
@ -284,7 +284,7 @@ public class ResourceBuildCoreTests extends TestCase {
// Find the base project type definition
IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
IProjectType projType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.exe");
IProjectType projType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.exe");
assertNotNull(projType);
// Create the managed-project (.cdtbuild) for our project that builds an executable.
@ -372,7 +372,7 @@ public class ResourceBuildCoreTests extends TestCase {
project = createProject(projectName);
// Now associate the builder with the project
addManagedBuildNature(project);
ManagedBuildTestHelper.addManagedBuildNature(project);
IProjectDescription description = project.getDescription();
// Make sure it has a managed nature
if (description != null) {
@ -385,7 +385,7 @@ public class ResourceBuildCoreTests extends TestCase {
// Find the base project type definition
IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
IProjectType projType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.exe");
IProjectType projType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.exe");
assertNotNull(projType);
// Create the managed-project (.cdtbuild) for our project that builds an executable.
@ -624,7 +624,7 @@ public class ResourceBuildCoreTests extends TestCase {
try {
project = createProject(projectName);
// Now associate the builder with the project
addManagedBuildNature(project);
ManagedBuildTestHelper.addManagedBuildNature(project);
IProjectDescription description = project.getDescription();
// Make sure it has a managed nature
if (description != null) {
@ -637,7 +637,7 @@ public class ResourceBuildCoreTests extends TestCase {
// Find the base project type definition
IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
IProjectType projType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.exe");
IProjectType projType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.exe");
assertNotNull(projType);
// Create the managed-project (.cdtbuild) for our project that builds a dummy executable
@ -712,33 +712,4 @@ public class ResourceBuildCoreTests extends TestCase {
ManagedBuildManager.removeBuildInfo(project);
}
private void addManagedBuildNature (IProject project) {
// Create the buildinformation object for the project
IManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
info.setValid(true);
// Add the managed build nature
try {
ManagedCProjectNature.addManagedNature(project, new NullProgressMonitor());
// ManagedCProjectNature.addManagedBuilder(project, new NullProgressMonitor());
} catch (CoreException e) {
fail("Test failed on adding managed build nature or builder: " + e.getLocalizedMessage());
}
// Associate the project with the managed builder so the clients can get proper information
ICDescriptor desc = null;
try {
desc = CCorePlugin.getDefault().getCProjectDescription(project, true);
desc.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
} catch (CoreException e) {
fail("Test failed on adding managed builder as scanner info provider: " + e.getLocalizedMessage());
}
try {
desc.saveProjectData();
} catch (CoreException e) {
fail("Test failed on saving the ICDescriptor data: " + e.getLocalizedMessage()); }
}
}

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2003, 2004 IBM Corporation and others.
# Copyright (c) 2003, 2005 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
@ -14,3 +14,8 @@ providerName=Eclipse.org
GeneratedMakefileCBuilder.name=Generated Makefile Builder
ManagedBuildNature.name=Managed Builder Project
ManagedMakeProject.name=Managed Make Project
objectFileName=Object File
executableName=Executable File
staticLibraryName=Static Library
sharedLibraryName=Shared Library

View file

@ -121,4 +121,46 @@
type="text"/>
</extension>
<!-- =================================================================================== -->
<!-- Define C/C++ "object" files ContentTypes -->
<!-- =================================================================================== -->
<extension point="org.eclipse.core.runtime.contentTypes">
<!-- declares a content type for object files -->
<content-type id="compiledObjectFile" name="%objectFileName"
priority="high"/>
<!-- declares a content type for executable files -->
<content-type id="executableFile" name="%executableName"
priority="high"/>
<!-- declares a content type for static libraries -->
<content-type id="staticLibrary" name="%staticLibraryName"
priority="high"/>
<!-- declares a content type for shared libraries -->
<content-type id="sharedLibrary" name="%sharedLibraryName"
priority="high"/>
</extension>
<extension point="org.eclipse.core.runtime.contentTypes">
<file-association
content-type="org.eclipse.cdt.managedbuilder.core.compiledObjectFile"
file-extensions="obj,o"/>
</extension>
<extension point="org.eclipse.core.runtime.contentTypes">
<file-association
content-type="org.eclipse.cdt.managedbuilder.core.executableFile"
file-extensions="exe,"/>
</extension>
<extension point="org.eclipse.core.runtime.contentTypes">
<file-association
content-type="org.eclipse.cdt.managedbuilder.core.staticLibrary"
file-extensions="lib,a"/>
</extension>
<extension point="org.eclipse.core.runtime.contentTypes">
<file-association
content-type="org.eclipse.cdt.managedbuilder.core.sharedLibrary"
file-extensions="dll,so"/>
</extension>
</plugin>

View file

@ -1330,15 +1330,7 @@ If the &quot;buildPathResolver&quot; attribute is specified, the &quot;pathDelim
<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;
[Enter examples here.]
</documentation>
</annotation>

View file

@ -39,15 +39,15 @@ public interface IAdditionalInput {
public IInputType getParent();
/**
* Returns a semi-colon separated list of the relative or absolute paths of the resources
* Returns an array of the relative or absolute paths of the resources
* to which this element applies.
* The resources must be a member of the project, the output from another tool in the
* tool-chain, or an external file. The file name of the path can use GNU Make pattern
* rule syntax (in order to generate the name from the input file name).
*
* @return String
* @return String[]
*/
public String getPaths();
public String[] getPaths();
/**
* Sets semi-colon separated list of the relative or absolute paths of the resources to

View file

@ -189,18 +189,18 @@ public interface IOutputType extends IBuildObject {
public void setOutputPrefix(String prefix);
/**
* Returns the paths of the complete set of output files for this outputType
* Returns the file names of the complete set of output files for this outputType
*
* @return String
* @return String[]
*/
public String getOutputNames();
public String[] getOutputNames();
/**
* Sets the complete set of output files for this outputType
* Sets the complete set of output file names for this outputType
*
* @param names
*/
public void getOutputNames(String names);
public void setOutputNames(String names);
/**
* Returns the pattern, using the Gnu pattern rule syntax, for deriving the

View file

@ -103,6 +103,20 @@ public interface ITool extends IBuildObject {
*/
public IOption getOptionById(String id);
/**
* Get the <code>IOption</code> in the receiver with the specified
* ID, or an option with a superclass with this id.
*
* <p>If the receiver does not have an option with that ID, the method
* returns <code>null</code>. It is the responsibility of the caller to
* verify the return value.
*
* @param id unique identifier of the option to search for
* @return <code>IOption</code>
* @since 3.0
*/
public IOption getOptionBySuperClassId(String id);
/**
* Returns the complete list of options that are available for this tool.
* The list is a merging of the options specified for this tool with the
@ -187,7 +201,8 @@ public interface ITool extends IBuildObject {
/**
* Returns all of the additional input resources of all InputType children.
* Note: This does not include additional dependencies.
* Note: This does not include the primary InputType and does not include
* additional dependencies.
*
* @return IPath[]
*/
@ -195,7 +210,8 @@ public interface ITool extends IBuildObject {
/**
* Returns all of the additional dependency resources of all InputType children.
* Note: This does not include additional inputs.
* Note: This does not include the primary InputType and does not include
* additional inputs.
*
* @return IPath[]
*/

View file

@ -264,18 +264,37 @@ public interface IToolChain extends IBuildObject {
public void setScannerConfigDiscoveryProfileId(String profileId);
/**
* Returns the id in this tool-chain that creates the build artifact.
* Returns the sem-colon separated list of Tool ids containing each
* tool that can create the final build artifact (the end target of
* the build). MBS will use the first ID in the list that matches
* a Tool in the ToolChain. One reason for specifying a list, is
* that different versions of a tool can be selected based upon the
* project nature (e.g. different tool definitions for a linker for C vs. C++).
*
* @return String
*/
public String getTargetToolId();
public String getTargetToolIds();
/**
* Sets the tool in this tool-chain that creates the build artifact.
* Sets the sem-colon separated list of Tool ids containing each
* tool that can create the final build artifact (the end target of
* the build).
*
* @param targetToolId
* @param targetToolIds
*/
public void setTargetTool(String targetToolId);
public void setTargetToolIds(String targetToolIds);
/**
* Returns the list of Tool ids containing each
* tool that can create the final build artifact (the end target of
* the build). MBS will use the first ID in the list that matches
* a Tool in the ToolChain. One reason for specifying a list, is
* that different versions of a tool can be selected based upon the
* project nature (e.g. different tool definitions for a linker for C vs. C++).
*
* @return String[]
*/
public String[] getTargetToolList();
/**
* Returns the OutputTypes in this tool-chain, besides the primary

View file

@ -114,8 +114,8 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
public static final String MANIFEST_ERROR_DUPLICATE = "ManagedBuildManager.error.manifest.duplicate"; //$NON-NLS-1$
private static final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
// This is the version of the manifest and project files that
private static final PluginVersionIdentifier buildInfoVersion = new PluginVersionIdentifier(2, 1, 0);
// This is the version of the manifest and project files
private static final PluginVersionIdentifier buildInfoVersion = new PluginVersionIdentifier(3, 0, 0);
private static Map depCalculatorsMap;
private static boolean projectTypesLoaded = false;
// Project types defined in the manifest files
@ -1291,11 +1291,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
// This is a 1.2 manifest and we are compatible for now
return true;
}
// isCompatibleWith will return FALSE, if:
// o The major versions are not equal
// o The major versions are equal, but the remainder of the manifest version # is
// greater than the MBS version #
return(buildInfoVersion.isCompatibleWith(version));
return(buildInfoVersion.isGreaterOrEqualTo(version));
}
/* (non-Javadoc)
@ -1322,11 +1318,14 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
// Since 2.0 this will be a processing instruction containing version
if (rootElement.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE) {
// This is a 1.2 project and it must be updated
} else {
// Make sure that the version is compatible with the manager
fileVersion = rootElement.getNodeValue();
PluginVersionIdentifier version = new PluginVersionIdentifier(fileVersion);
if (buildInfoVersion.isGreaterThan(version)) {
// This is >= 2.0 project, but earlier than the current MBS version - it may need to be updated
} else {
// This is a
// isCompatibleWith will return FALSE, if:
// o The major versions are not equal
// o The major versions are equal, but the remainder of the .cdtbuild version # is
@ -1334,8 +1333,6 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
if (!buildInfoVersion.isCompatibleWith(version)) {
throw new BuildException(ManagedMakeMessages.getFormattedString(PROJECT_VERSION_ERROR, project.getName()));
}
if (buildInfoVersion.isGreaterThan(version)) {
// TODO Upgrade the project
}
}

View file

@ -210,8 +210,12 @@ public class AdditionalInput implements IAdditionalInput {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IAdditionalInput#getPaths()
*/
public String getPaths() {
return paths;
public String[] getPaths() {
if (paths == null) {
return null;
}
String[] nameTokens = paths.split(";"); //$NON-NLS-1$
return nameTokens;
}
/* (non-Javadoc)
@ -229,6 +233,9 @@ public class AdditionalInput implements IAdditionalInput {
* @see org.eclipse.cdt.core.build.managed.IAdditionalInput#getKind()
*/
public int getKind() {
if (kind == null) {
return KIND_ADDITIONAL_INPUT_DEPENDENCY;
}
return kind.intValue();
}

View file

@ -642,13 +642,17 @@ public class Configuration extends BuildObject implements IConfiguration {
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getTargetTool()
*/
public ITool getTargetTool() {
String targetToolId = toolChain.getTargetToolId();
if (targetToolId == null) return null;
String[] targetToolIds = toolChain.getTargetToolList();
if (targetToolIds == null || targetToolIds.length == 0) return null;
// Look for a tool with this ID, or a tool with a superclass with this id
// For each target tool id, in list order,
// look for a tool with this ID, or a tool with a superclass with this id.
// Stop when we find a match
ITool[] tools = getFilteredTools();
for (int i = 0; i < tools.length; i++) {
ITool targetTool = tools[i];
for (int i=0; i<targetToolIds.length; i++) {
String targetToolId = targetToolIds[i];
for (int j=0; j<tools.length; j++) {
ITool targetTool = tools[j];
ITool tool = targetTool;
do {
if (targetToolId.equals(tool.getId())) {
@ -657,7 +661,7 @@ public class Configuration extends BuildObject implements IConfiguration {
tool = tool.getSuperClass();
} while (tool != null);
}
}
return null;
}

View file

@ -595,7 +595,7 @@ public class InputType extends BuildObject implements IInputType {
while (iter.hasNext()) {
AdditionalInput ai = (AdditionalInput) iter.next();
boolean match = false;
String[] tokens = ai.getPaths().split(";"); //$NON-NLS-1$
String[] tokens = ai.getPaths();
if (tokens.length == inputTokens.length) {
match = true;
for (int i = 0; i < tokens.length; i++) {
@ -637,11 +637,10 @@ public class InputType extends BuildObject implements IInputType {
int kind = current.getKind();
if (kind == IAdditionalInput.KIND_ADDITIONAL_DEPENDENCY ||
kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) {
String paths = current.getPaths();
String[] paths = current.getPaths();
if (paths != null) {
String[] pathTokens = paths.split(";"); //$NON-NLS-1$
for (int i = 0; i < pathTokens.length; i++) {
deps.add(Path.fromOSString(pathTokens[i]));
for (int i = 0; i < paths.length; i++) {
deps.add(Path.fromOSString(paths[i]));
}
}
}
@ -660,11 +659,10 @@ public class InputType extends BuildObject implements IInputType {
int kind = current.getKind();
if (kind == IAdditionalInput.KIND_ADDITIONAL_INPUT ||
kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) {
String paths = current.getPaths();
String[] paths = current.getPaths();
if (paths != null) {
String[] pathTokens = paths.split(";"); //$NON-NLS-1$
for (int i = 0; i < pathTokens.length; i++) {
ins.add(Path.fromOSString(pathTokens[i]));
for (int i = 0; i < paths.length; i++) {
ins.add(Path.fromOSString(paths[i]));
}
}
}

View file

@ -440,12 +440,11 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
}
}
}
//add paths specified in the environment
String envIncludePaths[] = ManagedBuildManager.getEnvironmentVariableProvider().getBuildPaths(config,IEnvVarBuildPath.BUILDPATH_INCLUDE);
if(envIncludePaths != null)
paths.addAll(Arrays.asList(envIncludePaths));
}
// Answer the results as an array
return (String[])paths.toArray(new String[paths.size()]);

View file

@ -685,7 +685,7 @@ public class OutputType extends BuildObject implements IOutputType {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOuputType#getOutputNames()
*/
public String getOutputNames() {
public String[] getOutputNames() {
if (outputNames == null) {
// If I have a superClass, ask it
if (superClass != null) {
@ -694,14 +694,15 @@ public class OutputType extends BuildObject implements IOutputType {
return null;
}
}
return outputNames;
String[] nameTokens = outputNames.split(";"); //$NON-NLS-1$
return nameTokens;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOuputType#setOutputNames()
*/
public void getOutputNames(String names) {
public void setOutputNames(String names) {
if (names == null && outputNames == null) return;
if (outputNames == null || names == null || !(names.equals(outputNames))) {
outputNames = names;
@ -713,14 +714,16 @@ public class OutputType extends BuildObject implements IOutputType {
* @see org.eclipse.cdt.core.build.managed.IOuputType#getPrimaryInputType()
*/
public IInputType getPrimaryInputType() {
if (primaryInputType == null) {
IInputType ret = primaryInputType;
if (ret == null) {
if (superClass != null) {
return superClass.getPrimaryInputType();
} else {
return null;
ret = superClass.getPrimaryInputType();
}
if (ret == null) {
ret = getParent().getPrimaryInputType();
}
}
return primaryInputType;
return ret;
}
/* (non-Javadoc)

View file

@ -242,9 +242,11 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
} else if (toolElement.getNodeName().equals(ITool.OPTION_CAT)) {
new OptionCategory(this, (Element)toolElement);
} else if (toolElement.getNodeName().equals(ITool.INPUT_TYPE)) {
new InputType(this, (Element)toolElement);
InputType inputType = new InputType(this, (Element)toolElement);
addInputType(inputType);
} else if (toolElement.getNodeName().equals(ITool.OUTPUT_TYPE)) {
new OutputType(this, (Element)toolElement);
OutputType outputType = new OutputType(this, (Element)toolElement);
addOutputType(outputType);
}
}
}
@ -923,6 +925,28 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
return opt;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITool#getOptionBySuperClassId(java.lang.String)
*/
public IOption getOptionBySuperClassId(String optionId) {
if (optionId == null) return null;
// Look for an option with this ID, or an option with a superclass with this id
IOption[] options = getOptions();
for (int i = 0; i < options.length; i++) {
IOption targetOption = options[i];
IOption option = targetOption;
do {
if (optionId.equals(option.getId())) {
return targetOption;
}
option = option.getSuperClass();
} while (option != null);
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getChildCategories()
*/
@ -973,7 +997,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
IInputType ourType = (IInputType)ourTypes.get(i);
int j;
for (j = 0; j < types.length; j++) {
if (ourType.getSuperClass().getId().equals(types[j].getId())) {
if (ourType.getSuperClass() != null &&
ourType.getSuperClass().getId().equals(types[j].getId())) {
types[j] = ourType;
break;
}
@ -1045,7 +1070,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
IOutputType ourType = (IOutputType)ourTypes.get(i);
int j;
for (j = 0; j < types.length; j++) {
if (ourType.getSuperClass().getId().equals(types[j].getId())) {
if (ourType.getSuperClass() != null &&
ourType.getSuperClass().getId().equals(types[j].getId())) {
types[j] = ourType;
break;
}
@ -1533,10 +1559,37 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
List allDeps = new ArrayList();
IInputType[] types = getInputTypes();
for (int i=0; i<types.length; i++) {
IPath[] deps = types[i].getAdditionalDependencies();
IInputType type = types[i];
// Additional dependencies come from 2 places.
// 1. From AdditionalInput childen
IPath[] deps = type.getAdditionalDependencies();
for (int j=0; j<deps.length; j++) {
allDeps.add(deps[j]);
}
// 2. From InputTypes that other than the primary input type
if (!type.getPrimaryInput()) {
if (type.getOptionId() != null) {
IOption option = getOptionBySuperClassId(type.getOptionId());
if (option != null) {
try {
List inputs = new ArrayList();
int optType = option.getValueType();
if (optType == IOption.STRING) {
inputs.add(option.getStringValue());
} else if (
optType == IOption.STRING_LIST ||
optType == IOption.LIBRARIES ||
optType == IOption.OBJECTS) {
inputs = (List)option.getValue();
}
allDeps.addAll(inputs);
} catch( BuildException ex ) {
}
}
} else if (type.getBuildVariable() != null && type.getBuildVariable().length() > 0) {
allDeps.add("$(" + type.getBuildVariable() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
return (IPath[])allDeps.toArray(new IPath[allDeps.size()]);
}
@ -1548,10 +1601,20 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
List allRes = new ArrayList();
IInputType[] types = getInputTypes();
for (int i=0; i<types.length; i++) {
IPath[] res = types[i].getAdditionalResources();
IInputType type = types[i];
// Additional dependencies come from 2 places.
// 1. From AdditionalInput childen
IPath[] res = type.getAdditionalResources();
for (int j=0; j<res.length; j++) {
allRes.add(res[j]);
}
// 2. From InputTypes that other than the primary input type
if (!type.getPrimaryInput()) {
String var = type.getBuildVariable();
if (var != null && var.length() > 0) {
allRes.add("$(" + type.getBuildVariable() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
return (IPath[])allRes.toArray(new IPath[allRes.size()]);
}

View file

@ -54,7 +54,7 @@ public class ToolChain extends BuildObject implements IToolChain {
private String errorParserIds;
private List osList;
private List archList;
private String targetToolId;
private String targetToolIds;
private String secondaryOutputIds;
private Boolean isAbstract;
private String scannerConfigDiscoveryProfileId;
@ -216,8 +216,8 @@ public class ToolChain extends BuildObject implements IToolChain {
if (toolChain.archList != null) {
archList = new ArrayList(toolChain.archList);
}
if (toolChain.targetToolId != null) {
targetToolId = new String(toolChain.targetToolId);
if (toolChain.targetToolIds != null) {
targetToolIds = new String(toolChain.targetToolIds);
}
if (toolChain.secondaryOutputIds != null) {
secondaryOutputIds = new String(toolChain.secondaryOutputIds);
@ -321,7 +321,7 @@ public class ToolChain extends BuildObject implements IToolChain {
secondaryOutputIds = element.getAttribute(SECONDARY_OUTPUTS);
// Get the target tool id
targetToolId = element.getAttribute(TARGET_TOOL);
targetToolIds = element.getAttribute(TARGET_TOOL);
// Get the scanner config discovery profile id
scannerConfigDiscoveryProfileId = element.getAttribute(SCANNER_CONFIG_PROFILE_ID);
@ -415,7 +415,7 @@ public class ToolChain extends BuildObject implements IToolChain {
// Get the target tool id
if (element.hasAttribute(TARGET_TOOL)) {
targetToolId = element.getAttribute(TARGET_TOOL);
targetToolIds = element.getAttribute(TARGET_TOOL);
}
// Get the scanner config discovery profile id
@ -490,8 +490,8 @@ public class ToolChain extends BuildObject implements IToolChain {
element.setAttribute(SECONDARY_OUTPUTS, secondaryOutputIds);
}
if (targetToolId != null) {
element.setAttribute(TARGET_TOOL, targetToolId);
if (targetToolIds != null) {
element.setAttribute(TARGET_TOOL, targetToolIds);
}
if (scannerConfigDiscoveryProfileId != null) {
@ -839,18 +839,43 @@ public class ToolChain extends BuildObject implements IToolChain {
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#getTargetTool()
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#getTargetToolIds()
*/
public String getTargetToolId() {
if (targetToolId == null) {
public String getTargetToolIds() {
if (targetToolIds == null) {
// Ask superClass for its list
if (superClass != null) {
return superClass.getTargetToolId();
return superClass.getTargetToolIds();
} else {
return null;
}
}
return targetToolId;
return targetToolIds;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#getTargetToolList()
*/
public String[] getTargetToolList() {
String IDs = getTargetToolIds();
String[] targetTools;
if (IDs != null) {
// Check for an empty string
if (IDs.length() == 0) {
targetTools = new String[0];
} else {
StringTokenizer tok = new StringTokenizer(IDs, ";"); //$NON-NLS-1$
List list = new ArrayList(tok.countTokens());
while (tok.hasMoreElements()) {
list.add(tok.nextToken());
}
String[] strArr = {""}; //$NON-NLS-1$
targetTools = (String[]) list.toArray(strArr);
}
} else {
targetTools = new String[0];
}
return targetTools;
}
/* (non-Javadoc)
@ -975,12 +1000,12 @@ public class ToolChain extends BuildObject implements IToolChain {
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#setTargetTool()
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#setTargetToolIds()
*/
public void setTargetTool(String newId) {
if (targetToolId == null && newId == null) return;
if (targetToolId == null || newId == null || !newId.equals(targetToolId)) {
targetToolId = newId;
public void setTargetToolIds(String newIds) {
if (targetToolIds == null && newIds == null) return;
if (targetToolIds == null || newIds == null || !newIds.equals(targetToolIds)) {
targetToolIds = newIds;
isDirty = true;
}
}

View file

@ -1061,6 +1061,10 @@ public class ToolReference implements IToolReference {
public void setCustomBuildStep(boolean customBuildStep) {
}
public IOption getOptionBySuperClassId(String id) {
return null;
}
/*
* 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

View file

@ -240,11 +240,13 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
private static final String OBJS_MACRO = "OBJS"; //$NON-NLS-1$
private static final String DEPS_MACRO = "DEPS"; //$NON-NLS-1$
private static final String MACRO_ADDITION_ADDPREFIX_HEADER = "${addprefix "; //$NON-NLS-1$
private static final String MACRO_ADDITION_ADDPREFIX_SUFFIX = "," + WHITESPACE + LINEBREAK; //$NON-NLS-1$
private static final String MACRO_ADDITION_PREFIX_SUFFIX = "+=" + WHITESPACE + LINEBREAK; //$NON-NLS-1$
private static final String PREBUILD = "pre-build"; //$NON-NLS-1$
private static final String MAINBUILD = "main-build"; //$NON-NLS-1$
private static final String POSTBUILD = "post-build"; //$NON-NLS-1$
private static final String SECONDARY_OUTPUTS = "secondary-outputs"; //$NON-NLS-1$
// Local variables needed by generator
private String buildTargetName;
@ -1144,6 +1146,13 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
if (buildTargetExt.length() > 0) {
buffer.append(DOT + buildTargetExt);
}
// Add the Secondary Outputs to the all target, if any
IOutputType[] secondaryOutputs = config.getToolChain().getSecondaryOutputs();
if (secondaryOutputs.length > 0) {
buffer.append(WHITESPACE + SECONDARY_OUTPUTS);
}
buffer.append(NEWLINE + NEWLINE);
/*
@ -1218,6 +1227,17 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
buffer.append(TAB + DASH + AT + ECHO + WHITESPACE + SINGLE_QUOTE
+ WHITESPACE + SINGLE_QUOTE + NEWLINE + NEWLINE);
}
// Add the Secondary Outputs target, if needed
if (secondaryOutputs.length > 0) {
buffer.append(SECONDARY_OUTPUTS + COLON);
Vector outs2 = calculateSecondaryOutputs(secondaryOutputs);
for (int i=0; i<outs2.size(); i++) {
buffer.append(WHITESPACE + (String)outs2.get(i));
}
buffer.append(NEWLINE + NEWLINE);
}
// Add all the needed dummy and phony targets
buffer.append(".PHONY: all clean dependents" + NEWLINE); //$NON-NLS-1$
buffer.append(".SECONDARY:"); //$NON-NLS-1$
@ -1340,14 +1360,23 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
Vector inputs = new Vector();
Vector dependencies = new Vector();
Vector outputs = new Vector();
Vector enumeratedOutputs = new Vector();
Vector enumeratedPrimaryOutputs = new Vector();
Vector enumeratedSecondaryOutputs = new Vector();
Vector outputVariables = new Vector();
String outputPrefix = EMPTY_STRING;
if (!getToolInputsOutputs(tool, inputs, dependencies, outputs, enumeratedOutputs, outputVariables,
bTargetTool, managedProjectOutputs)) {
if (!getToolInputsOutputs(tool, inputs, dependencies, outputs,
enumeratedPrimaryOutputs, enumeratedSecondaryOutputs,
outputVariables, bTargetTool, managedProjectOutputs)) {
return false;
}
// If we have no primary output, make all of the secondary outputs the primary output
if (enumeratedPrimaryOutputs.size() == 0) {
enumeratedPrimaryOutputs = enumeratedSecondaryOutputs;
enumeratedSecondaryOutputs.clear();
}
// Add the output variables for this tool to our list
outputVarsAdditionsList.addAll(outputVariables);
@ -1355,20 +1384,20 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
String buildRule = EMPTY_STRING;
String outflag = tool.getOutputFlag();
Iterator iter = enumeratedOutputs.listIterator();
String primaryOutputs = EMPTY_STRING;
boolean first = true;
while(iter.hasNext()) {
String output = (String)iter.next();
if (!first) buildRule += WHITESPACE;
for (int i=0; i<enumeratedPrimaryOutputs.size(); i++) {
String output = (String)enumeratedPrimaryOutputs.get(i);
if (!first) primaryOutputs += WHITESPACE;
first = false;
buildRule += output;
primaryOutputs += output;
}
buildRule += (COLON + WHITESPACE);
iter = inputs.listIterator();
buildRule += (primaryOutputs + COLON + WHITESPACE);
first = true;
iter = dependencies.listIterator();
while(iter.hasNext()) {
String input = (String)iter.next();
for (int i=0; i<dependencies.size(); i++) {
String input = (String)dependencies.get(i);
if (!first) buildRule += WHITESPACE;
first = false;
buildRule += input;
@ -1398,7 +1427,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
String[] cmdInputs = (String[])inputs.toArray(new String[inputs.size()]);
IManagedCommandLineGenerator gen = tool.getCommandLineGenerator();
IManagedCommandLineInfo cmdLInfo = gen.generateCommandLineInfo( tool, tool.getToolCommand(),
flags, outflag, outputPrefix, OUT_MACRO, cmdInputs, tool.getCommandLinePattern() );
flags, outflag, outputPrefix, primaryOutputs, cmdInputs, tool.getCommandLinePattern() );
// The command to build
String buildCmd = null;
if( cmdLInfo == null ) {
@ -1409,7 +1438,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// TODO report error
toolFlags = EMPTY_STRING;
}
buildCmd = tool.getToolCommand() + WHITESPACE + toolFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + OUT_MACRO + WHITESPACE + IN_MACRO;
buildCmd = tool.getToolCommand() + WHITESPACE + toolFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + primaryOutputs + WHITESPACE + IN_MACRO;
}
else buildCmd = cmdLInfo.getCommandLine();
buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
@ -1426,6 +1455,17 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE);
}
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE + NEWLINE);
// If we have secondary outputs, output dependency rules without commands
if (enumeratedSecondaryOutputs.size() > 0) {
String primaryOutput = (String)enumeratedPrimaryOutputs.get(0);
for (int i=0; i<enumeratedSecondaryOutputs.size(); i++) {
String output = (String)enumeratedSecondaryOutputs.get(0);
buffer.append(output + COLON + WHITESPACE + primaryOutput + NEWLINE);
}
buffer.append(NEWLINE);
}
return true;
}
@ -1465,8 +1505,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
}
protected boolean getToolInputsOutputs(ITool tool,
Vector inputs, Vector dependencies, Vector outputs, Vector enumeratedOutputs, Vector outputVariables,
boolean bTargetTool, Vector managedProjectOutputs) {
Vector inputs, Vector dependencies, Vector outputs,
Vector enumeratedPrimaryOutputs, Vector enumeratedSecondaryOutputs,
Vector outputVariables, boolean bTargetTool, Vector managedProjectOutputs) {
// Get the information regarding the tool's inputs and outputs from the objects
// created by calculateToolInputsOutputs
@ -1482,7 +1523,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// Populate the output Vectors
inputs.addAll(toolInfo.getCommandInputs());
outputs.addAll(toolInfo.getCommandOutputs());
enumeratedOutputs.addAll(toolInfo.getEnumeratedOutputs());
enumeratedPrimaryOutputs.addAll(toolInfo.getEnumeratedPrimaryOutputs());
enumeratedSecondaryOutputs.addAll(toolInfo.getEnumeratedSecondaryOutputs());
outputVariables.addAll(toolInfo.getOutputVariables());
dependencies.addAll(toolInfo.getCommandDependencies());
@ -1495,6 +1537,37 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
return true;
}
/* (non-Javadoc)
* @param fileHandle
* @throws CoreException
*/
protected Vector calculateSecondaryOutputs(IOutputType[] secondaryOutputs) {
Vector buildVars = new Vector();
for (int i=0; i<buildTools.length; i++) {
// Add the specified output build variables
IOutputType[] outTypes = buildTools[i].getOutputTypes();
if (outTypes != null && outTypes.length > 0) {
for (int j=0; j<outTypes.length; j++) {
IOutputType outType = outTypes[j];
// Is this one of the secondary outputs?
// Look for an outputType with this ID, or one with a superclass with this id
thisType:
for (int k = 0; k < secondaryOutputs.length; k++) {
IOutputType matchType = outType;
do {
if (matchType.getId().equals(secondaryOutputs[k].getId())) {
buildVars.add(outType.getBuildVariable());
break thisType;
}
matchType = matchType.getSuperClass();
} while (matchType != null);
}
}
}
}
return buildVars;
}
/*************************************************************************
* S O U R C E S (sources.mk) M A K E F I L E M E T H O D S
@ -1566,16 +1639,16 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry)iterator.next();
String macroName = (String)entry.getKey();
addMacroAdditionPrefix(buildVarToRuleStringMap, macroName, "$(ROOT)/" + relativePath, true); //$NON-NLS-1$
addMacroAdditionPrefix(buildVarToRuleStringMap, macroName, null, false);
}
iterator = buildOutVars.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry)iterator.next();
String macroName = (String)entry.getKey();
addMacroAdditionPrefix(buildVarToRuleStringMap, macroName, "./" + relativePath, true);
addMacroAdditionPrefix(buildVarToRuleStringMap, macroName, "./" + relativePath, true); //$NON-NLS-1$
}
// Create an entry for the DEPS macro
addMacroAdditionPrefix(buildVarToRuleStringMap, DEPS_MACRO, "./" + relativePath, true);
addMacroAdditionPrefix(buildVarToRuleStringMap, DEPS_MACRO, "./" + relativePath, true); //$NON-NLS-1$
// String buffers
StringBuffer buffer = new StringBuffer(); // Return buffer
@ -1601,7 +1674,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
}
// Write out the macro addition entries to the buffer
buffer.append(writeAdditionMacros(buildVarToRuleStringMap, true));
buffer.append(writeAdditionMacros(buildVarToRuleStringMap));
return buffer.append(ruleBuffer + NEWLINE);
}
@ -1642,7 +1715,20 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
continue;
}
// Add the resource name to the makefile line that adds resources to the build variable
addMacroAdditionFile(buildVarToRuleStringMap, varName, resource.getName());
String srcName;
if (generatedSource) {
srcName = resource.getName();
} else {
String resourceLocation = resource.getLocation().toString();
String projectLocation = project.getLocation().toString();
//if (resource.isLinked()) { NOTE: we don't use this since children of linked resources return false
if(!resourceLocation.startsWith(projectLocation)) {
srcName = resourceLocation;
} else {
srcName = "$(ROOT)/" + relativePath + resource.getName(); //$NON-NLS-1$
}
}
addMacroAdditionFile(buildVarToRuleStringMap, varName, srcName);
// Generate the rule to build this source file
IInputType inputType = tool.getInputType(ext);
@ -1670,7 +1756,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// For support of pre-CDT 3.0 integrations.
buildVariable = OBJS_MACRO; //$NON-NLS-1$
}
Vector generatedOutputs = calculateOutputsForSource(tool, relativePath, resource);
Vector generatedOutputs = calculateOutputsForSource(tool, relativePath, resource, false);
for (int k=0; k<generatedOutputs.size(); k++) {
// TODO - this will only work for outputs generated below the build output directory?
// try an option that generates an output outside of the project
@ -1725,12 +1811,13 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
String outputPrefix = null;
IManagedDependencyGenerator depGen = info.getDependencyGenerator(inputExtension);
boolean doDepGen = (depGen != null && depGen.getCalculatorType() == IManagedDependencyGenerator.TYPE_COMMAND);
boolean patternRule = false;
// If the tool creates a dependency file, add it to the list
if (doDepGen) {
String depFile = relativePath + resourceName + DOT + DEP_EXT;
getDependencyMakefiles().add(depFile);
generatedDepFile.append(depFile);
generatedDepFile.append(resourceName + DOT + DEP_EXT);
}
/*
@ -1756,30 +1843,6 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
IResourceConfiguration resConfig = null;
if( config != null ) resConfig = config.getResourceConfiguration(resource.getFullPath().toString());
// 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 + 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
String home = (generatedSource)? DOT : ROOT;
if( resConfig != null) {
buildRule = resourcePath + resourceName + OptDotExt + COLON + WHITESPACE + home + SEPARATOR + resourcePath + resourceName + DOT + inputExtension;
} else {
buildRule = relativePath + WILDCARD + OptDotExt + COLON + WHITESPACE + home + SEPARATOR + resourcePath + WILDCARD + DOT + inputExtension;
}
} // end fix for PR 70491
// Add any additional dependencies specified:
// 1. in additionalInput elements
// 2. from a dependency calculator not of TYPE_COMMAND
ITool tool;
if( resConfig != null) {
ITool[] tools = resConfig.getTools();
@ -1787,17 +1850,55 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
} else {
tool = info.getToolFromInputExtension(inputExtension);
}
// Get any additional dependencies specified for the tool
// figure out path to use to resource
String primaryOutputName = EMPTY_STRING;
String primaryDependencyName = EMPTY_STRING;
//if (resource.isLinked()) { NOTE: we don't use this since children of linked resources return false
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
primaryOutputName = relativePath + resourceName + OptDotExt;
primaryDependencyName = 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
String home = (generatedSource)? DOT : ROOT;
if( resConfig != null) {
// Need a hardcoded rule, not a pattern rule
primaryOutputName = resourcePath + resourceName + OptDotExt;
primaryDependencyName = home + SEPARATOR + resourcePath + resourceName + DOT + inputExtension;
} else {
primaryOutputName = relativePath + WILDCARD + OptDotExt;
primaryDependencyName = home + SEPARATOR + resourcePath + WILDCARD + DOT + inputExtension;
patternRule = true;
}
} // end fix for PR 70491
buildRule = primaryOutputName;
// If this is a pattern rule, add any additional outputs here
String otherPrimaryOutputs = EMPTY_STRING;
if (patternRule) {
Vector addlOutputs = calculateOutputsForSource(tool, relativePath, resource, true);
for (int i=0; i<addlOutputs.size(); i++) {
otherPrimaryOutputs += WHITESPACE + ((IPath)addlOutputs.get(i)).toString();
}
}
buildRule += otherPrimaryOutputs + COLON + WHITESPACE + primaryDependencyName;
// Other additional inputs
// Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
IPath[] addlDepPaths = tool.getAdditionalDependencies();
for (int i=0; i<addlDepPaths.length; i++) {
buildRule += WHITESPACE + addlDepPaths[i].toString();
}
if (depGen != null && depGen.getCalculatorType() != IManagedDependencyGenerator.TYPE_COMMAND) {
Vector addlDepsVector = calculateDependenciesForSource(depGen, tool, relativePath, resource);
for (int i=0; i<addlDepsVector.size(); i++) {
buildRule += WHITESPACE + addlDepsVector.get(i).toString();
}
}
// No duplicates in a makefile
if (getRuleList().contains(buildRule)) {
@ -1824,7 +1925,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// TODO add some routines to catch this
flags = EMPTY_STRING_ARRAY;
}
// Get any additional dependencies specified for the tool
// Other additional inputs
// Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
IPath[] addlInputPaths = tool.getAdditionalResources();
for (int i=0; i<addlInputPaths.length; i++) {
inputs.add(addlDepPaths[i].toString());
@ -1832,7 +1934,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// Call the command line generator
IManagedCommandLineGenerator cmdLGen = tool.getCommandLineGenerator();
cmdLInfo = cmdLGen.generateCommandLineInfo( tool, cmd, flags, outflag, outputPrefix,
OUT_MACRO, (String[])inputs.toArray(new String[inputs.size()]), tool.getCommandLinePattern() );
OUT_MACRO + otherPrimaryOutputs, (String[])inputs.toArray(new String[inputs.size()]), tool.getCommandLinePattern() );
String buildCmd = cmdLInfo.getCommandLine();
buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
@ -1847,17 +1949,19 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
outflag = info.getOutputFlag(outputExtension);
outputPrefix = info.getOutputPrefix(outputExtension);
String[] flags = buildFlags.split( "\\s" ); //$NON-NLS-1$
// Get any additional dependencies specified for the tool
// Other additional inputs
// Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
IPath[] addlInputPaths = tool.getAdditionalResources();
for (int i=0; i<addlInputPaths.length; i++) {
inputs.add(addlDepPaths[i].toString());
}
// Call the command line generator
cmdLInfo = info.generateCommandLineInfo( inputExtension, flags, outflag, outputPrefix,
OUT_MACRO, (String[])inputs.toArray(new String[inputs.size()]) );
OUT_MACRO + otherPrimaryOutputs, (String[])inputs.toArray(new String[inputs.size()]) );
// The command to build
String buildCmd = null;
if( cmdLInfo == null ) buildCmd = cmd + WHITESPACE + buildFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + OUT_MACRO + WHITESPACE + IN_MACRO;
if( cmdLInfo == null ) buildCmd = cmd + WHITESPACE + buildFlags + WHITESPACE +
outflag + WHITESPACE + outputPrefix + OUT_MACRO + otherPrimaryOutputs + WHITESPACE + IN_MACRO;
else buildCmd = cmdLInfo.getCommandLine();
buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
buffer.append(TAB + AT + buildCmd);
@ -1875,6 +1979,30 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
buffer.append(NEWLINE);
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + IN_MACRO + SINGLE_QUOTE + NEWLINE);
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE + NEWLINE);
// Add separate dependency lines per file if necessary
boolean addedDepLines = false;
if (depGen != null && depGen.getCalculatorType() != IManagedDependencyGenerator.TYPE_COMMAND) {
Vector addlDepsVector = calculateDependenciesForSource(depGen, tool, relativePath, resource);
for (int i=0; i<addlDepsVector.size(); i++) {
buffer.append(primaryOutputName + COLON + WHITESPACE + addlDepsVector.get(i).toString() + NEWLINE);
addedDepLines = true;
}
}
// If this is NOT a pattern rule, add any additional outputs here using dependency lines
if (!patternRule) {
Vector addlOutputs = calculateOutputsForSource(tool, relativePath, resource, true);
for (int i=0; i<addlOutputs.size(); i++) {
buffer.append(((IPath)addlOutputs.get(i)).toString() + COLON + WHITESPACE + primaryOutputName + NEWLINE);
addedDepLines = true;
}
}
if (addedDepLines) {
buffer.append(NEWLINE);
}
}
/* (non-Javadoc)
@ -1895,7 +2023,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
* @param resource
* @return Vector of IPaths that are relative to the build directory
*/
protected Vector calculateOutputsForSource(ITool tool, String relativePath, IResource resource) {
protected Vector calculateOutputsForSource(ITool tool,
String relativePath, IResource resource, boolean ignorePrimary) {
Vector outputs = new Vector();
String inExt = resource.getFileExtension();
String outExt = tool.getOutputExtension(inExt);
@ -1904,13 +2033,14 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
if (outTypes != null && outTypes.length > 0) {
for (int i=0; i<outTypes.length; i++) {
IOutputType type = outTypes[i];
boolean primaryOutput = (type == tool.getPrimaryOutputType());
if (primaryOutput && ignorePrimary) continue;
String outputPrefix = type.getOutputPrefix();
String variable = type.getBuildVariable();
boolean multOfType = type.getMultipleOfType();
boolean primaryOutput = (type == tool.getPrimaryOutputType());
IOption option = getOption(tool, type.getOptionId());
IOption option = tool.getOptionBySuperClassId(type.getOptionId());
IManagedOutputNameProvider nameProvider = type.getNameProvider();
String outputNames = type.getOutputNames();
String[] outputNames = type.getOutputNames();
// 1. If the tool is the build target and this is the primary output,
// use artifact name & extension
@ -1950,9 +2080,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
} else
// 4. If outputNames is specified, use it
if (outputNames != null) {
String[] pathTokens = outputNames.split(";"); //$NON-NLS-1$
for (int j = 0; j < pathTokens.length; j++) {
outputs.add(Path.fromOSString(pathTokens[j]));
for (int j = 0; j < outputNames.length; j++) {
outputs.add(Path.fromOSString(outputNames[j]));
}
} else {
// 4. Use the name pattern to generate a transformation macro
@ -1990,7 +2119,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// In this case, the output file name is the input file name with
// the output extension.
IPath outPath = resource.getFullPath().removeFileExtension();
if (!ignorePrimary) {
IPath outPath = Path.fromOSString(resource.getFullPath().removeFileExtension().lastSegment());
String outPrefix = tool.getOutputPrefix();
if (outPrefix.length() > 0) {
String outName = outPrefix + outPath.lastSegment();
@ -1999,6 +2129,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
outPath = outPath.addFileExtension(outExt);
outputs.add(outPath);
}
}
return outputs;
}
@ -2143,9 +2274,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
protected void addMacroAdditionPrefix(HashMap map, String macroName, String relativePath, boolean addPrefix) {
// there is no entry in the map, so create a buffer for this macro
StringBuffer tempBuffer = new StringBuffer();
tempBuffer.append(macroName + WHITESPACE + MACRO_ADDITION_PREFIX_SUFFIX); //$NON-NLS-1$
tempBuffer.append(macroName + WHITESPACE + MACRO_ADDITION_PREFIX_SUFFIX);
if (addPrefix) {
tempBuffer.append("${addprefix " + relativePath + MACRO_ADDITION_ADDPREFIX_SUFFIX); //$NON-NLS-1$ //$NON-NLS-2$
tempBuffer.append(MACRO_ADDITION_ADDPREFIX_HEADER + relativePath + MACRO_ADDITION_ADDPREFIX_SUFFIX);
}
// have to store the buffer in String form as StringBuffer is not a sublcass of Object
@ -2186,7 +2317,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
/* (non-Javadoc)
* Write all macro addition entries in a map to the buffer
*/
protected StringBuffer writeAdditionMacros(HashMap map, boolean addPrefix) {
protected StringBuffer writeAdditionMacros(HashMap map) {
StringBuffer buffer = new StringBuffer();
// Add the comment
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(MOD_VARS) + NEWLINE);
@ -2201,10 +2332,15 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
if (!(macroString.endsWith(MACRO_ADDITION_PREFIX_SUFFIX)) &&
!(macroString.endsWith(MACRO_ADDITION_ADDPREFIX_SUFFIX))) {
StringBuffer currentBuffer = new StringBuffer();
currentBuffer.append( macroString);
// Close off the rule
if (addPrefix) {
currentBuffer.append("}"); //$NON-NLS-1$
if (macroString.indexOf(MACRO_ADDITION_ADDPREFIX_HEADER) >= 0) {
currentBuffer.append(macroString + "}" + NEWLINE); //$NON-NLS-1$
} else {
// Remove the final "/"
if (macroString.endsWith(LINEBREAK)) {
macroString = macroString.substring(0, (macroString.length() - 2)) + NEWLINE;
}
currentBuffer.append(macroString);
}
currentBuffer.append(NEWLINE);
@ -2405,28 +2541,6 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
return ruleList;
}
/* (non-Javadoc)
* Returns the option that matches the option ID in this tool
*/
public IOption getOption(ITool tool, String optionId) {
if (optionId == null) return null;
// Look for an option with this ID, or an option with a superclass with this id
IOption[] options = tool.getOptions();
for (int i = 0; i < options.length; i++) {
IOption targetOption = options[i];
IOption option = targetOption;
do {
if (optionId.equals(option.getId())) {
return targetOption;
}
option = option.getSuperClass();
} while (option != null);
}
return null;
}
/*************************************************************************
* R E S O U R C E V I S I T O R M E T H O D S
************************************************************************/

View file

@ -59,11 +59,18 @@ public interface IManagedBuildGnuToolInfo {
public Vector getCommandOutputs();
/**
* Returns the raw list of tool's output file names.
* Returns the raw list of tool's primary output file names.
*
* @return Vector
*/
public Vector getEnumeratedOutputs();
public Vector getEnumeratedPrimaryOutputs();
/**
* Returns the raw list of tool's secondary output file names.
*
* @return Vector
*/
public Vector getEnumeratedSecondaryOutputs();
/**
* Returns the raw list of tool's output variable names.

View file

@ -61,7 +61,8 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
private Vector commandInputs = new Vector();
private Vector enumeratedInputs = new Vector();
private Vector commandOutputs = new Vector();
private Vector enumeratedOutputs = new Vector();
private Vector enumeratedPrimaryOutputs = new Vector();
private Vector enumeratedSecondaryOutputs = new Vector();
private Vector outputVariables = new Vector();
private Vector commandDependencies = new Vector();
//private Vector enumeratedDependencies = new Vector();
@ -103,8 +104,12 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
return commandOutputs;
}
public Vector getEnumeratedOutputs() {
return enumeratedOutputs;
public Vector getEnumeratedPrimaryOutputs() {
return enumeratedPrimaryOutputs;
}
public Vector getEnumeratedSecondaryOutputs() {
return enumeratedSecondaryOutputs;
}
public Vector getOutputVariables() {
@ -138,21 +143,61 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
public boolean calculateInputs(GnuMakefileGenerator makeGen, IResource[] projResources, boolean lastChance) {
// Get the inputs for this tool invocation
// Note that command inputs that are also dependencies are also added to the command dependencies list
/* The priorities for determining the names of the inputs of a tool are:
* 1. If an option is specified, use the value of the option.
* 2. If a build variable is specified, use the files that have been added to the build variable as
* the output(s) of other build steps.
* 3. Use the file extensions and the resources in the project
*/
boolean done = true;
Vector myCommandInputs = new Vector();
Vector myCommandDependencies = new Vector();
Vector myEnumeratedInputs = new Vector();
Vector myCommandInputs = new Vector(); // Inputs for the tool command line
Vector myCommandDependencies = new Vector(); // Dependencies for the make rule
Vector myEnumeratedInputs = new Vector(); // Complete list of individual inputs
IInputType[] inTypes = tool.getInputTypes();
if (inTypes != null && inTypes.length > 0) {
for (int i=0; i<inTypes.length; i++) {
IInputType type = inTypes[i];
String variable = type.getBuildVariable();
boolean primaryInput = type.getPrimaryInput();
boolean useFileExts = false;
IOption option = tool.getOptionBySuperClassId(type.getOptionId());
// Option?
if (option != null) {
try {
List inputs = new ArrayList();
int optType = option.getValueType();
if (optType == IOption.STRING) {
inputs.add(option.getStringValue());
} else if (
optType == IOption.STRING_LIST ||
optType == IOption.LIBRARIES ||
optType == IOption.OBJECTS) {
inputs = (List)option.getValue();
}
//myCommandInputs.add(inputs);
if (primaryInput) {
myCommandDependencies.add(0, inputs);
} else {
myCommandDependencies.add(inputs);
}
//myEnumeratedInputs.add(inputs);
} catch( BuildException ex ) {
}
} else {
// Build Variable?
if (variable.length() > 0) {
String cmdVariable = variable = "$(" + variable + ")"; //$NON-NLS-1$ //$NON-NLS-2$
myCommandInputs.add(cmdVariable);
if (primaryInput) {
myCommandDependencies.add(0, cmdVariable);
} else {
myCommandDependencies.add(cmdVariable);
}
// If there is an output variable with the same name, get
// the files associated with it.
List outMacroList = makeGen.getBuildVariableList(variable, true);
@ -168,6 +213,8 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
}
}
}
// Use file extensions
if (variable.length() == 0 || useFileExts) {
if (type.getMultipleOfType()) {
// Calculate myEnumeratedInputs using the file extensions and the resources in the project
@ -181,6 +228,11 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
// TODO - is project relative correct?
if (!useFileExts) {
myCommandInputs.add(projResources[i].getProjectRelativePath());
if (primaryInput) {
myCommandDependencies.add(0, projResources[i].getProjectRelativePath());
} else {
myCommandDependencies.add(projResources[i].getProjectRelativePath());
}
}
myEnumeratedInputs.add(projResources[i].getProjectRelativePath());
break;
@ -193,6 +245,8 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
// Rule will be generated by addRuleForSource
}
}
}
// Get any additional inputs specified in the manifest file or the project file
IAdditionalInput[] addlInputs = type.getAdditionalInputs();
if (addlInputs != null) {
@ -201,12 +255,11 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
int kind = addlInput.getKind();
if (kind == IAdditionalInput.KIND_ADDITIONAL_INPUT ||
kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) {
String paths = addlInput.getPaths();
String[] paths = addlInput.getPaths();
if (paths != null) {
String[] pathTokens = paths.split(";"); //$NON-NLS-1$
for (int k = 0; k < pathTokens.length; k++) {
myCommandInputs.add(pathTokens[k]);
myEnumeratedInputs.add(pathTokens[k]);
for (int k = 0; k < paths.length; k++) {
myCommandInputs.add(paths[k]);
myEnumeratedInputs.add(paths[k]);
}
}
}
@ -233,7 +286,7 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
if (done) {
commandInputs.addAll(myCommandInputs);
commandDependencies.addAll(myCommandDependencies);
commandDependencies.addAll(0, myCommandDependencies);
enumeratedInputs.addAll(myEnumeratedInputs);
inputsCalculated = true;
return true;
@ -243,7 +296,7 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
}
/*
* The priorities for determining the names of the ouputs of a tool are:
* The priorities for determining the names of the outputs of a tool are:
* 1. If the tool is the build target and primary output, use artifact name & extension
* 2. If an option is specified, use the value of the option
* 3. If a nameProvider is specified, call it
@ -251,12 +304,16 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
* 5. Use the name pattern to generate a transformation macro
* so that the source names can be transformed into the target names
* using the built-in string substitution functions of <code>make</code>.
*
* NOTE: If an option is not specified and this is not the primary output type, the outputs
* from the type are not added to the command line
*/
public boolean calculateOutputs(GnuMakefileGenerator makeGen, HashSet handledInputExtensions, boolean lastChance) {
boolean done = true;
Vector myCommandOutputs = new Vector();
Vector myEnumeratedOutputs = new Vector();
Vector myEnumeratedPrimaryOutputs = new Vector();
Vector myEnumeratedSecondaryOutputs = new Vector();
HashMap myOutputMacros = new HashMap();
// The next two fields are used together
Vector myBuildVars = new Vector();
@ -272,9 +329,9 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
String variable = type.getBuildVariable();
boolean multOfType = type.getMultipleOfType();
boolean primaryOutput = (type == tool.getPrimaryOutputType());
IOption option = makeGen.getOption(tool, type.getOptionId());
IOption option = tool.getOptionBySuperClassId(type.getOptionId());
IManagedOutputNameProvider nameProvider = type.getNameProvider();
String outputNames = type.getOutputNames();
String[] outputNames = type.getOutputNames();
// 1. If the tool is the build target and this is the primary output,
// use artifact name & extension
@ -306,7 +363,7 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
}
}
}
myCommandOutputs.addAll(outputs);
//myCommandOutputs.addAll(outputs);
typeEnumeratedOutputs.addAll(outputs);
if (variable.length() > 0) {
if (myOutputMacros.containsKey(variable)) {
@ -334,7 +391,9 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
}
outNames = nameProvider.getOutputNames(tool, inputPaths);
if (outNames != null) {
if (primaryOutput) {
myCommandOutputs.addAll(Arrays.asList(outNames));
}
typeEnumeratedOutputs.addAll(Arrays.asList(outNames));
}
}
@ -350,10 +409,11 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
} else
// 4. If outputNames is specified, use it
if (outputNames != null) {
String[] pathTokens = outputNames.split(";"); //$NON-NLS-1$
if (pathTokens.length > 0) {
List namesList = Arrays.asList(pathTokens);
if (outputNames.length > 0) {
List namesList = Arrays.asList(outputNames);
if (primaryOutput) {
myCommandOutputs.addAll(namesList);
}
typeEnumeratedOutputs.addAll(namesList);
if (variable.length() > 0) {
if (myOutputMacros.containsKey(variable)) {
@ -405,7 +465,9 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
fileName = "default"; //$NON-NLS-1$
}
// Replace the % with the file name
if (primaryOutput) {
myCommandOutputs.add(namePattern.replaceAll("%", fileName)); //$NON-NLS-1$
}
typeEnumeratedOutputs.add(namePattern.replaceAll("%", fileName)); //$NON-NLS-1$
if (variable.length() > 0) {
List outputs = new ArrayList();
@ -425,7 +487,11 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
myBuildVars.add(variable);
myBuildVarsValues.add(typeEnumeratedOutputs);
}
myEnumeratedOutputs.addAll(typeEnumeratedOutputs);
if (primaryOutput) {
myEnumeratedPrimaryOutputs.addAll(typeEnumeratedOutputs);
} else {
myEnumeratedSecondaryOutputs.addAll(typeEnumeratedOutputs);
}
}
} else {
if (bIsTargetTool) {
@ -435,7 +501,7 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
outputName += (DOT + targetExt);
}
myCommandOutputs.add(outputName);
myEnumeratedOutputs.add(outputName);
myEnumeratedPrimaryOutputs.add(outputName);
} else {
// For support of pre-CDT 3.0 integrations.
// NOTE WELL: This only supports the case of a single "target tool"
@ -463,7 +529,8 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
if (done) {
commandOutputs.addAll(myCommandOutputs);
enumeratedOutputs.addAll(myEnumeratedOutputs);
enumeratedPrimaryOutputs.addAll(myEnumeratedPrimaryOutputs);
enumeratedSecondaryOutputs.addAll(myEnumeratedSecondaryOutputs);
outputVariables.addAll(myOutputMacros.keySet());
outputsCalculated = true;
for (int i=0; i<myBuildVars.size(); i++) {
@ -548,11 +615,10 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
int kind = addlInput.getKind();
if (kind == IAdditionalInput.KIND_ADDITIONAL_DEPENDENCY ||
kind == IAdditionalInput.KIND_ADDITIONAL_INPUT_DEPENDENCY) {
String paths = addlInput.getPaths();
String[] paths = addlInput.getPaths();
if (paths != null) {
String[] pathTokens = paths.split(";"); //$NON-NLS-1$
for (int k = 0; k < pathTokens.length; k++) {
myCommandDependencies.add(pathTokens[k]);
for (int k = 0; k < paths.length; k++) {
myCommandDependencies.add(paths[k]);
//myEnumeratedInputs.add(pathTokens[k]);
}
}

View file

@ -0,0 +1,73 @@
/**********************************************************************
* Copyright (c) 2005 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.File;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.WorkspaceJob;
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.eclipse.core.runtime.jobs.ISchedulingRule;
class UpdateManagedProject21 {
/**
* @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, final IProject project) throws CoreException {
String[] projectName = new String[]{project.getName()};
IFile file = project.getFile(ManagedBuildManager.SETTINGS_FILE_NAME);
File settingsFile = file.getLocation().toFile();
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(file, "_21backup", monitor, project); //$NON-NLS-1$
// No physical conversion is need since the 3.0 model is a superset of the 2.1 model
// Just upgrade the version
((ManagedBuildInfo)info).setVersion(ManagedBuildManager.getBuildInfoVersion().toString());
info.setValid(true);
// Save the updated file
// If the tree is locked spawn a job to this.
IWorkspace workspace = project.getWorkspace();
boolean treeLock = workspace.isTreeLocked();
ISchedulingRule rule = workspace.getRuleFactory().createRule(project);
if (treeLock) {
WorkspaceJob job = new WorkspaceJob("Updating managed Project") {
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
ManagedBuildManager.saveBuildInfo(project, true);
return Status.OK_STATUS;
}
};
job.setRule(rule);
job.schedule();
} else {
ManagedBuildManager.saveBuildInfo(project, true);
}
monitor.done();
}
}

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2004 Intel Corporation and others.
* Copyright (c) 2004, 2005 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
@ -112,7 +112,7 @@ public class UpdateManagedProjectManager {
PluginVersionIdentifier compVersion = ManagedBuildManager.getBuildInfoVersion();
if(projVersion.isEquivalentTo(compVersion))
if(compVersion.isEquivalentTo(projVersion))
return true;
return false;
}
@ -291,6 +291,10 @@ public class UpdateManagedProjectManager {
UpdateManagedProject20.doProjectUpdate(monitor, fProject);
version = getManagedBuildInfoVersion(info.getVersion());
}
if(version.isEquivalentTo(new PluginVersionIdentifier(2,1,0))){
UpdateManagedProject21.doProjectUpdate(monitor, fProject);
version = getManagedBuildInfoVersion(info.getVersion());
}
if(!isCompatibleProject(info)){
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,

View file

@ -118,12 +118,9 @@
</managedBuildRevision>
<tool
natureFilter="cnature"
sources="o"
outputs=""
name="%ToolName.linker.gnu.c"
outputFlag="-o"
command="gcc"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultNoDependencyCalculator"
id="cdt.managedbuild.tool.gnu.c.linker">
<envVarBuildPath
pathType="buildpathLibrary"
@ -255,15 +252,32 @@
id="gnu.c.link.option.defname"
valueType="string">
</option>
<inputType
sources="o"
multipleOfType="true"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultNoDependencyCalculator"
buildVariable="OBJS"
id="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput
paths="$(USER_OBJS)"
kind="additionalinputdependency">
</additionalInput>
<additionalInput
paths="$(LIBS)"
kind="additionalinput">
</additionalInput>
</inputType>
<outputType
outputs=""
buildVariable="EXECUTABLES"
id="cdt.managedbuild.tool.gnu.c.linker.output">
</outputType>
</tool>
<tool
natureFilter="ccnature"
sources="o"
outputs=""
name="%ToolName.linker.gnu.cpp"
outputFlag="-o"
command="g++"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultNoDependencyCalculator"
id="cdt.managedbuild.tool.gnu.cpp.linker">
<envVarBuildPath
pathType="buildpathLibrary"
@ -386,16 +400,32 @@
valueType="string"
id="gnu.cpp.link.option.defname">
</option>
<inputType
sources="o"
multipleOfType="true"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultNoDependencyCalculator"
buildVariable="OBJS"
id="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput
paths="$(USER_OBJS)"
kind="additionalinputdependency">
</additionalInput>
<additionalInput
paths="$(LIBS)"
kind="additionalinput">
</additionalInput>
</inputType>
<outputType
outputs=""
buildVariable="EXECUTABLES"
id="cdt.managedbuild.tool.gnu.cpp.linker.output">
</outputType>
</tool>
<tool
natureFilter="both"
isAbstract="true"
sources="o"
name="%ToolName.archiver.gnu"
outputs="a"
command="ar"
outputPrefix="lib"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultNoDependencyCalculator"
id="cdt.managedbuild.tool.gnu.archiver">
<optionCategory
owner="cdt.managedbuild.tool.gnu.archiver"
@ -409,6 +439,27 @@
valueType="string"
id="gnu.both.lib.option.flags">
</option>
<inputType
sources="o"
multipleOfType="true"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultNoDependencyCalculator"
buildVariable="OBJS"
id="cdt.managedbuild.tool.gnu.archiver.input">
<additionalInput
paths="$(USER_OBJS)"
kind="additionalinputdependency">
</additionalInput>
<additionalInput
paths="$(LIBS)"
kind="additionalinput">
</additionalInput>
</inputType>
<outputType
outputs="a"
outputPrefix="lib"
buildVariable="ARCHIVES"
id="cdt.managedbuild.tool.gnu.archiver.output">
</outputType>
</tool>
<!--tool
command="windres"
@ -475,8 +526,6 @@
</tool-->
<tool
command="as"
sources="s,S"
outputs="o"
name="%ToolName.assembler.gnu"
outputFlag="-o"
id="cdt.managedbuild.tool.gnu.assembler"
@ -513,15 +562,21 @@
category="gnu.asm.category.general"
name="%Option.Gnu.Assembler.version"
id="gnu.both.asm.option.version"/>
<inputType
sources="s,S"
id="cdt.managedbuild.tool.gnu.assembler.input">
</inputType>
<outputType
outputs="o"
buildVariable="OBJS"
id="cdt.managedbuild.tool.gnu.assembler.output">
</outputType>
</tool>
<tool
natureFilter="cnature"
sources="o"
outputs=""
name="%ToolName.linker.macosx.c"
outputFlag="-o"
command="gcc"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultNoDependencyCalculator"
id="cdt.managedbuild.tool.macosx.c.linker">
<envVarBuildPath
pathType="buildpathLibrary"
@ -632,15 +687,32 @@
id="macosx.c.link.option.shared"
valueType="boolean">
</option>
<inputType
sources="o"
multipleOfType="true"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultNoDependencyCalculator"
buildVariable="OBJS"
id="cdt.managedbuild.tool.macosx.c.linker.input">
<additionalInput
paths="$(USER_OBJS)"
kind="additionalinputdependency">
</additionalInput>
<additionalInput
paths="$(LIBS)"
kind="additionalinput">
</additionalInput>
</inputType>
<outputType
outputs=""
buildVariable="EXECUTABLES"
id="cdt.managedbuild.tool.macosx.c.linker.output">
</outputType>
</tool>
<tool
natureFilter="ccnature"
sources="o"
outputs=""
name="%ToolName.linker.macosx.cpp"
outputFlag="-o"
command="g++"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultNoDependencyCalculator"
id="cdt.managedbuild.tool.macosx.cpp.linker">
<envVarBuildPath
pathType="buildpathLibrary"
@ -742,18 +814,34 @@
valueType="boolean"
id="macosx.cpp.link.option.shared">
</option>
<inputType
sources="o"
multipleOfType="true"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultNoDependencyCalculator"
buildVariable="OBJS"
id="cdt.managedbuild.tool.macosx.cpp.linker.input">
<additionalInput
paths="$(USER_OBJS)"
kind="additionalinputdependency">
</additionalInput>
<additionalInput
paths="$(LIBS)"
kind="additionalinput">
</additionalInput>
</inputType>
<outputType
outputs=""
buildVariable="EXECUTABLES"
id="cdt.managedbuild.tool.macosx.cpp.linker.output">
</outputType>
</tool>
<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">
<envVarBuildPath
pathType="buildpathInclude"
@ -987,17 +1075,24 @@
id="gnu.c.compiler.option.misc.ansi"
valueType="boolean">
</option>
<inputType
sources="c"
dependencyExtensions="h"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator"
id="cdt.managedbuild.tool.gnu.c.compiler.input">
</inputType>
<outputType
outputs="o"
buildVariable="OBJS"
id="cdt.managedbuild.tool.gnu.c.compiler.output">
</outputType>
</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">
<envVarBuildPath
pathType="buildpathInclude"
@ -1217,6 +1312,17 @@
id="gnu.cpp.compiler.option.other.verbose"
valueType="boolean">
</option>
<inputType
sources="c,C,cc,cxx,cpp"
dependencyExtensions="h,H,hpp"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator"
id="cdt.managedbuild.tool.gnu.cpp.compiler.input">
</inputType>
<outputType
outputs="o"
buildVariable="OBJS"
id="cdt.managedbuild.tool.gnu.cpp.compiler.output">
</outputType>
</tool>
<tool
@ -1227,6 +1333,11 @@
variableList="LIBRARY_PATH"
buildPathResolver="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.CygwinPathResolver">
</envVarBuildPath>
<outputType
outputs="exe"
superClass="cdt.managedbuild.tool.gnu.c.linker.output"
id="cdt.managedbuild.tool.gnu.c.linker.cygwin.output">
</outputType>
</tool>
<tool
id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin"
@ -1236,6 +1347,11 @@
variableList="LIBRARY_PATH"
buildPathResolver="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.CygwinPathResolver">
</envVarBuildPath>
<outputType
outputs="exe"
superClass="cdt.managedbuild.tool.gnu.cpp.linker.output"
id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.output">
</outputType>
</tool>
<tool
id="cdt.managedbuild.tool.gnu.c.compiler.cygwin"
@ -1271,6 +1387,7 @@
archList="all"
osList="solaris,linux,hpux,aix,qnx"
name="%ToolChainName.Dbg"
targetTool="cdt.managedbuild.tool.gnu.c.linker.exe.debug;cdt.managedbuild.tool.gnu.cpp.linker.exe.debug"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
id="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform
@ -1338,6 +1455,7 @@
archList="all"
osList="solaris,linux,hpux,aix,qnx"
name="%ToolChainName.Rel"
targetTool="cdt.managedbuild.tool.gnu.c.linker.exe.release;cdt.managedbuild.tool.gnu.cpp.linker.exe.release"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
id="cdt.managedbuild.toolchain.gnu.exe.release">
<targetPlatform
@ -1413,6 +1531,7 @@
archList="all"
osList="solaris,linux,hpux,aix,qnx"
name="%ToolChainName.Dbg"
targetTool="cdt.managedbuild.tool.gnu.c.linker.so.debug;cdt.managedbuild.tool.gnu.cpp.linker.so.debug"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
id="cdt.managedbuild.toolchain.gnu.so.debug">
<targetPlatform
@ -1459,25 +1578,35 @@
</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>
<outputType
outputs="so"
outputPrefix="lib"
buildVariable="LIBRARIES"
superClass="cdt.managedbuild.tool.gnu.c.linker.output"
id="cdt.managedbuild.tool.gnu.c.linker.so.debug.output">
</outputType>
</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>
<outputType
outputs="so"
outputPrefix="lib"
buildVariable="LIBRARIES"
superClass="cdt.managedbuild.tool.gnu.cpp.linker.output"
id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.output">
</outputType>
</tool>
<tool
id="cdt.managedbuild.tool.gnu.assembler.so.debug"
@ -1495,6 +1624,7 @@
archList="all"
osList="solaris,linux,hpux,aix,qnx"
name="%ToolChainName.Rel"
targetTool="cdt.managedbuild.tool.gnu.c.linker.so.release;cdt.managedbuild.tool.gnu.cpp.linker.so.release"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
id="cdt.managedbuild.toolchain.gnu.so.release">
<targetPlatform
@ -1541,25 +1671,35 @@
</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>
<outputType
outputs="so"
outputPrefix="lib"
buildVariable="LIBRARIES"
superClass="cdt.managedbuild.tool.gnu.c.linker.output"
id="cdt.managedbuild.tool.gnu.c.linker.so.release.output">
</outputType>
</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>
<outputType
outputs="so"
outputPrefix="lib"
buildVariable="LIBRARIES"
superClass="cdt.managedbuild.tool.gnu.cpp.linker.output"
id="cdt.managedbuild.tool.gnu.cpp.linker.so.release.output">
</outputType>
</tool>
<tool
id="cdt.managedbuild.tool.gnu.assembler.so.release"
@ -1584,6 +1724,7 @@
archList="all"
osList="solaris,linux,hpux,aix,qnx"
name="%ToolChainName.Dbg"
targetTool="cdt.managedbuild.tool.gnu.archiver.lib.debug"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
id="cdt.managedbuild.toolchain.gnu.lib.debug">
<targetPlatform
@ -1630,8 +1771,6 @@
</tool>
<tool
id="cdt.managedbuild.tool.gnu.archiver.lib.debug"
outputs="a"
outputPrefix="lib"
superClass="cdt.managedbuild.tool.gnu.archiver">
</tool>
<tool
@ -1650,6 +1789,7 @@
archList="all"
osList="solaris,linux,hpux,aix,qnx"
name="%ToolChainName.Rel"
targetTool="cdt.managedbuild.tool.gnu.archiver.lib.release"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
id="cdt.managedbuild.toolchain.gnu.lib.release">
<targetPlatform
@ -1696,8 +1836,6 @@
</tool>
<tool
id="cdt.managedbuild.tool.gnu.archiver.lib.release"
outputs="a"
outputPrefix="lib"
superClass="cdt.managedbuild.tool.gnu.archiver">
</tool>
<tool
@ -1723,6 +1861,7 @@
archList="all"
osList="win32"
name="%ToolChainName.Dbg"
targetTool="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.debug;cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.debug"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"
isToolChainSupported="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.IsGnuCygwinToolChainSupported"
configurationEnvironmentSupplier="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.GnuCygwinConfigurationEnvironmentSupplier"
@ -1771,12 +1910,10 @@
</tool>
<tool
id="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.debug"
outputs="exe"
superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin">
</tool>
<tool
id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.debug"
outputs="exe"
superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin">
</tool>
<tool
@ -1795,6 +1932,7 @@
archList="all"
osList="win32"
name="%ToolChainName.Rel"
targetTool="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.release;cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.release"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"
isToolChainSupported="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.IsGnuCygwinToolChainSupported"
configurationEnvironmentSupplier="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.GnuCygwinConfigurationEnvironmentSupplier"
@ -1843,12 +1981,10 @@
</tool>
<tool
id="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.release"
outputs="exe"
superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin">
</tool>
<tool
id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.exe.release"
outputs="exe"
superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin">
</tool>
<tool
@ -1874,6 +2010,7 @@
archList="all"
osList="win32"
name="%ToolChainName.Dbg"
targetTool="cdt.managedbuild.tool.gnu.c.linker.cygwin.so.debug;cdt.managedbuild.tool.gnu.cpp.linker.cygwin.so.debug"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"
isToolChainSupported="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.IsGnuCygwinToolChainSupported"
configurationEnvironmentSupplier="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.GnuCygwinConfigurationEnvironmentSupplier"
@ -1922,23 +2059,33 @@
</tool>
<tool
id="cdt.managedbuild.tool.gnu.c.linker.cygwin.so.debug"
outputs="dll,a.dll"
superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin">
<option
id="gnu.c.link.cygwin.so.debug.option.shared"
defaultValue="true"
superClass="gnu.c.link.option.shared">
</option>
<outputType
outputs="dll,a.dll"
buildVariable="LIBRARIES"
superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.output"
id="cdt.managedbuild.tool.gnu.c.linker.cygwin.so.debug.output">
</outputType>
</tool>
<tool
id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.so.debug"
outputs="dll,a.dll"
superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin">
<option
id="gnu.cpp.link.cygwin.so.debug.option.shared"
defaultValue="true"
superClass="gnu.cpp.link.option.shared">
</option>
<outputType
outputs="dll,a.dll"
buildVariable="LIBRARIES"
superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.output"
id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.so.debug.output">
</outputType>
</tool>
<tool
id="cdt.managedbuild.tool.gnu.assembler.cygwin.so.debug"
@ -1956,6 +2103,7 @@
archList="all"
osList="win32"
name="%ToolChainName.Rel"
targetTool="cdt.managedbuild.tool.gnu.c.linker.cygwin.so.release;cdt.managedbuild.tool.gnu.cpp.linker.cygwin.so.release"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"
isToolChainSupported="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.IsGnuCygwinToolChainSupported"
configurationEnvironmentSupplier="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.GnuCygwinConfigurationEnvironmentSupplier"
@ -2004,23 +2152,33 @@
</tool>
<tool
id="cdt.managedbuild.tool.gnu.c.linker.cygwin.so.release"
outputs="dll,a.dll"
superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin">
<option
id="gnu.c.link.cygwin.so.release.option.shared"
defaultValue="true"
superClass="gnu.c.link.option.shared">
</option>
<outputType
outputs="dll,a.dll"
buildVariable="LIBRARIES"
superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.output"
id="cdt.managedbuild.tool.gnu.c.linker.cygwin.so.release.output">
</outputType>
</tool>
<tool
id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.so.release"
outputs="dll,a.dll"
superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin">
<option
id="gnu.cpp.link.cygwin.so.release.option.shared"
defaultValue="true"
superClass="gnu.cpp.link.option.shared">
</option>
<outputType
outputs="dll,a.dll"
buildVariable="LIBRARIES"
superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.output"
id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.so.release.output">
</outputType>
</tool>
<tool
id="cdt.managedbuild.tool.gnu.assembler.cygwin.so.release"
@ -2045,6 +2203,7 @@
archList="all"
osList="win32"
name="%ToolChainName.Dbg"
targetTool="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.debug"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"
isToolChainSupported="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.IsGnuCygwinToolChainSupported"
configurationEnvironmentSupplier="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.GnuCygwinConfigurationEnvironmentSupplier"
@ -2093,8 +2252,6 @@
</tool>
<tool
id="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.debug"
outputPrefix="lib"
outputs="a"
superClass="cdt.managedbuild.tool.gnu.archiver">
</tool>
<tool
@ -2113,6 +2270,7 @@
archList="all"
osList="win32"
name="%ToolChainName.Rel"
targetTool="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.release"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"
isToolChainSupported="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.IsGnuCygwinToolChainSupported"
configurationEnvironmentSupplier="org.eclipse.cdt.managedbuilder.toolchain.gnu.cygwin.GnuCygwinConfigurationEnvironmentSupplier"
@ -2161,8 +2319,6 @@
</tool>
<tool
id="cdt.managedbuild.tool.gnu.archiver.cygwin.lib.release"
outputPrefix="lib"
outputs="a"
superClass="cdt.managedbuild.tool.gnu.archiver">
</tool>
<tool
@ -2187,6 +2343,7 @@
archList="all"
osList="macosx"
name="%ToolChainName.Dbg"
targetTool="cdt.managedbuild.tool.macosx.c.linker.macosx.exe.debug;cdt.managedbuild.tool.macosx.cpp.linker.macosx.exe.debug"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
id="cdt.managedbuild.toolchain.gnu.macosx.exe.debug">
<targetPlatform
@ -2254,6 +2411,7 @@
archList="all"
osList="macosx"
name="%ToolChainName.Rel"
targetTool="cdt.managedbuild.tool.macosx.c.linker.macosx.exe.release;cdt.managedbuild.tool.macosx.cpp.linker.macosx.exe.release"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
id="cdt.managedbuild.toolchain.gnu.macosx.exe.release">
<targetPlatform
@ -2329,6 +2487,7 @@
archList="all"
osList="macosx"
name="%ToolChainName.Dbg"
targetTool="cdt.managedbuild.tool.macosx.c.linker.macosx.so.debug;cdt.managedbuild.tool.macosx.cpp.linker.macosx.so.debug"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
id="cdt.managedbuild.toolchain.gnu.macosx.so.debug">
<targetPlatform
@ -2375,8 +2534,6 @@
</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"
@ -2393,16 +2550,28 @@
defaultValue="true"
superClass="macosx.c.link.option.nodeflibs">
</option>
<outputType
outputs="dylib"
outputPrefix="lib"
buildVariable="LIBRARIES"
superClass="cdt.managedbuild.tool.macosx.c.linker.output"
id="cdt.managedbuild.tool.macosx.c.linker.macosx.so.debug.output">
</outputType>
</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>
<outputType
outputs="dylib"
buildVariable="LIBRARIES"
superClass="cdt.managedbuild.tool.macosx.cpp.linker.output"
id="cdt.managedbuild.tool.macosx.cpp.linker.macosx.so.debug.output">
</outputType>
</tool>
<tool
id="cdt.managedbuild.tool.gnu.assembler.macosx.so.debug"
@ -2420,6 +2589,7 @@
archList="all"
osList="macosx"
name="%ToolChainName.Rel"
targetTool="cdt.managedbuild.tool.macosx.c.linker.macosx.so.release;cdt.managedbuild.tool.macosx.cpp.linker.macosx.so.release"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
id="cdt.managedbuild.toolchain.gnu.macosx.so.release">
<targetPlatform
@ -2466,8 +2636,6 @@
</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"
@ -2484,16 +2652,28 @@
defaultValue="true"
superClass="macosx.c.link.option.nodeflibs">
</option>
<outputType
outputs="dylib"
outputPrefix="lib"
buildVariable="LIBRARIES"
superClass="cdt.managedbuild.tool.macosx.c.linker.output"
id="cdt.managedbuild.tool.macosx.c.linker.macosx.so.release.output">
</outputType>
</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>
<outputType
outputs="dylib"
buildVariable="LIBRARIES"
superClass="cdt.managedbuild.tool.macosx.cpp.linker.output"
id="cdt.managedbuild.tool.macosx.cpp.linker.macosx.so.release.output">
</outputType>
</tool>
<tool
id="cdt.managedbuild.tool.gnu.assembler.macosx.so.release"
@ -2518,6 +2698,7 @@
archList="all"
osList="macosx"
name="%ToolChainName.Dbg"
targetTool="cdt.managedbuild.toolmacosx.lib.debug.gnu.archiver"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
id="cdt.managedbuild.toolchain.gnu.macosx.lib.debug">
<targetPlatform
@ -2564,8 +2745,6 @@
</tool>
<tool
id="cdt.managedbuild.toolmacosx.lib.debug.gnu.archiver"
outputPrefix="lib"
outputs="a"
superClass="cdt.managedbuild.tool.gnu.archiver">
</tool>
<tool
@ -2584,6 +2763,7 @@
archList="all"
osList="macosx"
name="%ToolChainName.Rel"
targetTool="cdt.managedbuild.toolmacosx.lib.release.gnu.archiver"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
id="cdt.managedbuild.toolchain.gnu.macosx.lib.release">
<targetPlatform
@ -2630,8 +2810,6 @@
</tool>
<tool
id="cdt.managedbuild.toolmacosx.lib.release.gnu.archiver"
outputPrefix="lib"
outputs="a"
superClass="cdt.managedbuild.tool.gnu.archiver">
</tool>
<tool

View file

@ -1,5 +1,5 @@
/**********************************************************************
* Copyright (c) 2002,2004 IBM Corporation and others.
* Copyright (c) 2002, 2005 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
@ -17,7 +17,10 @@ import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
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.ui.properties.BuildOptionSettingsPage;
@ -68,6 +71,8 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
private static final String OPTIONS_LABEL = LABEL + ".ToolOptions"; //$NON-NLS-1$
private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 20, 30 };
private static final String EMPTY_STRING = new String();
/*
* Dialog widgets
*/
@ -365,6 +370,9 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
protected void setValues() {
IConfiguration config = null;
IResourceConfiguration resConfig = null;
if (provider == null) {
// IResource element = parent.getProject();
IResource resource = (IResource) element;
@ -372,9 +380,11 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
optionList.setContentProvider(provider);
}
if ( element instanceof IProject ) {
optionList.setInput(parent.getSelectedConfiguration());
config = parent.getSelectedConfiguration();
optionList.setInput(config);
} else if ( element instanceof IFile){
optionList.setInput(resParent.getCurrentResourceConfig());
resConfig = resParent.getCurrentResourceConfig();
optionList.setInput(resConfig);
}
optionList.expandAll();
@ -399,11 +409,58 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
// Determine what the selection in the tree should be
Object primary = null;
if (selectedTool != null) {
// There is a selected tool defined
primary = selectedTool;
// There is a selected tool defined. See if it matches any current tool (by name)
ITool[] tools = null;
if ( element instanceof IProject ) {
tools = config.getFilteredTools();
} else if ( element instanceof IFile){
tools = resConfig.getTools();
}
String matchName = selectedTool.getName();
for (int i=0; i<tools.length; i++) {
ITool tool = tools[i];
if (tool.getName().equals(matchName)) {
primary = tool;
break;
}
}
} else if (selectedCategory != null) {
// There is a selected option or category
primary = selectedCategory;
// There is a selected option or category.
// See if it matches any category in the current config (by name)
ITool[] tools = null;
if ( element instanceof IProject ) {
tools = config.getFilteredTools();
} else if ( element instanceof IFile){
tools = resConfig.getTools();
}
String matchName = EMPTY_STRING;
IBuildObject catOrTool = selectedCategory;
do {
matchName = catOrTool.getName() + matchName;
if (catOrTool instanceof ITool) break;
else if (catOrTool instanceof IOptionCategory) {
catOrTool = ((IOptionCategory)catOrTool).getOwner();
} else break;
} while (catOrTool != null);
for (int i=0; i<tools.length && primary == null; i++) {
ITool tool = tools[i];
IOptionCategory[] cats = tool.getChildCategories();
for (int j=0; j<cats.length; j++) {
String catName = EMPTY_STRING;
catOrTool = cats[j];
do {
catName = catOrTool.getName() + catName;
if (catOrTool instanceof ITool) break;
else if (catOrTool instanceof IOptionCategory) {
catOrTool = ((IOptionCategory)catOrTool).getOwner();
} else break;
} while (catOrTool != null);
if (catName.equals(matchName)) {
primary = cats[j];
break;
}
}
}
}
if (primary == null) {