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