Ray Milkey | 3275ae8 | 2018-05-29 15:35:36 -0700 | [diff] [blame] | 1 | """ |
| 2 | Copyright 2018-present Open Networking Foundation |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | """ |
| 16 | |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 17 | load("//tools/build/bazel:generate_workspace.bzl", "COMPILE", "TEST") |
| 18 | load("//tools/build/bazel:variables.bzl", "ONOS_VERSION") |
| 19 | load("//tools/build/bazel:generate_test_rules.bzl", "generate_test_rules") |
Ray Milkey | b7949e7 | 2018-06-19 18:31:02 -0700 | [diff] [blame] | 20 | load("//tools/build/bazel:checkstyle.bzl", "checkstyle_test") |
Thomas Vachuska | ac9e524 | 2018-07-19 16:15:39 -0700 | [diff] [blame] | 21 | load("//tools/build/bazel:pom_file.bzl", "pom_file") |
Thomas Vachuska | 50ac098 | 2018-07-19 10:17:37 -0700 | [diff] [blame] | 22 | load("//tools/build/bazel:java_sources.bzl", "java_sources") |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 23 | load("//tools/build/bazel:java_sources.bzl", "java_sources_alt") |
Thomas Vachuska | 0f7d7a4 | 2018-07-18 15:23:40 -0700 | [diff] [blame] | 24 | load("//tools/build/bazel:javadoc.bzl", "javadoc") |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 25 | load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library") |
| 26 | |
| 27 | def _auto_name(): |
| 28 | return "onos-" + native.package_name().replace("/", "-") |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 29 | |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 30 | def _all_java_sources(): |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 31 | return native.glob(["src/main/java/**/*.java"]) |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 32 | |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 33 | def _all_java_test_sources(): |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 34 | return native.glob(["src/test/java/**/*.java"]) |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 35 | |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 36 | def _all_test_resources(): |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 37 | return native.glob(["src/test/resources/**"]) |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 38 | |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 39 | def _all_resources(resources_root): |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 40 | if resources_root == None: |
| 41 | return native.glob(["src/main/resources/**"]) |
| 42 | else: |
| 43 | return native.glob([resources_root + "**"]) |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 44 | |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 45 | def _webapp(): |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 46 | return native.glob(["src/main/webapp/WEB-INF/web.xml"]) |
| 47 | |
| 48 | def _include_resources_to_string(include_resources): |
| 49 | result = "" |
| 50 | for (path, filename) in include_resources.items(): |
| 51 | result += (path + "=" + filename) |
| 52 | return result |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 53 | |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 54 | """ |
| 55 | Implementation of the rule to call bnd to make an OSGI jar file |
| 56 | """ |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 57 | |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 58 | def _bnd_impl(ctx): |
Ray Milkey | 3275ae8 | 2018-05-29 15:35:36 -0700 | [diff] [blame] | 59 | if (len(ctx.files.source) == 1): |
| 60 | input_file = ctx.files.source[0] |
| 61 | else: |
| 62 | # this is a list of inputs. The one we want is the last one |
| 63 | # in the list that isn't a source jar |
| 64 | for file in reversed(ctx.files.source): |
| 65 | if ("-src" in file.path): |
| 66 | continue |
| 67 | else: |
| 68 | input_file = file |
| 69 | break |
| 70 | |
| 71 | jar = input_file.path |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 72 | output = ctx.outputs.osgi_jar.path |
Thomas Vachuska | 8e022a9 | 2018-07-10 14:47:38 -0700 | [diff] [blame] | 73 | name = ctx.attr.name |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 74 | group = ctx.attr.group |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 75 | version = ctx.attr.version |
| 76 | license = "" |
Ray Milkey | 12ae6ca | 2018-06-11 15:34:30 -0700 | [diff] [blame] | 77 | import_packages = ctx.attr.import_packages |
Jian Li | 4ad8687 | 2018-08-05 03:34:35 +0900 | [diff] [blame] | 78 | bundle_classpath = ctx.attr.bundle_classpath |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 79 | exportPackages = "*" |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 80 | include_resources = ctx.attr.include_resources |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 81 | web_context = ctx.attr.web_context |
| 82 | if web_context == None or web_context == "": |
| 83 | web_context = "NONE" |
| 84 | web_xml = ctx.attr.web_xml |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 85 | dynamicimportPackages = "" |
Ray Milkey | 3275ae8 | 2018-05-29 15:35:36 -0700 | [diff] [blame] | 86 | cp = "" |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 87 | |
Ray Milkey | 3275ae8 | 2018-05-29 15:35:36 -0700 | [diff] [blame] | 88 | inputDependencies = [input_file] |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 89 | |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 90 | # determine the dependencies and build the class path |
| 91 | for dep in ctx.attr.deps: |
Ray Milkey | 25b785a | 2018-06-12 09:59:14 -0700 | [diff] [blame] | 92 | if java_common.provider in dep: |
| 93 | file = dep.files.to_list()[0] |
Ray Milkey | 25b785a | 2018-06-12 09:59:14 -0700 | [diff] [blame] | 94 | if cp: |
| 95 | cp += ":" |
| 96 | cp += file.path |
| 97 | inputDependencies = inputDependencies + [file] |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 98 | |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 99 | web_xml_root_path = "" |
| 100 | if len(web_xml) != 0: |
| 101 | web_xml_root = web_xml[0].files.to_list()[0] |
| 102 | inputDependencies += [web_xml_root] |
| 103 | web_xml_root_path = web_xml_root.path.replace("WEB-INF/web.xml", "") |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 104 | |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 105 | # call bnd to make the OSGI jar file |
| 106 | arguments = [ |
| 107 | jar, |
| 108 | output, |
| 109 | cp, |
| 110 | name, |
| 111 | group, |
| 112 | version, |
| 113 | license, |
Ray Milkey | 12ae6ca | 2018-06-11 15:34:30 -0700 | [diff] [blame] | 114 | import_packages, |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 115 | exportPackages, |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 116 | include_resources, |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 117 | web_context, |
| 118 | web_xml_root_path, |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 119 | dynamicimportPackages, |
Thomas Vachuska | e443694 | 2018-08-07 19:27:10 -0700 | [diff] [blame] | 120 | "classes", |
Jian Li | 4ad8687 | 2018-08-05 03:34:35 +0900 | [diff] [blame] | 121 | bundle_classpath, |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 122 | ] |
Ray Milkey | 12ae6ca | 2018-06-11 15:34:30 -0700 | [diff] [blame] | 123 | |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 124 | ctx.actions.run( |
| 125 | inputs = inputDependencies, |
| 126 | outputs = [ctx.outputs.osgi_jar], |
| 127 | arguments = arguments, |
| 128 | progress_message = "Running bnd wrapper on: %s" % ctx.attr.name, |
| 129 | executable = ctx.executable._bnd_exe, |
| 130 | ) |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 131 | |
Ray Milkey | 25b785a | 2018-06-12 09:59:14 -0700 | [diff] [blame] | 132 | deps = [] |
| 133 | if java_common.provider in ctx.attr.source: |
| 134 | deps.append(ctx.attr.source[java_common.provider]) |
| 135 | deps_provider = java_common.merge(deps) |
| 136 | return struct( |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 137 | providers = [deps_provider], |
Ray Milkey | 25b785a | 2018-06-12 09:59:14 -0700 | [diff] [blame] | 138 | ) |
| 139 | |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 140 | """ |
| 141 | Rule definition for calling bnd to make an OSGi jar file. |
| 142 | """ |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 143 | _bnd = rule( |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 144 | attrs = { |
| 145 | "deps": attr.label_list(), |
| 146 | "version": attr.string(), |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 147 | "group": attr.string(), |
Ray Milkey | 3275ae8 | 2018-05-29 15:35:36 -0700 | [diff] [blame] | 148 | "source": attr.label(), |
Ray Milkey | 12ae6ca | 2018-06-11 15:34:30 -0700 | [diff] [blame] | 149 | "import_packages": attr.string(), |
Jian Li | 4ad8687 | 2018-08-05 03:34:35 +0900 | [diff] [blame] | 150 | "bundle_classpath": attr.string(), |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 151 | "web_context": attr.string(), |
| 152 | "web_xml": attr.label_list(allow_files = True), |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 153 | "include_resources": attr.string(), |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 154 | "_bnd_exe": attr.label( |
| 155 | executable = True, |
| 156 | cfg = "host", |
| 157 | allow_files = True, |
| 158 | default = Label("//utils/osgiwrap:osgi-jar"), |
| 159 | ), |
| 160 | }, |
| 161 | fragments = ["java"], |
| 162 | outputs = { |
| 163 | "osgi_jar": "lib%{name}.jar", |
| 164 | }, |
| 165 | implementation = _bnd_impl, |
| 166 | ) |
| 167 | |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 168 | """ |
| 169 | Implementation of the rule to call swagger generator to create the registrator java class source |
| 170 | """ |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 171 | |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 172 | def _swagger_java_impl(ctx): |
| 173 | api_title = ctx.attr.api_title |
| 174 | api_version = ctx.attr.api_version |
| 175 | api_description = ctx.attr.api_description |
| 176 | api_package = ctx.attr.api_package |
| 177 | web_context = ctx.attr.web_context |
| 178 | |
| 179 | output_java = ctx.outputs.swagger_java.path |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 180 | output_dir = output_java[:output_java.find("generated-sources")] |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 181 | |
| 182 | package_name = ctx.attr.package_name |
| 183 | |
| 184 | srcs_arg = "" |
| 185 | resources_arg = "" |
| 186 | input_dependencies = [] |
| 187 | |
| 188 | for file in ctx.files.srcs: |
| 189 | srcs_arg += file.path + "," |
| 190 | input_dependencies.append(file) |
| 191 | |
| 192 | for resource in resources_arg: |
| 193 | resources_arg += resource.path + "," |
| 194 | |
| 195 | # call swagger generator to make the swagger JSON and java files |
| 196 | arguments = [ |
| 197 | srcs_arg, |
| 198 | resources_arg, |
| 199 | "", |
| 200 | package_name + "/src/main/resources", |
| 201 | output_dir, |
| 202 | output_dir, |
| 203 | web_context, |
| 204 | api_title, |
| 205 | api_version, |
| 206 | api_package, |
| 207 | api_description, |
| 208 | ] |
| 209 | |
| 210 | ctx.actions.run( |
| 211 | inputs = ctx.files.srcs, |
| 212 | outputs = [ctx.outputs.swagger_java], |
| 213 | arguments = arguments, |
| 214 | progress_message = "Running swagger generator on: %s" % ctx.attr.name, |
| 215 | executable = ctx.executable._swagger_generator_exe, |
| 216 | ) |
| 217 | |
| 218 | """ |
| 219 | Implementation of the rule to call swagger generator for swagger.json file |
| 220 | """ |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 221 | |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 222 | def _swagger_json_impl(ctx): |
| 223 | api_title = ctx.attr.api_title |
| 224 | api_version = ctx.attr.api_version |
| 225 | api_description = ctx.attr.api_description |
| 226 | api_package = ctx.attr.api_package |
| 227 | web_context = ctx.attr.web_context |
| 228 | |
| 229 | output_json = ctx.outputs.swagger_json.path |
| 230 | output_dir = output_json[:output_json.find("swagger.json")] |
| 231 | |
| 232 | package_name = ctx.attr.package_name |
| 233 | |
| 234 | srcs_arg = "" |
| 235 | resources_arg = "" |
| 236 | input_dependencies = [] |
| 237 | |
| 238 | for file in ctx.files.srcs: |
| 239 | srcs_arg += file.path + "," |
| 240 | input_dependencies.append(file) |
| 241 | |
| 242 | for resource in resources_arg: |
| 243 | resources_arg += resource.path + "," |
| 244 | |
| 245 | # call swagger generator to make the swagger JSON and java files |
| 246 | arguments = [ |
| 247 | srcs_arg, |
| 248 | resources_arg, |
| 249 | "", |
| 250 | package_name + "/src/main/resources", |
| 251 | output_dir, |
| 252 | output_dir, |
| 253 | web_context, |
| 254 | api_title, |
| 255 | api_version, |
| 256 | api_package, |
| 257 | api_description, |
| 258 | ] |
| 259 | |
| 260 | ctx.actions.run( |
| 261 | inputs = ctx.files.srcs, |
| 262 | outputs = [ctx.outputs.swagger_json], |
| 263 | arguments = arguments, |
| 264 | progress_message = "Running swagger generator on: %s" % ctx.attr.name, |
| 265 | executable = ctx.executable._swagger_generator_exe, |
| 266 | ) |
| 267 | |
| 268 | """ |
| 269 | Rule definition to call swagger generator to create the registrator java class source |
| 270 | """ |
| 271 | _swagger_java = rule( |
| 272 | attrs = { |
| 273 | "srcs": attr.label_list(allow_files = True), |
| 274 | "package_name": attr.string(), |
| 275 | "api_title": attr.string(), |
| 276 | "api_version": attr.string(), |
| 277 | "api_description": attr.string(), |
| 278 | "api_package": attr.string(), |
| 279 | "web_context": attr.string(), |
| 280 | "_swagger_generator_exe": attr.label( |
| 281 | executable = True, |
| 282 | cfg = "host", |
| 283 | allow_files = True, |
| 284 | default = Label("//tools/build/buck-plugin:swagger_generator"), |
| 285 | ), |
| 286 | "swagger_java": attr.output(), |
| 287 | }, |
| 288 | fragments = ["java"], |
| 289 | implementation = _swagger_java_impl, |
| 290 | ) |
| 291 | |
| 292 | """ |
| 293 | Rule definition to call swagger generator to create the swagger JSON |
| 294 | """ |
| 295 | _swagger_json = rule( |
| 296 | attrs = { |
| 297 | "srcs": attr.label_list(allow_files = True), |
| 298 | "package_name": attr.string(), |
| 299 | "api_title": attr.string(), |
| 300 | "api_version": attr.string(), |
| 301 | "api_description": attr.string(), |
| 302 | "api_package": attr.string(), |
| 303 | "web_context": attr.string(), |
| 304 | "_swagger_generator_exe": attr.label( |
| 305 | executable = True, |
| 306 | cfg = "host", |
| 307 | allow_files = True, |
| 308 | default = Label("//tools/build/buck-plugin:swagger_generator"), |
| 309 | ), |
| 310 | "swagger_json": attr.output(), |
| 311 | }, |
| 312 | fragments = ["java"], |
| 313 | implementation = _swagger_json_impl, |
| 314 | ) |
| 315 | |
| 316 | """ |
| 317 | Converts a jar file to an OSGI compatible jar file. |
| 318 | |
| 319 | Args: |
| 320 | name: name of the rule to create the OSGI jar file - required |
| 321 | jar: jar file to convert - required target |
| 322 | deps: dependencies needed by the jar file - required list of targets |
| 323 | version: Version of the generated jar file. Optional, defaults to the current ONOS version |
| 324 | group: Maven group ID for the resulting jar file. Optional, defaults to 'org.onosproject' |
| 325 | import_packages: OSGI import list. Optional, comma separated list, defaults to "*" |
| 326 | visibility: Visibility of the produced jar file to other BUILDs. Optional, defaults to private |
| 327 | """ |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 328 | |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 329 | def wrapped_osgi_jar( |
| 330 | name, |
| 331 | jar, |
| 332 | deps, |
| 333 | version = ONOS_VERSION, |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 334 | group = "org.onosproject", |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 335 | import_packages = "*", |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 336 | visibility = ["//visibility:private"]): |
| 337 | _bnd( |
| 338 | name = name, |
| 339 | source = jar, |
| 340 | deps = deps, |
| 341 | version = version, |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 342 | group = group, |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 343 | visibility = visibility, |
| 344 | import_packages = import_packages, |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 345 | web_xml = None, |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 346 | ) |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 347 | |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 348 | """ |
| 349 | Creates an OSGI jar and test jar file from a set of source and test files. |
| 350 | See osgi_jar() for a description of shared parameters. |
| 351 | Args: |
| 352 | test_srcs: Test source file(s) to compile. Optional list of targets, defaults to src/test/java/**/*.java |
| 353 | test_deps: Dependencies for the test jar. Optional list of targets, defaults to a common set of dependencies |
| 354 | test_resources: Resources to include in the test jar. Optional list of targets, defaults to src/test/resources/** |
| 355 | exclude_tests: Tests that should not be run. Useful for excluding things like test files without any @Test methods. |
| 356 | Optional ist of targets, defaults to [] |
| 357 | """ |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 358 | |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 359 | def osgi_jar_with_tests( |
| 360 | name = None, |
| 361 | deps = None, |
| 362 | test_deps = None, |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 363 | group = "org.onosproject", |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 364 | srcs = None, |
| 365 | resources_root = None, |
| 366 | resources = None, |
Thomas Vachuska | f8c8cb9 | 2018-07-11 17:12:43 -0700 | [diff] [blame] | 367 | resource_jars = [], |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 368 | include_resources = {}, |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 369 | test_srcs = None, |
| 370 | exclude_tests = None, |
Thomas Vachuska | a79bf6e | 2018-08-07 11:24:40 -0700 | [diff] [blame] | 371 | medium_tests = [], |
| 372 | large_tests = [], |
| 373 | enormous_tests = [], |
| 374 | flaky_tests = [], |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 375 | test_resources = None, |
| 376 | visibility = ["//visibility:public"], |
Ray Milkey | 12ae6ca | 2018-06-11 15:34:30 -0700 | [diff] [blame] | 377 | version = ONOS_VERSION, |
Thomas Vachuska | 5b9ff6a | 2018-07-13 11:00:50 -0700 | [diff] [blame] | 378 | suppress_errorprone = False, |
Ray Milkey | 134d292 | 2018-07-15 15:24:01 -0700 | [diff] [blame] | 379 | suppress_checkstyle = False, |
Thomas Vachuska | 0f7d7a4 | 2018-07-18 15:23:40 -0700 | [diff] [blame] | 380 | suppress_javadocs = False, |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 381 | web_context = None, |
| 382 | api_title = "", |
| 383 | api_version = "", |
| 384 | api_description = "", |
| 385 | api_package = "", |
Jian Li | 4ad8687 | 2018-08-05 03:34:35 +0900 | [diff] [blame] | 386 | import_packages = None, |
| 387 | bundle_classpath = ""): |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 388 | if name == None: |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 389 | name = _auto_name() |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 390 | if srcs == None: |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 391 | srcs = _all_java_sources() |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 392 | if resources == None: |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 393 | resources = _all_resources(resources_root) |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 394 | if test_srcs == None: |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 395 | test_srcs = _all_java_test_sources() |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 396 | if test_resources == None: |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 397 | test_resources = _all_test_resources() |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 398 | if exclude_tests == None: |
| 399 | exclude_tests = [] |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 400 | if deps == None: |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 401 | deps = COMPILE |
| 402 | if test_deps == None: |
| 403 | test_deps = TEST |
Ray Milkey | 12ae6ca | 2018-06-11 15:34:30 -0700 | [diff] [blame] | 404 | if import_packages == None: |
| 405 | import_packages = "*" |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 406 | tests_name = name + "-tests" |
| 407 | tests_jar_deps = list(depset(deps + test_deps)) + [name] |
| 408 | all_test_deps = tests_jar_deps + [tests_name] |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 409 | web_xml = _webapp() |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 410 | |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 411 | native_srcs = srcs |
| 412 | native_resources = resources |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 413 | if web_context != None and api_title != "" and len(resources) != 0: |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 414 | # generate Swagger files if needed |
| 415 | _swagger_java( |
| 416 | name = name + "_swagger_java", |
| 417 | srcs = srcs + resources, |
| 418 | package_name = native.package_name(), |
| 419 | api_title = api_title, |
| 420 | api_version = api_version, |
| 421 | api_description = api_description, |
| 422 | web_context = web_context, |
| 423 | api_package = api_package, |
| 424 | swagger_java = ("src/main/resources/apidoc/generated-sources/" + |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 425 | api_package.replace(".", "/") + |
| 426 | "/ApiDocRegistrator.java").replace("//", "/"), |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 427 | ) |
| 428 | _swagger_json( |
| 429 | name = name + "_swagger_json", |
| 430 | srcs = srcs + resources, |
| 431 | package_name = native.package_name(), |
| 432 | api_title = api_title, |
| 433 | api_version = api_version, |
| 434 | api_description = api_description, |
| 435 | web_context = web_context, |
| 436 | api_package = api_package, |
| 437 | swagger_json = "src/main/resources/apidoc/swagger.json", |
| 438 | ) |
| 439 | native_resources = [] |
| 440 | for r in resources: |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 441 | if not "definitions" in r: |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 442 | native_resources.append(r) |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 443 | native_srcs = srcs + [name + "_swagger_java"] |
| 444 | native_resources.append(name + "_swagger_json") |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 445 | |
Ray Milkey | 5063f5b | 2018-08-15 16:22:30 -0700 | [diff] [blame] | 446 | javacopts = ["-XepDisableAllChecks"] if suppress_errorprone else [] |
Thomas Vachuska | 5b9ff6a | 2018-07-13 11:00:50 -0700 | [diff] [blame] | 447 | |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 448 | # compile the Java code |
Thomas Vachuska | f8c8cb9 | 2018-07-11 17:12:43 -0700 | [diff] [blame] | 449 | if len(resource_jars) > 0: |
Ray Milkey | 5063f5b | 2018-08-15 16:22:30 -0700 | [diff] [blame] | 450 | native.java_library( |
| 451 | name = name + "-native", |
| 452 | srcs = native_srcs, |
| 453 | resource_jars = resource_jars, |
| 454 | deps = deps, |
| 455 | visibility = visibility, |
| 456 | javacopts = javacopts, |
| 457 | ) |
Thomas Vachuska | f8c8cb9 | 2018-07-11 17:12:43 -0700 | [diff] [blame] | 458 | else: |
Ray Milkey | 5063f5b | 2018-08-15 16:22:30 -0700 | [diff] [blame] | 459 | native.java_library( |
| 460 | name = name + "-native", |
| 461 | srcs = native_srcs, |
| 462 | resources = native_resources, |
| 463 | deps = deps, |
| 464 | visibility = visibility, |
| 465 | javacopts = javacopts, |
| 466 | ) |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 467 | |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 468 | _bnd( |
Ray Milkey | 25b785a | 2018-06-12 09:59:14 -0700 | [diff] [blame] | 469 | name = name, |
| 470 | source = name + "-native", |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 471 | deps = deps, |
| 472 | version = version, |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 473 | group = group, |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 474 | visibility = visibility, |
Ray Milkey | 12ae6ca | 2018-06-11 15:34:30 -0700 | [diff] [blame] | 475 | import_packages = import_packages, |
Jian Li | 4ad8687 | 2018-08-05 03:34:35 +0900 | [diff] [blame] | 476 | bundle_classpath = bundle_classpath, |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 477 | web_context = web_context, |
| 478 | web_xml = web_xml, |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 479 | include_resources = _include_resources_to_string(include_resources), |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 480 | ) |
Thomas Vachuska | 0f7d7a4 | 2018-07-18 15:23:40 -0700 | [diff] [blame] | 481 | |
Thomas Vachuska | ac9e524 | 2018-07-19 16:15:39 -0700 | [diff] [blame] | 482 | # rule for generating pom file for publishing |
| 483 | pom_file(name = name + "-pom", artifact = name, deps = deps, visibility = visibility) |
| 484 | |
| 485 | # rule for building source jar |
Thomas Vachuska | 50ac098 | 2018-07-19 10:17:37 -0700 | [diff] [blame] | 486 | if not suppress_javadocs: |
Ray Milkey | 5063f5b | 2018-08-15 16:22:30 -0700 | [diff] [blame] | 487 | java_sources(name = name + "-sources", srcs = srcs, visibility = visibility) |
Thomas Vachuska | 50ac098 | 2018-07-19 10:17:37 -0700 | [diff] [blame] | 488 | |
Thomas Vachuska | 0f7d7a4 | 2018-07-18 15:23:40 -0700 | [diff] [blame] | 489 | # rule for building javadocs |
| 490 | if not suppress_javadocs: |
Ray Milkey | 5063f5b | 2018-08-15 16:22:30 -0700 | [diff] [blame] | 491 | javadoc(name = name + "-javadoc", deps = deps, srcs = srcs, visibility = visibility) |
Thomas Vachuska | 0f7d7a4 | 2018-07-18 15:23:40 -0700 | [diff] [blame] | 492 | |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 493 | if test_srcs != []: |
| 494 | native.java_library( |
| 495 | name = tests_name, |
| 496 | srcs = test_srcs, |
| 497 | resources = test_resources, |
| 498 | deps = tests_jar_deps, |
| 499 | visibility = visibility, |
| 500 | ) |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 501 | |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 502 | generate_test_rules( |
| 503 | name = name + "-tests-gen", |
| 504 | test_files = test_srcs, |
| 505 | exclude_tests = exclude_tests, |
Thomas Vachuska | a79bf6e | 2018-08-07 11:24:40 -0700 | [diff] [blame] | 506 | medium_tests = medium_tests, |
| 507 | large_tests = large_tests, |
| 508 | enormous_tests = enormous_tests, |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 509 | deps = all_test_deps, |
| 510 | ) |
| 511 | |
Ray Milkey | 134d292 | 2018-07-15 15:24:01 -0700 | [diff] [blame] | 512 | if not suppress_checkstyle: |
| 513 | checkstyle_test( |
| 514 | name = name + "_checkstyle_test", |
| 515 | srcs = srcs, |
| 516 | ) |
Ray Milkey | b7949e7 | 2018-06-19 18:31:02 -0700 | [diff] [blame] | 517 | |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 518 | """ |
| 519 | Creates an OSGI jar file from a set of source files. |
| 520 | |
| 521 | Args: |
| 522 | name: Name of the rule to generate. Optional, defaults to a name based on the location in the source tree. |
| 523 | For example apps/mcast/app becomes onos-apps-mcast-app |
| 524 | deps: Dependencies of the generated jar file. Expressed as a list of targets |
| 525 | import_packages: OSGI import list. Optional, comma separated list, defaults to "*" |
Jian Li | 4ad8687 | 2018-08-05 03:34:35 +0900 | [diff] [blame] | 526 | bundle_classpath: intended for including dependencies in our bundle, so that our bundle can be deployed standalone |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 527 | group: Maven group ID for the resulting jar file. Optional, defaults to 'org.onosproject' |
| 528 | srcs: Source file(s) to compile. Optional list of targets, defaults to src/main/java/**/*.java |
| 529 | resources_root: Relative path to the root of the tree of resources for this jar. Optional, defaults to src/main/resources |
| 530 | resources: Resources to include in the jar file. Optional list of targets, defaults to all files beneath resources_root |
| 531 | visibility: Visibility of the produced jar file to other BUILDs. Optional, defaults to public |
| 532 | version: Version of the generated jar file. Optional, defaults to the current ONOS version |
Ray Milkey | 134d292 | 2018-07-15 15:24:01 -0700 | [diff] [blame] | 533 | suppress_errorprone: If true, don't run ErrorProne tests. Default is false |
| 534 | suppress_checkstyle: If true, don't run checkstyle tests. Default is false |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 535 | web_context: Web context for a WAB file if needed. Only needed if the jar file provides a REST API. Optional string |
| 536 | api_title: Swagger API title. Optional string, only used if the jar file provides a REST API and has swagger annotations |
| 537 | api_version: Swagger API version. Optional string, only used if the jar file provides a REST API and has swagger annotations |
| 538 | api_description: Swagger API description. Optional string, only used if the jar file provides a REST API and has swagger annotations |
| 539 | api_package: Swagger API package name. Optional string, only used if the jar file provides a REST API and has swagger annotations |
| 540 | """ |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 541 | |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 542 | def osgi_jar( |
| 543 | name = None, |
| 544 | deps = None, |
Ray Milkey | 12ae6ca | 2018-06-11 15:34:30 -0700 | [diff] [blame] | 545 | import_packages = None, |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 546 | group = "org.onosproject", |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 547 | srcs = None, |
| 548 | resources_root = None, |
| 549 | resources = None, |
Thomas Vachuska | f8c8cb9 | 2018-07-11 17:12:43 -0700 | [diff] [blame] | 550 | resource_jars = [], |
Ray Milkey | 6b3775a | 2018-06-28 11:18:44 -0700 | [diff] [blame] | 551 | include_resources = {}, |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 552 | visibility = ["//visibility:public"], |
Ray Milkey | 12ae6ca | 2018-06-11 15:34:30 -0700 | [diff] [blame] | 553 | version = ONOS_VERSION, |
Thomas Vachuska | 5b9ff6a | 2018-07-13 11:00:50 -0700 | [diff] [blame] | 554 | suppress_errorprone = False, |
Ray Milkey | 134d292 | 2018-07-15 15:24:01 -0700 | [diff] [blame] | 555 | suppress_checkstyle = False, |
Thomas Vachuska | 0f7d7a4 | 2018-07-18 15:23:40 -0700 | [diff] [blame] | 556 | suppress_javadocs = False, |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 557 | web_context = None, |
Ray Milkey | 12ae6ca | 2018-06-11 15:34:30 -0700 | [diff] [blame] | 558 | api_title = "", |
| 559 | api_version = "", |
| 560 | api_description = "", |
Jian Li | 4ad8687 | 2018-08-05 03:34:35 +0900 | [diff] [blame] | 561 | api_package = "", |
| 562 | bundle_classpath = ""): |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 563 | if srcs == None: |
Ray Milkey | 32ea35c | 2018-06-06 15:28:07 -0700 | [diff] [blame] | 564 | srcs = _all_java_sources() |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 565 | if deps == None: |
| 566 | deps = COMPILE |
| 567 | |
| 568 | osgi_jar_with_tests( |
| 569 | name = name, |
| 570 | deps = deps, |
| 571 | test_deps = [], |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 572 | group = group, |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 573 | srcs = srcs, |
| 574 | resources = resources, |
| 575 | resources_root = resources_root, |
Thomas Vachuska | f8c8cb9 | 2018-07-11 17:12:43 -0700 | [diff] [blame] | 576 | resource_jars = resource_jars, |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 577 | test_srcs = [], |
| 578 | exclude_tests = [], |
| 579 | test_resources = [], |
| 580 | visibility = visibility, |
Thomas Vachuska | 5b9ff6a | 2018-07-13 11:00:50 -0700 | [diff] [blame] | 581 | suppress_errorprone = suppress_errorprone, |
Ray Milkey | 134d292 | 2018-07-15 15:24:01 -0700 | [diff] [blame] | 582 | suppress_checkstyle = suppress_checkstyle, |
Thomas Vachuska | 0f7d7a4 | 2018-07-18 15:23:40 -0700 | [diff] [blame] | 583 | suppress_javadocs = suppress_javadocs, |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 584 | version = version, |
Ray Milkey | 12ae6ca | 2018-06-11 15:34:30 -0700 | [diff] [blame] | 585 | import_packages = import_packages, |
Ray Milkey | 275af2c | 2018-06-15 13:05:08 -0700 | [diff] [blame] | 586 | api_title = api_title, |
| 587 | api_version = api_version, |
| 588 | api_description = api_description, |
| 589 | api_package = api_package, |
Ray Milkey | 25747d8 | 2018-06-13 14:12:51 -0700 | [diff] [blame] | 590 | web_context = web_context, |
Jian Li | 4ad8687 | 2018-08-05 03:34:35 +0900 | [diff] [blame] | 591 | bundle_classpath = bundle_classpath, |
Ray Milkey | 0bcdfd1 | 2018-05-23 14:07:19 -0700 | [diff] [blame] | 592 | ) |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 593 | |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 594 | """ |
| 595 | Creates an OSGI jar file from a set of protobuf and gRPC libraries. |
| 596 | |
| 597 | Args: |
| 598 | name: Name of the rule to generate. Optional, defaults to a name based on the location in the source tree. |
| 599 | For example apps/mcast/app becomes onos-apps-mcast-app |
| 600 | proto_libs: (required) list of proto_library targets which generated Java classes will be included to this OSGi |
| 601 | jar. It is important that all the given targets reference to a single proto source files, for example |
| 602 | only the first 2 rules are good: |
| 603 | |
| 604 | proto_library( |
| 605 | name = "foo_proto", |
| 606 | srcs = ["foo.proto"], |
| 607 | ) |
| 608 | |
| 609 | proto_library( |
| 610 | name = "bar_proto", |
| 611 | srcs = ["bar.proto"], |
| 612 | ) |
| 613 | |
| 614 | # THIS WILL NOT WORK |
| 615 | proto_library( |
| 616 | name = "foo_and_bar_proto", |
| 617 | srcs = ["foo.proto", "bar.proto"], |
| 618 | ) |
| 619 | |
| 620 | grpc_proto_lib: (optional) proto_library target that contains the schema of a gRPC service. If not passed, |
| 621 | the produced jar will NOT have any gRPC stub classes. |
| 622 | deps: Dependencies of the generated jar file. Expressed as a list of targets |
| 623 | group: Maven group ID for the resulting jar file. Optional, defaults to 'org.onosproject' |
| 624 | visibility: Visibility of the produced jar file to other BUILDs. Optional, defaults to public |
| 625 | version: Version of the generated jar file. Optional, defaults to the current ONOS version |
| 626 | """ |
| 627 | |
| 628 | def osgi_proto_jar( |
| 629 | proto_libs, |
| 630 | grpc_proto_lib = None, |
| 631 | name = None, |
| 632 | deps = [], |
| 633 | group = "org.onosproject", |
| 634 | visibility = ["//visibility:public"], |
Ray Milkey | 5063f5b | 2018-08-15 16:22:30 -0700 | [diff] [blame] | 635 | version = ONOS_VERSION): |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 636 | if name == None: |
| 637 | name = _auto_name() |
| 638 | native.java_proto_library( |
| 639 | name = name + "-java-proto", |
| 640 | deps = proto_libs, |
| 641 | ) |
| 642 | java_sources_alt( |
| 643 | name = name + "-proto-srcjar", |
| 644 | srcs = [":%s-java-proto" % name], |
| 645 | ) |
| 646 | osgi_srcs = [ |
| 647 | ":%s-proto-srcjar" % name, |
| 648 | ] |
| 649 | base_deps = [ |
| 650 | "@com_google_protobuf//:protobuf_java", |
| 651 | ] |
| 652 | if grpc_proto_lib != None: |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 653 | java_grpc_library( |
| 654 | name = name + "-java-grpc", |
| 655 | srcs = [grpc_proto_lib], |
| 656 | deps = [":%s-java-proto" % name], |
| 657 | ) |
| 658 | osgi_srcs.append( |
Ray Milkey | 5063f5b | 2018-08-15 16:22:30 -0700 | [diff] [blame] | 659 | ":%s-java-grpc__do_not_reference__srcjar" % name, |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 660 | ) |
| 661 | base_deps.extend([ |
| 662 | "@com_google_guava_guava//jar", |
| 663 | "@io_grpc_grpc_java//core", |
| 664 | "@io_grpc_grpc_java//stub", |
| 665 | "@io_grpc_grpc_java//protobuf", |
| 666 | ]) |
| 667 | osgi_jar( |
| 668 | name = name, |
| 669 | srcs = osgi_srcs, |
| 670 | deps = base_deps + deps, |
| 671 | group = group, |
| 672 | visibility = visibility, |
| 673 | version = version, |
| 674 | suppress_errorprone = True, |
| 675 | suppress_checkstyle = True, |
| 676 | suppress_javadocs = True, |
| 677 | ) |