Skip to content

Commit

Permalink
chore: cleanup jasmine from_src index (bazel-contrib#1860)
Browse files Browse the repository at this point in the history
Instead, use replacements so the distribution uses different labels than we use locally
  • Loading branch information
alexeagle authored May 4, 2020
1 parent 2e9e61b commit 2e93d96
Show file tree
Hide file tree
Showing 31 changed files with 49 additions and 68 deletions.
4 changes: 2 additions & 2 deletions examples/user_managed_deps/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")

# Make the jasmine library available at runtime by exposing our node_modules
# directory.
Expand Down Expand Up @@ -41,8 +41,8 @@ nodejs_binary(
jasmine_node_test(
name = "test",
srcs = glob(["*.spec.js"]),
jasmine_deps = [],
node_modules = "//:node_modules",
tags = ["no-local-jasmine-deps"],
deps = [
":decrement",
":program",
Expand Down
2 changes: 1 addition & 1 deletion internal/common/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("//internal/common:copy_to_bin.bzl", "copy_to_bin")
load("//internal/common:params_file.bzl", "params_file")
load(":expand_into_runfiles_test.bzl", "expand_into_runfiles_test_suite")
Expand Down
2 changes: 1 addition & 1 deletion internal/linker/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_typescript//:index.bzl", "ts_library")

ts_library(
Expand Down
2 changes: 1 addition & 1 deletion internal/linker/test/local/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")

jasmine_node_test(
name = "test",
Expand Down
2 changes: 1 addition & 1 deletion internal/node/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary", "nodejs_test", "npm_package_bin")
load("@build_bazel_rules_nodejs//internal/golden_file_test:golden_file_test.bzl", "golden_file_test")
load("@npm//typescript:index.bzl", "tsc")
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("//internal/js_library:js_library.bzl", "js_library")
load("//internal/node:node_repositories.bzl", "BUILT_IN_NODE_PLATFORMS")
load("//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file")
Expand Down
12 changes: 6 additions & 6 deletions internal/npm_install/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
load("@build_bazel_rules_nodejs//internal/npm_install:npm_umd_bundle.bzl", "npm_umd_bundle")
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")

filegroup(
name = "goldens",
Expand Down Expand Up @@ -101,11 +101,12 @@ sh_test(
"coarse.spec.js",
"common.spec.js",
],
jasmine_deps = [
node_modules = "@fine_grained_deps_%s//:node_modules" % pkgmgr,
tags = ["no-local-jasmine-deps"],
deps = [
"@fine_grained_deps_%s//jasmine" % pkgmgr,
"@fine_grained_deps_%s//jasmine-core" % pkgmgr,
],
node_modules = "@fine_grained_deps_%s//:node_modules" % pkgmgr,
) for pkgmgr in [
"yarn",
"npm",
Expand All @@ -120,11 +121,10 @@ sh_test(
"common.spec.js",
"fine.spec.js",
],
jasmine_deps = [
tags = ["no-local-jasmine-deps"],
deps = [
"@fine_grained_deps_%s//jasmine" % pkgmgr,
"@fine_grained_deps_%s//jasmine-core" % pkgmgr,
],
deps = [
"@fine_grained_deps_%s//ajv" % pkgmgr,
"@fine_grained_deps_%s//typescript" % pkgmgr,
"@fine_grained_deps_%s//rxjs" % pkgmgr,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg_npm/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
load("//internal/node:context.bzl", "node_context_data")
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg_web/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")

# BEGIN-INTERNAL
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")

# END-INTERNAL
package(default_visibility = ["//visibility:public"])
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg_web/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
load("@npm//@babel/cli:index.bzl", "babel")
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
load("@npm_bazel_terser//:index.bzl", "terser_minified")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg_web/test2/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
load("@npm//@babel/cli:index.bzl", "babel")
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
load("@npm_bazel_terser//:index.bzl", "terser_minified")

Expand Down
4 changes: 4 additions & 0 deletions packages/jasmine/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ pkg_npm(
"@npm_bazel_jasmine//:package_contents",
],
build_file_content = "",
substitutions = {
"@npm_bazel_jasmine//:jasmine__pkg": "@npm//@bazel/jasmine",
"@npm_bazel_jasmine//:jasmine_runner.js": "@npm//:node_modules/@bazel/jasmine/jasmine_runner.js",
},
vendor_external = [
"npm_bazel_jasmine",
],
Expand Down
32 changes: 0 additions & 32 deletions packages/jasmine/src/index.from_src.bzl

This file was deleted.

13 changes: 11 additions & 2 deletions packages/jasmine/src/jasmine_node_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ def jasmine_node_test(
tags = [],
config_file = None,
coverage = False,
jasmine = "@npm//@bazel/jasmine",
jasmine_entry_point = "@npm//:node_modules/@bazel/jasmine/jasmine_runner.js",
# Replaced by pkg_npm with jasmine = "@npm//@bazel/jasmine",
jasmine = "@npm_bazel_jasmine//:jasmine__pkg",
# Replaced by pkg_npm with jasmine_entry_point = "@npm//:node_modules/@bazel/jasmine/jasmine_runner.js",
jasmine_entry_point = "@npm_bazel_jasmine//:jasmine_runner.js",
**kwargs):
"""Runs tests in NodeJS using the Jasmine test runner.
Expand Down Expand Up @@ -104,6 +106,13 @@ def jasmine_node_test(

all_data = data + srcs + deps + [Label(jasmine)]

# BEGIN-INTERNAL
# Only used when running tests in the rules_nodejs repo.
# Avoid adding duplicate deps though, some rules use this from source and declared the dep
if not "@npm//jasmine" in all_data and not str(Label("@npm//jasmine")) in all_data and not "no-local-jasmine-deps" in tags:
all_data.extend(["@npm//jasmine", "@npm//jasmine-reporters", "@npm//v8-coverage"])

# END-INTERNAL
all_data += [":%s_devmode_srcs.MF" % name]
all_data += [Label("@build_bazel_rules_nodejs//third_party/github.com/bazelbuild/bazel/tools/bash/runfiles")]

Expand Down
2 changes: 1 addition & 1 deletion packages/jasmine/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("//internal/common:copy_to_bin.bzl", "copy_to_bin")

jasmine_node_test(
Expand Down
2 changes: 1 addition & 1 deletion packages/karma/test/karma_typescript/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_karma//:index.bzl", "karma_web_test_suite")
load("@npm_bazel_typescript//:index.bzl", "ts_library")

Expand Down
2 changes: 1 addition & 1 deletion packages/labs/test/grpc_web/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_karma//:index.bzl", "karma_web_test_suite")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
Expand Down
2 changes: 1 addition & 1 deletion packages/labs/test/protobufjs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_labs//:index.bzl", "protobufjs_ts_library")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
Expand Down
2 changes: 1 addition & 1 deletion packages/protractor/test/protractor-utils/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_typescript//:index.bzl", "ts_library")

ts_library(
Expand Down
2 changes: 1 addition & 1 deletion packages/rollup/test/code_splitting/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")

rollup_bundle(
Expand Down
2 changes: 1 addition & 1 deletion packages/rollup/test/multiple_entry_points/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")

rollup_bundle(
Expand Down
2 changes: 1 addition & 1 deletion packages/rollup/test/sourcemaps/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")

rollup_bundle(
Expand Down
2 changes: 1 addition & 1 deletion packages/terser/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")

jasmine_node_test(
name = "test",
Expand Down
2 changes: 1 addition & 1 deletion packages/terser/test/directory_input/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@build_bazel_rules_nodejs//:tools/declare_directory.bzl", "declare_directory")
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_terser//:index.bzl", "terser_minified")

declare_directory(
Expand Down
2 changes: 1 addition & 1 deletion packages/terser/test/exec/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")

jasmine_node_test(
name = "test",
Expand Down
2 changes: 1 addition & 1 deletion packages/terser/test/inline_sourcemap/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_terser//:index.bzl", "terser_minified")

# Check that filegroups work
Expand Down
2 changes: 1 addition & 1 deletion packages/terser/test/sourcemap/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@build_bazel_rules_nodejs//:tools/declare_directory.bzl", "declare_directory")
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_terser//:index.bzl", "terser_minified")

filegroup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_typescript//:index.bzl", "ts_library")

ts_library(
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/test/googmodule/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
load("//packages/typescript/test/devmode_consumer:devmode_consumer.bzl", "devmode_consumer")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_typescript//:index.bzl", "ts_library")

ts_library(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
load("//packages/typescript/test/devmode_consumer:devmode_consumer.bzl", "devmode_consumer")
load("//packages/typescript/test/es6_consumer:es6_consumer.bzl", "es6_consumer")
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/test/ts_project/b/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_typescript//:index.bzl", "ts_project")

package(default_visibility = ["//packages/typescript/test:__subpackages__"])
Expand Down

0 comments on commit 2e93d96

Please sign in to comment.