use of org.apache.ivy.core.module.descriptor.DefaultIncludeRule in project ant-ivy by apache.
the class IvyDependencyInclude method asRule.
DefaultIncludeRule asRule(IvySettings settings) {
String matcherName = matcher == null ? PatternMatcher.EXACT : matcher;
String namePattern = name == null ? PatternMatcher.ANY_EXPRESSION : name;
String typePattern = type == null ? PatternMatcher.ANY_EXPRESSION : type;
String extPattern = ext == null ? typePattern : ext;
ArtifactId aid = new ArtifactId(new ModuleId(PatternMatcher.ANY_EXPRESSION, PatternMatcher.ANY_EXPRESSION), namePattern, typePattern, extPattern);
return new DefaultIncludeRule(aid, settings.getMatcher(matcherName), null);
}
use of org.apache.ivy.core.module.descriptor.DefaultIncludeRule in project ant-ivy by apache.
the class BintrayResolverTest method testBintrayArtifacts.
@Test
public void testBintrayArtifacts() throws Exception {
BintrayResolver resolver = new BintrayResolver();
resolver.setName("test");
resolver.setSettings(settings);
assertEquals("test", resolver.getName());
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache.ant", "ant-antunit", "1.2");
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(mrid, false);
dd.addIncludeRule("default", new DefaultIncludeRule(new ArtifactId(mrid.getModuleId(), "ant-antunit", "javadoc", "jar"), ExactPatternMatcher.INSTANCE, null));
dd.addIncludeRule("default", new DefaultIncludeRule(new ArtifactId(mrid.getModuleId(), "ant-antunit", "sources", "jar"), ExactPatternMatcher.INSTANCE, null));
ResolvedModuleRevision rmr = resolver.getDependency(dd, data);
assertNotNull(rmr);
assertEquals(mrid, rmr.getId());
DefaultArtifact profiler = new DefaultArtifact(mrid, rmr.getPublicationDate(), "ant-antunit", "javadoc", "jar");
DefaultArtifact trace = new DefaultArtifact(mrid, rmr.getPublicationDate(), "ant-antunit", "sources", "jar");
DownloadReport report = resolver.download(new Artifact[] { profiler, trace }, downloadOptions());
assertNotNull(report);
assertEquals(2, report.getArtifactsReports().length);
ArtifactDownloadReport ar = report.getArtifactReport(profiler);
assertNotNull(ar);
assertEquals(profiler, ar.getArtifact());
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
ar = report.getArtifactReport(trace);
assertNotNull(ar);
assertEquals(trace, ar.getArtifact());
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
// test to ask to download again, should use cache
report = resolver.download(new Artifact[] { profiler, trace }, downloadOptions());
assertNotNull(report);
assertEquals(2, report.getArtifactsReports().length);
ar = report.getArtifactReport(profiler);
assertNotNull(ar);
assertEquals(profiler, ar.getArtifact());
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
ar = report.getArtifactReport(trace);
assertNotNull(ar);
assertEquals(trace, ar.getArtifact());
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
}
use of org.apache.ivy.core.module.descriptor.DefaultIncludeRule in project ant-ivy by apache.
the class IvyDependency method asDependencyDescriptor.
DependencyDescriptor asDependencyDescriptor(ModuleDescriptor md, String masterConf, IvySettings settings) {
if (org == null) {
throw new BuildException("'org' is required on ");
}
if (name == null) {
throw new BuildException("'name' is required when using inline mode");
}
ModuleRevisionId mrid = ModuleRevisionId.newInstance(org, name, branch, rev);
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, mrid, force, changing, transitive);
if (conf != null) {
dd.addDependencyConfiguration(masterConf, conf);
} else {
dd.addDependencyConfiguration(masterConf, "*");
}
for (IvyDependencyConf c : confs) {
c.addConf(dd, masterConf);
}
for (IvyDependencyArtifact artifact : artifacts) {
artifact.addArtifact(dd, masterConf);
}
for (IvyDependencyExclude exclude : excludes) {
DefaultExcludeRule rule = exclude.asRule(settings);
dd.addExcludeRule(masterConf, rule);
}
for (IvyDependencyInclude include : includes) {
DefaultIncludeRule rule = include.asRule(settings);
dd.addIncludeRule(masterConf, rule);
}
return dd;
}
Aggregations