Resolve native Dependency Exported Headers


(Shaun) #1

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


(Gary Hale) #2

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.


(Shaun) #3

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