Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Make include_dependency(path; track_content=true) the default #54965

Merged
merged 3 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2090,21 +2090,22 @@ function _include_dependency(mod::Module, _path::AbstractString; track_content=t
end

"""
include_dependency(path::AbstractString; track_content::Bool=false)
include_dependency(path::AbstractString; track_content::Bool=true)

In a module, declare that the file, directory, or symbolic link specified by `path`
(relative or absolute) is a dependency for precompilation; that is, the module will need
to be recompiled if the modification time `mtime` of `path` changes.
If `track_content=true` recompilation is triggered when the content of `path` changes
(relative or absolute) is a dependency for precompilation; that is, if `track_content=true`
the module will need to be recompiled if the content of `path` changes
(if `path` is a directory the content equals `join(readdir(path))`).
If `track_content=false` recompilation is triggered when the modification time `mtime` of `path` changes.

This is only needed if your module depends on a path that is not used via [`include`](@ref). It has
no effect outside of compilation.

!!! compat "Julia 1.11"
Keyword argument `track_content` requires at least Julia 1.11.
fatteneder marked this conversation as resolved.
Show resolved Hide resolved
An error is now thrown if `path` is not readable.
"""
function include_dependency(path::AbstractString; track_content::Bool=false)
function include_dependency(path::AbstractString; track_content::Bool=true)
_include_dependency(Main, path, track_content=track_content, path_may_be_dir=true)
return nothing
end
Expand Down
4 changes: 2 additions & 2 deletions test/RelocationTestPkg2/src/RelocationTestPkg2.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module RelocationTestPkg2

include_dependency("foo.txt")
include_dependency("foodir")
include_dependency("foo.txt", track_content=false)
include_dependency("foodir", track_content=false)
greet() = print("Hello World!")

end # module RelocationTestPkg2