No way to target specific project configuration artifacts with existing Substitution DSL

(Steffen Yount) #1

Gradle Version: 3.1
Operating System and JVM version: Any

In our project configuration dependency blocks we can target specific project configuration artifacts like so:

dependencies {
    compile project(path: ':subproj1', configuration: 'lib1')

I believe this relies on DependencyHandler.project(Map<String, ?> notation) as defined in the dependency DSL.

If I want to substitute that particular project configuration artifact with a downloadable module artifact I’d expect to be able to specify the project substitution with something like the following:

    configurations.all {
        resolutionStrategy {
            dependencySubstitution {
                substitute project(path: ':subproj1', configuration: 'lib1') with module('com.example:subproj1:1')

But this doesn’t work, since there’s no corresponding DependencySubstitutions.project(Map<String, ?> notation) in the substitution DSL.

Can the DSL be made to support this use case? Is there already another way to target individual project configuration artifacts for substitution?

Similarly, it would be nice to have the option to declare modules targeted for substitution using the map-style notation. With a corresponding function like DependencySubstitutions.module(Map<String, ?> notation) in the substitution DSL. E.g:

module(group: 'com.example', name: 'subproj1', version: '1')