Cpp library dependencies and flavors

Hey all,

I am trying to use native support with a few flavors. The project consists a few sub-projects where one represents the main result and most of the other subprojects are linked as dependencies. The structure is similar to this:

Deps:

libraries{
    dep{}
}

Main:

model{
    flavors{
        api1
        api2
    }
}
libraries{
    main{
        binaries.all{
            lib project: ":deps", library: "dep", linkage: "static"
        }
    }
}

Both ‘‘main’’ and ‘‘deps’’ are subprojects and I get the following error:

No shared library binary available for library 'dep' with [flavor: 'api1', platform: 'clang', buildType: 'debug']

That is because the library ‘‘dep’’ has no flavor ‘‘api1’’. In fact, it has no flavors at all but the resolver does not fall back to the default flavor and I was not able to find a way to specify the flavor while declaring the dependency. What I would like to do is this:

libraries{
    main{
        binaries.all{
            lib project: ":deps", library: "mydep", linkage: "static", flavor:"default"
        }
    }
}

Is there a way to resolve the library (I need this for subproject native libraries as well as for prebuilt-libraries) manually?

Best, -Thasso

It’s inconvenient, but currently all of your library dependencies must be built with the same flavors (and platforms). Proper dependency resolution for the native plugins is very high on our list of priorities: currently it’s more of a ‘placeholder’ implementation, lacking transitive resolution, variant compatibility, etc.

Stay tuned for better support in the future.