Examples of IvySettings


Examples of org.apache.ivy.core.settings.IvySettings

    private List params = new ArrayList();

    public void doExecute() throws BuildException {
        Ivy ivy = getIvyInstance();
        IvySettings settings = ivy.getSettings();
        if (xsl && xslFile == null) {
            throw new BuildException("xsl file is mandatory when using xsl generation");
        }
        if (module == null && PatternMatcher.EXACT.equals(matcher)) {
            throw new BuildException("no module name provided for ivy repository graph task: "
                    + "It can either be set explicitely via the attribute 'module' or "
                    + "via 'ivy.module' property or a prior call to <resolve/>");
        } else if (module == null && !PatternMatcher.EXACT.equals(matcher)) {
            module = PatternMatcher.ANY_EXPRESSION;
        }
        ModuleRevisionId mrid = ModuleRevisionId.newInstance(organisation, module, revision);

        try {
            ModuleRevisionId criteria = null;

            if ((revision == null) || settings.getVersionMatcher().isDynamic(mrid)) {
                criteria = new ModuleRevisionId(new ModuleId(organisation, module), branch, "*");
            } else {
                criteria = new ModuleRevisionId(new ModuleId(organisation, module), branch,
                        revision);
            }

            ModuleRevisionId[] mrids = ivy.listModules(criteria, settings.getMatcher(matcher));

            // replace all found revisions with the original requested revision
            Set modules = new HashSet();
            for (int i = 0; i < mrids.length; i++) {
                modules.add(ModuleRevisionId.newInstance(mrids[i], revision));
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

        this.merge = merge;
    }

    public void doExecute() throws BuildException {
        Ivy ivy = getIvyInstance();
        IvySettings settings = ivy.getSettings();

        organisation = getProperty(organisation, settings, "ivy.organisation", resolveId);
        module = getProperty(module, settings, "ivy.module", resolveId);
        revision = getProperty(revision, settings, "ivy.revision", resolveId);
        pubBranch = getProperty(pubBranch, settings, "ivy.deliver.branch");
        pubRevision = getProperty(pubRevision, settings, "ivy.deliver.revision");
        deliverpattern = getProperty(deliverpattern, settings, "ivy.deliver.ivy.pattern");
        status = getProperty(status, settings, "ivy.status");
        if (deliveryList == null) {
            String deliveryListPath = getProperty(settings, "ivy.delivery.list.file");
            if (deliveryListPath == null) {
                deliveryList = new File(System.getProperty("java.io.tmpdir")
                        + "/delivery.properties");
            } else {
                deliveryList = getProject().resolveFile(settings.substitute(deliveryListPath));
            }
        }
        if (resolveId == null) {
            if (organisation == null) {
                throw new BuildException("no organisation provided for ivy deliver task: "
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

            }
            if (cacheName != null) {
                throw new BuildException("specify only one of 'resolver' or 'cache'");
            }
            Ivy ivy = getIvyInstance();
            IvySettings settings = ivy.getSettings();
            DependencyResolver resolver = settings.getResolver(resolverName);
            if (resolver == null) {
                throw new BuildException("the resolver '" + resolverName + "' was not found");
            }
            if (!(resolver instanceof BasicResolver)) {
                throw new BuildException("the type of resolver '" + resolver.getClass().getName()
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

        if (value == null) {
            throw new BuildException("no value provided for ivy listmodules task");
        }

        Ivy ivy = getIvyInstance();
        IvySettings settings = ivy.getSettings();

        SearchEngine searcher = new SearchEngine(settings);
        PatternMatcher patternMatcher = settings.getMatcher(matcher);

        ModuleRevisionId[] mrids;
        if (resolver == null) {
            mrids = searcher.listModules(
                ModuleRevisionId.newInstance(organisation, module, branch, revision),
                patternMatcher);
        } else {
            DependencyResolver depResolver = settings.getResolver(resolver);
            if (depResolver == null) {
                throw new BuildException("Unknown resolver: " + resolver);
            }
            mrids = searcher.listModules(depResolver,
                ModuleRevisionId.newInstance(organisation, module, branch, revision),
                patternMatcher);
        }

        for (int i = 0; i < mrids.length; i++) {
            String name = IvyPatternHelper.substitute(settings.substitute(property), mrids[i]);
            String value = IvyPatternHelper.substitute(settings.substitute(this.value), mrids[i]);
            getProject().setProperty(name, value);
        }
    }
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

        Message.setShowProgress(showProgress);
    }

    public void doExecute() throws BuildException {
        Ivy ivy = getIvyInstance();
        IvySettings settings = ivy.getSettings();
        try {
            conf = getProperty(conf, settings, "ivy.configurations");
            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));
                if (file != null) {
                    getProject().setProperty("ivy.resolved.file", file.getAbsolutePath());
                    settings.setVariable("ivy.resolved.file", file.getAbsolutePath());
                }
                if (resolveId != null) {
                    getProject().setProperty("ivy.organisation." + resolveId, mdOrg);
                    settings.setVariable("ivy.organisation." + resolveId, mdOrg);
                    getProject().setProperty("ivy.module." + resolveId, mdName);
                    settings.setVariable("ivy.module." + resolveId, mdName);
                    getProject().setProperty("ivy.revision." + resolveId, mdRev);
                    settings.setVariable("ivy.revision." + resolveId, mdRev);
                    if (getCheckIfChanged()) {
                        // hasChanged has already been set earlier
                        getProject().setProperty("ivy.deps.changed." + resolveId,
                            hasChanged.toString());
                        settings.setVariable("ivy.deps.changed." + resolveId, hasChanged.toString());
                    }
                    getProject().setProperty("ivy.resolved.configurations." + resolveId,
                        mergeConfs(confs));
                    settings.setVariable("ivy.resolved.configurations." + resolveId,
                        mergeConfs(confs));
                    if (file != null) {
                        getProject().setProperty("ivy.resolved.file." + resolveId,
                            file.getAbsolutePath());
                        settings.setVariable("ivy.resolved.file." + resolveId,
                            file.getAbsolutePath());
                    }
                }
            }
        } catch (MalformedURLException e) {
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

        this.property = prefix;
    }

    public void doExecute() throws BuildException {
        Ivy ivy = getIvyInstance();
        IvySettings settings = ivy.getSettings();

        try {
            if (organisation != null || module != null || revision != null || branch != null) {
                if (organisation == null) {
                    throw new BuildException("no organisation provided for ivy info task");
                }
                if (module == null) {
                    throw new BuildException("no module name provided for ivy info task");
                }
                if (revision == null) {
                    throw new BuildException("no revision provided for ivy info task");
                }

                if (branch == null) {
                    settings.getDefaultBranch(new ModuleId(organisation, module));
                }
                ResolvedModuleRevision rmr = ivy.findModule(ModuleRevisionId.newInstance(
                    organisation, module, branch, revision));
                if (rmr != null) {
                    ModuleDescriptor md = rmr.getDescriptor();
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

        if (prefix == null) {
            throw new BuildException("null prefix not allowed");
        }

        Ivy ivy = getIvyInstance();
        IvySettings settings = ivy.getSettings();
        if (branch == null) {
            branch = settings.getDefaultBranch(new ModuleId(organisation, module));
        }
        if (revision == null || revision.length() == 0) {
            revision = "latest.integration";
        } else if (!revision.endsWith("+")) {
            revision = revision + "+";
        }
        if (!prefix.endsWith(".") && prefix.length() > 0) {
            prefix = prefix + ".";
        }

        SearchEngine searcher = new SearchEngine(settings);

        PatternMatcher patternMatcher = new PatternMatcher() {
            private PatternMatcher exact = new ExactPatternMatcher();

            private PatternMatcher regexp = new ExactOrRegexpPatternMatcher();

            public Matcher getMatcher(String expression) {
                if (expression.equals(organisation) || expression.equals(module)
                        || expression.equals(branch)) {
                    return exact.getMatcher(expression);
                }
                return regexp.getMatcher(expression);
            }

            public String getName() {
                return "buildnumber-matcher";
            }
        };
        ModuleRevisionId[] revisions;
        if (resolver == null) {
            revisions = searcher.listModules(
                ModuleRevisionId.newInstance(organisation, module, branch, ".*"), patternMatcher);
        } else {
            DependencyResolver depResolver = settings.getResolver(resolver);
            if (depResolver == null) {
                throw new BuildException("Unknown resolver: " + resolver);
            }
            revisions = searcher.listModules(depResolver,
                ModuleRevisionId.newInstance(organisation, module, branch, ".*"), patternMatcher);
        }

        ArtifactInfo[] infos = new ArtifactInfo[revisions.length];
        for (int i = 0; i < revisions.length; i++) {
            infos[i] = new ResolvedModuleRevisionArtifactInfo(revisions[i]);
        }

        VersionMatcher matcher = settings.getVersionMatcher();
        LatestStrategy latestStrategy = settings.getLatestStrategy("latest-revision");
        List sorted = latestStrategy.sort(infos);

        ModuleRevisionId askedMrid = ModuleRevisionId.newInstance(organisation, module, branch,
            revision);

View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

    private File cachedir;

    protected void setUp() throws Exception {
        Message.setDefaultLogger(new DefaultMessageLogger(99));

        settings = new IvySettings();
        ResolveEngine engine = new ResolveEngine(settings, new EventManager(), new SortEngine(
                settings));
        cache = new File("build/cache");
        data = new ResolveData(engine, new ResolveOptions());
        cache.mkdirs();
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

        this.resolveId = resolveId;
    }

    public void doExecute() throws BuildException {
        Ivy ivy = getIvyInstance();
        IvySettings settings = ivy.getSettings();

        conf = getProperty(conf, settings, "ivy.resolved.configurations", resolveId);
        if ("*".equals(conf)) {
            conf = getProperty(settings, "ivy.resolved.configurations", resolveId);
        }
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

    private ResolveData _data;

    private File _cache;

    protected void setUp() throws Exception {
        _settings = new IvySettings();
        _engine = new ResolveEngine(_settings, new EventManager(), new SortEngine(_settings));
        _cache = new File("build/cache");
        _data = new ResolveData(_engine, new ResolveOptions());
        _cache.mkdirs();
        _settings.setDefaultCache(_cache);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.