-
Notifications
You must be signed in to change notification settings - Fork 572
Description
Summary
Transitive data dependencies are currently included in the compile inputs of Rustc actions via dep_info.transitive_data in _process_build_scripts. This means that changes to a data file in a dependency trigger recompilation of all downstream targets, even though data files are intended to be runtime-only dependencies (unlike compile_data).
For example, if library bar has data = ["foo.txt"], editing foo.txt does not rebuild bar itself, but does rebuild any binary that depends on bar. This is incorrect -- only compile_data should affect compilation, while data should only affect runfiles.
See #3609 for the original bug report and reproduction case.
Change
A new incompatible flag incompatible_do_not_include_transitive_data_in_compile_inputs has been introduced (defaulting to True) that removes dep_info.transitive_data from the compile inputs constructed in _process_build_scripts.
This is safe because:
- Proc macro data is already handled separately via
dep_info.transitive_proc_macro_datainnolinkstamp_compile_inputs - Direct build script compile data (
build_info.compile_data) is already added independently - The
transitive_datafield onDepInfocontinues to serve its purpose incollect_depsfor propagating data to proc macros
Migration
If you rely on the old behavior where data files from transitive dependencies are available as compile inputs, you can opt out by setting: