blob: 84cf64530f748d82c38c4ea7a11b60c0d4e1e9fd [file] [log] [blame]
John Cater214a7ae2017-08-09 17:24:53 +02001load("//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
Damien Martin-Guillerez49a3e4b2017-11-03 15:30:52 +01002load("//scripts/docs:jekyll.bzl", "jekyll_build")
David Chen8a142fe2016-05-06 07:57:17 +00003
Dmitry Lomov251d7542015-11-18 16:16:22 +00004exports_files(
Ulf Adams9e24ebd2016-06-23 09:24:57 +00005 [
dmartingcdb8a632017-09-04 11:43:35 +02006 "docs/user-manual.html",
Ulf Adams9e24ebd2016-06-23 09:24:57 +00007 "command-line-reference-prefix.html",
8 "command-line-reference-suffix.html",
9 ],
Dmitry Lomov251d7542015-11-18 16:16:22 +000010)
Damien Martin-Guillerezde54bca2016-02-29 10:49:43 +000011
Laszlo Csomor3d215782017-07-27 11:34:09 +020012exports_files(
13 [
14 "images/favicon.ico",
15 ],
16 visibility = ["//src/main/native/windows:__pkg__"],
17)
18
Kristina Chodorowa028ae22016-12-13 18:59:51 +000019DOT_GRAPH_HTML_FILES = [
dzc22b85a22017-05-31 20:37:50 +020020 "docs/query.html",
21 "docs/build-ref.html",
Kristina Chodorowa028ae22016-12-13 18:59:51 +000022]
23
Damien Martin-Guillerezde54bca2016-02-29 10:49:43 +000024filegroup(
25 name = "srcs",
26 srcs = glob(["**"]),
27 visibility = ["//:__pkg__"],
28)
David Chen8a142fe2016-05-06 07:57:17 +000029
30filegroup(
31 name = "jekyll-srcs",
32 srcs = glob(
33 ["**/*"],
34 exclude = [
35 "BUILD",
36 "jekyll-tree.sh",
37 "*.swp",
Ulf Adams9e24ebd2016-06-23 09:24:57 +000038 "command-line-reference-prefix.html",
39 "command-line-reference-suffix.html",
David Chenf328fde2016-07-27 00:12:32 +000040 "site/README.md",
Kristina Chodorowa028ae22016-12-13 18:59:51 +000041 ] + DOT_GRAPH_HTML_FILES,
David Chen8a142fe2016-05-06 07:57:17 +000042 ),
43)
44
45pkg_tar(
46 name = "jekyll-files",
John Cater214a7ae2017-08-09 17:24:53 +020047 srcs = [":jekyll-srcs"],
David Chen8a142fe2016-05-06 07:57:17 +000048 strip_prefix = ".",
49)
50
51pkg_tar(
52 name = "bootstrap-css",
John Cater214a7ae2017-08-09 17:24:53 +020053 srcs = ["//third_party/css/bootstrap:bootstrap_css"],
David Chen8a142fe2016-05-06 07:57:17 +000054 package_dir = "assets",
55 strip_prefix = "/third_party/css/bootstrap",
56)
57
58pkg_tar(
59 name = "bootstrap-images",
John Cater214a7ae2017-08-09 17:24:53 +020060 srcs = ["//third_party/css/bootstrap:bootstrap_images"],
David Chen8a142fe2016-05-06 07:57:17 +000061 package_dir = "assets",
62 strip_prefix = "/third_party/css/bootstrap",
63)
64
65pkg_tar(
66 name = "font-awesome-css",
John Cater214a7ae2017-08-09 17:24:53 +020067 srcs = ["//third_party/css/font_awesome:font_awesome_css"],
David Chen8a142fe2016-05-06 07:57:17 +000068 package_dir = "assets",
69 strip_prefix = "/third_party/css/font_awesome",
70)
71
72pkg_tar(
73 name = "font-awesome-font",
John Cater214a7ae2017-08-09 17:24:53 +020074 srcs = ["//third_party/css/font_awesome:font_awesome_font"],
David Chen8a142fe2016-05-06 07:57:17 +000075 package_dir = "assets",
76 strip_prefix = "/third_party/css/font_awesome",
77)
78
79pkg_tar(
80 name = "bootstrap-js",
John Cater214a7ae2017-08-09 17:24:53 +020081 srcs = ["//third_party/javascript/bootstrap:bootstrap_js"],
David Chen8a142fe2016-05-06 07:57:17 +000082 package_dir = "assets",
83 strip_prefix = "/third_party/javascript/bootstrap",
84)
85
86pkg_tar(
David Chen3f697512016-05-09 08:46:21 +000087 name = "jekyll-base",
David Chen8a142fe2016-05-06 07:57:17 +000088 deps = [
89 ":bootstrap-css",
90 ":bootstrap-images",
91 ":bootstrap-js",
Kristina Chodorowa028ae22016-12-13 18:59:51 +000092 ":dot-graphs",
David Chen8a142fe2016-05-06 07:57:17 +000093 ":font-awesome-css",
94 ":font-awesome-font",
95 ":jekyll-files",
96 ],
97)
David Chen3f697512016-05-09 08:46:21 +000098
99pkg_tar(
100 name = "skylark-rule-docs",
John Cater214a7ae2017-08-09 17:24:53 +0200101 srcs = [
David Chen3f697512016-05-09 08:46:21 +0000102 "//tools/build_defs/docker:README.md",
103 "//tools/build_defs/pkg:README.md",
104 ],
105 strip_prefix = "/tools/build_defs",
106)
107
108genrule(
Kristina Chodorowa028ae22016-12-13 18:59:51 +0000109 name = "dot-graphs",
110 srcs = DOT_GRAPH_HTML_FILES,
111 outs = ["dot.tar"],
112 cmd = """
113origdir=$$PWD
114tmpdir=$$(mktemp -d)
115for f in $(SRCS); do
116 mkdir -p $$tmpdir/$$(dirname $$f)
Klaus Aehlig7ed28be2017-03-02 15:26:38 +0000117 if which dot > /dev/null; then
Kristina Chodorowfc9750c2017-02-09 21:13:13 +0000118 $(location //scripts/docs:generate_dot_graphs) < $$f > $$tmpdir/$$f
119 else
Kristina Chodorow762576e2017-02-10 17:16:28 +0000120 cp $$f $$tmpdir/$$f
Kristina Chodorowfc9750c2017-02-09 21:13:13 +0000121 fi
Kristina Chodorowa028ae22016-12-13 18:59:51 +0000122done
123cd $$tmpdir/site
124tar cf $$origdir/$@ *
125""",
126 tools = ["//scripts/docs:generate_dot_graphs"],
127)
128
129genrule(
David Chen3f697512016-05-09 08:46:21 +0000130 name = "jekyll-tree",
131 srcs = [
132 ":jekyll-base",
133 ":skylark-rule-docs",
134 "//src/main/java/com/google/devtools/build/lib:gen_buildencyclopedia",
135 "//src/main/java/com/google/devtools/build/lib:gen_skylarklibrary",
Ulf Adams9e24ebd2016-06-23 09:24:57 +0000136 "//src/main/java/com/google/devtools/build/lib:gen_command-line-reference",
David Chen3f697512016-05-09 08:46:21 +0000137 ],
138 outs = ["jekyll-tree.tar"],
139 cmd = ("$(location jekyll-tree.sh) $@ " +
140 "$(location :jekyll-base) " +
141 "$(location :skylark-rule-docs) " +
142 "$(location //src/main/java/com/google/devtools/build/lib:gen_buildencyclopedia) " +
Ulf Adams9e24ebd2016-06-23 09:24:57 +0000143 "$(location //src/main/java/com/google/devtools/build/lib:gen_skylarklibrary) " +
144 "$(location //src/main/java/com/google/devtools/build/lib:gen_command-line-reference)"),
David Chen3f697512016-05-09 08:46:21 +0000145 tools = [
146 "jekyll-tree.sh",
147 ],
148)
Damien Martin-Guillerez49a3e4b2017-11-03 15:30:52 +0100149
150jekyll_build(
151 name = "site",
152 srcs = [":jekyll-tree"],
153 bucket = "docs.bazel.build",
154)