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

[WIP] Handle cases where loading packages breaks generation #161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions src/DocumentationGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ function build_package_docs(packagespec::Pkg.Types.PackageSpec, buildpath, regis
build_git_docs(packagespec, buildpath, uri; src_prefix=src_prefix, href_prefix=href_prefix)
elseif type == "vendored"
build_local_docs(packagespec, buildpath, uri; src_prefix=src_prefix, href_prefix=href_prefix)
elseif type == "vendored-no-load"
build_local_docs(packagespec, buildpath, uri; src_prefix=src_prefix, href_prefix=href_prefix, load_package=false)
else
@error("Invalid doctype specified: $(type).")
Dict(
Expand Down
9 changes: 6 additions & 3 deletions src/builders.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function maybe_redirect(uri)
return uri
end

function build_local_docs(packagespec, buildpath, uri, pkgroot = nothing; gitdirdocs = false, src_prefix="", href_prefix="")
function build_local_docs(packagespec, buildpath, uri, pkgroot = nothing; gitdirdocs = false, src_prefix="", href_prefix="", load_package = true)
uri = something(uri, "docs")
mktempdir() do envdir
pkgname = packagespec.name
Expand All @@ -99,8 +99,11 @@ function build_local_docs(packagespec, buildpath, uri, pkgroot = nothing; gitdir
pkgfile = Base.find_package(pkgname)
pkgroot = normpath(joinpath(pkgfile, "..", ".."))
end
mod = try_use_package(packagespec)

mod = if load_package
try_use_package(packagespec)
else
nothing
end
# actual Documenter docs
try
for docdir in joinpath.(pkgroot, unique([uri, "docs", "doc"]))
Expand Down
9 changes: 9 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,15 @@ end
success = [true],
doctype = ["documenter"],
using_failed = [false]
),
(
name = "Tetris",
uuid = "d02b474b-c6a0-45b1-beee-9a2049fa00e6",
url = "https://github.com/mossr/Tetris.jl/",
versions = [v"1.0.0"],
installs = [true],
success = [true],
doctype = ["fallback_autodocs"],
)
]

Expand Down