-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move @bazel/karma package to rules_nodejs
- Loading branch information
Showing
18 changed files
with
4,121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# 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-INTERNAL | ||
# 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 # INTERNAL fences. | ||
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "npm_package") | ||
load("@npm_bazel_typescript//:defs.bzl", "ts_library") | ||
|
||
COMPAT_VERSION = "FIXME" | ||
|
||
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 = "copy_LICENSE", | ||
srcs = ["@build_bazel_rules_nodejs//: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 = { | ||
"0.0.0-COMPAT_VERSION": COMPAT_VERSION, | ||
}, | ||
deps = [ | ||
":bazel_karma", | ||
":copy_LICENSE", | ||
":generate_README", | ||
], | ||
) | ||
|
||
# END-INTERNAL | ||
exports_files(["karma.conf.js"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Copyright 2017 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. | ||
|
||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") | ||
|
||
workspace(name = "npm_bazel_karma") | ||
|
||
local_repository( | ||
name = "build_bazel_rules_nodejs", | ||
path = "../..", | ||
) | ||
|
||
# Load nested npm_bazel_typescript repository | ||
local_repository( | ||
name = "npm_bazel_typescript", | ||
path = "../typescript", | ||
) | ||
|
||
# Uncomment for local development | ||
# local_repository(path = "../../../rules_typescript", | ||
git_repository( | ||
name = "build_bazel_rules_typescript", | ||
commit = "57c8d4d02d28b95ca12a145538fa87e3ecc6b74b", | ||
remote = "http://github.com/bazelbuild/rules_typescript.git", | ||
) | ||
|
||
# Load our dependencies | ||
load("@npm_bazel_typescript//:package.bzl", "rules_typescript_dev_dependencies") | ||
|
||
rules_typescript_dev_dependencies() | ||
|
||
# Load rules_karma dependencies | ||
load("//:package.bzl", "rules_karma_dependencies") | ||
|
||
rules_karma_dependencies() | ||
|
||
load("@build_bazel_rules_nodejs//:defs.bzl", "yarn_install") | ||
|
||
yarn_install( | ||
name = "npm", | ||
package_json = "//:package.json", | ||
yarn_lock = "//:yarn.lock", | ||
) | ||
|
||
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies") | ||
|
||
install_bazel_dependencies() | ||
|
||
# Setup typescript toolchain | ||
load("@npm_bazel_typescript//:defs.bzl", "ts_setup_workspace") | ||
|
||
ts_setup_workspace() | ||
|
||
# Dependencies for generating documentation | ||
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories") | ||
|
||
sass_repositories() | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "com_google_protobuf", | ||
sha256 = "9510dd2afc29e7245e9e884336f848c8a6600a14ae726adb6befdb4f786f0be2", | ||
strip_prefix = "protobuf-3.6.1.3", | ||
type = "zip", | ||
# v3.6.1.3 as of 2019-01-15 | ||
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.6.1.3.zip"], | ||
) | ||
|
||
load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories") | ||
|
||
skydoc_repositories() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# 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. | ||
|
||
"""Pinned browser versions tested against in https://github.com/bazelbuild/rules_typescript CI. | ||
""" | ||
|
||
load("@io_bazel_rules_webtesting//web/internal:platform_http_file.bzl", "platform_http_file") | ||
|
||
def browser_repositories(): | ||
"""Load pinned rules_webtesting browser versions.""" | ||
|
||
platform_http_file( | ||
name = "org_chromium_chromium", | ||
amd64_sha256 = | ||
"941de83d78b27d43db07f427136ba159d661bb111db8d9ffe12499b863a003e1", | ||
amd64_urls = [ | ||
# Chromium 69.0.3497.0 (2018-07-19 snaphot 576668) | ||
# https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/576668/ | ||
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/576668/chrome-linux.zip", | ||
], | ||
licenses = ["notice"], # BSD 3-clause (maybe more?) | ||
macos_sha256 = | ||
"bd01783e7d179e9f85d4b6f0c9df53118d13977cc7d365a1caa9d198c6afcfd8", | ||
macos_urls = [ | ||
# Chromium 69.0.3497.0 (2018-07-19 snaphot 576668) | ||
# https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/576668/ | ||
# NOTE: There is an issue with ChromeHeadless on OSX chromium 70+ | ||
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/576668/chrome-mac.zip", | ||
], | ||
windows_sha256 = | ||
"d1bb728118c12ea436d8ea07dba980789e7d860aa664dd1fad78bc20e8d9391c", | ||
windows_urls = [ | ||
# Chromium 66.0.3359.0 (2018-03-01 snaphot 540270) | ||
# https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win_x64/612439/ | ||
# NOTE: There is an issue with chromium 68-71 with Windows: https://bugs.chromium.org/p/chromium/issues/detail?id=540270 | ||
# and pinning to 72 is not possible as the archive name has changed to chrome-win.zip which breaks | ||
# as the executable path the hard-coded in rules_webtesting and includes the archive name. | ||
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/540270/chrome-win32.zip", | ||
], | ||
) | ||
|
||
platform_http_file( | ||
name = "org_chromium_chromedriver", | ||
amd64_sha256 = | ||
"687d2e15c42908e2911344c08a949461b3f20a83017a7a682ef4d002e05b5d46", | ||
amd64_urls = [ | ||
# ChromeDriver 2.44 supports Chrome v69-71 | ||
# http://chromedriver.chromium.org/downloads | ||
"https://chromedriver.storage.googleapis.com/2.44/chromedriver_linux64.zip", | ||
], | ||
licenses = ["reciprocal"], # BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like), Academic Free License v. 2.0, BSD 2-clause, MIT | ||
macos_sha256 = | ||
"3fd49c2782a5f93cb48ff2dee021004d9a7fb393798e4c4807b391cedcd30ed9", | ||
macos_urls = [ | ||
# ChromeDriver 2.44 supports Chrome v69-71 | ||
# http://chromedriver.chromium.org/downloads | ||
"https://chromedriver.storage.googleapis.com/2.44/chromedriver_mac64.zip", | ||
], | ||
windows_sha256 = | ||
"a8fa028acebef7b931ef9cb093f02865f9f7495e49351f556e919f7be77f072e", | ||
windows_urls = [ | ||
# ChromeDriver 2.38 supports Chrome v65-67 | ||
# http://chromedriver.chromium.org/downloads | ||
"https://chromedriver.storage.googleapis.com/2.38/chromedriver_win32.zip", | ||
], | ||
) | ||
|
||
platform_http_file( | ||
name = "org_mozilla_firefox", | ||
amd64_sha256 = | ||
"3a729ddcb1e0f5d63933177a35177ac6172f12edbf9fbbbf45305f49333608de", | ||
amd64_urls = [ | ||
"https://mirror.bazel.build/ftp.mozilla.org/pub/firefox/releases/61.0.2/linux-x86_64/en-US/firefox-61.0.2.tar.bz2", | ||
"https://ftp.mozilla.org/pub/firefox/releases/61.0.2/linux-x86_64/en-US/firefox-61.0.2.tar.bz2", | ||
], | ||
licenses = ["reciprocal"], # MPL 2.0 | ||
macos_sha256 = | ||
"bf23f659ae34832605dd0576affcca060d1077b7bf7395bc9874f62b84936dc5", | ||
macos_urls = [ | ||
"https://mirror.bazel.build/ftp.mozilla.org/pub/firefox/releases/61.0.2/mac/en-US/Firefox%2061.0.2.dmg", | ||
"https://ftp.mozilla.org/pub/firefox/releases/61.0.2/mac/en-US/Firefox%2061.0.2.dmg", | ||
], | ||
) | ||
|
||
platform_http_file( | ||
name = "org_mozilla_geckodriver", | ||
amd64_sha256 = | ||
"c9ae92348cf00aa719be6337a608fae8304691a95668e8e338d92623ba9e0ec6", | ||
amd64_urls = [ | ||
"https://mirror.bazel.build/github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-linux64.tar.gz", | ||
"https://github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-linux64.tar.gz", | ||
], | ||
licenses = ["reciprocal"], # MPL 2.0 | ||
macos_sha256 = | ||
"ce4a3e9d706db94e8760988de1ad562630412fa8cf898819572522be584f01ce", | ||
macos_urls = [ | ||
"https://mirror.bazel.build/github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-macos.tar.gz", | ||
"https://github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-macos.tar.gz", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright 2017 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. | ||
|
||
"Defaults for rules_karma repository not meant to be used downstream" | ||
|
||
load( | ||
"@npm_bazel_karma//:defs.bzl", | ||
_karma_web_test = "karma_web_test", | ||
_karma_web_test_suite = "karma_web_test_suite", | ||
_ts_web_test = "ts_web_test", | ||
_ts_web_test_suite = "ts_web_test_suite", | ||
) | ||
|
||
INTERNAL_KARMA_BIN = "@npm_bazel_karma//:karma_bin" | ||
|
||
def karma_web_test(karma = INTERNAL_KARMA_BIN, **kwargs): | ||
_karma_web_test(karma = karma, **kwargs) | ||
|
||
def karma_web_test_suite(karma = INTERNAL_KARMA_BIN, **kwargs): | ||
_karma_web_test_suite(karma = karma, **kwargs) | ||
|
||
def ts_web_test(karma = INTERNAL_KARMA_BIN, **kwargs): | ||
_ts_web_test(karma = karma, **kwargs) | ||
|
||
def ts_web_test_suite(karma = INTERNAL_KARMA_BIN, **kwargs): | ||
_ts_web_test_suite(karma = karma, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2017 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. | ||
|
||
""" Public API surface is re-exported here. | ||
""" | ||
|
||
load( | ||
":karma_web_test.bzl", | ||
_karma_web_test = "karma_web_test", | ||
_karma_web_test_suite = "karma_web_test_suite", | ||
) | ||
load( | ||
":ts_web_test.bzl", | ||
_ts_web_test = "ts_web_test", | ||
_ts_web_test_suite = "ts_web_test_suite", | ||
) | ||
|
||
# TODO(alexeagle): make ts_web_test && ts_web_test_suite work in google3 | ||
ts_web_test = _ts_web_test | ||
ts_web_test_suite = _ts_web_test_suite | ||
karma_web_test = _karma_web_test | ||
karma_web_test_suite = _karma_web_test_suite |
Oops, something went wrong.