Skip to main content
summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorMikhail Sennikovsky2006-05-18 09:11:49 +0000
committerMikhail Sennikovsky2006-05-18 09:11:49 +0000
commitc39dabe4c2b32e00070429bbc0ca2f5fbb8750a8 (patch)
tree8448f1cbc3888cc2d28ef96f10f826558058a3a3 /build
parentf9fa5b5f7f558881f1507316fc18fcbbc9fac7a2 (diff)
downloadorg.eclipse.cdt-c39dabe4c2b32e00070429bbc0ca2f5fbb8750a8.tar.gz
org.eclipse.cdt-c39dabe4c2b32e00070429bbc0ca2f5fbb8750a8.tar.xz
org.eclipse.cdt-c39dabe4c2b32e00070429bbc0ca2f5fbb8750a8.zip
target tool calculation now works when the targetTool is not specified with the tool-chain
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java41
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java6
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java44
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java28
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/macros/MbsMacroSupplier.java6
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java16
6 files changed, 92 insertions, 49 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java
index 1ca572e51a0..7308ddc64b9 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java
@@ -259,7 +259,16 @@ public interface IConfiguration extends IBuildObject {
public ITool[] getTools();
/**
- * Returns the tool in this configuration that creates the build artifact.
+ * Returns the tool in this configuration specified with
+ * the toolChain#targetTool attribute that creates the build artifact
+ *
+ * NOTE: This method returns null in case the toolChain definition
+ * does not have the targetTool attribute or if the attribute does not
+ * refer to the appropriate tool.
+ * For the target tool calculation the IConfiguration#calculateTargetTool()
+ * method should be used
+ *
+ * @see IConfiguration#calculateTargetTool()
*
* @return ITool
*/
@@ -508,4 +517,34 @@ public interface IConfiguration extends IBuildObject {
*/
public boolean needsFullRebuild();
+ /**
+ * Calculates the configuration target tool.
+ *
+ * @return ITool or null if not found
+ *
+ * @since 3.1
+ */
+ public ITool calculateTargetTool();
+
+ /**
+ * Returns a <code>ITool</code> for the tool associated with the
+ * output extension.
+ *
+ * @param extension the file extension of the output file
+ * @return ITool
+ *
+ * @since 3.1
+ */
+ public ITool getToolFromOutputExtension(String extension);
+
+ /**
+ * Returns a <code>ITool</code> for the tool associated with the
+ * input extension.
+ *
+ * @param extension the file extension of the input file
+ * @return ITool
+ *
+ * @since 3.1
+ */
+ public ITool getToolFromInputExtension(String sourceExtension);
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java
index ad117774ad2..f23ce917ea5 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java
@@ -566,7 +566,7 @@ public class BuildDescription implements IBuildDescription {
// Generate the step to build this source file
IInputType primaryInputType = tool.getPrimaryInputType();
if ((primaryInputType != null && !primaryInputType.getMultipleOfType()) ||
- (inputType == null && tool != fInfo.getToolFromOutputExtension(fCfg.getArtifactExtension()))){
+ (inputType == null && tool != fCfg.getToolFromOutputExtension(fCfg.getArtifactExtension()))){
BuildStep action = null;
BuildIOType argument = null;
@@ -1423,7 +1423,7 @@ public class BuildDescription implements IBuildDescription {
}
//TODO
} else if (VAR_LIBS.equals(var)){
- ITool libTool = fCfg.getTargetTool();
+ ITool libTool = fCfg.calculateTargetTool();
if(libTool == null)
libTool = step.getTool();
@@ -1515,7 +1515,7 @@ public class BuildDescription implements IBuildDescription {
public String[] getUserObjs(BuildStep step) {
Vector objs = new Vector();
- ITool tool = fCfg.getTargetTool();
+ ITool tool = fCfg.calculateTargetTool();
if(tool == null)
tool = step.getTool();
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
index a0ba69691e0..4cc276d59d4 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
@@ -1641,29 +1641,49 @@ public class Configuration extends BuildObject implements IConfiguration {
ITool tool = getTargetTool();
if(tool == null){
+ tool = getToolFromOutputExtension(getArtifactExtension());
+ }
+
+ if(tool == null){
IConfiguration extCfg;
for(extCfg = this;
extCfg != null && !extCfg.isExtensionElement();
extCfg = extCfg.getParent()){
-
}
- String ext = extCfg != null ? extCfg.getArtifactExtension() :
- getArtifactExtension();
-
- // Get all the tools for the current config
- ITool[] tools = getFilteredTools();
- for (int index = 0; index < tools.length; index++) {
- ITool t = tools[index];
- if (t.producesFileType(ext)) {
- tool = t;
- break;
- }
+ if(extCfg != null){
+ tool = getToolFromOutputExtension(extCfg.getArtifactExtension());
}
}
return tool;
}
+
+ public ITool getToolFromOutputExtension(String extension) {
+ // Treat a null argument as an empty string
+ String ext = extension == null ? EMPTY_STRING : extension;
+ // Get all the tools for the current config
+ ITool[] tools = getFilteredTools();
+ for (int index = 0; index < tools.length; index++) {
+ ITool tool = tools[index];
+ if (tool.producesFileType(ext)) {
+ return tool;
+ }
+ }
+ return null;
+ }
+
+ public ITool getToolFromInputExtension(String sourceExtension) {
+ // Get all the tools for the current config
+ ITool[] tools = getFilteredTools();
+ for (int index = 0; index < tools.length; index++) {
+ ITool tool = tools[index];
+ if (tool.buildsFileType(sourceExtension)) {
+ return tool;
+ }
+ }
+ return null;
+ }
/*
* The resource delta passed to the builder is not always up-to-date
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
index 33bdb114a53..b7c65c826bb 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
@@ -405,7 +405,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
*/
public String[] getLibsForConfiguration(String extension) {
Vector libs = new Vector();
- ITool tool = getDefaultConfiguration().getTargetTool();
+ ITool tool = getDefaultConfiguration().calculateTargetTool();
if(tool == null)
tool = getToolFromOutputExtension(extension);
@@ -668,32 +668,16 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolFromInputExtension(java.lang.String)
*/
public ITool getToolFromInputExtension(String sourceExtension) {
- // Get all the tools for the current config
- ITool[] tools = getFilteredTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- if (tool.buildsFileType(sourceExtension)) {
- return tool;
- }
- }
- return null;
+ IConfiguration config = getDefaultConfiguration();
+ return config.getToolFromInputExtension(sourceExtension);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getToolFromOutputExtension(java.lang.String)
*/
public ITool getToolFromOutputExtension(String extension) {
- // Treat a null argument as an empty string
- String ext = extension == null ? new String() : extension;
- // Get all the tools for the current config
- ITool[] tools = getFilteredTools();
- for (int index = 0; index < tools.length; index++) {
- ITool tool = tools[index];
- if (tool.producesFileType(ext)) {
- return tool;
- }
- }
- return null;
+ IConfiguration config = getDefaultConfiguration();
+ return config.getToolFromOutputExtension(extension);
}
/* (non-Javadoc)
@@ -766,7 +750,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
*/
public String[] getUserObjectsForConfiguration(String extension) {
Vector objs = new Vector();
- ITool tool = getDefaultConfiguration().getTargetTool();
+ ITool tool = getDefaultConfiguration().calculateTargetTool();
if(tool == null)
tool = getToolFromOutputExtension(extension);
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/macros/MbsMacroSupplier.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/macros/MbsMacroSupplier.java
index 2a1a58e3b15..510b59e77b3 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/macros/MbsMacroSupplier.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/macros/MbsMacroSupplier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005 Intel Corporation and others.
+ * Copyright (c) 2005, 2006 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -412,7 +412,7 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
}
else if("BuildArtifactFileBaseName".equals(macroName)){ //$NON-NLS-1$
String name = cfg.getArtifactName();
- ITool targetTool = cfg.getTargetTool();
+ ITool targetTool = cfg.calculateTargetTool();
if(targetTool != null){
IOutputType pot = targetTool.getPrimaryOutputType();
String prefix = pot.getOutputPrefix();
@@ -473,7 +473,7 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
macro = new BuildMacro(macroName,IBuildMacro.VALUE_TEXT,name);
}
else if("BuildArtifactFilePrefix".equals(macroName)){ //$NON-NLS-1$
- ITool targetTool = cfg.getTargetTool();
+ ITool targetTool = cfg.calculateTargetTool();
if(targetTool != null){
IOutputType pot = targetTool.getPrimaryOutputType();
String prefix = pot.getOutputPrefix();
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
index b72f236dbc8..e953fe6bda2 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
@@ -1175,10 +1175,10 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
String postannouncebuildStep = info.getPostannouncebuildStep();
String targets = rebuild ? "clean all" : "all"; //$NON-NLS-1$ //$NON-NLS-2$
- ITool targetTool = config.getTargetTool();
- if (targetTool == null) {
- targetTool = info.getToolFromOutputExtension(buildTargetExt);
- }
+ ITool targetTool = config.calculateTargetTool();
+// if (targetTool == null) {
+// targetTool = info.getToolFromOutputExtension(buildTargetExt);
+// }
// Get all the projects the build target depends on
IProject[] refdProjects = null;
@@ -3687,10 +3687,10 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
int[] doneState = new int[buildTools.length];
// Identify the target tool
- ITool targetTool = config.getTargetTool();
- if (targetTool == null) {
- targetTool = info.getToolFromOutputExtension(buildTargetExt);
- }
+ ITool targetTool = config.calculateTargetTool();
+// if (targetTool == null) {
+// targetTool = info.getToolFromOutputExtension(buildTargetExt);
+// }
// Initialize the tool info array and the done state
for (int i=0; i<buildTools.length; i++) {

Back to the top