mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-11 10:15:39 +02:00
Bug #222742 : List values in Tool Options are not propagated
This commit is contained in:
parent
d82d0c2245
commit
93003bf673
1 changed files with 41 additions and 47 deletions
|
@ -81,6 +81,7 @@ import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||||
import org.eclipse.core.runtime.content.IContentType;
|
import org.eclipse.core.runtime.content.IContentType;
|
||||||
import org.eclipse.core.runtime.content.IContentTypeSettings;
|
import org.eclipse.core.runtime.content.IContentTypeSettings;
|
||||||
import org.eclipse.core.runtime.preferences.IScopeContext;
|
import org.eclipse.core.runtime.preferences.IScopeContext;
|
||||||
|
import org.osgi.framework.Version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a tool that can be invoked during a build.
|
* Represents a tool that can be invoked during a build.
|
||||||
|
@ -2212,25 +2213,22 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
public String[] getAllOutputExtensions(IProject project) {
|
public String[] getAllOutputExtensions(IProject project) {
|
||||||
IOutputType[] types = getOutputTypes();
|
IOutputType[] types = getOutputTypes();
|
||||||
if (types != null && types.length > 0) {
|
if (types != null && types.length > 0) {
|
||||||
List allExts = new ArrayList();
|
List<String> allExts = new ArrayList<String>();
|
||||||
for (int i=0; i<types.length; i++) {
|
for (IOutputType t : types) {
|
||||||
String[] exts = ((OutputType)types[i]).getOutputExtensions(this, project);
|
String[] exts = ((OutputType)t).getOutputExtensions(this, project);
|
||||||
if (exts != null) {
|
if (exts != null)
|
||||||
for (int j=0; j<exts.length; j++) {
|
for (String s : exts)
|
||||||
allExts.add(exts[j]);
|
allExts.add(s);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (allExts.size() > 0) {
|
|
||||||
return (String[])allExts.toArray(new String[allExts.size()]);
|
|
||||||
}
|
}
|
||||||
|
if (allExts.size() > 0)
|
||||||
|
return allExts.toArray(new String[allExts.size()]);
|
||||||
}
|
}
|
||||||
// If none, use the outputs specified for the Tool (backwards compatibility)
|
// If none, use the outputs specified for the Tool (backwards compatibility)
|
||||||
String[] extsList = getOutputsAttribute();
|
String[] extsList = getOutputsAttribute();
|
||||||
if (extsList != null && extsList.length > 0) {
|
if (extsList != null && extsList.length > 0)
|
||||||
return extsList;
|
return extsList;
|
||||||
}
|
else
|
||||||
return EMPTY_STRING_ARRAY;
|
return EMPTY_STRING_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -2479,13 +2477,11 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
IMacroContextInfoProvider provider) throws BuildException {
|
IMacroContextInfoProvider provider) throws BuildException {
|
||||||
IOption[] opts = getOptions();
|
IOption[] opts = getOptions();
|
||||||
ArrayList<String> flags = new ArrayList<String>();
|
ArrayList<String> flags = new ArrayList<String>();
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (IOption op : opts) {
|
for (IOption op : opts) {
|
||||||
IOption option = getOptionToSet(op, false);
|
IOption option = op;
|
||||||
if (option == null)
|
if (option == null)
|
||||||
continue;
|
continue;
|
||||||
option.setValue(op.getValue());
|
|
||||||
|
|
||||||
sb.setLength( 0 );
|
sb.setLength( 0 );
|
||||||
|
|
||||||
// check to see if the option has an applicability calculator
|
// check to see if the option has an applicability calculator
|
||||||
|
@ -2497,7 +2493,20 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
} else if ( parent instanceof IToolChain ){
|
} else if ( parent instanceof IToolChain ){
|
||||||
config = ((IToolChain)parent).getParent();
|
config = ((IToolChain)parent).getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (applicabilityCalculator == null || applicabilityCalculator.isOptionUsedInCommandLine(config, this, option)) {
|
if (applicabilityCalculator == null || applicabilityCalculator.isOptionUsedInCommandLine(config, this, option)) {
|
||||||
|
|
||||||
|
// update option in case when its value changed.
|
||||||
|
// This code is added to fix bug #219684 and
|
||||||
|
// avoid using "getOptionToSet()"
|
||||||
|
if (applicabilityCalculator != null &&
|
||||||
|
!(applicabilityCalculator instanceof BooleanExpressionApplicabilityCalculator)) {
|
||||||
|
if (option.getSuperClass() != null)
|
||||||
|
option = getOptionBySuperClassId(option.getSuperClass().getId());
|
||||||
|
else
|
||||||
|
option = getOptionById(option.getId());
|
||||||
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
switch (option.getValueType()) {
|
switch (option.getValueType()) {
|
||||||
case IOption.BOOLEAN :
|
case IOption.BOOLEAN :
|
||||||
|
@ -2626,7 +2635,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
*/
|
*/
|
||||||
public String getToolCommandFlagsString(IPath inputFileLocation, IPath outputFileLocation) throws BuildException{
|
public String getToolCommandFlagsString(IPath inputFileLocation, IPath outputFileLocation) throws BuildException{
|
||||||
// Get all of the optionList
|
// Get all of the optionList
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
String[] flags = getToolCommandFlags(inputFileLocation,outputFileLocation);
|
String[] flags = getToolCommandFlags(inputFileLocation,outputFileLocation);
|
||||||
for (int index = 0; index < flags.length; index++) {
|
for (int index = 0; index < flags.length; index++) {
|
||||||
if( flags[ index ] != null ) {
|
if( flags[ index ] != null ) {
|
||||||
|
@ -3075,9 +3084,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
String[] tmpVersions = versionsSupported.split(","); //$NON-NLS-1$
|
String[] tmpVersions = versionsSupported.split(","); //$NON-NLS-1$
|
||||||
|
|
||||||
for (int j = 0; j < tmpVersions.length; j++) {
|
for (int j = 0; j < tmpVersions.length; j++) {
|
||||||
if (new PluginVersionIdentifier(version)
|
if (new Version(version).equals(new Version(tmpVersions[j]))) {
|
||||||
.equals(new PluginVersionIdentifier(
|
|
||||||
tmpVersions[j]))) {
|
|
||||||
// version is supported.
|
// version is supported.
|
||||||
// Do the automatic conversion without
|
// Do the automatic conversion without
|
||||||
// prompting the user.
|
// prompting the user.
|
||||||
|
@ -3316,12 +3323,12 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
return (CLanguageData)typeToDataMap.get(type);
|
return (CLanguageData)typeToDataMap.get(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private void initDataMap(){
|
private void initDataMap(){
|
||||||
if(fDataMapInited)
|
if(fDataMapInited)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<IInputType> types = getLanguageInputTypes();
|
List<IInputType> types = getLanguageInputTypes();
|
||||||
// List datas = new ArrayList();
|
|
||||||
|
|
||||||
if(types != null){
|
if(types != null){
|
||||||
if(types.size() == 0){
|
if(types.size() == 0){
|
||||||
|
@ -3334,38 +3341,29 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
typeToDataMap.put(null, data);
|
typeToDataMap.put(null, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// datas.add(data);
|
|
||||||
} else {
|
} else {
|
||||||
//create editable input types for lang datas first
|
//create editable input types for lang datas first
|
||||||
|
|
||||||
for(ListIterator iter = types.listIterator(); iter.hasNext();){
|
for(ListIterator<IInputType> iter = types.listIterator(); iter.hasNext();){
|
||||||
IInputType type = (IInputType)iter.next();
|
IInputType type = iter.next();
|
||||||
iter.set(getEdtableInputType(type));
|
iter.set(getEdtableInputType(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
Map map = (Map)typeToDataMap.clone();
|
Map<IInputType, CLanguageData> map = (Map<IInputType, CLanguageData>)typeToDataMap.clone();
|
||||||
for(ListIterator iter = types.listIterator(); iter.hasNext();){
|
for(IInputType type : types){
|
||||||
IInputType type = (IInputType)iter.next();
|
|
||||||
CLanguageData data = (CLanguageData)map.remove(type);
|
CLanguageData data = (CLanguageData)map.remove(type);
|
||||||
if(data == null){
|
if(data == null){
|
||||||
data = new BuildLanguageData(this, type);
|
data = new BuildLanguageData(this, type);
|
||||||
typeToDataMap.put(type, data);
|
typeToDataMap.put(type, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// datas.add(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(map.size() > 0){
|
if(map.size() > 0){
|
||||||
for(Iterator iter = map.keySet().iterator(); iter.hasNext();){
|
for(IInputType it : map.keySet()){
|
||||||
typeToDataMap.remove(iter.next());
|
typeToDataMap.remove(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// int size = datas.size();
|
|
||||||
// for(int i = 0; i < size; i++){
|
|
||||||
// ((BuildLanguageData)datas.get(i)).obtainEditableInputType();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
fDataMapInited = true;
|
fDataMapInited = true;
|
||||||
}
|
}
|
||||||
|
@ -3683,7 +3681,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
String name = getName();
|
String name = getName();
|
||||||
String version = ManagedBuildManager.getVersionFromIdAndVersion(getId());
|
String version = ManagedBuildManager.getVersionFromIdAndVersion(getId());
|
||||||
if(version != null && version.length() != 0){
|
if(version != null && version.length() != 0){
|
||||||
return new StringBuffer().append(name).append(" (").append(version).append("").toString(); //$NON-NLS-1$ //$NON-NLS-2$
|
return new StringBuilder().append(name).append(" (").append(version).append("").toString(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -3804,7 +3802,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
} else if(ids.length == 0){
|
} else if(ids.length == 0){
|
||||||
errorParserIds = EMPTY_STRING;
|
errorParserIds = EMPTY_STRING;
|
||||||
} else {
|
} else {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append(ids[0]);
|
buf.append(ids[0]);
|
||||||
for(int i = 1; i < ids.length; i++){
|
for(int i = 1; i < ids.length; i++){
|
||||||
buf.append(";").append(ids[i]); //$NON-NLS-1$
|
buf.append(";").append(ids[i]); //$NON-NLS-1$
|
||||||
|
@ -3833,7 +3831,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
} else {
|
} else {
|
||||||
String version = ManagedBuildManager.getVersionFromIdAndVersion(getId());
|
String version = ManagedBuildManager.getVersionFromIdAndVersion(getId());
|
||||||
if(version != null){
|
if(version != null){
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append(name);
|
buf.append(name);
|
||||||
buf.append(" (v").append(version).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
|
buf.append(" (v").append(version).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
name = buf.toString();
|
name = buf.toString();
|
||||||
|
@ -3932,18 +3930,14 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(inputTypeList != null && inputTypeList.size() != 0){
|
if(inputTypeList != null && inputTypeList.size() != 0){
|
||||||
InputType inType;
|
for(InputType inType : inputTypeList){
|
||||||
for(Iterator iter = inputTypeList.iterator(); iter.hasNext();){
|
|
||||||
inType = (InputType)iter.next();
|
|
||||||
if(inType.hasCustomSettings())
|
if(inType.hasCustomSettings())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(outputTypeList != null && outputTypeList.size() != 0){
|
if(outputTypeList != null && outputTypeList.size() != 0){
|
||||||
OutputType outType;
|
for(OutputType outType : outputTypeList){
|
||||||
for(Iterator iter = outputTypeList.iterator(); iter.hasNext();){
|
|
||||||
outType = (OutputType)iter.next();
|
|
||||||
if(outType.hasCustomSettings())
|
if(outType.hasCustomSettings())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue