DependencySubstitution does not accept ProjectDependency or project configuration

I am trying to substitute a maven artifact with a local project using the incubating DependencySubstitution feature. The local project requires a configuration (x86Release) to generate the correct artifact. The current dependencySubstitution only allows the specification of the project path, but not the configuration. Causing the build to fail.
As a user of Dependency Substitution I expect to be able to specify a ProjectDependency as a substitute, including the project’s configuration.

In android development flavors are used widely and encouraged (for example for libraries that support different processor architectures) These different flavors are published to maven with different artifactID’s (without classifier). However these artifacts are produced by the same gradle project using different configurations.

For this workflow to work it should be possible to specify the project configuration for a dependency substitution:

resolutionStrategy {
    dependencySubstitution {
        substitute module("com.example.android:lib-x86:1.0.0") with project(":lib", configuration: "x86Release")
    }
}

Note the addition of the configuration argument.

Any thoughts on this?

You can substitute for project dependencies but currently it is not possible to substitute with a particular configuration.

@daz, any additional comments here. Are there any plans to support specifying a project dependency configuration via the dependency substitution DSL?

At this stage, dependency substitution is all based around the ComponentSelector API, which is centred around the concept of Component and Binary from the new software model. We are currently working to add variant-aware dependency resolution to this model. The next generation Android plugin will be build on this support.

It will be difficult to expose the concept of Configuration in dependency substitution, while remaining forward compatible with this new model.

I am glad to here this is on your radar. Dependency substitution is a very useful feature, and I look forward to using it for android libraries.
Thanks for all the great work!

This is similar to the issue I brought up as well: How to write custom substitution rules for ResolutionStrategy

My bet is if the two of us hit this, others may as well. For now, I’m unable to use the feature. Too bad. It really would have helped. I hope it gets better over time. I hope this feedback helps guide the way toward improvements.

Thanks