mirror of https://github.com/apache/ant-ivy
IMPROVE: add wildcard support for extending configurations (IVY-235) (thanks to Maarten Coene)
git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/trunk@484317 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1d6a986b28
commit
ffa3cf166b
|
|
@ -32,6 +32,7 @@ for detailed view of each issue, please consult http://jira.jayasoft.org/
|
|||
- NEW: add option to cachepath task to create a path with local artifact paths (IVY-221)
|
||||
- NEW: allow extending configurations to override the mapping of their super configurations (IVY-218)
|
||||
|
||||
- IMPROVE: add wildcard support for extending configurations (IVY-235)
|
||||
- IMPROVE: add support for xslt parameters in the report task (IVY-227)
|
||||
- IMPROVE: comments now aren't lost when delivering ivy files (IVY-226)
|
||||
- IMPROVE: add sort of 'fallback'-mapping to the defaultconfmapping attribute (IVY-215)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
*/
|
||||
package fr.jayasoft.ivy;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import fr.jayasoft.ivy.extendable.DefaultExtendableItem;
|
||||
|
||||
|
||||
|
|
@ -132,4 +135,39 @@ public class Configuration extends DefaultExtendableItem {
|
|||
public int hashCode() {
|
||||
return getName().hashCode();
|
||||
}
|
||||
|
||||
public void replaceWildcards(ModuleDescriptor md) {
|
||||
if (this != md.getConfiguration(_name)) {
|
||||
throw new IllegalArgumentException(
|
||||
"The given ModuleDescriptor doesn't own this configuration!");
|
||||
}
|
||||
|
||||
Configuration[] configs = md.getConfigurations();
|
||||
|
||||
Set newExtends = new LinkedHashSet();
|
||||
for (int j = 0; j < _extends.length; j++) {
|
||||
if ("*".equals(_extends[j])) {
|
||||
addOther(configs, null, newExtends);
|
||||
} else if ("*(public)".equals(_extends[j])) {
|
||||
addOther(configs, Visibility.PUBLIC, newExtends);
|
||||
} else if ("*(private)".equals(_extends[j])) {
|
||||
addOther(configs, Visibility.PRIVATE, newExtends);
|
||||
} else {
|
||||
newExtends.add(_extends[j]);
|
||||
}
|
||||
}
|
||||
|
||||
this._extends = (String[]) newExtends.toArray(new String[newExtends.size()]);
|
||||
}
|
||||
|
||||
private void addOther(Configuration[] allConfigs, Visibility visibility, Set configs) {
|
||||
for (int i = 0; i < allConfigs.length; i++) {
|
||||
String currentName = allConfigs[i].getName();
|
||||
if (!_name.equals(currentName)
|
||||
&& ((visibility == null) || visibility.equals(allConfigs[i].getVisibility()))) {
|
||||
configs.add(currentName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -474,9 +474,18 @@ public class XmlModuleDescriptorParser extends AbstractModuleDescriptorParser {
|
|||
private void checkConfigurations() {
|
||||
if (_md.getConfigurations().length == 0) {
|
||||
_md.addConfiguration(new Configuration("default"));
|
||||
} else {
|
||||
replaceConfigurationWildcards();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void replaceConfigurationWildcards() {
|
||||
Configuration[] configs = _md.getConfigurations();
|
||||
for (int i = 0; i < configs.length; i++) {
|
||||
configs[i].replaceWildcards(_md);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue