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", |
Dmitrii Filippov | daee7fc | 2020-01-14 20:42:56 +0100 | [diff] [blame] | 45 | json_maps = [ |
| 46 | "//polygerrit-ui/app/node_modules_licenses:polygerrit-licenses.json", |
| 47 | ], |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 48 | opts = ["--asciidoctor"], |
| 49 | targets = [ |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 50 | "//polygerrit-ui/app:polygerrit_ui", |
David Ostrovsky | 0924b93 | 2017-08-24 08:56:45 +0200 | [diff] [blame] | 51 | "//java/com/google/gerrit/pgm", |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 52 | ], |
Han-Wen Nienhuys | eb16fe0 | 2016-09-21 11:14:04 +0200 | [diff] [blame] | 53 | ) |
Yuxuan 'fishy' Wang | dd6f8dd | 2016-09-27 06:05:06 +0800 | [diff] [blame] | 54 | |
Han-Wen Nienhuys | 762070f | 2016-12-08 17:32:27 +0100 | [diff] [blame] | 55 | license_map( |
Marija Savtchouk | 495a56a | 2021-10-18 17:07:45 +0100 | [diff] [blame] | 56 | name = "backend_licenses", |
| 57 | opts = ["--asciidoctor"], |
| 58 | targets = [ |
| 59 | "//java/com/google/gerrit/pgm", |
| 60 | ], |
| 61 | ) |
| 62 | |
| 63 | license_map( |
Han-Wen Nienhuys | 762070f | 2016-12-08 17:32:27 +0100 | [diff] [blame] | 64 | name = "js_licenses", |
Dmitrii Filippov | daee7fc | 2020-01-14 20:42:56 +0100 | [diff] [blame] | 65 | json_maps = [ |
| 66 | "//polygerrit-ui/app/node_modules_licenses:polygerrit-licenses.json", |
| 67 | ], |
Han-Wen Nienhuys | 762070f | 2016-12-08 17:32:27 +0100 | [diff] [blame] | 68 | targets = [ |
Han-Wen Nienhuys | 762070f | 2016-12-08 17:32:27 +0100 | [diff] [blame] | 69 | "//polygerrit-ui/app:polygerrit_ui", |
| 70 | ], |
Han-Wen Nienhuys | 762070f | 2016-12-08 17:32:27 +0100 | [diff] [blame] | 71 | ) |
| 72 | |
Han-Wen Nienhuys | 0a6495e | 2019-03-28 15:44:43 +0100 | [diff] [blame] | 73 | sh_test( |
| 74 | name = "check_licenses", |
| 75 | srcs = ["check_licenses_test.sh"], |
| 76 | data = [ |
Marija Savtchouk | 495a56a | 2021-10-18 17:07:45 +0100 | [diff] [blame] | 77 | "backend_licenses.gen.txt", |
| 78 | "backend_licenses.txt", |
Han-Wen Nienhuys | 0a6495e | 2019-03-28 15:44:43 +0100 | [diff] [blame] | 79 | "js_licenses.gen.txt", |
| 80 | "js_licenses.txt", |
| 81 | "licenses.gen.txt", |
| 82 | "licenses.txt", |
| 83 | ], |
| 84 | ) |
| 85 | |
Yuxuan 'fishy' Wang | dd6f8dd | 2016-09-27 06:05:06 +0800 | [diff] [blame] | 86 | DOC_DIR = "Documentation" |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 87 | |
Han-Wen Nienhuys | 0a6495e | 2019-03-28 15:44:43 +0100 | [diff] [blame] | 88 | SRCS = glob(["*.txt"]) |
Yuxuan 'fishy' Wang | dd6f8dd | 2016-09-27 06:05:06 +0800 | [diff] [blame] | 89 | |
| 90 | genrule( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 91 | name = "index", |
| 92 | srcs = SRCS, |
| 93 | outs = ["index.jar"], |
Dave Borowitz | 90135c1 | 2018-05-24 15:24:41 -0400 | [diff] [blame] | 94 | cmd = "$(location //java/com/google/gerrit/asciidoctor:doc_indexer) " + |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 95 | "-o $(OUTS) " + |
| 96 | "--prefix \"%s/\" " % DOC_DIR + |
| 97 | "--in-ext \".txt\" " + |
| 98 | "--out-ext \".html\" " + |
| 99 | "$(SRCS)", |
Dave Borowitz | 90135c1 | 2018-05-24 15:24:41 -0400 | [diff] [blame] | 100 | tools = ["//java/com/google/gerrit/asciidoctor:doc_indexer"], |
Yuxuan 'fishy' Wang | dd6f8dd | 2016-09-27 06:05:06 +0800 | [diff] [blame] | 101 | ) |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 102 | |
| 103 | # For the same srcs, we can have multiple genasciidoc_zip rules, but only one |
| 104 | # genasciidoc rule. Because multiple genasciidoc rules will have conflicting |
| 105 | # output files. |
| 106 | genasciidoc( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 107 | name = "Documentation", |
| 108 | srcs = SRCS, |
| 109 | attributes = documentation_attributes(), |
| 110 | backend = "html5", |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 111 | ) |
| 112 | |
| 113 | genasciidoc_zip( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 114 | name = "html", |
| 115 | srcs = SRCS, |
| 116 | attributes = documentation_attributes(), |
| 117 | backend = "html5", |
| 118 | directory = DOC_DIR, |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 119 | ) |
| 120 | |
| 121 | genasciidoc_zip( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 122 | name = "searchfree", |
| 123 | srcs = SRCS, |
| 124 | attributes = documentation_attributes(), |
| 125 | backend = "html5", |
| 126 | directory = DOC_DIR, |
| 127 | searchbox = False, |
Yuxuan 'fishy' Wang | 14fdf93 | 2016-09-30 07:59:54 +0800 | [diff] [blame] | 128 | ) |