Skip to content

Commit 6cf3a05

Browse files
authored
RFC: Make include_dependency(path; track_content=true) the default (#54965)
By changing the default to `true` we make it easier to build relocatable packages from already existing ones when 1.11 lands. This keyword was just added during 1.11, so its not yet too late to change its default.
1 parent f2558c4 commit 6cf3a05

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

base/loading.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,21 +2090,22 @@ function _include_dependency(mod::Module, _path::AbstractString; track_content=t
20902090
end
20912091

20922092
"""
2093-
include_dependency(path::AbstractString; track_content::Bool=false)
2093+
include_dependency(path::AbstractString; track_content::Bool=true)
20942094
20952095
In a module, declare that the file, directory, or symbolic link specified by `path`
2096-
(relative or absolute) is a dependency for precompilation; that is, the module will need
2097-
to be recompiled if the modification time `mtime` of `path` changes.
2098-
If `track_content=true` recompilation is triggered when the content of `path` changes
2096+
(relative or absolute) is a dependency for precompilation; that is, if `track_content=true`
2097+
the module will need to be recompiled if the content of `path` changes
20992098
(if `path` is a directory the content equals `join(readdir(path))`).
2099+
If `track_content=false` recompilation is triggered when the modification time `mtime` of `path` changes.
21002100
21012101
This is only needed if your module depends on a path that is not used via [`include`](@ref). It has
21022102
no effect outside of compilation.
21032103
21042104
!!! compat "Julia 1.11"
21052105
Keyword argument `track_content` requires at least Julia 1.11.
2106+
An error is now thrown if `path` is not readable.
21062107
"""
2107-
function include_dependency(path::AbstractString; track_content::Bool=false)
2108+
function include_dependency(path::AbstractString; track_content::Bool=true)
21082109
_include_dependency(Main, path, track_content=track_content, path_may_be_dir=true)
21092110
return nothing
21102111
end
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module RelocationTestPkg2
22

3-
include_dependency("foo.txt")
4-
include_dependency("foodir")
3+
include_dependency("foo.txt", track_content=false)
4+
include_dependency("foodir", track_content=false)
55
greet() = print("Hello World!")
66

77
end # module RelocationTestPkg2

0 commit comments

Comments
 (0)