org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor Java Examples

The following examples show how to use org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GradlePomModuleDescriptorParser.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
protected MutableModuleVersionMetaData doParseDescriptor(DescriptorParseContext parserSettings, LocallyAvailableExternalResource resource, boolean validate) throws IOException, ParseException, SAXException {
    PomReader pomReader = new PomReader(resource);
    GradlePomModuleDescriptorBuilder mdBuilder = new GradlePomModuleDescriptorBuilder(resource, parserSettings, pomReader);

    doParsePom(parserSettings, mdBuilder, pomReader);

    String artifactId = pomReader.getArtifactId();
    if (pomReader.getRelocation() == null) {
        mdBuilder.addMainArtifact(artifactId, pomReader.getPackaging());
    }

    DefaultModuleDescriptor moduleDescriptor = mdBuilder.getModuleDescriptor();
    ModuleDescriptorAdapter adapter = new ModuleDescriptorAdapter(moduleDescriptor);
    if ("pom".equals(pomReader.getPackaging())) {
        adapter.setMetaDataOnly(true);
    }
    return adapter;
}
 
Example #2
Source File: IvyConfigurationProvider.java    From walkmod-core with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void addArtifact(String groupId, String artifactId, String version) throws Exception {

		artifacts.add(groupId+":"+artifactId+":"+version);

		String[] dep = null;
		dep = new String[] { groupId, artifactId, version };
		if (md == null) {
			md = DefaultModuleDescriptor.newDefaultInstance(ModuleRevisionId.newInstance(dep[0], dep[1] + "-caller",
					"working"));
		}
		DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, ModuleRevisionId.newInstance(dep[0],
				dep[1], dep[2]), false, false, true);
		md.addDependency(dd);
		ExcludeRule er = new DefaultExcludeRule(new ArtifactId(new ModuleId("org.walkmod", "walkmod-core"),
				PatternMatcher.ANY_EXPRESSION, PatternMatcher.ANY_EXPRESSION, PatternMatcher.ANY_EXPRESSION),
				ExactPatternMatcher.INSTANCE, null);
		dd.addExcludeRule(null, er);
	}
 
Example #3
Source File: ResolveEngine.java    From ant-ivy with Apache License 2.0 6 votes vote down vote up
public ResolvedModuleRevision findModule(ModuleRevisionId id, ResolveOptions options) {
    DependencyResolver r = settings.getResolver(id);
    if (r == null) {
        throw new IllegalStateException("no resolver found for " + id.getModuleId());
    }
    DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(id,
        new String[] {"*"}, false, false);

    if (options.getResolveId() == null) {
        options.setResolveId(ResolveOptions.getDefaultResolveId(md));
    }

    try {
        return r.getDependency(new DefaultDependencyDescriptor(id, true), new ResolveData(this,
                options, new ConfigurationResolveReport(this, md, "default", null, options)));
    } catch (ParseException e) {
        throw new RuntimeException("problem while parsing repository module descriptor for "
                + id + ": " + e, e);
    }
}
 
Example #4
Source File: XmlModuleDescriptorParser.java    From ant-ivy with Apache License 2.0 6 votes vote down vote up
/**
 * Explain how to inherit metadata related to info element
 *
 * @param parent
 *            a given parent module descriptor
 */
protected void mergeInfo(ModuleDescriptor parent) {
    ModuleRevisionId parentMrid = parent.getModuleRevisionId();

    DefaultModuleDescriptor descriptor = getMd();
    ModuleRevisionId currentMrid = descriptor.getModuleRevisionId();

    ModuleRevisionId mergedMrid = ModuleRevisionId.newInstance(
        mergeValue(parentMrid.getOrganisation(), currentMrid.getOrganisation()),
        currentMrid.getName(),
        mergeValue(parentMrid.getBranch(), currentMrid.getBranch()),
        mergeRevisionValue(parentMrid.getRevision(), currentMrid.getRevision()),
        mergeValues(parentMrid.getQualifiedExtraAttributes(),
            currentMrid.getQualifiedExtraAttributes()));

    descriptor.setModuleRevisionId(mergedMrid);
    descriptor.setResolvedModuleRevisionId(mergedMrid);

    descriptor.setStatus(mergeValue(parent.getStatus(), descriptor.getStatus()));
    if (descriptor.getNamespace() == null && parent instanceof DefaultModuleDescriptor) {
        Namespace parentNamespace = ((DefaultModuleDescriptor) parent).getNamespace();
        descriptor.setNamespace(parentNamespace);
    }

    descriptor.getExtraInfos().addAll(parent.getExtraInfos());
}
 
Example #5
Source File: GradlePomModuleDescriptorParser.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
protected MutableModuleVersionMetaData doParseDescriptor(DescriptorParseContext parserSettings, LocallyAvailableExternalResource resource, boolean validate) throws IOException, ParseException, SAXException {
    PomReader pomReader = new PomReader(resource);
    GradlePomModuleDescriptorBuilder mdBuilder = new GradlePomModuleDescriptorBuilder(resource, parserSettings, pomReader);

    doParsePom(parserSettings, mdBuilder, pomReader);

    String artifactId = pomReader.getArtifactId();
    if (pomReader.getRelocation() == null) {
        mdBuilder.addMainArtifact(artifactId, pomReader.getPackaging());
    }

    DefaultModuleDescriptor moduleDescriptor = mdBuilder.getModuleDescriptor();
    ModuleDescriptorAdapter adapter = new ModuleDescriptorAdapter(moduleDescriptor);
    if ("pom".equals(pomReader.getPackaging())) {
        adapter.setMetaDataOnly(true);
    }
    return adapter;
}
 
Example #6
Source File: SortTest.java    From ant-ivy with Apache License 2.0 6 votes vote down vote up
/**
 * When the version asked by a dependency is not compatible with the version declared in the
 * module to order, the two modules should be considered as independent.
 * NB: I'm sure of what 'compatible' means !
 */
@Test
public void testDifferentVersionNotConsidered() {
    // To test it, I use a 'broken' loop (in one step, I change the revision) in such a way that
    // I get only one solution. If the loop was
    // complete more solutions where possible.

    addDependency(md1, "md4", "rev4-other");
    addDependency(md2, "md1", "rev1");
    addDependency(md3, "md2", "rev2");
    addDependency(md4, "md3", "rev3");

    DefaultModuleDescriptor[][] possibleOrder = new DefaultModuleDescriptor[][] {
            {md1, md2, md3, md4}};

    for (List<ModuleDescriptor> toSort : getAllLists(md1, md3, md2, md4)) {
        assertSorted(possibleOrder, sortModuleDescriptors(toSort, nonMatchReporter));
    }
}
 
Example #7
Source File: XmlModuleDescriptorWriterTest.java    From ant-ivy with Apache License 2.0 6 votes vote down vote up
/**
 * Test that the transitive attribute is not written when the configuration IS transitive.
 *
 * This is the default and writing it will only add noise and cause a deviation from the known
 * behavior (before fixing IVY-1207).
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-1207">IVY-1207</a>
 */
@Test
public void testTransitiveAttributeNotWrittenForTransitiveConfs() throws Exception {
    // Given a ModuleDescriptor with a transitive configuration
    DefaultModuleDescriptor md = new DefaultModuleDescriptor(new ModuleRevisionId(new ModuleId(
            "myorg", "myname"), "1.0"), "integration", new Date());
    Configuration conf = new Configuration("conf", PUBLIC, "desc", null, true, null);
    md.addConfiguration(conf);

    // When the ModuleDescriptor is written
    XmlModuleDescriptorWriter.write(md, LICENSE, dest);

    // Then the transitive attribute must NOT be written
    String output = FileUtil.readEntirely(dest);
    String writtenConf = output.substring(output.indexOf("<configurations>") + 16,
        output.indexOf("</configurations>")).trim();
    assertFalse("Transitive attribute set: " + writtenConf,
            writtenConf.contains("transitive="));
}
 
Example #8
Source File: BundleInfoAdapter.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
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);
    }

}
 
Example #9
Source File: AbstractOSGiResolver.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #10
Source File: IvyOverride.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
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));
}
 
Example #11
Source File: ModuleDescriptorWrapper.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
public DefaultModuleDescriptor getModuleDescriptor() {
    if (md == null) {
        synchronized (this) {
            if (md != null) {
                return md;
            }
            md = BundleInfoAdapter.toModuleDescriptor(OSGiManifestParser.getInstance(),
                baseUri, bundleInfo, profileProvider);
        }
    }
    return md;
}
 
Example #12
Source File: LogTriggerTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    ev = new StartResolveEvent(DefaultModuleDescriptor.newBasicInstance(
        ModuleRevisionId.parse("o#A;1"), new Date()), new String[] {"c"});
    trigger = new LogTrigger();
    trigger.setEvent(ev.getName());
    testDir = new File("build/test/trigger");
    testDir.mkdirs();
}
 
Example #13
Source File: IvyConflict.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #14
Source File: OBRResolverTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
private void genericTestResolve(String jarName, String conf, ModuleRevisionId[] expectedMrids,
        ModuleRevisionId[] expected2Mrids) throws Exception {
    JarInputStream jis = new JarInputStream(
            new FileInputStream("test/test-repo/bundlerepo/" + jarName));
    Manifest manifest = jis.getManifest();
    jis.close();
    BundleInfo bundleInfo = ManifestParser.parseManifest(manifest);
    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<>();
    for (Artifact artifact : resolveReport.getArtifacts()) {
        actual.add(artifact.getModuleRevisionId());
    }
    Set<ModuleRevisionId> expected = new HashSet<>(Arrays.asList(expectedMrids));
    if (expected2Mrids != null) {
        // in this use case, we have two choices, let's try the second one
        try {
            Set<ModuleRevisionId> expected2 = new HashSet<>(
                    Arrays.asList(expected2Mrids));
            assertEquals(expected2, actual);
            return; // test passed
        } catch (AssertionError e) {
            // too bad, let's continue
        }
    }
    assertEquals(expected, actual);
}
 
Example #15
Source File: DefaultConfigurationsToArtifactsConverter.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void addArtifacts(MutableLocalComponentMetaData metaData, Iterable<? extends Configuration> configurations) {
    DefaultModuleDescriptor moduleDescriptor = metaData.getModuleDescriptor();
    for (Configuration configuration : configurations) {
        for (PublishArtifact publishArtifact : configuration.getArtifacts()) {
            Artifact ivyArtifact = createIvyArtifact(publishArtifact, moduleDescriptor.getModuleRevisionId());
            metaData.addArtifact(configuration.getName(), ivyArtifact, publishArtifact.getFile());
        }
    }
}
 
Example #16
Source File: GradlePomModuleDescriptorParser.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected MutableModuleComponentResolveMetaData doParseDescriptor(DescriptorParseContext parserSettings, LocallyAvailableExternalResource resource, boolean validate) throws IOException, ParseException, SAXException {
    PomReader pomReader = new PomReader(resource);
    GradlePomModuleDescriptorBuilder mdBuilder = new GradlePomModuleDescriptorBuilder(pomReader);

    doParsePom(parserSettings, mdBuilder, pomReader);

    DefaultModuleDescriptor moduleDescriptor = mdBuilder.getModuleDescriptor();
    if(pomReader.getRelocation() != null) {
        return new DefaultMavenModuleResolveMetaData(moduleDescriptor, "pom", true);
    }
    return new DefaultMavenModuleResolveMetaData(moduleDescriptor, pomReader.getPackaging(), false);
}
 
Example #17
Source File: XmlModuleDescriptorParser.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
/**
 * Describes how to merge configurations elements
 *
 * @param parent
 *            the module descriptor
 */
protected void mergeConfigurations(ModuleDescriptor parent) {
    ModuleRevisionId sourceMrid = parent.getModuleRevisionId();
    for (Configuration configuration : parent.getConfigurations()) {
        Message.debug("Merging configuration with: " + configuration.getName());
        // copy configuration from parent descriptor
        getMd().addConfiguration(new Configuration(configuration, sourceMrid));
    }

    if (parent instanceof DefaultModuleDescriptor) {
        setDefaultConfMapping(((DefaultModuleDescriptor) parent).getDefaultConfMapping());
        setDefaultConf(((DefaultModuleDescriptor) parent).getDefaultConf());
        getMd().setMappingOverride(((DefaultModuleDescriptor) parent).isMappingOverride());
    }
}
 
Example #18
Source File: LatestVersionMatcherTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
private void assertAccept(String askedVersion, String askedBranch, String foundStatus,
        String foundBranch, boolean b) {
    ModuleRevisionId askedMrid = ModuleRevisionId.newInstance("org", "name", askedBranch,
        askedVersion);
    DefaultModuleDescriptor foundMD = DefaultModuleDescriptor.newDefaultInstance(
        ModuleRevisionId.newInstance("org", "name", foundBranch, (String) null));
    foundMD.setStatus(foundStatus);
    assertEquals(b, vm.accept(askedMrid, foundMD));
}
 
Example #19
Source File: BuildableIvyModuleResolveMetaData.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static void attachArtifact(MDArtifact artifact, Set<String> configurations, DefaultModuleDescriptor target) {
    //The existing artifact configurations will be first
    Set<String> existingConfigurations = newLinkedHashSet(asList(artifact.getConfigurations()));
    for (String c : configurations) {
        if (!existingConfigurations.contains(c)) {
            artifact.addConfiguration(c);
            target.addArtifact(c, artifact);
        }
    }
}
 
Example #20
Source File: SortTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Test
public void testSort() {
    addDependency(md2, "md1", "rev1");
    addDependency(md3, "md2", "rev2");
    addDependency(md4, "md3", "rev3");

    DefaultModuleDescriptor[][] expectedOrder = new DefaultModuleDescriptor[][] {
            {md1, md2, md3, md4}};

    for (List<ModuleDescriptor> toSort : getAllLists(md1, md3, md2, md4)) {
        assertSorted(expectedOrder, sortModuleDescriptors(toSort, nonMatchReporter));
    }
}
 
Example #21
Source File: DefaultConfigurationsToArtifactsConverter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void addArtifacts(MutableLocalComponentMetaData metaData, Iterable<? extends Configuration> configurations) {
    DefaultModuleDescriptor moduleDescriptor = metaData.getModuleDescriptor();
    for (Configuration configuration : configurations) {
        for (PublishArtifact publishArtifact : configuration.getArtifacts()) {
            Artifact ivyArtifact = createIvyArtifact(publishArtifact, moduleDescriptor.getModuleRevisionId());
            metaData.addArtifact(configuration.getName(), ivyArtifact, publishArtifact.getFile());
        }
    }
}
 
Example #22
Source File: IvyInternalPublisher.java    From jeka with Apache License 2.0 5 votes vote down vote up
private DefaultModuleDescriptor createModuleDescriptor(JkVersionedModule jkVersionedModule,
                                                       JkMavenPublication publication,
                                                       JkDependencySet resolvedDependencies,
                                                       Instant deliveryDate,
                                                       JkVersionProvider resolvedVersions) {
    final DefaultModuleDescriptor moduleDescriptor = IvyTranslations.toPublicationLessModule(
            jkVersionedModule, resolvedDependencies, JkScope.DEFAULT_SCOPE_MAPPING, resolvedVersions);
    IvyTranslations.populateModuleDescriptorWithPublication(moduleDescriptor, publication,
            deliveryDate);
    return moduleDescriptor;
}
 
Example #23
Source File: PublishLocalComponentFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public MutableLocalComponentMetaData convert(Set<? extends Configuration> configurations, ModuleInternal module) {
    MutableLocalComponentMetaData publishMetaData = resolveLocalComponentFactory.convert(configurations, module);
    DefaultModuleDescriptor moduleDescriptor = publishMetaData.getModuleDescriptor();
    moduleDescriptor.addExtraAttributeNamespace(IVY_MAVEN_NAMESPACE_PREFIX, IVY_MAVEN_NAMESPACE);
    configurationsToArtifactsConverter.addArtifacts(publishMetaData, configurations);
    return publishMetaData;
}
 
Example #24
Source File: IvyInternalPublisher.java    From jeka with Apache License 2.0 5 votes vote down vote up
private ModuleDescriptor createModuleDescriptor(JkVersionedModule jkVersionedModule,
        JkIvyPublication publication, JkDependencySet dependencies,
        JkScopeMapping defaultMapping, Instant deliveryDate, JkVersionProvider resolvedVersions) {

    final DefaultModuleDescriptor moduleDescriptor = IvyTranslations.toPublicationLessModule(
            jkVersionedModule, dependencies, defaultMapping, resolvedVersions);
    IvyTranslations.populateModuleDescriptorWithPublication(moduleDescriptor, publication,
            deliveryDate);
    return moduleDescriptor;
}
 
Example #25
Source File: MockResolver.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
static MockResolver buildMockResolver(ResolverSettings settings, String name,
        boolean findRevision, final ModuleRevisionId mrid, final Date publicationDate,
        final boolean isdefault) {
    final MockResolver r = new MockResolver();
    r.setName(name);
    r.setSettings(settings);
    if (findRevision) {
        DefaultModuleDescriptor md = new DefaultModuleDescriptor(mrid, "integration",
                publicationDate, isdefault);
        r.rmr = new ResolvedModuleRevision(r, r, md, new MetadataArtifactDownloadReport(
                md.getMetadataArtifact()));
    }
    return r;
}
 
Example #26
Source File: SortTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Test
public void testCircularDependency2() {
    addDependency(md2, "md3", "rev3");
    addDependency(md2, "md1", "rev1");
    addDependency(md3, "md2", "rev2");
    addDependency(md4, "md3", "rev3");
    DefaultModuleDescriptor[][] possibleOrder = new DefaultModuleDescriptor[][] {
            {md1, md3, md2, md4}, {md1, md2, md3, md4}
            // {md3, md1, md2, md4}
            // we don't have this solution. The loops appear has one contiguous element.
    };
    for (List<ModuleDescriptor> toSort : getAllLists(md1, md3, md2, md4)) {
        assertSorted(possibleOrder, sortModuleDescriptors(toSort, nonMatchReporter));
    }
}
 
Example #27
Source File: IvyInternalPublisher.java    From jeka with Apache License 2.0 5 votes vote down vote up
@Override
public void publishMaven(JkVersionedModule versionedModule, JkMavenPublication publication,
                         JkDependencySet dependencies, UnaryOperator<Path> signer) {
    JkLog.startTask("Publishing on Maven repositories");
    final DefaultModuleDescriptor moduleDescriptor = createModuleDescriptor(versionedModule,
            publication, dependencies, Instant.now(), JkVersionProvider.of());
    final int count = publishMavenArtifacts(publication, moduleDescriptor, signer);
    JkLog.info("Module published in %s.", JkUtilsString.plurialize(count,
            "repository", "repositories"));
   JkLog.endTask();
}
 
Example #28
Source File: DefaultDependenciesToModuleDescriptorConverter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void addDependencies(DefaultModuleDescriptor moduleDescriptor, Collection<? extends Configuration> configurations) {
    for (Configuration configuration : configurations) {
        for (ModuleDependency dependency : configuration.getDependencies().withType(ModuleDependency.class)) {
            dependencyDescriptorFactory.addDependencyDescriptor(configuration.getName(), moduleDescriptor, dependency);
        }
    }
}
 
Example #29
Source File: DefaultClientModuleMetaDataFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public MutableModuleVersionMetaData createModuleDescriptor(ModuleRevisionId moduleRevisionId, Set<ModuleDependency> dependencies) {
    DefaultModuleDescriptor moduleDescriptor = new DefaultModuleDescriptor(moduleRevisionId,
            "release", null);
    moduleDescriptor.addConfiguration(new Configuration(Dependency.DEFAULT_CONFIGURATION));
    addDependencyDescriptors(moduleDescriptor, dependencies, dependencyDescriptorFactory);
    moduleDescriptor.addArtifact(Dependency.DEFAULT_CONFIGURATION,
            new DefaultArtifact(moduleRevisionId, null, moduleRevisionId.getName(), "jar", "jar"));
    return new ModuleDescriptorAdapter(moduleDescriptor);
}
 
Example #30
Source File: DefaultClientModuleMetaDataFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void addDependencyDescriptors(DefaultModuleDescriptor moduleDescriptor, Set<ModuleDependency> dependencies,
                                      DependencyDescriptorFactory dependencyDescriptorFactory) {
    for (ModuleDependency dependency : dependencies) {
        dependencyDescriptorFactory.addDependencyDescriptor(Dependency.DEFAULT_CONFIGURATION, moduleDescriptor,
                dependency);
    }
}