当前位置: 首页>>代码示例>>Java>>正文


Java ModuleDescriptor.getConfiguration方法代码示例

本文整理汇总了Java中org.apache.ivy.core.module.descriptor.ModuleDescriptor.getConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java ModuleDescriptor.getConfiguration方法的具体用法?Java ModuleDescriptor.getConfiguration怎么用?Java ModuleDescriptor.getConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ivy.core.module.descriptor.ModuleDescriptor的用法示例。


在下文中一共展示了ModuleDescriptor.getConfiguration方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveTargetConfigurations

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
public Set<ConfigurationMetaData> resolveTargetConfigurations(DependencyMetaData dependencyMetaData, ConfigurationMetaData fromConfiguration, ComponentResolveMetaData targetComponent) {
    // TODO - resolve directly to config meta data
    ModuleDescriptor targetDescriptor = targetComponent.getDescriptor();
    DependencyDescriptor dependencyDescriptor = dependencyMetaData.getDescriptor();
    Set<String> targetConfigurationNames = new LinkedHashSet<String>();
    for (String config : dependencyDescriptor.getModuleConfigurations()) {
        if (config.equals("*") || config.equals("%")) {
            collectTargetConfiguration(dependencyDescriptor, fromConfiguration, fromConfiguration.getName(), targetDescriptor, targetConfigurationNames);
        } else if (fromConfiguration.getHierarchy().contains(config)) {
            collectTargetConfiguration(dependencyDescriptor, fromConfiguration, config, targetDescriptor, targetConfigurationNames);
        }
    }

    Set<ConfigurationMetaData> targets = new LinkedHashSet<ConfigurationMetaData>();
    for (String targetConfigurationName : targetConfigurationNames) {
        // TODO - move this down below
        if (targetDescriptor.getConfiguration(targetConfigurationName) == null) {
            throw new RuntimeException(String.format("Module version %s, configuration '%s' declares a dependency on configuration '%s' which is not declared in the module descriptor for %s",
                    fromConfiguration.getComponent().getId(), fromConfiguration.getName(),
                    targetConfigurationName, targetComponent.getId()));
        }
        ConfigurationMetaData targetConfiguration = targetComponent.getConfiguration(targetConfigurationName);
        targets.add(targetConfiguration);
    }
    return targets;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:27,代码来源:DefaultDependencyToConfigurationResolver.java

示例2: collectTargetConfiguration

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
private void collectTargetConfiguration(DependencyDescriptor dependencyDescriptor, ConfigurationMetaData fromConfiguration, String mappingRhs, ModuleDescriptor targetModule, Collection<String> targetConfigs) {
    String[] dependencyConfigurations = dependencyDescriptor.getDependencyConfigurations(mappingRhs, fromConfiguration.getName());
    for (String target : dependencyConfigurations) {
        String candidate = target;
        int startFallback = candidate.indexOf('(');
        if (startFallback >= 0) {
            if (candidate.charAt(candidate.length() - 1) == ')') {
                String preferred = candidate.substring(0, startFallback);
                if (targetModule.getConfiguration(preferred) != null) {
                    targetConfigs.add(preferred);
                    continue;
                }
                candidate = candidate.substring(startFallback + 1, candidate.length() - 1);
            }
        }
        if (candidate.equals("*")) {
            Collections.addAll(targetConfigs, targetModule.getPublicConfigurationsNames());
            continue;
        }
        targetConfigs.add(candidate);
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:23,代码来源:DefaultDependencyToConfigurationResolver.java

示例3: resolveTargetConfigurations

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
public Set<ConfigurationMetaData> resolveTargetConfigurations(DependencyMetaData dependencyMetaData, ConfigurationMetaData fromConfiguration, ComponentMetaData targetComponent) {
    // TODO - resolve directly to config meta data
    ModuleDescriptor targetDescriptor = targetComponent.getDescriptor();
    DependencyDescriptor dependencyDescriptor = dependencyMetaData.getDescriptor();
    Set<String> targetConfigurationNames = new LinkedHashSet<String>();
    for (String config : dependencyDescriptor.getModuleConfigurations()) {
        if (config.equals("*") || config.equals("%")) {
            collectTargetConfiguration(dependencyDescriptor, fromConfiguration, fromConfiguration.getName(), targetDescriptor, targetConfigurationNames);
        } else if (fromConfiguration.getHierarchy().contains(config)) {
            collectTargetConfiguration(dependencyDescriptor, fromConfiguration, config, targetDescriptor, targetConfigurationNames);
        }
    }

    Set<ConfigurationMetaData> targets = new LinkedHashSet<ConfigurationMetaData>();
    for (String targetConfigurationName : targetConfigurationNames) {
        // TODO - move this down below
        if (targetDescriptor.getConfiguration(targetConfigurationName) == null) {
            throw new RuntimeException(String.format("Module version %s, configuration '%s' declares a dependency on configuration '%s' which is not declared in the module descriptor for %s",
                    fromConfiguration.getComponent().getId(), fromConfiguration.getName(),
                    targetConfigurationName, targetComponent.getId()));
        }
        ConfigurationMetaData targetConfiguration = targetComponent.getConfiguration(targetConfigurationName);
        targets.add(targetConfiguration);
    }
    return targets;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:27,代码来源:DefaultDependencyToConfigurationResolver.java

示例4: testImportConfigurationsWithExtendOtherConfigs

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
@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));
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:17,代码来源:XmlModuleDescriptorParserTest.java

示例5: checkDescriptor

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
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));
            }
        }
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:11,代码来源:LazyDependencyToModuleResolver.java

示例6: assertConf

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
protected void assertConf(ModuleDescriptor md, String name, String desc, Visibility visibility,
        String[] exts) {
    Configuration conf = md.getConfiguration(name);
    assertNotNull("configuration not found: " + name, conf);
    assertEquals(name, conf.getName());
    assertEquals(desc, conf.getDescription());
    assertEquals(visibility, conf.getVisibility());
    assertEquals(Arrays.asList(exts), Arrays.asList(conf.getExtends()));
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:10,代码来源:AbstractModuleDescriptorParserTester.java

示例7: testExtendOtherConfigs

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入方法依赖的package包/类
@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));
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:16,代码来源:XmlModuleDescriptorParserTest.java


注:本文中的org.apache.ivy.core.module.descriptor.ModuleDescriptor.getConfiguration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。