-
Notifications
You must be signed in to change notification settings - Fork 250
/
BUILD
167 lines (153 loc) · 5.43 KB
/
BUILD
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain")
load("@rules_java//java:defs.bzl", "java_library")
load(":extractors.bzl", "extractor_action")
package(default_visibility = ["//visibility:public"])
exports_files(["extractors.bzl"])
# Clone of default Java proto toolchain with "annotate_code" enabled for
# cross-language metadata file generation.
#
# --proto_toolchain_for_java=@io_kythe//kythe/extractors:java_proto_toolchain
proto_lang_toolchain(
name = "java_proto_toolchain",
command_line = "--java_out=annotate_code:$(OUT)",
runtime = ":protobuf_java",
)
# Clone of the java protobuf runtime that also exposes jsr250 so the generated
# proto classes with our inserted annotations can be compiled.
java_library(
name = "protobuf_java",
exports = [
"@com_google_protobuf//:protobuf_java",
"@maven//:org_apache_tomcat_tomcat_annotations_api",
],
)
# Clone of default C++ proto toolchain with "annotate_headers" enabled for
# cross-language metadata file generation.
#
# In order to work around the difficulty of plumbing additional files through
# the C++ rules, we use a plugin which embeds the metadata generated by protoc
# directly at the end of the respective headers.
#
# --proto_toolchain_for_cc=@io_kythe//kythe/extractors:cc_proto_toolchain
proto_lang_toolchain(
name = "cc_proto_toolchain",
command_line = "--PLUGIN_C++_out=:$(OUT)",
plugin = "//kythe/cxx/tools:proto_metadata_plugin",
runtime = "@com_google_protobuf//:protobuf_nowkt",
)
# Alternatively, if the plugin doesn't work you can use the default code generator
# to output the metadata into a separate file. This needs to be invoked with:
#
# bazel build \
# --proto_toolchain_for_cc=@io_kythe//kythe/extractor:cc_native_proto_toolchain \
# --cc_proto_library_header_suffixes=.pb.h,.pb.h.meta
proto_lang_toolchain(
name = "cc_native_proto_toolchain",
command_line = "--cpp_out=annotate_headers,annotation_pragma_name=kythe_metadata,annotation_guard_name=KYTHE_IS_RUNNING:$(OUT)",
runtime = "@com_google_protobuf//:protobuf_nowkt",
)
extractor_action(
name = "extract_kzip_cxx",
args = [
"$(EXTRA_ACTION_FILE)",
"$(output $(ACTION_ID).cxx.kzip)",
"$(location //external:vnames_config)",
],
data = ["//external:vnames_config"],
extractor = "@io_kythe//kythe/cxx/extractor:cxx_extractor_bazel",
mnemonics = ["CppCompile"],
output = "$(ACTION_ID).cxx.kzip",
)
extractor_action(
name = "extract_kzip_java",
args = [
"$(EXTRA_ACTION_FILE)",
"$(output $(ACTION_ID).java.kzip)",
"$(location //external:vnames_config)",
],
data = ["//external:vnames_config"],
extractor = "@io_kythe//kythe/java/com/google/devtools/kythe/extractors/java/bazel:java_extractor",
mnemonics = ["Javac"],
output = "$(ACTION_ID).java.kzip",
)
# We only support Bazel rules_go 0.19.0 and up.
extractor_action(
name = "extract_kzip_go",
args = [
"-corpus kythe.io",
"$(EXTRA_ACTION_FILE)",
"$(output $(ACTION_ID).go.kzip)",
"$(location //external:vnames_config)",
],
data = ["//external:vnames_config"],
extractor = "@io_kythe//kythe/go/extractors/cmd/bazel:bazel_go_extractor",
mnemonics = ["GoCompilePkg"],
output = "$(ACTION_ID).go.kzip",
)
extractor_action(
name = "extract_kzip_jvm",
args = [
"$(EXTRA_ACTION_FILE)",
"$(output $(ACTION_ID).jvm.kzip)",
"$(location //external:vnames_config)",
],
data = ["//external:vnames_config"],
extractor = "@io_kythe//kythe/java/com/google/devtools/kythe/extractors/jvm/bazel:bazel_jvm_extractor",
mnemonics = ["JavaIjar"],
output = "$(ACTION_ID).jvm.kzip",
)
extractor_action(
name = "extract_kzip_objc",
args = [
"$(EXTRA_ACTION_FILE)",
"$(output $(ACTION_ID).objc.kzip)",
"$(location //external:vnames_config)",
"$(location //third_party/bazel:get_devdir)",
"$(location //third_party/bazel:get_sdkroot)",
],
data = [
"//external:vnames_config",
"//third_party/bazel:get_devdir",
"//third_party/bazel:get_sdkroot",
],
extractor = "@io_kythe//kythe/cxx/extractor:objc_extractor_bazel",
mnemonics = ["ObjcCompile"],
output = "$(ACTION_ID).objc.kzip",
)
extractor_action(
name = "extract_typescript_kzip",
args = [
"--extra_action=$(EXTRA_ACTION_FILE)",
"--include='\\.(js|json|tsx?|d\\.ts)$$'",
"--language=typescript",
"--output=$(output $(ACTION_ID).typescript.kzip)",
"--rules=$(location //external:vnames_config)",
"--scoped=true",
"--source='\\.ts$$'",
],
data = ["//external:vnames_config"],
extractor = "@io_kythe//kythe/go/extractors/cmd/bazel:extract_kzip",
mnemonics = [
"TypeScriptCompile",
"AngularTemplateCompile",
],
output = "$(ACTION_ID).typescript.kzip",
)
extractor_action(
name = "extract_kzip_protobuf",
args = [
"--extra_action=$(EXTRA_ACTION_FILE)",
"--language=protobuf",
"--rules=$(location //external:vnames_config)",
"--output=$(output $(ACTION_ID).protobuf.kzip)",
],
data = ["//external:vnames_config"],
extractor = "//kythe/go/extractors/proto:extract_proto_kzip",
mnemonics = ["GenProtoDescriptorSet"],
output = "$(ACTION_ID).protobuf.kzip",
)
bzl_library(
name = "extractors_bzl",
srcs = ["extractors.bzl"],
)