Binaries ModelMap is empty for testSuites?

(David Cowden) #1

I have the following:

testSuites {
    withType(GoogleTestTestSuiteSpec) {
//        sources {
//            cpp {
//                lib project: ':gtest', library: 'gtest'
//            } // this works but gradle borks if gtest does not support all the
//        }     // platforms the  gtest project supports

        binaries.all {
            if (targetPlatform.operatingSystem.macOsX || targetPlatform.operatingSystem.linux) {
                sources ... // configure sources with the dependency like above
            } // but...
              // println binaries.values() results in []

What I’d like to do is only add the a dependency on gtest for the platforms gtest supports (as declared in its build.gradle). I’m cross-compiling for targets other than osx and linux. But I can only run the tests on osx and linux. Is there a workaround for this?