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

Remove Documenter dep. #10

Merged
merged 2 commits into from
May 11, 2022
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
6 changes: 1 addition & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
name = "PrecompileSignatures"
uuid = "91cefc8d-f054-46dc-8f8c-26e11d7c5411"
authors = ["Rik Huijzer <t.h.huijzer@rug.nl>"]
version = "3.0.2"

[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
version = "3.0.3"

[compat]
Documenter = "0.27"
julia = "1.6"

[extras]
Expand Down
25 changes: 22 additions & 3 deletions src/PrecompileSignatures.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
module PrecompileSignatures

using Documenter.Utilities: submodules

export precompile_directives, write_directives, @precompile_signatures

# Taken from https://github.com/JuliaDocs/Documenter.jl/blob/1fcf1de5b0dd3f45a3c17af3d18776a456fe6a12/src/Utilities/Utilities.jl#L213-L231=
function _submodules(modules::Vector{Module})
out = Set{Module}()
for each in modules
_submodules(each, out)
end
out
end
function _submodules(root::Module, seen = Set{Module}())
push!(seen, root)
for name in names(root, all=true)
if Base.isidentifier(name) && isdefined(root, name) && !Base.isdeprecated(root, name)
object = getfield(root, name)
if isa(object, Module) && !(object in seen) && parentmodule(object::Module) == root
_submodules(object, seen)
end
end
end
return seen
end

function _is_macro(f::Function)
text = sprint(show, MIME"text/plain"(), f)
return contains(text, "macro with")
Expand Down Expand Up @@ -194,7 +213,7 @@ end
function _all_submodules(M::Vector{Module})::Vector{Module}
out = Module[]
for m in M
S = submodules(m)
S = _submodules(m)
for s in S
push!(out, s)
end
Expand Down