summaryrefslogtreecommitdiffstats
path: root/Documentation/BUILD
blob: af355ca56df5831b906fb9959e9a3e4e07737d54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
load("//tools/bzl:asciidoc.bzl", "documentation_attributes", "genasciidoc", "genasciidoc_zip")
load("//tools/bzl:license.bzl", "license_map")

package(default_visibility = ["//visibility:public"])

exports_files([
    "replace_macros.py",
])

filegroup(
    name = "prettify_files",
    srcs = [
        ":prettify.min.css",
        ":prettify.min.js",
    ],
)

genrule(
    name = "prettify_min_css",
    srcs = ["//resources/com/google/gerrit/prettify:client/prettify.css"],
    outs = ["prettify.min.css"],
    cmd = "cp $< $@",
)

genrule(
    name = "prettify_min_js",
    srcs = ["//resources/com/google/gerrit/prettify:client/prettify.js"],
    outs = ["prettify.min.js"],
    cmd = "cp $< $@",
)

filegroup(
    name = "resources",
    srcs = glob([
        "images/*.jpg",
        "images/*.png",
    ]) + [
        ":prettify_files",
        "//:LICENSES.txt",
    ],
)

license_map(
    name = "licenses",
    json_maps = [
        "//polygerrit-ui/app/node_modules_licenses:polygerrit-licenses.json",
    ],
    opts = ["--asciidoctor"],
    targets = [
        "//polygerrit-ui/app:polygerrit_ui",
        "//java/com/google/gerrit/pgm",
    ],
)

license_map(
    name = "backend_licenses",
    opts = ["--asciidoctor"],
    targets = [
        "//java/com/google/gerrit/pgm",
    ],
)

license_map(
    name = "js_licenses",
    json_maps = [
        "//polygerrit-ui/app/node_modules_licenses:polygerrit-licenses.json",
    ],
    targets = [
        "//polygerrit-ui/app:polygerrit_ui",
    ],
)

sh_test(
    name = "check_licenses",
    srcs = ["check_licenses_test.sh"],
    data = [
        "backend_licenses.gen.txt",
        "backend_licenses.txt",
        "js_licenses.gen.txt",
        "js_licenses.txt",
        "licenses.gen.txt",
        "licenses.txt",
    ],
)

DOC_DIR = "Documentation"

SRCS = glob(["*.txt"])

genrule(
    name = "index",
    srcs = SRCS,
    outs = ["index.jar"],
    cmd = "$(location //java/com/google/gerrit/asciidoctor:doc_indexer) " +
          "-o $(OUTS) " +
          "--prefix \"%s/\" " % DOC_DIR +
          "--in-ext \".txt\" " +
          "--out-ext \".html\" " +
          "$(SRCS)",
    tools = ["//java/com/google/gerrit/asciidoctor:doc_indexer"],
)

# For the same srcs, we can have multiple genasciidoc_zip rules, but only one
# genasciidoc rule. Because multiple genasciidoc rules will have conflicting
# output files.
genasciidoc(
    name = "Documentation",
    srcs = SRCS,
    attributes = documentation_attributes(),
    backend = "html5",
)

genasciidoc_zip(
    name = "html",
    srcs = SRCS,
    attributes = documentation_attributes(),
    backend = "html5",
    directory = DOC_DIR,
)

genasciidoc_zip(
    name = "searchfree",
    srcs = SRCS,
    attributes = documentation_attributes(),
    backend = "html5",
    directory = DOC_DIR,
    searchbox = False,
)