Package org.apache.ivy.core.report

Examples of org.apache.ivy.core.report.ResolveReport


        URL url = new File("test/repositories/1/packaging/module1/ivys/ivy-1.0.xml").toURI()
                .toURL();

        // normal resolve, the file goes in the cache
        ResolveReport report = ivy.resolve(url, roptions);
        assertFalse(report.hasError());
        ModuleDescriptor md = report.getModuleDescriptor();
        assertNotNull(md);

        String pattern = "build/test/retrieve/[organization]/[module]/[conf]/[type]s/[artifact]-[revision](.[ext])";

        RetrieveOptions options = getRetrieveOptions();
View Full Code Here


        URL url = new File("test/repositories/1/packaging/module1/ivys/ivy-1.0.xml").toURI()
                .toURL();

        // normal resolve, the file goes in the cache
        ResolveReport report = ivy.resolve(url, roptions);
        assertFalse(report.hasError());
        ModuleDescriptor md = report.getModuleDescriptor();
        assertNotNull(md);

        String pattern = "build/test/retrieve/[organization]/[module]/[conf]/[type]s/[artifact]-[revision](.[ext])";

        RetrieveOptions options = getRetrieveOptions();
View Full Code Here

        BundleInfo bundleInfo = ManifestParser.parseManifest(in.getManifest());
        bundleInfo.addArtifact(new BundleArtifact(false, new File("test/test-repo/bundlerepo/"
                + jarName).toURI(), null));
        DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
            OSGiManifestParser.getInstance(), null, bundleInfo, profileProvider);
        ResolveReport resolveReport = ivy.resolve(md,
            new ResolveOptions().setConfs(new String[] {conf}).setOutputReport(false));
        assertFalse("resolve failed " + resolveReport.getAllProblemMessages(),
            resolveReport.hasError());
        Set<ModuleRevisionId> actual = new HashSet<ModuleRevisionId>();
        List<Artifact> artifacts = resolveReport.getArtifacts();
        for (Artifact artfact : artifacts) {
            actual.add(artfact.getModuleRevisionId());
        }
        Set<ModuleRevisionId> expected = new HashSet<ModuleRevisionId>(Arrays.asList(expectedMrids));
        if (expected2Mrids != null) {
View Full Code Here

        BundleInfo bundleInfo = ManifestParser.parseManifest(in.getManifest());
        bundleInfo.addArtifact(new BundleArtifact(false, new File("test/test-repo/bundlerepo/"
                + jarName).toURI(), null));
        DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
            OSGiManifestParser.getInstance(), null, bundleInfo, profileProvider);
        ResolveReport resolveReport = ivy.resolve(md,
            new ResolveOptions().setConfs(new String[] {conf}).setOutputReport(false));
        assertTrue(resolveReport.hasError());
    }
View Full Code Here

            resolveOptions.setTransitive(false);
        }
        if (line.hasOption("refresh")) {
            resolveOptions.setRefresh(true);
        }
        ResolveReport report = ivy.resolve(ivyfile.toURI().toURL(), resolveOptions);
        if (report.hasError()) {
            System.exit(1);
        }
        ModuleDescriptor md = report.getModuleDescriptor();

        if (confs.length == 1 && "*".equals(confs[0])) {
            confs = md.getConfigurationsNames();
        }
        if (line.hasOption("retrieve")) {
View Full Code Here

                    "no to resolver name: please provide it through parameter 'to'");
        }
        ModuleRevisionId mrid = ModuleRevisionId
                .newInstance(organisation, module, branch, revision);

        ResolveReport report;
        try {
            report = ivy.install(
                mrid,
                from,
                to,
                new InstallOptions().setTransitive(transitive).setValidate(doValidate(settings))
                        .setOverwrite(overwrite).setConfs(conf.split(","))
                        .setArtifactFilter(FilterHelper.getArtifactTypeFilter(type))
                        .setMatcherName(matcher)
                        .setInstallOriginalMetadata(installOriginalMetadata));
        } catch (Exception e) {
            throw new BuildException("impossible to install " + mrid + ": " + e, e);
        }

        if (report.hasError() && isHaltonfailure()) {
            throw new BuildException(
                    "Problem happened while installing modules - see output for details");
        }
    }
View Full Code Here

            }

            mrids = (ModuleRevisionId[]) modules.toArray(new ModuleRevisionId[modules.size()]);
            ModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(mrids, true, false);
            String resolveId = ResolveOptions.getDefaultResolveId(md);
            ResolveReport report = ivy.resolve(md, new ResolveOptions().setResolveId(resolveId)
                    .setValidate(doValidate(settings)));

            ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
            new XmlReportOutputter().output(report, cacheMgr, new ResolveOptions());
            if (graph) {
View Full Code Here

    private boolean showEvicted = false;

    public void doExecute() throws BuildException {
        prepareAndCheck();
        ResolveReport report = getResolvedReport();
        log("Dependency tree for " + report.getResolveId());
        ModuleRevisionId mrid = report.getModuleDescriptor().getModuleRevisionId();
        // make dependency tree easier to fetch informations
        for (Iterator iterator = report.getDependencies().iterator(); iterator.hasNext();) {
            IvyNode dependency = (IvyNode) iterator.next();
            populateDependencyTree(dependency, mrid, report);
        }
        printDependencies((List) dependencies.get(mrid), 0);
    }
View Full Code Here

        if (dest.exists() && dest.isDirectory()) {
            throw new BuildException("The destination file '" + dest.getAbsolutePath()
                    + "' already exist and is a folder");
        }

        ResolveReport report = getResolvedReport();

        List/* <ModuleId> */midToKeep = new ArrayList();
        for (int i = 0; i < keeps.size(); i++) {
            midToKeep.add(ModuleId.newInstance(((Keep) keeps.get(i)).org,
                ((Keep) keeps.get(i)).module));
        }

        ModuleDescriptor md = report.toFixedModuleDescriptor(getSettings(), midToKeep);
        try {
            XmlModuleDescriptorWriter.write(md, dest);
        } catch (IOException e) {
            throw new BuildException("Failed to write into the file " + dest.getAbsolutePath()
                    + " (" + e.getMessage() + ")", e);
View Full Code Here

            type = getProperty(type, settings, "ivy.resolve.default.type.filter");
            String[] confs = splitConfs(conf);

            boolean childs = !dependencies.isEmpty() || !excludes.isEmpty() || !conflicts.isEmpty();

            ResolveReport report;
            if (childs) {
                if (isInline()) {
                    throw new BuildException("the inline mode is incompatible with child elements");
                }
                if (organisation != null) {
                    throw new BuildException("'organisation' is not allowed with child elements");
                }
                if (module != null) {
                    throw new BuildException("'module' is not allowed with child elements");
                }
                if (file != null) {
                    throw new BuildException("'file' not allowed with child elements");
                }
                if (!getAllowedLogOptions().contains(log)) {
                    throw new BuildException("invalid option for 'log': " + log
                            + ". Available options are " + getAllowedLogOptions());
                }

                ModuleRevisionId mrid = ModuleRevisionId.newInstance("", "",
                    Ivy.getWorkingRevision());
                DefaultModuleDescriptor md = DefaultModuleDescriptor.newBasicInstance(mrid, null);

                Iterator itDeps = dependencies.iterator();
                while (itDeps.hasNext()) {
                    IvyDependency dep = (IvyDependency) itDeps.next();
                    DependencyDescriptor dd = dep.asDependencyDescriptor(md, "default", settings);
                    md.addDependency(dd);
                }

                Iterator itExcludes = excludes.iterator();
                while (itExcludes.hasNext()) {
                    IvyExclude exclude = (IvyExclude) itExcludes.next();
                    DefaultExcludeRule rule = exclude.asRule(settings);
                    rule.addConfiguration("default");
                    md.addExcludeRule(rule);
                }

                Iterator itConflicts = conflicts.iterator();
                while (itConflicts.hasNext()) {
                    IvyConflict conflict = (IvyConflict) itConflicts.next();
                    conflict.addConflict(md, settings);
                }

                report = ivy
                        .resolve(md, getResolveOptions(ivy, new String[] {"default"}, settings));
            } else if (isInline()) {
                if (organisation == null) {
                    throw new BuildException("'organisation' is required when using inline mode");
                }
                if (module == null) {
                    throw new BuildException("'module' is required when using inline mode");
                }
                if (file != null) {
                    throw new BuildException("'file' not allowed when using inline mode");
                }
                if (!getAllowedLogOptions().contains(log)) {
                    throw new BuildException("invalid option for 'log': " + log
                            + ". Available options are " + getAllowedLogOptions());
                }
                for (int i = 0; i < confs.length; i++) {
                    if ("*".equals(confs[i])) {
                        confs[i] = "*(public)";
                    }
                }
                if (revision == null) {
                    revision = "latest.integration";
                }
                report = ivy.resolve(
                    ModuleRevisionId.newInstance(organisation, module, branch, revision),
                    getResolveOptions(ivy, confs, settings), changing);

            } else {
                if (organisation != null) {
                    throw new BuildException(
                            "'organisation' not allowed when not using 'org' attribute");
                }
                if (module != null) {
                    throw new BuildException("'module' not allowed when not using 'org' attribute");
                }
                if (file == null) {
                    file = getProject().resolveFile(getProperty(settings, "ivy.dep.file"));
                }
                report = ivy.resolve(file.toURI().toURL(), getResolveOptions(ivy, confs, settings));
            }
            if (report.hasError()) {
                if (failureProperty != null) {
                    getProject().setProperty(failureProperty, "true");
                }
                if (isHaltonfailure()) {
                    throw new BuildException("resolve failed - see output for details");
                }
            }
            setResolved(report, resolveId, isKeep());
            confs = report.getConfigurations();

            if (isKeep()) {
                ModuleDescriptor md = report.getModuleDescriptor();
                // put resolved infos in ant properties and ivy variables
                // putting them in ivy variables is important to be able to change from one resolve
                // call to the other
                String mdOrg = md.getModuleRevisionId().getOrganisation();
                String mdName = md.getModuleRevisionId().getName();
                String mdRev = md.getResolvedModuleRevisionId().getRevision();
                getProject().setProperty("ivy.organisation", mdOrg);
                settings.setVariable("ivy.organisation", mdOrg);
                getProject().setProperty("ivy.module", mdName);
                settings.setVariable("ivy.module", mdName);
                getProject().setProperty("ivy.revision", mdRev);
                settings.setVariable("ivy.revision", mdRev);
                for (int i = 0; i < md.getInheritedDescriptors().length; i++) {
                    ExtendsDescriptor parent = md.getInheritedDescriptors()[i];
                    String parentOrg = parent.getResolvedParentRevisionId().getOrganisation();
                    String parentModule = parent.getResolvedParentRevisionId().getName();
                    String parentRevision = parent.getResolvedParentRevisionId().getRevision();
                    String parentBranch = parent.getResolvedParentRevisionId().getBranch();
                    getProject().setProperty("ivy.parent[" + i + "].organisation", parentOrg);
                    settings.setVariable("ivy.parent[" + i + "].organisation", parentOrg);
                    getProject().setProperty("ivy.parent[" + i + "].module", parentModule);
                    settings.setVariable("ivy.parent[" + i + "].module", parentModule);
                    getProject().setProperty("ivy.parent[" + i + "].revision", parentRevision);
                    settings.setVariable("ivy.parent[" + i + "].revision", parentRevision);
                    if (parentBranch != null) {
                        getProject().setProperty("ivy.parent[" + i + "].branch", parentBranch);
                        settings.setVariable("ivy.parent[" + i + "].branch", parentBranch);
                    }
                }
                getProject().setProperty("ivy.parents.count",
                    String.valueOf(md.getInheritedDescriptors().length));
                settings.setVariable("ivy.parents.count",
                    String.valueOf(md.getInheritedDescriptors().length));

                Boolean hasChanged = null;
                if (getCheckIfChanged()) {
                    hasChanged = Boolean.valueOf(report.hasChanged());
                    getProject().setProperty("ivy.deps.changed", hasChanged.toString());
                    settings.setVariable("ivy.deps.changed", hasChanged.toString());
                }
                getProject().setProperty("ivy.resolved.configurations", mergeConfs(confs));
                settings.setVariable("ivy.resolved.configurations", mergeConfs(confs));
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.report.ResolveReport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.