What does Gradle 2.0 native build try to build .h files by default?

(teg) #1

I’m building numerous library projects with gradle and for the most part it works great. Using VisualCpp toolchan.

One problem I have though is that gradle attempt to compile header files that are in the CPP folders not just the .cpp files. This tends to fail because the headers have dependencies on other headers that actually get resolved in the cpp files themselves. Sometimes the H’s actually contain C++ code and only work when included inside other CPP files (don’t ask, it’s not my code).

So, building headers files even if they’re in the CPP folder is problematic. I have a work around, I can apply a filter to each project so, it only looks for .cpp in the CPP folders but, it’s a pain and messy to do this with every project.

Is building the .h files intentional?


Our plan is to add these filters by default. The “default” layout has headers and source files in separate directories, so these filters weren’t added early on. But it never makes sense to pass header files as source to the compiler, so it’s clearly not a great behaviour.

There’s a story to add the appropriate file filters for ‘native’ languages: https://github.com/gradle/gradle/blob/master/design-docs/continuous-delivery-for-c-plus-plus.md#story-language-source-sets-filter-source-files-by-file-extension. If you’re interested in helping out with a pull request, that would be great!