• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
16load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
17load("@npm//@bazel/typescript:index.bzl", "ts_library", "ts_project")
18load("ts_proto_collection.bzl", "ts_proto_collection")
19
20package(default_visibility = ["//visibility:public"])
21
22filegroup(
23    name = "ts_proto_collection_template",
24    srcs = ["ts_proto_collection.template.ts"],
25)
26
27ts_project(
28    name = "lib",
29    srcs = [
30        "index.ts",
31        "proto_collection.ts",
32    ],
33    declaration = True,
34    source_map = True,
35    deps = ["@npm//:node_modules"],  # can't use fine-grained deps
36)
37
38js_library(
39    name = "pw_protobuf_compiler",
40    package_name = "@pigweed/pw_protobuf_compiler",
41    srcs = ["package.json"],
42    deps = [":lib"],
43)
44
45ts_proto_collection(
46    name = "test_proto_collection",
47    js_proto_library = "//pw_protobuf_compiler:test_protos_tspb",
48    proto_library = "//pw_protobuf_compiler:test_protos",
49)
50
51ts_library(
52    name = "ts_proto_collection_test_lib",
53    srcs = [
54        "ts_proto_collection_test.ts",
55    ],
56    deps = [
57        ":test_proto_collection",
58        "//pw_protobuf_compiler:test_protos_tspb",
59        "//pw_rpc/ts:packet_proto_tspb",
60        "@npm//@types/google-protobuf",
61        "@npm//@types/jasmine",
62    ],
63)
64
65jasmine_node_test(
66    name = "ts_proto_collection_test",
67    srcs = [
68        ":ts_proto_collection_test_lib",
69    ],
70)
71