Ivy-publish generateDescriptorFileForIvyPublication not repsecting configurations

Not sure if this is because the plugin is incomplete or it is a bug, but ivy-publish does not seem to be repsecting my dependency configurations. It includes dependencies even when transitive=false or they are excluded with the “exclude” property.

Example:

dependencies {
 compile (group: 'agroup', name: 'aname', version: 'aversion', configuration:'compile') {
  exclude group: 'bgroup', module: 'bname'
 }
          compile ('foo:barr:1.0') {transitive =
false}
}

Would generate (assume agroup:aname depends on bgroup:bname):

<dependencies>
  <!-- This should really be:
   <dependency org="agroup" name="aname" rev="aversion" conf="runtime->compile">
    <exclude org="bgroup" module="bname"/>
  </dependency>
  -->
    <dependency org="agroup" name="aname" rev="aversion" conf="runtime->compile"/>
    <!-- This should really be:
  <dependency org="foo" name="bar" rev="1.0" transitive="false" conf="runtime->default"/>
  -->
    <dependency org="foo" name="bar" rev="1.0" conf="runtime->default"/>
</dependencies>

I looked through the source code and it looks like these features are not yet implemented. Until then I am using the following in the withXml closure (it doesn’t handle all cases but does what I need):

// Now go through and add more information to the ivy configuration
// As of Gradle 2.2.1 ivy-publish does not yet implement these features
logger.debug("Modifying dependencies...");
asNode().dependencies[0].each {
  Node node = (Node)it;
    /*
  * Given:
  * Ivy.xml:
  * <dependency org="dOrg" name="dName" rev="dRev" configuration="dConfLeft->dConfRight">
  *
  * Gradle:
  * dependencies {
  *
 gConfLeft (group:'gOrg' name:'gName' version:'gRev' configuration:'gConfRight') { ... }
  *
 ...
  * }
  */
    String dOrg = node.attribute("org");
 String dName = node.attribute("name");
 String dRev = node.attribute("rev");
 String dConfFull = node.attribute("conf");
 String dConfLeft = dConfFull?.split("->")[0];
 String dConfRight = dConfFull?.split("->").length > 1? dConfFull?.split("->")[1] : "default";
    logger.debug("
Processing: $dOrg:$dName:$dRev:$dConfFull")
    // Find the dependency if possible
 List<Configuration> configsToSearch = new ArrayList<Configuration>();
 Configuration dConfObj = p.getConfigurations().findByName(dConfLeft);
 if (dConfObj != null) {
  // the java plugin always publishes using the 'runtime' configuration
  // to pick that up we can search parents
  configsToSearch.add(dConfObj);
      // Not sure if this is recursive...
  configsToSearch.addAll(dConfObj.getExtendsFrom());
 }
    logger.debug("Need to search through: " + configsToSearch);
 ModuleDependency realDep = null;
 for (Configuration conf : configsToSearch) {
  // At this point gConfLeft is either = dConfLeft or is a parent of dConfLeft
  String gConfLeft = conf.name;
  DomainObjectSet<ModuleDependency> mydeps = conf.getDependencies().matching({
    Dependency d ->
        if (d instanceof ModuleDependency) {
    ModuleDependency md = (ModuleDependency)d;
          String gConfRight = md.getConfiguration();
          String gOrg = md.getGroup();
    String gName = md.getName();
    String gRev = md.getVersion();
          // This probably does not handle wildcards correctly
    boolean compare = (nullSafeEquals(dOrg, gOrg)
      && nullSafeEquals(dName, gName)
      && nullSafeEquals(dRev, gRev)
      && nullSafeEquals(dConfRight, gConfRight)
      );
          logger.debug("Compare: $dOrg==$gOrg $dName==$gName $dRev==$gName $dConfRight==$gConfRight: $compare");
          return compare;
   } else {
    logger.debug("Not a ModuleDependency: " + d);
   }
        return false;
  });
      if (mydeps.size() == 0) {
       } else if (mydeps.size() > 1) {
   // Not sure how to handle this...
   logger.warn("Found > 1 dependencies for: $dOrg:$dName:$dRev:$dConfFull:$mydeps");
   realDep = mydeps.iterator().next();
   break;
  } else {
   realDep = mydeps.iterator().next();
   break;
  }
 }
    if (realDep != null) {
      // Add transitive attribute
  if (!realDep.isTransitive()) {
   node.attributes().put('transitive', 'false');
  }
      // Add excludes
  if (realDep.getExcludeRules() != null) {
   for (ExcludeRule er : realDep.getExcludeRules()) {
    node.appendNode("exclude", [org:er.getGroup(), name:er.getModule()]);
   }
  }
 } else {
  logger.warn("Could not find dependency for: $dOrg:$dName:$dRev:$dConfLeft");
 }
}