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


Java DefaultModuleDescriptor.addDependency方法代码示例

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


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

示例1: computeModuleDescriptor

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
public static DefaultModuleDescriptor computeModuleDescriptor(DefaultModuleDescriptor md, IvySettings settings,
        List<IvyDependency> dependencies, List<IvyConflict> conflicts, List<IvyExclude> excludes) {
    for (IvyDependency dependency : dependencies) {
        DependencyDescriptor dd = dependency.asDependencyDescriptor(md, "default", settings);
        md.addDependency(dd);
    }

    for (IvyExclude exclude : excludes) {
        org.apache.ivy.core.module.descriptor.DefaultExcludeRule rule = exclude.asRule(settings);
        rule.addConfiguration("default");
        md.addExcludeRule(rule);
    }

    for (IvyConflict conflict : conflicts) {
        conflict.addConflict(md, settings);
    }
    return md;
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:19,代码来源:EasyAntPluginBridge.java

示例2: mergeDependencies

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private void mergeDependencies(DependencyDescriptor[] dependencies) {
    DefaultModuleDescriptor md = getMd();
    for (DependencyDescriptor dependencyDescriptor : dependencies) {
        LOGGER.debug("Merging dependency with: {}", dependencyDescriptor.getDependencyRevisionId());
        md.addDependency(dependencyDescriptor);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:IvyXmlModuleDescriptorParser.java

示例3: buildResolvedCapabilityMd

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private MDResolvedResource buildResolvedCapabilityMd(DependencyDescriptor dd,
        ModuleDescriptor md) {
    String org = dd.getDependencyRevisionId().getOrganisation();
    String name = dd.getDependencyRevisionId().getName();
    String rev = md.getExtraInfoContentByTagName(BundleInfoAdapter.EXTRA_INFO_EXPORT_PREFIX
            + name);
    ModuleRevisionId capabilityRev = ModuleRevisionId.newInstance(org, name, rev,
        Collections.singletonMap(CAPABILITY_EXTRA_ATTR, md.getModuleRevisionId().toString()));

    DefaultModuleDescriptor capabilityMd = new DefaultModuleDescriptor(capabilityRev,
            getSettings().getStatusManager().getDefaultStatus(), new Date());

    String useConf = BundleInfoAdapter.CONF_USE_PREFIX + dd.getDependencyRevisionId().getName();

    capabilityMd.addConfiguration(BundleInfoAdapter.CONF_DEFAULT);
    capabilityMd.addConfiguration(BundleInfoAdapter.CONF_OPTIONAL);
    capabilityMd.addConfiguration(BundleInfoAdapter.CONF_TRANSITIVE_OPTIONAL);
    capabilityMd.addConfiguration(new Configuration(useConf));

    DefaultDependencyDescriptor capabilityDD = new DefaultDependencyDescriptor(
            md.getModuleRevisionId(), false);
    capabilityDD.addDependencyConfiguration(BundleInfoAdapter.CONF_NAME_DEFAULT,
        BundleInfoAdapter.CONF_NAME_DEFAULT);
    capabilityDD.addDependencyConfiguration(BundleInfoAdapter.CONF_NAME_OPTIONAL,
        BundleInfoAdapter.CONF_NAME_OPTIONAL);
    capabilityDD.addDependencyConfiguration(BundleInfoAdapter.CONF_NAME_TRANSITIVE_OPTIONAL,
        BundleInfoAdapter.CONF_NAME_TRANSITIVE_OPTIONAL);
    capabilityDD.addDependencyConfiguration(useConf, useConf);
    capabilityMd.addDependency(capabilityDD);

    MetadataArtifactDownloadReport report = new MetadataArtifactDownloadReport(null);
    report.setDownloadStatus(DownloadStatus.NO);
    report.setSearched(true);
    ResolvedModuleRevision rmr = new ResolvedModuleRevision(this, this, capabilityMd, report);
    return new MDResolvedResource(null, capabilityMd.getRevision(), rmr);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:37,代码来源:AbstractOSGiResolver.java

示例4: requirementAsDependency

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private static void requirementAsDependency(DefaultModuleDescriptor md, BundleInfo bundleInfo,
        Set<String> exportedPkgNames) {
    for (BundleRequirement requirement : bundleInfo.getRequirements()) {
        String type = requirement.getType();
        String name = requirement.getName();

        if (BundleInfo.PACKAGE_TYPE.equals(type) && exportedPkgNames.contains(name)) {
            // don't declare package exported by the current bundle
            continue;
        }

        if (BundleInfo.EXECUTION_ENVIRONMENT_TYPE.equals(type)) {
            // execution environment are handled elsewhere
            continue;
        }

        ModuleRevisionId ddmrid = asMrid(type, name, requirement.getVersion());
        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ddmrid, false);

        String conf = CONF_NAME_DEFAULT;
        if (BundleInfo.PACKAGE_TYPE.equals(type)) {
            // declare the configuration for the package
            conf = CONF_USE_PREFIX + name;
            md.addConfiguration(new Configuration(CONF_USE_PREFIX + name, PUBLIC,
                    "Exported package " + name, new String[] {CONF_NAME_DEFAULT}, true, null));
            dd.addDependencyConfiguration(conf, conf);
        }

        if ("optional".equals(requirement.getResolution())) {
            dd.addDependencyConfiguration(CONF_NAME_OPTIONAL, conf);
            dd.addDependencyConfiguration(CONF_NAME_TRANSITIVE_OPTIONAL,
                CONF_NAME_TRANSITIVE_OPTIONAL);
        } else {
            dd.addDependencyConfiguration(CONF_NAME_DEFAULT, conf);
        }

        md.addDependency(dd);
    }

}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:41,代码来源:BundleInfoAdapter.java

示例5: mergeDependencies

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
/**
 * Describes how dependencies should be inherited
 *
 * @param dependencies
 *            array of dependencies to inherit
 */
protected void mergeDependencies(DependencyDescriptor[] dependencies) {
    DefaultModuleDescriptor md = getMd();
    for (DependencyDescriptor dependencyDescriptor : dependencies) {
        Message.debug("Merging dependency with: "
                + dependencyDescriptor.getDependencyRevisionId().toString());
        md.addDependency(dependencyDescriptor);
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:15,代码来源:XmlModuleDescriptorParser.java

示例6: addDependency

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private DependencyDescriptor addDependency(DefaultModuleDescriptor parent, String moduleName,
        String revision) {
    ModuleRevisionId mrid = ModuleRevisionId.newInstance("org", moduleName, revision);
    DependencyDescriptor depDescr = new DefaultDependencyDescriptor(parent, mrid, false, false,
            true);
    parent.addDependency(depDescr);
    return depDescr;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:9,代码来源:SortTest.java

示例7: cloneMd

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private DefaultModuleDescriptor cloneMd(ModuleDescriptor md, Artifact af) {

        DefaultModuleDescriptor newMd = new DefaultModuleDescriptor(md.getModuleRevisionId(),
                "release", null, true);
        newMd.addConfiguration(new Configuration(ModuleDescriptor.DEFAULT_CONFIGURATION));
        newMd.setLastModified(System.currentTimeMillis());

        newMd.setDescription(md.getDescription());
        newMd.setHomePage(md.getHomePage());
        newMd.setLastModified(md.getLastModified());
        newMd.setPublicationDate(md.getPublicationDate());
        newMd.setResolvedPublicationDate(md.getResolvedPublicationDate());
        newMd.setStatus(md.getStatus());

        Configuration[] allConfs = md.getConfigurations();
        if (allConfs.length == 0) {
            newMd.addArtifact(ModuleDescriptor.DEFAULT_CONFIGURATION, af);
        } else {
            for (Configuration conf : allConfs) {
                newMd.addConfiguration(conf);
                newMd.addArtifact(conf.getName(), af);
            }
        }

        for (DependencyDescriptor dependency : md.getDependencies()) {
            newMd.addDependency(dependency);
        }

        for (ExcludeRule excludeRule : md.getAllExcludeRules()) {
            newMd.addExcludeRule(excludeRule);
        }

        newMd.getExtraInfos().addAll(md.getExtraInfos());

        for (License license : md.getLicenses()) {
            newMd.addLicense(license);
        }

        return newMd;
    }
 
开发者ID:apache,项目名称:ant-ivyde,代码行数:41,代码来源:WorkspaceResolver.java

示例8: addDependencyDescriptor

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
public void addDependencyDescriptor(String configuration, DefaultModuleDescriptor moduleDescriptor,
                                    ModuleDependency dependency) {
    IvyDependencyDescriptorFactory factoryInternal = findFactoryForDependency(dependency);
    EnhancedDependencyDescriptor dependencyDescriptor = factoryInternal.createDependencyDescriptor(configuration, dependency, moduleDescriptor);
    moduleDescriptor.addDependency(dependencyDescriptor);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:7,代码来源:DefaultDependencyDescriptorFactory.java

示例9: doExecute

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
public void doExecute() throws BuildException {
    prepareAndCheck();

    ModuleDescriptor originalModuleDescriptor = getResolvedReport().getModuleDescriptor();
    // clone module descriptor
    DefaultModuleDescriptor latestModuleDescriptor = new DefaultModuleDescriptor(
            originalModuleDescriptor.getModuleRevisionId(),
            originalModuleDescriptor.getStatus(), originalModuleDescriptor.getPublicationDate());
    // copy configurations
    for (Configuration configuration : originalModuleDescriptor.getConfigurations()) {
        latestModuleDescriptor.addConfiguration(configuration);
    }
    // clone dependency and add new one with the requested revisionToCheck
    for (DependencyDescriptor dependencyDescriptor : originalModuleDescriptor.getDependencies()) {
        ModuleRevisionId upToDateMrid = ModuleRevisionId.newInstance(
            dependencyDescriptor.getDependencyRevisionId(), revisionToCheck);
        latestModuleDescriptor.addDependency(dependencyDescriptor.clone(upToDateMrid));
    }

    // resolve
    ResolveOptions resolveOptions = new ResolveOptions();
    resolveOptions.setDownload(isDownload());
    resolveOptions.setLog(getLog());
    resolveOptions.setConfs(splitToArray(getConf()));
    resolveOptions.setCheckIfChanged(checkIfChanged);

    ResolveReport latestReport;
    try {
        latestReport = getIvyInstance().getResolveEngine().resolve(latestModuleDescriptor,
            resolveOptions);

        displayDependencyUpdates(getResolvedReport(), latestReport);
        if (showTransitive) {
            displayNewDependencyOnLatest(getResolvedReport(), latestReport);
            displayMissingDependencyOnLatest(getResolvedReport(), latestReport);
        }

    } catch (ParseException | IOException e) {
        throw new BuildException("impossible to resolve dependencies:\n\t" + e, e);
    }

}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:43,代码来源:IvyDependencyUpdateChecker.java

示例10: generateModules

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private void generateModules(int nbModules, int minDependencies, int maxDependencies,
        int minVersions, int maxVersions) throws IOException {
    int nb = 0;
    int curDep = 1;
    int varDeps = maxDependencies - minDependencies;
    int varVersions = maxVersions - minVersions;
    Random r = new Random(System.currentTimeMillis());

    while (nb < nbModules) {
        int deps = minDependencies + r.nextInt(varDeps + 1);
        int versions = minVersions + r.nextInt(varVersions + 1);

        int prevCurDep = curDep;
        for (int ver = 0; ver < versions; ver++) {
            DefaultModuleDescriptor md = new DefaultModuleDescriptor(
                    ModuleRevisionId.newInstance("apache", "mod" + nb, "1." + ver),
                    "integration", new Date());

            curDep = prevCurDep;
            for (int i = 0; i < deps && curDep < nbModules; i++) {
                int d;
                if (i % 2 == 1) {
                    d = nb + i;
                    if (d >= prevCurDep) {
                        d = curDep;
                        curDep++;
                    }
                } else {
                    d = curDep;
                    curDep++;
                }
                DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
                        md,
                        ModuleRevisionId.newInstance("apache", "mod" + d, "latest.integration"),
                        false, false, true);
                dd.addDependencyConfiguration("default", "default");
                md.addDependency(dd);
            }
            XmlModuleDescriptorWriter.write(md, new File("build/test/perf/mod" + nb + "/ivy-1."
                    + ver + ".xml"));
            FileUtil.copy(new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"),
                new File("build/test/perf/mod" + nb + "/mod" + nb + "-1." + ver + ".jar"), null);
        }
        nb++;
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:47,代码来源:TestPerformance.java


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