|
| 1 | +# Get the buildroot and stdlibdir from the make environment to make sure we're |
| 2 | +# generating docs for the current julia source tree, regardless of what julia |
| 3 | +# executable we're using. If these arguments are not passed, fall back to |
| 4 | +# assuming that we're running a just-built version of julia and generating docs |
| 5 | +# in tree. |
1 | 6 | let r = r"buildroot=(.+)", i = findfirst(x -> occursin(r, x), ARGS) |
2 | | - global const buildrootdoc = i === nothing ? (@__DIR__) : joinpath(first(match(r, ARGS[i]).captures), "doc") |
| 7 | + if i === nothing |
| 8 | + global const buildrootdoc = @__DIR__ |
| 9 | + global const buildroot = abspath(joinpath(buildrootdoc, "..")) |
| 10 | + else |
| 11 | + global const buildroot = first(match(r, ARGS[i]).captures) |
| 12 | + global const buildrootdoc = joinpath(buildroot, "doc") |
| 13 | + end |
| 14 | +end |
| 15 | + |
| 16 | +let r = r"stdlibdir=(.+)", i = findfirst(x -> occursin(r, x), ARGS) |
| 17 | + if i === nothing |
| 18 | + global const STDLIB_DIR = Sys.STDLIB |
| 19 | + else |
| 20 | + global const STDLIB_DIR = first(match(r, ARGS[i]).captures) |
| 21 | + end |
3 | 22 | end |
4 | 23 |
|
5 | 24 | # Install dependencies needed to build the documentation. |
@@ -28,7 +47,6 @@ cp_q(src, dest) = isfile(dest) || cp(src, dest) |
28 | 47 |
|
29 | 48 | # make links for stdlib package docs, this is needed until #552 in Documenter.jl is finished |
30 | 49 | const STDLIB_DOCS = [] |
31 | | -const STDLIB_DIR = Sys.STDLIB |
32 | 50 | const EXT_STDLIB_DOCS = ["Pkg"] |
33 | 51 | cd(joinpath(buildrootdoc, "src")) do |
34 | 52 | Base.rm("stdlib"; recursive=true, force=true) |
|
0 commit comments