github.com/sercand/please@v13.4.0+incompatible/docs/BUILD (about) 1 deps = [] 2 3 for src in glob( 4 ["*.html"], 5 exclude = [ 6 "template.html", 7 "lexicon*.html", 8 "language.html", 9 ], 10 ): 11 templated_rule = genrule( 12 name = src.replace(".", "_"), 13 srcs = ["template.html", src], 14 outs = [src], 15 cmd = "$TOOL $SRCS > $OUT", 16 tools = [":templater"], 17 ) 18 deps += [templated_rule] 19 20 genrule( 21 name = "rules", 22 outs = ["rules.json"], 23 cmd = "$TOOL query rules > $OUT", 24 tools = ["//src:please"], 25 ) 26 27 genrule( 28 name = "lexicon_html", 29 srcs = deps + [ 30 "lexicon.html", 31 "lexicon_entry.html", 32 "template.html", 33 ":rules", 34 ], 35 outs = ["lexicon.html"], 36 cmd = [ 37 "$TOOLS_LEX > lexicon.html", 38 "$TOOLS_TMPL docs/template.html lexicon.html > tmp.html", 39 "mv tmp.html $OUT", 40 ], 41 tools = { 42 "lex": [":lexicon_templater"], 43 "tmpl": [":templater"], 44 }, 45 ) 46 47 genrule( 48 name = "language_html", 49 srcs = { 50 "html": [ 51 "template.html", 52 "language.html", 53 ], 54 "grammar": ["grammar.txt"], 55 }, 56 outs = ["language.html"], 57 cmd = "$TOOLS_TEMPLATE $SRCS_HTML | $TOOLS_GRAMMAR > $OUT", 58 tools = { 59 "grammar": [":grammar_templater"], 60 "template": [":templater"], 61 }, 62 ) 63 64 filegroup( 65 name = "docs", 66 srcs = glob(["images/*.png"]) + deps + [ 67 ":language_html", 68 ":lexicon_html", 69 "styles.css", 70 "action.js", 71 "images/thoughtmachine.png", 72 "plz-recording.json", 73 "//third_party/js:asciinema", 74 ], 75 ) 76 77 go_binary( 78 name = "templater", 79 srcs = ["template.go"], 80 ) 81 82 go_binary( 83 name = "lexicon_templater", 84 srcs = ["template_lexicon.go"], 85 ) 86 87 go_binary( 88 name = "grammar_templater", 89 srcs = ["template_grammar.go"], 90 ) 91 92 # Convenient for popping open the docs in a browser after building (must use 'plz run'). 93 sh_cmd( 94 name = "view", 95 cmd = "sensible-browser $(out_location :index_html)", 96 deps = [ 97 ":docs", 98 ":index_html", 99 ], 100 )