forked from EnzymeAD/Reactant.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.jl
86 lines (75 loc) · 2.49 KB
/
make.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using Reactant, ReactantCore
using Documenter, DocumenterVitepress
DocMeta.setdocmeta!(Reactant, :DocTestSetup, :(using Reactant); recursive=true)
# Helper functions
function first_letter_uppercase(str)
return uppercase(str[1]) * str[2:end]
end
# Generate examples
using Literate
const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples")
const OUTPUT_DIR = joinpath(@__DIR__, "src/generated")
examples = Pair{String,String}[]
for (_, name) in examples
example_filepath = joinpath(EXAMPLES_DIR, string(name, ".jl"))
Literate.markdown(example_filepath, OUTPUT_DIR; documenter=true)
end
examples = [
title => joinpath("generated", string(name, ".md")) for (title, name) in examples
]
pages = [
"Reactant.jl" => "index.md",
"Introduction" => [
"Getting Started" => "introduction/index.md",
"Configuration" => "introduction/configuration.md",
],
"Tutorials" =>
["Overview" => "tutorials/index.md", "Profiling" => "tutorials/profiling.md"],
"API Reference" => [
"Reactant API" => "api/api.md",
"Ops" => "api/ops.md",
"Dialects" => sort!(
[
first_letter_uppercase(first(splitext(basename(file)))) =>
joinpath("api/dialects", file) for
file in readdir(joinpath(@__DIR__, "src/api/dialects")) if
splitext(file)[2] == ".md"
];
by=first,
),
"MLIR API" => "api/mlirc.md",
"XLA" => "api/xla.md",
"Internal API" => "api/internal.md",
],
]
makedocs(;
modules=[
Reactant,
ReactantCore,
Reactant.XLA,
Reactant.MLIR,
Reactant.MLIR.API,
Reactant.MLIR.IR,
filter(
Base.Fix2(isa, Module),
[
getproperty(Reactant.MLIR.Dialects, x) for
x in names(Reactant.MLIR.Dialects; all=true) if x != :Dialects
],
)...,
],
authors="William Moses <[email protected]>, Valentin Churavy <[email protected]>",
sitename="Reactant.jl",
format=MarkdownVitepress(;
repo="github.com/EnzymeAD/Reactant.jl",
devbranch="main",
devurl="dev",
# md_output_path=".", # Uncomment for local testing
# build_vitepress=false, # Uncomment for local testing
),
# clean=false, # Uncomment for local testing
pages=pages,
doctest=true,
warnonly=[:cross_references],
)
deploydocs(; repo="github.com/EnzymeAD/Reactant.jl", devbranch="main", push_preview=true)