Greetings Gradle developers. Using Gradle 2.10 for a very large C++ project I noticed a significant recompilation of up-to-date source files. I tracked this down to the known issue stated in the release notes for 2.10.
For C++ and related languages, Gradle uses source file parsing to determine the set of included headers for a source file. If Gradle cannot determine the set of included headers, it will fall back to the old mechanism of including all files in all include directories as inputs. This means that using a macro to define an #include file is not recommended, as it can prevent Gradle from taking advantage of this optimization.
In practice the approach seems to have a logic error which makes any change to one CPP source file to reevaluate all CPP sources against their includes and mark them as out-of-date. As an experiment I changed the logic that marks the dependency as changed when an include is âunknownâ to simply ignore the unknown include. It will still hash the include file itself but not declare it out-of-date just because the dependency is not a readable file. I understand that this is a limited application since the conditional include may in fact change by a redefinition but in our case that is simply not true and I prefer not to enforce such handling.
Could we have perhaps a documented âStrategyâ option for such issues until a more robust option is implemented? I am thinking of a system property perhaps controlling the flagging of the include as out-of-date or not. I plan to make this change as a temporary patch to solve my immediate problem and produce a pull request for your review.
For reference I have this issue use the Boost library for C++. It has several #include references that are not file names but #define macros that are evaluated at compile time.
This is the output seen in cases of recompilation with my projects pointing squarely to the Boost include files.
Cannot determine changed state of included âBOOST_USER_CONFIGâ in source file âconfig.hppâ. Assuming changed.
Cannot determine changed state of included âAUX778076_INCLUDE_STRINGâ in source file âinclude_preprocessed.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_SLIST_HEADERâ in source file âslist_traits.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âabi_prefix.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_SUFFIXâ in source file âabi_suffix.hppâ. Assuming changed.
Cannot determine changed state of included âAUX778076_INCLUDE_STRINGâ in source file âinclude_preprocessed.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_INTRUSIVE_INVARIANT_ASSERT_INCLUDEâ in source file âassert.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_REGEX_USER_CONFIGâ in source file âconfig.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âregex_traits_defaults.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âpattern_except.hppâ. Assuming changed.
Cannot determine changed state of included âB1â in source file âstatic_mutex.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âprimary_transform.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âcpp_regex_traits.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âc_regex_traits.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âw32_regex_traits.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âregex_traits.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âregex_raw_buffer.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âchar_regex_traits.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âstates.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âregbase.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âiterator_traits.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âbasic_regex.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âbasic_regex_creator.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âbasic_regex_parser.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âsub_match.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âregex_format.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âmatch_results.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âprotected_call.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âperl_matcher_recursive.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âperl_matcher_non_recursive.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âperl_matcher_common.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âperl_matcher.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âinstances.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âregex_match.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âregex_search.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âregex_iterator.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âregex_token_iterator.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âregex_grep.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âregex_replace.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âregex_merge.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_ABI_PREFIXâ in source file âregex_split.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_SLIST_HEADERâ in source file âslist.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_SLIST_HEADERâ in source file âcontainer_traits.hppâ. Assuming changed.
Cannot determine changed state of included âBOOST_SLIST_HEADERâ in source file âadjacency_list.hppâ. Assuming changed.
Thanks,
Alex Volanis