David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 1 | package(default_visibility = ["//visibility:public"]) |
David Ostrovsky | 9413ff8 | 2016-10-25 00:02:17 +0200 | [diff] [blame] | 2 | |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 3 | load("//tools/bzl:asciidoc.bzl", "documentation_attributes") |
| 4 | load("//tools/bzl:asciidoc.bzl", "genasciidoc") |
| 5 | load("//tools/bzl:asciidoc.bzl", "genasciidoc_zip") |
Han-Wen Nienhuys | eb16fe0 | 2016-09-21 11:14:04 +0200 | [diff] [blame] | 6 | load("//tools/bzl:license.bzl", "license_map") |
| 7 | |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 8 | exports_files([ |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 9 | "replace_macros.py", |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 10 | ]) |
| 11 | |
| 12 | filegroup( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 13 | name = "prettify_files", |
| 14 | srcs = [ |
| 15 | ":prettify.min.css", |
| 16 | ":prettify.min.js", |
| 17 | ], |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 18 | ) |
| 19 | |
| 20 | genrule( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 21 | name = "prettify_min_css", |
| 22 | srcs = ["//gerrit-prettify:src/main/resources/com/google/gerrit/prettify/client/prettify.css"], |
| 23 | outs = ["prettify.min.css"], |
| 24 | cmd = "cp $< $@", |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 25 | ) |
| 26 | |
| 27 | genrule( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 28 | name = "prettify_min_js", |
| 29 | srcs = ["//gerrit-prettify:src/main/resources/com/google/gerrit/prettify/client/prettify.js"], |
| 30 | outs = ["prettify.min.js"], |
| 31 | cmd = "cp $< $@", |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 32 | ) |
| 33 | |
| 34 | filegroup( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 35 | name = "resources", |
| 36 | srcs = glob([ |
| 37 | "images/*.jpg", |
| 38 | "images/*.png", |
| 39 | ]) + [ |
| 40 | ":prettify_files", |
| 41 | "//:LICENSES.txt", |
| 42 | ], |
| 43 | visibility = ["//visibility:public"], |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 44 | ) |
| 45 | |
Han-Wen Nienhuys | eb16fe0 | 2016-09-21 11:14:04 +0200 | [diff] [blame] | 46 | license_map( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 47 | name = "licenses", |
| 48 | opts = ["--asciidoctor"], |
| 49 | targets = [ |
| 50 | "//gerrit-pgm:pgm", |
| 51 | "//gerrit-gwtui:ui_module", |
| 52 | "//polygerrit-ui/app:polygerrit_ui", |
| 53 | ], |
| 54 | visibility = ["//visibility:public"], |
Han-Wen Nienhuys | eb16fe0 | 2016-09-21 11:14:04 +0200 | [diff] [blame] | 55 | ) |
Yuxuan 'fishy' Wang | dd6f8dd | 2016-09-27 06:05:06 +0800 | [diff] [blame] | 56 | |
Han-Wen Nienhuys | 762070f | 2016-12-08 17:32:27 +0100 | [diff] [blame] | 57 | license_map( |
| 58 | name = "js_licenses", |
| 59 | targets = [ |
David Pursehouse | 9561f38 | 2017-02-28 17:32:44 +0900 | [diff] [blame] | 60 | "//gerrit-gwtui:ui_module", |
Han-Wen Nienhuys | 762070f | 2016-12-08 17:32:27 +0100 | [diff] [blame] | 61 | "//polygerrit-ui/app:polygerrit_ui", |
| 62 | ], |
| 63 | visibility = ["//visibility:public"], |
| 64 | ) |
| 65 | |
Yuxuan 'fishy' Wang | dd6f8dd | 2016-09-27 06:05:06 +0800 | [diff] [blame] | 66 | DOC_DIR = "Documentation" |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 67 | |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 68 | SRCS = glob(["*.txt"]) + [":licenses.txt"] |
Yuxuan 'fishy' Wang | dd6f8dd | 2016-09-27 06:05:06 +0800 | [diff] [blame] | 69 | |
| 70 | genrule( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 71 | name = "index", |
| 72 | srcs = SRCS, |
| 73 | outs = ["index.jar"], |
| 74 | cmd = "$(location //lib/asciidoctor:doc_indexer) " + |
| 75 | "-o $(OUTS) " + |
| 76 | "--prefix \"%s/\" " % DOC_DIR + |
| 77 | "--in-ext \".txt\" " + |
| 78 | "--out-ext \".html\" " + |
| 79 | "$(SRCS)", |
| 80 | tools = ["//lib/asciidoctor:doc_indexer"], |
Yuxuan 'fishy' Wang | dd6f8dd | 2016-09-27 06:05:06 +0800 | [diff] [blame] | 81 | ) |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 82 | |
| 83 | # For the same srcs, we can have multiple genasciidoc_zip rules, but only one |
| 84 | # genasciidoc rule. Because multiple genasciidoc rules will have conflicting |
| 85 | # output files. |
| 86 | genasciidoc( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 87 | name = "Documentation", |
| 88 | srcs = SRCS, |
| 89 | attributes = documentation_attributes(), |
| 90 | backend = "html5", |
| 91 | visibility = ["//visibility:public"], |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 92 | ) |
| 93 | |
| 94 | genasciidoc_zip( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 95 | name = "html", |
| 96 | srcs = SRCS, |
| 97 | attributes = documentation_attributes(), |
| 98 | backend = "html5", |
| 99 | directory = DOC_DIR, |
| 100 | visibility = ["//visibility:public"], |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 101 | ) |
| 102 | |
| 103 | genasciidoc_zip( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 104 | name = "searchfree", |
| 105 | srcs = SRCS, |
| 106 | attributes = documentation_attributes(), |
| 107 | backend = "html5", |
| 108 | directory = DOC_DIR, |
| 109 | searchbox = False, |
| 110 | visibility = ["//visibility:public"], |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 111 | ) |