Java Code Examples for org.apache.ivy.core.module.descriptor.Configuration#getExtends()
The following examples show how to use
org.apache.ivy.core.module.descriptor.Configuration#getExtends() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IvyNode.java From ant-ivy with Apache License 2.0 | 6 votes |
@Deprecated public void discardConf(String rootModuleConf, String conf) { Set<String> depConfs = usage.addAndGetConfigurations(rootModuleConf); if (md == null) { depConfs.remove(conf); } else { // remove all given dependency configurations to the set + extended ones Configuration c = md.getConfiguration(conf); if (conf == null) { Message.warn("unknown configuration in " + getId() + ": " + conf); } else { // recursive remove of extended configurations for (String ext : c.getExtends()) { discardConf(rootModuleConf, ext); } depConfs.remove(c.getName()); } } }
Example 2
Source File: XmlModuleDescriptorWriter.java From ant-ivy with Apache License 2.0 | 6 votes |
protected static void printConfiguration(Configuration conf, PrintWriter out) { out.print("<conf"); out.print(" name=\"" + XMLHelper.escape(conf.getName()) + "\""); out.print(" visibility=\"" + XMLHelper.escape(conf.getVisibility().toString()) + "\""); if (conf.getDescription() != null) { out.print(" description=\"" + XMLHelper.escape(conf.getDescription()) + "\""); } String[] exts = conf.getExtends(); if (exts.length > 0) { out.print(listToPrefixedString(exts, " extends=\"")); } if (!conf.isTransitive()) { out.print(" transitive=\"false\""); } if (conf.getDeprecated() != null) { out.print(" deprecated=\"" + XMLHelper.escape(conf.getDeprecated()) + "\""); } printExtraAttributes(conf, out, " "); out.println("/>"); }
Example 3
Source File: AbstractModuleDescriptorParser.java From ant-ivy with Apache License 2.0 | 6 votes |
private void addExtendingConfigurations(String conf, DefaultDependencyDescriptor dd, boolean useDefaultMappingToGuessRightOperand) { Set<String> configsToAdd = new HashSet<>(); for (Configuration config : md.getConfigurations()) { for (String ext : config.getExtends()) { if (conf.equals(ext)) { String configName = config.getName(); configsToAdd.add(configName); addExtendingConfigurations(configName, dd, useDefaultMappingToGuessRightOperand); } } } parseDepsConfs(configsToAdd.toArray(new String[configsToAdd.size()]), dd, useDefaultMappingToGuessRightOperand); }
Example 4
Source File: XmlModuleDescriptorParserTest.java From ant-ivy with Apache License 2.0 | 6 votes |
@Test public void testImportConfigurationsWithExtendOtherConfigs() throws Exception { // import configurations and default mapping ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-configextendsothers2.xml"), true); assertNotNull(md); // has an 'all-public' configuration Configuration allPublic = md.getConfiguration("all-public"); assertNotNull(allPublic); // 'all-public' extends all other public configurations String[] allPublicExt = allPublic.getExtends(); assertEquals(Arrays.asList("default", "test", "extra"), Arrays.asList(allPublicExt)); }
Example 5
Source File: AbstractModuleDescriptorBackedMetaData.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private DefaultConfigurationMetaData populateConfigurationFromDescriptor(String name) { Configuration descriptorConfiguration = moduleDescriptor.getConfiguration(name); if (descriptorConfiguration == null) { return null; } Set<String> hierarchy = new LinkedHashSet<String>(); hierarchy.add(name); for (String parent : descriptorConfiguration.getExtends()) { hierarchy.addAll(getConfiguration(parent).hierarchy); } DefaultConfigurationMetaData configuration = new DefaultConfigurationMetaData(name, descriptorConfiguration, hierarchy); configurations.put(name, configuration); return configuration; }
Example 6
Source File: LazyDependencyToModuleResolver.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
protected void checkDescriptor(ComponentMetaData metaData) { ModuleDescriptor moduleDescriptor = metaData.getDescriptor(); for (Configuration configuration : moduleDescriptor.getConfigurations()) { for (String parent : configuration.getExtends()) { if (moduleDescriptor.getConfiguration(parent) == null) { throw new ModuleVersionResolveException(metaData.getId(), String.format("Configuration '%s' extends unknown configuration '%s' in module descriptor for %%s.", configuration.getName(), parent)); } } } }
Example 7
Source File: AbstractModuleDescriptorBackedMetaData.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private DefaultConfigurationMetaData populateConfigurationFromDescriptor(String name) { Configuration descriptorConfiguration = moduleDescriptor.getConfiguration(name); if (descriptorConfiguration == null) { return null; } Set<String> hierarchy = new LinkedHashSet<String>(); hierarchy.add(name); for (String parent : descriptorConfiguration.getExtends()) { hierarchy.addAll(getConfiguration(parent).hierarchy); } DefaultConfigurationMetaData configuration = new DefaultConfigurationMetaData(name, descriptorConfiguration, hierarchy); configurations.put(name, configuration); return configuration; }
Example 8
Source File: LazyDependencyToModuleResolver.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
protected void checkDescriptor(ComponentMetaData metaData) { ModuleDescriptor moduleDescriptor = metaData.getDescriptor(); for (Configuration configuration : moduleDescriptor.getConfigurations()) { for (String parent : configuration.getExtends()) { if (moduleDescriptor.getConfiguration(parent) == null) { throw new ModuleVersionResolveException(metaData.getId(), String.format("Configuration '%s' extends unknown configuration '%s' in module descriptor for %%s.", configuration.getName(), parent)); } } } }
Example 9
Source File: IvyNodeCallers.java From ant-ivy with Apache License 2.0 | 5 votes |
public void addConfiguration(String callerConf, String[] dependencyConfs) { updateConfs(callerConf, dependencyConfs); Configuration conf = md.getConfiguration(callerConf); if (conf != null) { String[] confExtends = conf.getExtends(); if (confExtends != null) { for (String confExtend : confExtends) { addConfiguration(confExtend, dependencyConfs); } } } }
Example 10
Source File: XmlModuleDescriptorParserTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Test public void testExtendOtherConfigs() throws Exception { // import configurations and default mapping ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-configextendsothers1.xml"), true); assertNotNull(md); // has an 'all-public' configuration Configuration allPublic = md.getConfiguration("all-public"); assertNotNull(allPublic); // 'all-public' extends all other public configurations String[] allPublicExt = allPublic.getExtends(); assertEquals(Arrays.asList("default", "test"), Arrays.asList(allPublicExt)); }
Example 11
Source File: ResolveEngine.java From ant-ivy with Apache License 2.0 | 4 votes |
private void doFetchDependencies(VisitNode node, String conf, Set<String> fetchedSet) { Configuration c = node.getConfiguration(conf); if (c == null) { if (!node.isConfRequiredByMergedUsageOnly(conf)) { Message.warn("configuration not found '" + conf + "' in " + node.getResolvedId() + ": ignoring"); if (node.getParent() != null) { Message.warn("it was required from " + node.getParent().getResolvedId()); } } return; } // we handle the case where the asked configuration extends others: // we have to first fetch the extended configurations // first we check if this is the actual requested conf (not an extended one) boolean requestedConfSet = false; if (node.getRequestedConf() == null) { node.setRequestedConf(conf); requestedConfSet = true; } // now let's recurse in extended confs String[] extendedConfs = c.getExtends(); if (extendedConfs.length > 0) { node.updateConfsToFetch(Arrays.asList(extendedConfs)); } for (String extendedConf : extendedConfs) { fetchDependencies(node, extendedConf, fetchedSet, false); } // now we can actually resolve this configuration dependencies if (!isDependenciesFetched(node.getNode(), conf, fetchedSet) && node.isTransitive()) { for (VisitNode dep : node.getDependencies(conf)) { dep.useRealNode(); // the node may have been resolved to another real one while // resolving other deps for (String rconf : dep.getRequiredConfigurations(node, conf)) { fetchDependencies(dep, rconf, fetchedSet, true); } if (!dep.isEvicted() && !dep.hasProblem()) { // if there are still confs to fetch (usually because they have // been updated when evicting another module), we fetch them now for (String fconf : dep.getConfsToFetch()) { // shouldBeFixed=false to because some of those dependencies might // be private when they were actually extending public conf. // Should we keep two list of confs to fetch (private&public)? // I don't think, visibility is already checked, and a change in the // configuration between version might anyway have worse problems. fetchDependencies(dep, fconf, fetchedSet, false); } } } markDependenciesFetched(node.getNode(), conf, fetchedSet); } // we have finished with this configuration, if it was the original requested conf // we can clean it now if (requestedConfSet) { node.setRequestedConf(null); } }