blob: 613dcde2a679256157d0cb2068d46c4e5acc825e [file] [log] [blame]
John Cater214a7ae2017-08-09 17:24:53 +02001load("//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
David Chen8a142fe2016-05-06 07:57:17 +00002
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
Laszlo Csomor3d215782017-07-27 11:34:09 +020011exports_files(
12 [
13 "images/favicon.ico",
14 ],
15 visibility = ["//src/main/native/windows:__pkg__"],
16)
17
Kristina Chodorowa028ae22016-12-13 18:59:51 +000018DOT_GRAPH_HTML_FILES = [
dzc22b85a22017-05-31 20:37:50 +020019 "docs/query.html",
20 "docs/build-ref.html",
Kristina Chodorowa028ae22016-12-13 18:59:51 +000021]
22
Damien Martin-Guillerezde54bca2016-02-29 10:49:43 +000023filegroup(
24 name = "srcs",
25 srcs = glob(["**"]),
26 visibility = ["//:__pkg__"],
27)
David Chen8a142fe2016-05-06 07:57:17 +000028
29filegroup(
30 name = "jekyll-srcs",
31 srcs = glob(
32 ["**/*"],
33 exclude = [
34 "BUILD",
35 "jekyll-tree.sh",
36 "*.swp",
Ulf Adams9e24ebd2016-06-23 09:24:57 +000037 "command-line-reference-prefix.html",
38 "command-line-reference-suffix.html",
David Chenf328fde2016-07-27 00:12:32 +000039 "site/README.md",
Kristina Chodorowa028ae22016-12-13 18:59:51 +000040 ] + DOT_GRAPH_HTML_FILES,
David Chen8a142fe2016-05-06 07:57:17 +000041 ),
42)
43
44pkg_tar(
45 name = "jekyll-files",
John Cater214a7ae2017-08-09 17:24:53 +020046 srcs = [":jekyll-srcs"],
David Chen8a142fe2016-05-06 07:57:17 +000047 strip_prefix = ".",
48)
49
50pkg_tar(
51 name = "bootstrap-css",
John Cater214a7ae2017-08-09 17:24:53 +020052 srcs = ["//third_party/css/bootstrap:bootstrap_css"],
David Chen8a142fe2016-05-06 07:57:17 +000053 package_dir = "assets",
54 strip_prefix = "/third_party/css/bootstrap",
55)
56
57pkg_tar(
58 name = "bootstrap-images",
John Cater214a7ae2017-08-09 17:24:53 +020059 srcs = ["//third_party/css/bootstrap:bootstrap_images"],
David Chen8a142fe2016-05-06 07:57:17 +000060 package_dir = "assets",
61 strip_prefix = "/third_party/css/bootstrap",
62)
63
64pkg_tar(
65 name = "font-awesome-css",
John Cater214a7ae2017-08-09 17:24:53 +020066 srcs = ["//third_party/css/font_awesome:font_awesome_css"],
David Chen8a142fe2016-05-06 07:57:17 +000067 package_dir = "assets",
68 strip_prefix = "/third_party/css/font_awesome",
69)
70
71pkg_tar(
72 name = "font-awesome-font",
John Cater214a7ae2017-08-09 17:24:53 +020073 srcs = ["//third_party/css/font_awesome:font_awesome_font"],
David Chen8a142fe2016-05-06 07:57:17 +000074 package_dir = "assets",
75 strip_prefix = "/third_party/css/font_awesome",
76)
77
78pkg_tar(
79 name = "bootstrap-js",
John Cater214a7ae2017-08-09 17:24:53 +020080 srcs = ["//third_party/javascript/bootstrap:bootstrap_js"],
David Chen8a142fe2016-05-06 07:57:17 +000081 package_dir = "assets",
82 strip_prefix = "/third_party/javascript/bootstrap",
83)
84
85pkg_tar(
David Chen3f697512016-05-09 08:46:21 +000086 name = "jekyll-base",
David Chen8a142fe2016-05-06 07:57:17 +000087 deps = [
88 ":bootstrap-css",
89 ":bootstrap-images",
90 ":bootstrap-js",
Kristina Chodorowa028ae22016-12-13 18:59:51 +000091 ":dot-graphs",
David Chen8a142fe2016-05-06 07:57:17 +000092 ":font-awesome-css",
93 ":font-awesome-font",
94 ":jekyll-files",
95 ],
96)
David Chen3f697512016-05-09 08:46:21 +000097
98pkg_tar(
99 name = "skylark-rule-docs",
John Cater214a7ae2017-08-09 17:24:53 +0200100 srcs = [
David Chen3f697512016-05-09 08:46:21 +0000101 "//tools/build_defs/docker:README.md",
102 "//tools/build_defs/pkg:README.md",
103 ],
104 strip_prefix = "/tools/build_defs",
105)
106
107genrule(
Kristina Chodorowa028ae22016-12-13 18:59:51 +0000108 name = "dot-graphs",
109 srcs = DOT_GRAPH_HTML_FILES,
110 outs = ["dot.tar"],
111 cmd = """
112origdir=$$PWD
113tmpdir=$$(mktemp -d)
114for f in $(SRCS); do
115 mkdir -p $$tmpdir/$$(dirname $$f)
Klaus Aehlig7ed28be2017-03-02 15:26:38 +0000116 if which dot > /dev/null; then
Kristina Chodorowfc9750c2017-02-09 21:13:13 +0000117 $(location //scripts/docs:generate_dot_graphs) < $$f > $$tmpdir/$$f
118 else
Kristina Chodorow762576e2017-02-10 17:16:28 +0000119 cp $$f $$tmpdir/$$f
Kristina Chodorowfc9750c2017-02-09 21:13:13 +0000120 fi
Kristina Chodorowa028ae22016-12-13 18:59:51 +0000121done
122cd $$tmpdir/site
123tar cf $$origdir/$@ *
124""",
125 tools = ["//scripts/docs:generate_dot_graphs"],
126)
127
128genrule(
David Chen3f697512016-05-09 08:46:21 +0000129 name = "jekyll-tree",
130 srcs = [
131 ":jekyll-base",
132 ":skylark-rule-docs",
133 "//src/main/java/com/google/devtools/build/lib:gen_buildencyclopedia",
134 "//src/main/java/com/google/devtools/build/lib:gen_skylarklibrary",
Ulf Adams9e24ebd2016-06-23 09:24:57 +0000135 "//src/main/java/com/google/devtools/build/lib:gen_command-line-reference",
David Chen3f697512016-05-09 08:46:21 +0000136 ],
137 outs = ["jekyll-tree.tar"],
138 cmd = ("$(location jekyll-tree.sh) $@ " +
139 "$(location :jekyll-base) " +
140 "$(location :skylark-rule-docs) " +
141 "$(location //src/main/java/com/google/devtools/build/lib:gen_buildencyclopedia) " +
Ulf Adams9e24ebd2016-06-23 09:24:57 +0000142 "$(location //src/main/java/com/google/devtools/build/lib:gen_skylarklibrary) " +
143 "$(location //src/main/java/com/google/devtools/build/lib:gen_command-line-reference)"),
David Chen3f697512016-05-09 08:46:21 +0000144 tools = [
145 "jekyll-tree.sh",
146 ],
147)