blob: 54f69edf4facb6ced84c049427eb8bc5bf9e981b [file] [log] [blame]
# Copyright 2018 The Bazel Authors. 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.
# BEGIN-DEV-ONLY
# Parts of this BUILD file only necessary when building within the bazelbuild/rules_typescript repo.
# The generated `@bazel/karma` npm package contains a trimmed BUILD file using # DEV-ONLY fences.
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "npm_package")
load("@npm_bazel_typescript//:version.bzl", "COMPAT_VERSION")
load("@npm_bazel_typescript//internal:defaults.bzl", "ts_library")
package(default_visibility = ["//visibility:public"])
# Exports to be consumed for generating skydoc.
exports_files([
"karma_web_test.bzl",
"ts_web_test.bzl",
"web_test.bzl",
])
ts_library(
name = "bazel_karma",
srcs = glob(["*.ts"]),
module_name = "@bazel/karma",
tsconfig = ":tsconfig.json",
deps = [
"@npm//@types/node",
"@npm//tmp",
],
)
nodejs_binary(
name = "karma_bin",
data = [
":bazel_karma",
"@npm//jasmine-core",
"@npm//karma",
"@npm//karma-chrome-launcher",
"@npm//karma-firefox-launcher",
"@npm//karma-jasmine",
"@npm//karma-requirejs",
"@npm//karma-sauce-launcher",
"@npm//karma-sourcemap-loader",
"@npm//requirejs",
"@npm//tmp",
],
entry_point = "karma/bin/karma",
install_source_map_support = False,
)
genrule(
name = "license_copy",
srcs = ["@npm_bazel_typescript//:LICENSE"],
outs = ["LICENSE"],
cmd = "cp $< $@",
)
# Ugly genrule depending on local linux environment to build the README out of skylark doc generation.
# Only referenced when we do a release.
# TODO: This ought to be possible with stardoc alone. Need to coordinate with Chris Parsons.
genrule(
name = "generate_README",
srcs = ["//docs", "//docs:install.md"],
outs = ["README.md"],
cmd = "unzip -o -d docs $(location //docs:docs) && cat docs/install.md docs/*_web_test.md | sed 's/^##/\\\n##/' > $@",
)
npm_package(
name = "npm_package",
srcs = [
"BUILD.bazel",
"WORKSPACE",
"browser_repositories.bzl",
"defaults.bzl",
"defs.bzl",
"karma.conf.js",
"karma.js",
"karma_web_test.bzl",
"package.bzl",
"package.json",
"ts_web_test.bzl",
"web_test.bzl",
],
replacements = {
"(#|\/\/)\\s+BEGIN-DEV-ONLY[\\w\W]+?(#|\/\/)\\s+END-DEV-ONLY": "",
"0.0.0-COMPAT_VERSION": COMPAT_VERSION,
},
deps = [
":bazel_karma",
":license_copy",
":generate_README"
],
)
# END-DEV-ONLY
exports_files(["karma.conf.js"])