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

Fix #636 #640

Merged
merged 1 commit into from
Aug 4, 2021
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
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Revise"
uuid = "295af30f-e4ad-537b-8983-00126c2a3abe"
version = "3.1.17"
version = "3.1.18"

[deps]
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
Expand Down Expand Up @@ -38,6 +38,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
RoundingIntegers = "d5f540fe-1c90-5db3-b776-2e2f362d9394"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
UnsafeArrays = "c4a57d5a-5b31-53a6-b365-19f8c011fbd6"

[targets]
test = ["CatIndices", "EndpointRanges", "EponymTuples", "Example", "IndirectArrays", "InteractiveUtils", "MacroTools", "MappedArrays", "Random", "Requires", "RoundingIntegers", "Test"]
test = ["CatIndices", "EndpointRanges", "EponymTuples", "Example", "IndirectArrays", "InteractiveUtils", "MacroTools", "MappedArrays", "Random", "Requires", "RoundingIntegers", "Test", "UnsafeArrays"]
2 changes: 1 addition & 1 deletion src/pkgs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ end
function eval_require_now(pkgdata::PkgData, fileidx::Int, filekey::String, sourcefile::String, modcaller::Module, expr::Expr)
fi = pkgdata.fileinfos[fileidx]
exsnew = ExprsSigs()
exsnew[expr] = nothing
exsnew[RelocatableExpr(expr)] = nothing
mexsnew = ModuleExprsSigs(modcaller=>exsnew)
# Before executing the expression we need to set the load path appropriately
prev = Base.source_path(nothing)
Expand Down
23 changes: 23 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3408,6 +3408,10 @@ do_test("New files & Requires.jl") && @testset "New files & Requires.jl" begin
include(fn)
@require Revise="295af30f-e4ad-537b-8983-00126c2a3abe" Revise.track(TrackRequires, fn)
end
@require UnsafeArrays="c4a57d5a-5b31-53a6-b365-19f8c011fbd6" begin
fn = joinpath(@__DIR__, "subdir", "yetanotherfile.jl")
include(fn)
end
end
end # module
""")
Expand All @@ -3427,6 +3431,11 @@ do_test("New files & Requires.jl") && @testset "New files & Requires.jl" begin
ftrack() = 1
""")
end
open(joinpath(sd, "yetanotherfile.jl"), "w") do io
println(io, """
fauto() = 1
""")
end
sleep(mtimedelay)
@eval using TrackRequires
notified = isdefined(TrackRequires.Requires, :withnotifications)
Expand Down Expand Up @@ -3471,6 +3480,20 @@ do_test("New files & Requires.jl") && @testset "New files & Requires.jl" begin
idx = findfirst(name->occursin("anotherfile", name), sf)
@test !isabspath(sf[idx])
end
@test_throws UndefVarError TrackRequires.fauto()
@eval using UnsafeArrays
sleep(2) # allow time for the @async in all @require blocks to finish
if notified
@test TrackRequires.fauto() == 1
id = Base.PkgId(TrackRequires)
pkgdata = Revise.pkgdatas[id]
sf = Revise.srcfiles(pkgdata)
@test count(name->occursin("@require", name), sf) == 1
@test count(name->occursin("yetanotherfile", name), sf) == 1
@test !any(isequal("."), sf)
idx = findfirst(name->occursin("yetanotherfile", name), sf)
@test !isabspath(sf[idx])
end

# Ensure it also works if the Requires dependency is pre-loaded
dn = joinpath(testdir, "TrackRequires2", "src")
Expand Down