mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
Bug 571433: Make ManagedCommandLineGenerator API
Allow extenders to extend the ManagedCommandLineGenerator in order to add options that are placed on the toolchain node instead of the tool. Contributed by STMicroelectronics Change-Id: I548bcbf72f1290cd4bc0ce830c27ce032a62c9c9 Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
This commit is contained in:
parent
cdd00392c1
commit
0ca137e854
13 changed files with 183 additions and 83 deletions
|
@ -25,7 +25,7 @@ import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineGenerator;
|
import org.eclipse.cdt.managedbuilder.core.ManagedCommandLineGenerator;
|
||||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
||||||
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -71,13 +71,8 @@ public class ManagedCommandLineGeneratorTest extends TestCase {
|
||||||
return new TestSuite(ManagedCommandLineGeneratorTest.class);
|
return new TestSuite(ManagedCommandLineGeneratorTest.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void testGetCommandLineGenerator() {
|
|
||||||
IManagedCommandLineGenerator gen = ManagedCommandLineGenerator.getCommandLineGenerator();
|
|
||||||
assertNotNull(gen);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void testGenerateCommandLineInfoPatterns() {
|
public final void testGenerateCommandLineInfoPatterns() {
|
||||||
IManagedCommandLineGenerator gen = ManagedCommandLineGenerator.getCommandLineGenerator();
|
IManagedCommandLineGenerator gen = new ManagedCommandLineGenerator();
|
||||||
IManagedCommandLineInfo info = null;
|
IManagedCommandLineInfo info = null;
|
||||||
for (int i = 0; i < testCommandLinePatterns.length; i++) {
|
for (int i = 0; i < testCommandLinePatterns.length; i++) {
|
||||||
info = gen.generateCommandLineInfo(null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL,
|
info = gen.generateCommandLineInfo(null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL,
|
||||||
|
@ -90,7 +85,7 @@ public class ManagedCommandLineGeneratorTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void testGenerateCommandLineInfoDoublePattern() {
|
public final void testGenerateCommandLineInfoDoublePattern() {
|
||||||
IManagedCommandLineGenerator gen = ManagedCommandLineGenerator.getCommandLineGenerator();
|
IManagedCommandLineGenerator gen = new ManagedCommandLineGenerator();
|
||||||
|
|
||||||
IManagedCommandLineInfo info = gen.generateCommandLineInfo(null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL,
|
IManagedCommandLineInfo info = gen.generateCommandLineInfo(null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL,
|
||||||
OUTPUT_PREFIX_VAL, OUTPUT_VAL, INPUTS_ARRAY_VAL, "${OUTPUT_FLAG} ${OUTPUT_FLAG}");
|
OUTPUT_PREFIX_VAL, OUTPUT_VAL, INPUTS_ARRAY_VAL, "${OUTPUT_FLAG} ${OUTPUT_FLAG}");
|
||||||
|
@ -99,7 +94,7 @@ public class ManagedCommandLineGeneratorTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void testGenerateCommandLineInfoParameters() {
|
public final void testGenerateCommandLineInfoParameters() {
|
||||||
IManagedCommandLineGenerator gen = ManagedCommandLineGenerator.getCommandLineGenerator();
|
IManagedCommandLineGenerator gen = new ManagedCommandLineGenerator();
|
||||||
|
|
||||||
IManagedCommandLineInfo info = gen.generateCommandLineInfo(null, "", FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL,
|
IManagedCommandLineInfo info = gen.generateCommandLineInfo(null, "", FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL,
|
||||||
OUTPUT_PREFIX_VAL, OUTPUT_VAL, INPUTS_ARRAY_VAL, null);
|
OUTPUT_PREFIX_VAL, OUTPUT_VAL, INPUTS_ARRAY_VAL, null);
|
||||||
|
|
|
@ -41,7 +41,9 @@ public interface IManagedCommandLineInfo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* provide list of resources used by tool for transformation
|
* provide list of resources used by tool for transformation
|
||||||
|
* @deprecated Useless method that does not handle whitespace properly.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public String getInputs();
|
public String getInputs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -228,4 +228,9 @@ public interface IResourceConfiguration extends IResourceInfo {
|
||||||
void setRebuildState(boolean rebuild);
|
void setRebuildState(boolean rebuild);
|
||||||
|
|
||||||
void setTools(ITool[] tools);
|
void setTools(ITool[] tools);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 9.2
|
||||||
|
*/
|
||||||
|
IToolChain getBaseToolChain();
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,6 @@ import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.IMatchKeyProvider;
|
import org.eclipse.cdt.managedbuilder.internal.core.IMatchKeyProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.InputType;
|
import org.eclipse.cdt.managedbuilder.internal.core.InputType;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineGenerator;
|
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.MatchKey;
|
import org.eclipse.cdt.managedbuilder.internal.core.MatchKey;
|
||||||
|
@ -787,7 +786,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
||||||
if (tool != null) {
|
if (tool != null) {
|
||||||
return tool.getCommandLineGenerator();
|
return tool.getCommandLineGenerator();
|
||||||
}
|
}
|
||||||
return ManagedCommandLineGenerator.getCommandLineGenerator();
|
return new ManagedCommandLineGenerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,141 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2004, 2016 Intel Corporation and others.
|
||||||
|
*
|
||||||
|
* This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License 2.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Intel Corporation - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.managedbuilder.core;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 9.2
|
||||||
|
*/
|
||||||
|
public class ManagedCommandLineGenerator implements IManagedCommandLineGenerator {
|
||||||
|
|
||||||
|
private static final String DOUBLE_QUOTE = "\""; //$NON-NLS-1$
|
||||||
|
private static final String WHITESPACE = " "; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final String CMD_LINE_PRM_NAME = "COMMAND"; //$NON-NLS-1$
|
||||||
|
private static final String FLAGS_PRM_NAME = "FLAGS"; //$NON-NLS-1$
|
||||||
|
private static final String OUTPUT_FLAG_PRM_NAME = "OUTPUT_FLAG"; //$NON-NLS-1$
|
||||||
|
private static final String OUTPUT_PREFIX_PRM_NAME = "OUTPUT_PREFIX"; //$NON-NLS-1$
|
||||||
|
private static final String OUTPUT_PRM_NAME = "OUTPUT"; //$NON-NLS-1$
|
||||||
|
private static final String INPUTS_PRM_NAME = "INPUTS"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private String makeVariable(String variableName) {
|
||||||
|
return "${" + variableName + "}"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IManagedCommandLineInfo generateCommandLineInfo(ITool tool, String commandName, String[] flags,
|
||||||
|
String outputFlag, String outputPrefix, String outputName, String[] inputResources,
|
||||||
|
String commandLinePattern) {
|
||||||
|
if (commandLinePattern == null || commandLinePattern.length() <= 0) {
|
||||||
|
commandLinePattern = Tool.DEFAULT_PATTERN;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the output name isn't a variable then quote it
|
||||||
|
if (outputName.length() > 0 && outputName.indexOf("$(") != 0) { //$NON-NLS-1$
|
||||||
|
outputName = DOUBLE_QUOTE + outputName + DOUBLE_QUOTE;
|
||||||
|
}
|
||||||
|
|
||||||
|
String inputsStr = ""; //$NON-NLS-1$
|
||||||
|
if (inputResources != null) {
|
||||||
|
for (String inp : inputResources) {
|
||||||
|
if (inp != null && !inp.isEmpty()) {
|
||||||
|
// if the input resource isn't a variable then quote it
|
||||||
|
if (inp.indexOf("$(") != 0) { //$NON-NLS-1$
|
||||||
|
inp = DOUBLE_QUOTE + inp + DOUBLE_QUOTE;
|
||||||
|
}
|
||||||
|
inputsStr = inputsStr + inp + WHITESPACE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inputsStr = inputsStr.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
String flagsStr = stringArrayToString(flags);
|
||||||
|
|
||||||
|
String command = commandLinePattern;
|
||||||
|
|
||||||
|
command = command.replace(makeVariable(CMD_LINE_PRM_NAME), commandName);
|
||||||
|
command = command.replace(makeVariable(FLAGS_PRM_NAME), flagsStr);
|
||||||
|
command = command.replace(makeVariable(OUTPUT_FLAG_PRM_NAME), outputFlag);
|
||||||
|
command = command.replace(makeVariable(OUTPUT_PREFIX_PRM_NAME), outputPrefix);
|
||||||
|
command = command.replace(makeVariable(OUTPUT_PRM_NAME), outputName);
|
||||||
|
command = command.replace(makeVariable(INPUTS_PRM_NAME), inputsStr);
|
||||||
|
|
||||||
|
command = command.replace(makeVariable(CMD_LINE_PRM_NAME.toLowerCase()), commandName);
|
||||||
|
command = command.replace(makeVariable(FLAGS_PRM_NAME.toLowerCase()), flagsStr);
|
||||||
|
command = command.replace(makeVariable(OUTPUT_FLAG_PRM_NAME.toLowerCase()), outputFlag);
|
||||||
|
command = command.replace(makeVariable(OUTPUT_PREFIX_PRM_NAME.toLowerCase()), outputPrefix);
|
||||||
|
command = command.replace(makeVariable(OUTPUT_PRM_NAME.toLowerCase()), outputName);
|
||||||
|
command = command.replace(makeVariable(INPUTS_PRM_NAME.toLowerCase()), inputsStr);
|
||||||
|
|
||||||
|
return toManagedCommandLineInfo(command.trim(), commandLinePattern, commandName, flags, outputFlag,
|
||||||
|
outputPrefix, outputName, inputResources);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IManagedCommandLineInfo toManagedCommandLineInfo(String commandLine, String commandLinePattern,
|
||||||
|
String commandName, String[] flags, String outputFlag, String outputPrefix, String outputName,
|
||||||
|
String[] inputResources) {
|
||||||
|
String flagsStr = stringArrayToString(flags);
|
||||||
|
String inputResourcesStr = stringArrayToString(inputResources);
|
||||||
|
|
||||||
|
return new IManagedCommandLineInfo() {
|
||||||
|
@Override
|
||||||
|
public String getCommandLine() {
|
||||||
|
return commandLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandLinePattern() {
|
||||||
|
return commandLinePattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return commandName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFlags() {
|
||||||
|
return flagsStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOutputFlag() {
|
||||||
|
return outputFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOutputPrefix() {
|
||||||
|
return outputPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOutput() {
|
||||||
|
return outputName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getInputs() {
|
||||||
|
return inputResourcesStr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private String stringArrayToString(String[] array) {
|
||||||
|
if (array == null) {
|
||||||
|
return ""; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
return String.join(WHITESPACE, array);
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,10 @@ import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link org.eclipse.cdt.managedbuilder.core.ManagedCommandLineGenerator}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public class ManagedCommandLineGenerator implements IManagedCommandLineGenerator {
|
public class ManagedCommandLineGenerator implements IManagedCommandLineGenerator {
|
||||||
|
|
||||||
public final String AT = "@"; //$NON-NLS-1$
|
public final String AT = "@"; //$NON-NLS-1$
|
||||||
|
@ -51,7 +55,6 @@ public class ManagedCommandLineGenerator implements IManagedCommandLineGenerator
|
||||||
private static ManagedCommandLineGenerator cmdLineGen;
|
private static ManagedCommandLineGenerator cmdLineGen;
|
||||||
|
|
||||||
protected ManagedCommandLineGenerator() {
|
protected ManagedCommandLineGenerator() {
|
||||||
cmdLineGen = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ManagedCommandLineGenerator getCommandLineGenerator() {
|
public static ManagedCommandLineGenerator getCommandLineGenerator() {
|
||||||
|
@ -60,70 +63,12 @@ public class ManagedCommandLineGenerator implements IManagedCommandLineGenerator
|
||||||
return cmdLineGen;
|
return cmdLineGen;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String makeVariable(String variableName) {
|
|
||||||
return "${" + variableName + "}"; //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator#getCommandLineInfo(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String[], java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IManagedCommandLineInfo generateCommandLineInfo(ITool tool, String commandName, String[] flags,
|
public IManagedCommandLineInfo generateCommandLineInfo(ITool tool, String commandName, String[] flags,
|
||||||
String outputFlag, String outputPrefix, String outputName, String[] inputResources,
|
String outputFlag, String outputPrefix, String outputName, String[] inputResources,
|
||||||
String commandLinePattern) {
|
String commandLinePattern) {
|
||||||
if (commandLinePattern == null || commandLinePattern.length() <= 0)
|
// Forward the call to the API implementation
|
||||||
commandLinePattern = Tool.DEFAULT_PATTERN;
|
return new org.eclipse.cdt.managedbuilder.core.ManagedCommandLineGenerator().generateCommandLineInfo(tool,
|
||||||
|
commandName, flags, outputFlag, outputPrefix, outputName, inputResources, commandLinePattern);
|
||||||
// if the output name isn't a variable then quote it
|
|
||||||
if (outputName.length() > 0 && outputName.indexOf("$(") != 0) //$NON-NLS-1$
|
|
||||||
outputName = DOUBLE_QUOTE + outputName + DOUBLE_QUOTE;
|
|
||||||
|
|
||||||
String inputsStr = ""; //$NON-NLS-1$
|
|
||||||
if (inputResources != null) {
|
|
||||||
for (String inp : inputResources) {
|
|
||||||
if (inp != null && inp.length() > 0) {
|
|
||||||
// if the input resource isn't a variable then quote it
|
|
||||||
if (inp.indexOf("$(") != 0) { //$NON-NLS-1$
|
|
||||||
inp = DOUBLE_QUOTE + inp + DOUBLE_QUOTE;
|
|
||||||
}
|
|
||||||
inputsStr = inputsStr + inp + WHITESPACE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inputsStr = inputsStr.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
String flagsStr = stringArrayToString(flags);
|
|
||||||
|
|
||||||
String command = commandLinePattern;
|
|
||||||
|
|
||||||
command = command.replace(makeVariable(CMD_LINE_PRM_NAME), commandName);
|
|
||||||
command = command.replace(makeVariable(FLAGS_PRM_NAME), flagsStr);
|
|
||||||
command = command.replace(makeVariable(OUTPUT_FLAG_PRM_NAME), outputFlag);
|
|
||||||
command = command.replace(makeVariable(OUTPUT_PREFIX_PRM_NAME), outputPrefix);
|
|
||||||
command = command.replace(makeVariable(OUTPUT_PRM_NAME), outputName);
|
|
||||||
command = command.replace(makeVariable(INPUTS_PRM_NAME), inputsStr);
|
|
||||||
|
|
||||||
command = command.replace(makeVariable(CMD_LINE_PRM_NAME.toLowerCase()), commandName);
|
|
||||||
command = command.replace(makeVariable(FLAGS_PRM_NAME.toLowerCase()), flagsStr);
|
|
||||||
command = command.replace(makeVariable(OUTPUT_FLAG_PRM_NAME.toLowerCase()), outputFlag);
|
|
||||||
command = command.replace(makeVariable(OUTPUT_PREFIX_PRM_NAME.toLowerCase()), outputPrefix);
|
|
||||||
command = command.replace(makeVariable(OUTPUT_PRM_NAME.toLowerCase()), outputName);
|
|
||||||
command = command.replace(makeVariable(INPUTS_PRM_NAME.toLowerCase()), inputsStr);
|
|
||||||
|
|
||||||
return new ManagedCommandLineInfo(command.trim(), commandLinePattern, commandName, stringArrayToString(flags),
|
|
||||||
outputFlag, outputPrefix, outputName, stringArrayToString(inputResources));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String stringArrayToString(String[] array) {
|
|
||||||
if (array == null || array.length <= 0)
|
|
||||||
return ""; //$NON-NLS-1$
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
for (int i = 0; i < array.length; i++) {
|
|
||||||
if (i > 0) // we add whitespace after each but not first so .trim() is a no-op
|
|
||||||
sb.append(WHITESPACE);
|
|
||||||
sb.append(array[i]);
|
|
||||||
}
|
|
||||||
return sb.toString().trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@ package org.eclipse.cdt.managedbuilder.internal.core;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link org.eclipse.cdt.managedbuilder.core.ManagedCommandLineGenerator}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public class ManagedCommandLineInfo implements IManagedCommandLineInfo {
|
public class ManagedCommandLineInfo implements IManagedCommandLineInfo {
|
||||||
|
|
||||||
private String commandLine;
|
private String commandLine;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
|
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,4 +161,9 @@ public class MultiFileInfo extends MultiResourceInfo implements IFileInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IToolChain getBaseToolChain() {
|
||||||
|
return ((IFileInfo) fRis[curr]).getBaseToolChain();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -918,6 +918,7 @@ public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
|
||||||
return list.toArray(new BuildLanguageData[list.size()]);
|
return list.toArray(new BuildLanguageData[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToolChain getBaseToolChain() {
|
public IToolChain getBaseToolChain() {
|
||||||
ITool tools[] = getToolsToInvoke();
|
ITool tools[] = getToolsToInvoke();
|
||||||
ITool baseTool = null;
|
ITool baseTool = null;
|
||||||
|
|
|
@ -65,6 +65,7 @@ import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedCommandLineGenerator;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildEntryStorage;
|
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildEntryStorage;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildLanguageData;
|
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildLanguageData;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.enablement.OptionEnablementExpression;
|
import org.eclipse.cdt.managedbuilder.internal.enablement.OptionEnablementExpression;
|
||||||
|
@ -2190,7 +2191,7 @@ public class Tool extends HoldsOptions
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ManagedCommandLineGenerator.getCommandLineGenerator();
|
return new ManagedCommandLineGenerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -2,10 +2,10 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %Bundle-Name
|
Bundle-Name: %Bundle-Name
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.build.crossgcc;singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.build.crossgcc;singleton:=true
|
||||||
Bundle-Version: 1.2.100.qualifier
|
Bundle-Version: 1.2.200.qualifier
|
||||||
Require-Bundle: org.eclipse.core.runtime,
|
Require-Bundle: org.eclipse.core.runtime,
|
||||||
org.eclipse.cdt.core;bundle-version="5.1.0",
|
org.eclipse.cdt.core;bundle-version="5.1.0",
|
||||||
org.eclipse.cdt.managedbuilder.core;bundle-version="5.0.100",
|
org.eclipse.cdt.managedbuilder.core;bundle-version="9.2.0",
|
||||||
org.eclipse.cdt.managedbuilder.gnu.ui;bundle-version="5.0.100",
|
org.eclipse.cdt.managedbuilder.gnu.ui;bundle-version="5.0.100",
|
||||||
org.eclipse.core.resources;bundle-version="3.5.0",
|
org.eclipse.core.resources;bundle-version="3.5.0",
|
||||||
org.eclipse.cdt.managedbuilder.ui;bundle-version="8.1.0",
|
org.eclipse.cdt.managedbuilder.ui;bundle-version="8.1.0",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Copyright (c) 2009, 2020 Contributors to the Eclipse Foundation
|
# Copyright (c) 2009, 2021 Contributors to the Eclipse Foundation
|
||||||
#
|
#
|
||||||
# See the NOTICE file(s) distributed with this work for additional
|
# See the NOTICE file(s) distributed with this work for additional
|
||||||
# information regarding copyright ownership.
|
# information regarding copyright ownership.
|
||||||
|
@ -24,7 +24,7 @@ blurb=C/C++ GCC Cross Compiler Support\n\
|
||||||
Version: {featureVersion}\n\
|
Version: {featureVersion}\n\
|
||||||
Build id: {0}\n\
|
Build id: {0}\n\
|
||||||
\n\
|
\n\
|
||||||
Copyright (c) 2009, 2020 Contributors to the Eclipse Foundation
|
Copyright (c) 2009, 2021 Contributors to the Eclipse Foundation
|
||||||
\n\
|
\n\
|
||||||
See the NOTICE file(s) distributed with this work for additional\n\
|
See the NOTICE file(s) distributed with this work for additional\n\
|
||||||
information regarding copyright ownership.\n\
|
information regarding copyright ownership.\n\
|
||||||
|
|
|
@ -16,10 +16,10 @@ package org.eclipse.cdt.internal.build.crossgcc;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineGenerator;
|
import org.eclipse.cdt.managedbuilder.core.ManagedCommandLineGenerator;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ResourceConfiguration;
|
|
||||||
|
|
||||||
public class CrossCommandLineGenerator extends ManagedCommandLineGenerator {
|
public class CrossCommandLineGenerator extends ManagedCommandLineGenerator {
|
||||||
|
|
||||||
|
@ -29,10 +29,11 @@ public class CrossCommandLineGenerator extends ManagedCommandLineGenerator {
|
||||||
String commandLinePattern) {
|
String commandLinePattern) {
|
||||||
IBuildObject parent = tool.getParent();
|
IBuildObject parent = tool.getParent();
|
||||||
IToolChain toolchain;
|
IToolChain toolchain;
|
||||||
if (parent instanceof ResourceConfiguration)
|
if (parent instanceof IResourceConfiguration) {
|
||||||
toolchain = ((ResourceConfiguration) parent).getBaseToolChain();
|
toolchain = ((IResourceConfiguration) parent).getBaseToolChain();
|
||||||
else
|
} else {
|
||||||
toolchain = (IToolChain) parent;
|
toolchain = (IToolChain) parent;
|
||||||
|
}
|
||||||
|
|
||||||
IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.prefix"); //$NON-NLS-1$
|
IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.prefix"); //$NON-NLS-1$
|
||||||
String prefix = (String) option.getValue();
|
String prefix = (String) option.getValue();
|
||||||
|
|
Loading…
Add table
Reference in a new issue