blob: 1672988fdb906cfe1485c4f7adba4a3124ff5e1c [file] [log] [blame]
David Chen8a142fe2016-05-06 07:57:17 +00001load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
2
Dmitry Lomov251d7542015-11-18 16:16:22 +00003exports_files(
Ulf Adams9e24ebd2016-06-23 09:24:57 +00004 [
dzc22b85a22017-05-31 20:37:50 +02005 "docs/bazel-user-manual.html",
Ulf Adams9e24ebd2016-06-23 09:24:57 +00006 "command-line-reference-prefix.html",
7 "command-line-reference-suffix.html",
8 ],
Dmitry Lomov251d7542015-11-18 16:16:22 +00009)
Damien Martin-Guillerezde54bca2016-02-29 10:49:43 +000010
Kristina Chodorowa028ae22016-12-13 18:59:51 +000011DOT_GRAPH_HTML_FILES = [
dzc22b85a22017-05-31 20:37:50 +020012 "docs/query.html",
13 "docs/build-ref.html",
Kristina Chodorowa028ae22016-12-13 18:59:51 +000014]
15
Damien Martin-Guillerezde54bca2016-02-29 10:49:43 +000016filegroup(
17 name = "srcs",
18 srcs = glob(["**"]),
19 visibility = ["//:__pkg__"],
20)
David Chen8a142fe2016-05-06 07:57:17 +000021
22filegroup(
23 name = "jekyll-srcs",
24 srcs = glob(
25 ["**/*"],
26 exclude = [
27 "BUILD",
28 "jekyll-tree.sh",
29 "*.swp",
Ulf Adams9e24ebd2016-06-23 09:24:57 +000030 "command-line-reference-prefix.html",
31 "command-line-reference-suffix.html",
David Chenf328fde2016-07-27 00:12:32 +000032 "site/README.md",
Kristina Chodorowa028ae22016-12-13 18:59:51 +000033 ] + DOT_GRAPH_HTML_FILES,
David Chen8a142fe2016-05-06 07:57:17 +000034 ),
35)
36
37pkg_tar(
38 name = "jekyll-files",
39 files = [":jekyll-srcs"],
40 strip_prefix = ".",
41)
42
43pkg_tar(
44 name = "bootstrap-css",
45 files = ["//third_party/css/bootstrap:bootstrap_css"],
46 package_dir = "assets",
47 strip_prefix = "/third_party/css/bootstrap",
48)
49
50pkg_tar(
51 name = "bootstrap-images",
52 files = ["//third_party/css/bootstrap:bootstrap_images"],
53 package_dir = "assets",
54 strip_prefix = "/third_party/css/bootstrap",
55)
56
57pkg_tar(
58 name = "font-awesome-css",
59 files = ["//third_party/css/font_awesome:font_awesome_css"],
60 package_dir = "assets",
61 strip_prefix = "/third_party/css/font_awesome",
62)
63
64pkg_tar(
65 name = "font-awesome-font",
66 files = ["//third_party/css/font_awesome:font_awesome_font"],
67 package_dir = "assets",
68 strip_prefix = "/third_party/css/font_awesome",
69)
70
71pkg_tar(
72 name = "bootstrap-js",
73 files = ["//third_party/javascript/bootstrap:bootstrap_js"],
74 package_dir = "assets",
75 strip_prefix = "/third_party/javascript/bootstrap",
76)
77
78pkg_tar(
David Chen3f697512016-05-09 08:46:21 +000079 name = "jekyll-base",
David Chen8a142fe2016-05-06 07:57:17 +000080 deps = [
81 ":bootstrap-css",
82 ":bootstrap-images",
83 ":bootstrap-js",
Kristina Chodorowa028ae22016-12-13 18:59:51 +000084 ":dot-graphs",
David Chen8a142fe2016-05-06 07:57:17 +000085 ":font-awesome-css",
86 ":font-awesome-font",
87 ":jekyll-files",
88 ],
89)
David Chen3f697512016-05-09 08:46:21 +000090
91pkg_tar(
92 name = "skylark-rule-docs",
93 files = [
94 "//tools/build_defs/docker:README.md",
95 "//tools/build_defs/pkg:README.md",
96 ],
97 strip_prefix = "/tools/build_defs",
98)
99
100genrule(
Kristina Chodorowa028ae22016-12-13 18:59:51 +0000101 name = "dot-graphs",
102 srcs = DOT_GRAPH_HTML_FILES,
103 outs = ["dot.tar"],
104 cmd = """
105origdir=$$PWD
106tmpdir=$$(mktemp -d)
107for f in $(SRCS); do
108 mkdir -p $$tmpdir/$$(dirname $$f)
Klaus Aehlig7ed28be2017-03-02 15:26:38 +0000109 if which dot > /dev/null; then
Kristina Chodorowfc9750c2017-02-09 21:13:13 +0000110 $(location //scripts/docs:generate_dot_graphs) < $$f > $$tmpdir/$$f
111 else
Kristina Chodorow762576e2017-02-10 17:16:28 +0000112 cp $$f $$tmpdir/$$f
Kristina Chodorowfc9750c2017-02-09 21:13:13 +0000113 fi
Kristina Chodorowa028ae22016-12-13 18:59:51 +0000114done
115cd $$tmpdir/site
116tar cf $$origdir/$@ *
117""",
118 tools = ["//scripts/docs:generate_dot_graphs"],
119)
120
121genrule(
David Chen3f697512016-05-09 08:46:21 +0000122 name = "jekyll-tree",
123 srcs = [
124 ":jekyll-base",
125 ":skylark-rule-docs",
126 "//src/main/java/com/google/devtools/build/lib:gen_buildencyclopedia",
127 "//src/main/java/com/google/devtools/build/lib:gen_skylarklibrary",
Ulf Adams9e24ebd2016-06-23 09:24:57 +0000128 "//src/main/java/com/google/devtools/build/lib:gen_command-line-reference",
David Chen3f697512016-05-09 08:46:21 +0000129 ],
130 outs = ["jekyll-tree.tar"],
131 cmd = ("$(location jekyll-tree.sh) $@ " +
132 "$(location :jekyll-base) " +
133 "$(location :skylark-rule-docs) " +
134 "$(location //src/main/java/com/google/devtools/build/lib:gen_buildencyclopedia) " +
Ulf Adams9e24ebd2016-06-23 09:24:57 +0000135 "$(location //src/main/java/com/google/devtools/build/lib:gen_skylarklibrary) " +
136 "$(location //src/main/java/com/google/devtools/build/lib:gen_command-line-reference)"),
David Chen3f697512016-05-09 08:46:21 +0000137 tools = [
138 "jekyll-tree.sh",
139 ],
140)