-
Notifications
You must be signed in to change notification settings - Fork 18
Description
If you want to load a preference associated with a dependency:
const _format = load_preference(MPIPreferences, "_format") # access 'third-party' preferenceThis access does not end up recorded in the preferences hash for the pkgimage, so changes to the preference due not trigger re-compilation properly.
The problem is that it will end up in Base.COMPILETIME_PREFERENCES, but the entries will be ignored since Julia only queries for the preferences associated with the "top-level" module:
// call get_compiletime_prefs(__toplevel__)
jl_value_t *args[3] = {get_compiletime_prefs_func, (jl_value_t*)toplevel, NULL};
prefs_list = (jl_value_t*)jl_apply(args, 2);
JL_TYPECHK(write_dependency_list, array, prefs_list);
// Call get_preferences_hash(__toplevel__, prefs_list)
args[0] = prefs_hash_func;
args[2] = prefs_list;
prefs_hash = (jl_value_t*)jl_apply(args, 3);
JL_TYPECHK(write_dependency_list, uint64, prefs_hash);It seems like this code is confused about the package associated with the definition vs. the usage - the key in Base.COMPILETIME_PREFERENCES is the module associated with the preference definition, not the usage / dependency.
(fwiw, Base.COMPILETIME_PREFERENCES should only ever include preferences accessed during the current pre-compilation run - iiuc, keying / filtering should not be necessary at all)