summaryrefslogtreecommitdiffhomepage
path: root/website/BUILD
diff options
context:
space:
mode:
Diffstat (limited to 'website/BUILD')
-rw-r--r--website/BUILD97
1 files changed, 60 insertions, 37 deletions
diff --git a/website/BUILD b/website/BUILD
index 8121d81a7..d6afd5f44 100644
--- a/website/BUILD
+++ b/website/BUILD
@@ -1,5 +1,5 @@
-load("//tools:defs.bzl", "go_binary", "pkg_tar")
-load("//website:defs.bzl", "docs")
+load("//tools:defs.bzl", "pkg_tar")
+load("//website:defs.bzl", "doc", "docs")
package(licenses = ["notice"])
@@ -29,36 +29,39 @@ genrule(
name = "files",
srcs = [
":config",
+ ":css",
":docs",
- ":posts",
":static",
":syscallmd",
+ "//website/blog:posts",
"//website/cmd/server",
],
outs = ["files.tgz"],
cmd = "set -x; " +
- "rm -rf $(@D)/input && mkdir -p $(@D)/input && " +
- "rm -rf $(@D)/output && mkdir -p $(@D)/output/_site && " +
- "tar -xf $(location :config) -C $(@D)/input && " +
- "tar -xf $(location :docs) -C $(@D)/input && " +
- "tar -xf $(location :posts) -C $(@D)/input && " +
- "tar -xf $(location :syscallmd) -C $(@D)/input && " +
- "find $(@D)/input -type f -exec chmod u+rw {} \\; && " +
+ "T=$$(mktemp -d); " +
+ "mkdir -p $$T/input && " +
+ "mkdir -p $$T/output/_site && " +
+ "tar -xf $(location :config) -C $$T/input && " +
+ "tar -xf $(location :css) -C $$T/input && " +
+ "tar -xf $(location :docs) -C $$T/input && " +
+ "tar -xf $(location :syscallmd) -C $$T/input && " +
+ "tar -xf $(location //website/blog:posts) -C $$T/input && " +
+ "find $$T/input -type f -exec chmod u+rw {} \\; && " +
"docker run -i --user $$(id -u):$$(id -g) " +
- "-v $$(readlink -m $(@D)/input):/input " +
- "-v $$(readlink -m $(@D)/output/_site):/output " +
+ "-v $$(readlink -m $$T/input):/input " +
+ "-v $$(readlink -m $$T/output/_site):/output " +
"gvisor.dev/images/jekyll && " +
- "tar -xf $(location :static) -C $(@D)/output/_site && " +
+ "tar -xf $(location :static) -C $$T/output/_site && " +
"docker run -i --user $$(id -u):$$(id -g) " +
- "-v $$(readlink -m $(@D)/output/_site):/output " +
+ "-v $$(readlink -m $$T/output/_site):/output " +
"gvisor.dev/images/jekyll " +
"/usr/gem/bin/htmlproofer " +
"--disable-external " +
"--check-html " +
"/output && " +
- "cp $(location //website/cmd/server) $(@D)/output/server && " +
- "tar -zcf $@ -C $(@D)/output . && " +
- "rm -rf $(@D)/input $(@D)/output",
+ "cp $(location //website/cmd/server) $$T/output/server && " +
+ "tar -zcf $@ -C $$T/output . && " +
+ "rm -rf $$T",
tags = [
"local",
"manual",
@@ -70,23 +73,43 @@ genrule(
# in after jekyll generates all the dynamic content.
pkg_tar(
name = "static",
- srcs = glob([
+ srcs = [
"archive.key",
+ ] + glob([
"performance/**",
]),
strip_prefix = "./",
)
+# main.scss requires front-matter to be processed.
+genrule(
+ name = "css",
+ srcs = glob([
+ "css/**",
+ ]),
+ outs = [
+ "css.tar",
+ ],
+ cmd = "T=$$(mktemp -d); " +
+ "mkdir -p $$T/css && " +
+ "for file in $(SRCS); do " +
+ "echo -en '---\\n---\\n' > $$T/css/$$(basename $$file) && " +
+ "cat $$file >> $$T/css/$$(basename $$file); " +
+ "done && " +
+ "tar -C $$T -czf $@ . && " +
+ "rm -rf $$T",
+)
+
# config is "mostly" static content. These are parts of the site that are
# present when jekyll runs, but are not dynamically generated.
pkg_tar(
name = "config",
- srcs = glob([
+ srcs = [
+ ":css",
+ "_config.yml",
+ "//website/blog:index.html",
+ ] + glob([
"assets/**",
- "blog/*.html",
- "*.yml",
- "css/**",
- "index.md",
"_includes/**",
"_layouts/**",
"_plugins/**",
@@ -95,10 +118,19 @@ pkg_tar(
strip_prefix = "./",
)
+# index is the index file.
+doc(
+ name = "index",
+ src = "index.md",
+ layout = "base",
+ permalink = "/",
+)
+
# docs is the dynamic content of the site.
docs(
name = "docs",
deps = [
+ ":index",
"//:code_of_conduct",
"//:contributing",
"//:governance",
@@ -128,15 +160,6 @@ docs(
],
)
-# posts are moved to the _posts directory.
-pkg_tar(
- name = "posts",
- srcs = glob([
- "blog/*.md",
- ]),
- package_dir = "_posts",
-)
-
# Generate JSON for system call tables
genrule(
name = "syscalljson",
@@ -150,9 +173,9 @@ genrule(
name = "syscallmd",
srcs = [":syscalljson"],
outs = ["syscallsmd"],
- cmd = "mkdir $(@D)/_tmp && \
- $(location //website/cmd/generate-syscall-docs) -in $< -out $(@D)/_tmp && \
- tar -C $(@D)/_tmp -czf $@ . && \
- rm -rf $(@D)/_tmp",
- tools = ["//website/cmd/generate-syscall-docs"],
+ cmd = "T=$$(mktemp -d) && " +
+ "$(location //website/cmd/syscalldocs) -in $< -out $$T && " +
+ "tar -C $$T -czf $@ . && " +
+ "rm -rf $$T",
+ tools = ["//website/cmd/syscalldocs"],
)