Skip to content

Commit

Permalink
Fix #636 (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy authored Aug 4, 2021
1 parent 165433a commit a93550a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
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

2 comments on commit a93550a

@timholy
Copy link
Owner Author

@timholy timholy commented on a93550a Aug 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/42184

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.1.18 -m "<description of version>" a93550a25a22af9a50b752338d94e22c759ca771
git push origin v3.1.18

Please sign in to comment.