Skip to content
Open
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
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df"
RoundingIntegers = "d5f540fe-1c90-5db3-b776-2e2f362d9394"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
UnsafeArrays = "c4a57d5a-5b31-53a6-b365-19f8c011fbd6"
POMDPs = "a93abf59-7444-517b-a68a-c42f96afdd7d"

[targets]
test = ["CatIndices", "EndpointRanges", "EponymTuples", "Example", "IndirectArrays", "InteractiveUtils", "MacroTools", "MappedArrays", "Random", "Requires", "RoundingIntegers", "Test", "UnsafeArrays"]
test = ["CatIndices", "EndpointRanges", "EponymTuples", "Example", "IndirectArrays", "InteractiveUtils", "MacroTools", "MappedArrays", "Random", "Requires", "RoundingIntegers", "Test", "UnsafeArrays", "POMDPs"]
4 changes: 3 additions & 1 deletion src/pkgs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ end
# Use locking to prevent races between inner and outer @require blocks
const requires_lock = ReentrantLock()

function add_require(sourcefile::String, modcaller::Module, idmod::String, modname::String, expr::Expr)
function add_require(sourcefile::String, modcaller::Module, idmod::String, modname::String, expr::Union{Expr,Symbol})
# make sure we are always dealing with an expression, not a Symbol
expr = expr isa Expr ? expr : Expr(expr)
id = PkgId(modcaller)
# If this fires when the module is first being loaded (because the dependency
# was already loaded), Revise may not yet have the pkgdata for this package.
Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3093,6 +3093,7 @@ do_test("New files & Requires.jl") && @testset "New files & Requires.jl" begin
export testfunc
include("testfile.jl")
end
@require POMDPs="a93abf59-7444-517b-a68a-c42f96afdd7d" nothing
@require CatIndices="aafaddc9-749c-510e-ac4f-586e18779b91" onearg(1)
@require IndirectArrays="9b13fd28-a010-5f03-acff-a1bbcff69959" @eval SubModule include("st.jl")
@require RoundingIntegers="d5f540fe-1c90-5db3-b776-2e2f362d9394" begin
Expand Down Expand Up @@ -3132,6 +3133,9 @@ do_test("New files & Requires.jl") && @testset "New files & Requires.jl" begin
@eval using IndirectArrays
sleep(mtimedelay)
notified && @test TrackRequires.SubModule.h(TrackRequires.SubModule.NewType()) == 3
# Check that we also handle symbols (rather than expressions) in `@require`
@eval using POMDPs # to trigger Requires
sleep(mtimedelay)
# Check a non-block expression
warnfile = randtmp()
open(warnfile, "w") do io
Expand Down