Search in sources :

Example 36 with ModuleId

use of org.apache.ivy.core.module.id.ModuleId in project ant-ivy by apache.

the class IvyFindRevision method doExecute.

public void doExecute() throws BuildException {
    if (organisation == null) {
        throw new BuildException("no organisation provided for ivy findrevision task");
    }
    if (module == null) {
        throw new BuildException("no module name provided for ivy findrevision task");
    }
    if (revision == null) {
        throw new BuildException("no revision provided for ivy findrevision task");
    }
    Ivy ivy = getIvyInstance();
    IvySettings settings = ivy.getSettings();
    if (branch == null) {
        branch = settings.getDefaultBranch(new ModuleId(organisation, module));
    }
    ResolvedModuleRevision rmr = ivy.findModule(ModuleRevisionId.newInstance(organisation, module, branch, revision));
    if (rmr != null) {
        getProject().setProperty(property, rmr.getId().getRevision());
    }
}
Also used : ModuleId(org.apache.ivy.core.module.id.ModuleId) IvySettings(org.apache.ivy.core.settings.IvySettings) ResolvedModuleRevision(org.apache.ivy.core.resolve.ResolvedModuleRevision) BuildException(org.apache.tools.ant.BuildException) Ivy(org.apache.ivy.Ivy)

Example 37 with ModuleId

use of org.apache.ivy.core.module.id.ModuleId in project ant-ivy by apache.

the class IvyOverride method addOverride.

void addOverride(DefaultModuleDescriptor md, IvySettings settings) {
    String matcherName = (matcher == null) ? PatternMatcher.EXACT : matcher;
    String orgPattern = (org == null) ? PatternMatcher.ANY_EXPRESSION : org;
    String modulePattern = (module == null) ? PatternMatcher.ANY_EXPRESSION : module;
    md.addDependencyDescriptorMediator(new ModuleId(orgPattern, modulePattern), settings.getMatcher(matcherName), new OverrideDependencyDescriptorMediator(branch, rev));
}
Also used : OverrideDependencyDescriptorMediator(org.apache.ivy.core.module.descriptor.OverrideDependencyDescriptorMediator) ModuleId(org.apache.ivy.core.module.id.ModuleId)

Example 38 with ModuleId

use of org.apache.ivy.core.module.id.ModuleId in project ant-ivy by apache.

the class IvyConflict method addConflict.

void addConflict(DefaultModuleDescriptor md, IvySettings settings) {
    String matcherName = (matcher == null) ? PatternMatcher.EXACT : matcher;
    String orgPattern = (org == null) ? PatternMatcher.ANY_EXPRESSION : org;
    String modulePattern = (module == null) ? PatternMatcher.ANY_EXPRESSION : module;
    ConflictManager cm = null;
    if (rev != null) {
        cm = new FixedConflictManager(splitToArray(rev));
    } else if (manager != null) {
        cm = settings.getConflictManager(manager);
    }
    md.addConflictManager(new ModuleId(orgPattern, modulePattern), settings.getMatcher(matcherName), cm);
}
Also used : ModuleId(org.apache.ivy.core.module.id.ModuleId) ConflictManager(org.apache.ivy.plugins.conflict.ConflictManager) FixedConflictManager(org.apache.ivy.plugins.conflict.FixedConflictManager) FixedConflictManager(org.apache.ivy.plugins.conflict.FixedConflictManager)

Example 39 with ModuleId

use of org.apache.ivy.core.module.id.ModuleId in project ant-ivy by apache.

the class IvyExclude method asRule.

DefaultExcludeRule asRule(IvySettings settings) {
    String matcherName = (matcher == null) ? PatternMatcher.EXACT : matcher;
    String orgPattern = (org == null) ? PatternMatcher.ANY_EXPRESSION : org;
    String modulePattern = (module == null) ? PatternMatcher.ANY_EXPRESSION : module;
    String artifactPattern = (artifact == null) ? PatternMatcher.ANY_EXPRESSION : artifact;
    String typePattern = (type == null) ? PatternMatcher.ANY_EXPRESSION : type;
    String extPattern = (ext == null) ? typePattern : ext;
    ArtifactId aid = new ArtifactId(new ModuleId(orgPattern, modulePattern), artifactPattern, typePattern, extPattern);
    return new DefaultExcludeRule(aid, settings.getMatcher(matcherName), null);
}
Also used : ModuleId(org.apache.ivy.core.module.id.ModuleId) DefaultExcludeRule(org.apache.ivy.core.module.descriptor.DefaultExcludeRule) ArtifactId(org.apache.ivy.core.module.id.ArtifactId)

Example 40 with ModuleId

use of org.apache.ivy.core.module.id.ModuleId in project ant-ivy by apache.

the class IvyRepositoryReport method genreport.

private void genreport(ResolutionCacheManager cache, String organisation, String module) {
    // first process the report with xslt
    XSLTProcess xslt = new XSLTProcess();
    xslt.setTaskName(getTaskName());
    xslt.setProject(getProject());
    xslt.init();
    String resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(organisation, module));
    xslt.setIn(cache.getConfigurationResolveReportInCache(resolveId, "default"));
    xslt.setOut(new File(getTodir(), outputname + "." + xslext));
    xslt.setStyle(xslFile);
    XSLTProcess.Param xslExt = xslt.createParam();
    xslExt.setName("extension");
    xslExt.setExpression(xslext);
    // add the provided XSLT parameters
    for (XSLTProcess.Param param : params) {
        XSLTProcess.Param realParam = xslt.createParam();
        realParam.setName(param.getName());
        realParam.setExpression(param.getExpression());
    }
    xslt.execute();
}
Also used : ModuleId(org.apache.ivy.core.module.id.ModuleId) XSLTProcess(org.apache.tools.ant.taskdefs.XSLTProcess) File(java.io.File)

Aggregations

ModuleId (org.apache.ivy.core.module.id.ModuleId)49 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)19 ModuleDescriptor (org.apache.ivy.core.module.descriptor.ModuleDescriptor)13 File (java.io.File)9 HashMap (java.util.HashMap)9 ArrayList (java.util.ArrayList)8 Test (org.junit.Test)8 Date (java.util.Date)6 DefaultDependencyDescriptor (org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor)6 DefaultModuleDescriptor (org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor)6 DependencyDescriptor (org.apache.ivy.core.module.descriptor.DependencyDescriptor)6 BuildException (org.apache.tools.ant.BuildException)6 Ivy (org.apache.ivy.Ivy)5 ArtifactId (org.apache.ivy.core.module.id.ArtifactId)5 ResolveReport (org.apache.ivy.core.report.ResolveReport)5 ResolvedModuleRevision (org.apache.ivy.core.resolve.ResolvedModuleRevision)5 IvySettings (org.apache.ivy.core.settings.IvySettings)5 IOException (java.io.IOException)4 Map (java.util.Map)4 Configuration (org.apache.ivy.core.module.descriptor.Configuration)4