Resolve native Dependency Exported Headers

Hi,

We currently use gradle in a native multi-project environment. We are looking at integrating PC-lint into the process and as part of that we need to resolve the external header dependencies of a binary.

We have got to the point where we can collect the related source and headers for a binaries sourcesets. However the libs are just textual references to another project. Is there a way similar to the native compile process to get a file list or similiar of the external dependencies headers?

Any help appreciated.

Thanks,
Shaun

Assuming you are defining the external dependency as another component or a prebuilt library, you can access the library dependencies of a binary and from that get the header directories of each library:

model {
    components {
        all {
            binaries.withType(NativeBinarySpec).afterEach { binary ->
                def headers = binary.libs.collect { it.includeRoots }
            }
        }
    }
} 

“headers” above will be a collection of FileCollections representing the header directories of dependency libraries.

1 Like

Hi Gary,

Thanks for the quick response. Apologies for the delay in my reply. This is exactly what I was looking for and solved the issue at hand. Thank you very much.

One step closer to having PC-lint integrated.

Thanks,
Shaun