1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 321040 - Getting Library search paths from Tool's Option

This commit is contained in:
James Blackburn 2011-02-13 15:37:47 +00:00
parent a733900f52
commit 8b954e69cb
3 changed files with 49 additions and 6 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2010 IBM Corporation and others.
* Copyright (c) 2003, 2011 IBM 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
@ -9,6 +9,7 @@
* IBM - Initial API and implementation
* ARM Ltd. - basic tooltip support
* James Blackburn (Broadcom Corp.)
* Petri Tuononen - [321040] Get Library Search Paths
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.core;
@ -340,8 +341,17 @@ public interface IOption extends IBuildObject {
*
* @since 7.0
*/
public String[] getLibraryFiles() throws BuildException ;
public String[] getLibraryFiles() throws BuildException;
/**
* @return an array or <code>String</code>s containing the library paths
* passed to the linker.
*
* @throws BuildException if the option isn't of type IOption#LIBRARY_PATHS
* @since 8.0
*/
public String[] getLibraryPaths() throws BuildException;
/**
* @return a <code>String</code> containing the unique ID of the selected
* enumeration in an enumerated option. For an option that has not been

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2010 IBM Corporation and others.
* Copyright (c) 2003, 2011 IBM 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
@ -8,6 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
* ARM Ltd. - basic tooltip support
* Petri Tuononen - [321040] Get Library Search Paths
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@ -1387,7 +1388,6 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IOption#getLibraryFiles()
*/
@ -1405,6 +1405,23 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IOption#getLibraryPaths()
*/
public String[] getLibraryPaths() throws BuildException {
if (getValueType() != LIBRARY_PATHS) {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
@SuppressWarnings("unchecked")
ArrayList<String> v = (ArrayList<String>)getValue();
if (v == null) {
return EMPTY_STRING_ARRAY;
} else {
v.trimToSize();
return v.toArray(new String[v.size()]);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IOption#getDefaultEnumValue()
*/

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2010 IBM Corporation and others.
* Copyright (c) 2003, 2011 IBM 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
@ -8,6 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
* ARM Ltd. - basic tooltip support
* Petri Tuononen - [321040] Get Library Search Paths
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@ -455,6 +456,21 @@ public class OptionReference implements IOption {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IOption#getLibraryPaths()
*/
public String[] getLibraryPaths() throws BuildException {
if (value == null)
return option.getLibraryPaths();
else if (getValueType() == LIBRARY_PATHS) {
@SuppressWarnings("unchecked")
ArrayList<String> list = (ArrayList<String>)value;
return list.toArray(new String[list.size()]);
}
else
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
*/