コード例 #1
0
 private void fillModuleDependencies()
     throws IvySettingsNotFoundException, IvySettingsFileReadException {
   final ModuleDescriptor descriptor = ivyManager.getModuleDescriptor(module);
   if (descriptor != null) {
     final DependencyDescriptor[] ivyDependencies = descriptor.getDependencies();
     for (Module dependencyModule :
         IntellijUtils.getAllModulesWithIvyIdeaFacet(module.getProject())) {
       if (!module.equals(dependencyModule)) {
         for (DependencyDescriptor ivyDependency : ivyDependencies) {
           final ModuleId ivyDependencyId = ivyDependency.getDependencyId();
           final ModuleId dependencyModuleId = getModuleId(dependencyModule);
           if (ivyDependencyId.equals(dependencyModuleId)) {
             LOGGER.info(
                 "Recognized dependency "
                     + ivyDependency
                     + " as intellij module '"
                     + dependencyModule.getName()
                     + "' in this project!");
             moduleDependencies.put(dependencyModuleId, dependencyModule);
             break;
           }
         }
       }
     }
   }
 }
コード例 #2
0
  public void testUpdateWithExcludeConfigurations5() throws Exception {
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    URL settingsUrl =
        new File("test/java/org/apache/ivy/plugins/parser/xml/" + "test-update-excludedconfs5.xml")
            .toURL();
    XmlModuleDescriptorUpdater.update(
        settingsUrl,
        buffer,
        getUpdateOptions("release", "mynewrev").setConfsToExclude(new String[] {"myconf2"}));

    XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
    ModuleDescriptor updatedMd =
        parser.parseDescriptor(
            new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()),
            new BasicResource("test", false, 0, 0, false),
            true);

    DependencyDescriptor[] deps = updatedMd.getDependencies();
    assertNotNull("Dependencies shouldn't be null", deps);
    assertEquals("Number of dependencies is incorrect", 8, deps.length);

    // check that none of the dependencies contains myconf2
    for (int i = 0; i < deps.length; i++) {
      String name = deps[i].getDependencyId().getName();
      assertFalse(
          "Dependency " + name + " shouldn't have myconf2 as module configuration",
          Arrays.asList(deps[i].getModuleConfigurations()).contains("myconf2"));
      assertEquals(
          "Dependency " + name + " shouldn't have a dependency artifact for configuration myconf2",
          0,
          deps[i].getDependencyArtifacts("myconf2").length);
    }
  }
コード例 #3
0
  public void testUpdateWithComments() throws Exception {
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    URL settingsUrl =
        new File("test/java/org/apache/ivy/plugins/parser/xml/" + "test-with-comments.xml").toURL();
    XmlModuleDescriptorUpdater.update(
        settingsUrl,
        new BufferedOutputStream(buffer, 1024),
        getUpdateOptions("release", "mynewrev"));

    XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
    ModuleDescriptor updatedMd =
        parser.parseDescriptor(
            new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()),
            new BasicResource("test", false, 0, 0, false),
            true);

    DependencyDescriptor[] dependencies = updatedMd.getDependencies();
    assertNotNull(dependencies);
    assertEquals(3, dependencies.length);
  }
コード例 #4
0
 public DependencyDescriptor[] getDependencies() {
   return module.getDependencies();
 }