forked from tensorflow/tfjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.bazel
104 lines (95 loc) · 3 KB
/
BUILD.bazel
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
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =============================================================================
load("//tools:defaults.bzl", "esbuild", "ts_library")
load("//tools:enumerate_tests.bzl", "enumerate_tests")
package(default_visibility = ["//visibility:public"])
TEST_SRCS = [
"**/*_test.ts",
]
filegroup(
name = "all_test_entrypoints",
srcs = glob(
["**/*_test.ts"],
exclude = [
"setup_test.ts",
],
),
)
# Generates the 'tests.ts' file that imports all test entrypoints.
enumerate_tests(
name = "tests",
srcs = [":all_test_entrypoints"],
root_path = "tfjs-backend-webgl/src",
)
ts_library(
name = "tfjs-backend-webgl_src_lib",
srcs = glob(
["**/*.ts"],
exclude = TEST_SRCS + ["index.ts"],
),
module_name = "@tensorflow/tfjs-backend-webgl/dist",
deps = [
"//tfjs-backend-cpu/src:tfjs-backend-cpu_lib",
"//tfjs-backend-cpu/src:tfjs-backend-cpu_src_lib",
"//tfjs-core/src:tfjs-core_lib",
"//tfjs-core/src:tfjs-core_src_lib",
"@npm//@types/offscreencanvas",
"@npm//@types/seedrandom",
"@npm//@types/webgl-ext",
"@npm//@types/webgl2",
],
)
ts_library(
name = "tfjs-backend-webgl_lib",
srcs = ["index.ts"],
module_name = "@tensorflow/tfjs-backend-webgl",
deps = [
":tfjs-backend-webgl_src_lib",
],
)
ts_library(
name = "tfjs-backend-webgl_test_lib",
# TODO(mattsoulanille): Mark as testonly when esbuild is fixed to allow it.
# https://github.com/bazelbuild/rules_nodejs/pull/2984
# testonly = True,
srcs = glob(TEST_SRCS) + [":tests"],
module_name = "@tensorflow/tfjs-backend-webgl/dist",
deps = [
":tfjs-backend-webgl_lib",
":tfjs-backend-webgl_src_lib",
"//tfjs-backend-cpu/src:tfjs-backend-cpu_lib",
"//tfjs-core/src:tfjs-core_lib",
"//tfjs-core/src:tfjs-core_src_lib",
"//tfjs-core/src:tfjs-core_test_lib",
],
)
esbuild(
name = "tfjs-backend-webgl_test_bundle",
testonly = True,
entry_point = "setup_test.ts",
external = [
# webworker tests call 'require('@tensorflow/tfjs')', which
# is external to the test bundle.
# Note: This is not a bazel target. It's just a string.
"@tensorflow/tfjs",
"worker_threads",
"util",
],
sources_content = True,
deps = [
":tfjs-backend-webgl_lib",
":tfjs-backend-webgl_test_lib",
],
)