Skip to content

Commit

Permalink
chore: cleanup some deprecated APIs
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
@bazel/typescript and @bazel/karma no longer have a defs.bzl file. Use
index.bzl instead.

The @Yarn workspace is no longer created. Use @nodejs//:yarn instead.

Fixes #1144
  • Loading branch information
alexeagle committed Sep 20, 2019
1 parent cc20e57 commit ae2f128
Show file tree
Hide file tree
Showing 14 changed files with 9 additions and 115 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ install_bazel_dependencies()
# With http_archive it only sees releases/download/*.tar.gz urls
git_repository(
name = "build_bazel_rules_typescript",
commit = "5ad356d09a6d7275bfef6f9717274e7dd9cda978",
commit = "fcf33e92a60c2b0613e931d05b305e1d962648e0",
remote = "http://github.com/bazelbuild/rules_typescript.git",
)

Expand Down
2 changes: 1 addition & 1 deletion examples/angular/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ load("@npm_bazel_karma//:browser_repositories.bzl", "browser_repositories")
browser_repositories()

# Setup the rules_typescript tooolchain
load("@npm_bazel_typescript//:defs.bzl", "ts_setup_workspace")
load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")

ts_setup_workspace()

Expand Down
2 changes: 1 addition & 1 deletion examples/angular/e2e/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@npm_bazel_protractor//:index.bzl", "protractor_web_test_suite")
load("@npm_bazel_typescript//:defs.bzl", "ts_library")
load("@npm_bazel_typescript//:index.bzl", "ts_library")

ts_library(
name = "e2e",
Expand Down
2 changes: 1 addition & 1 deletion examples/angular/src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("@npm//history-server:index.bzl", "history_server")
load("@npm_angular_bazel//:index.bzl", "ng_module")
load("@npm_bazel_typescript//:defs.bzl", "ts_config", "ts_devserver", "ts_library")
load("@npm_bazel_typescript//:index.bzl", "ts_config", "ts_devserver", "ts_library")

package(default_visibility = ["//:__subpackages__"])

Expand Down
2 changes: 1 addition & 1 deletion examples/angular/src/app/hello-world/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("@npm_angular_bazel//:index.bzl", "ng_module")
load("@npm_bazel_typescript//:defs.bzl", "ts_library")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
load("//tools:defaults.bzl", "ts_web_test_suite")

package(default_visibility = ["//:__subpackages__"])
Expand Down
2 changes: 1 addition & 1 deletion examples/angular/src/app/todos/reducers/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_typescript//:defs.bzl", "ts_library")
load("@npm_bazel_typescript//:index.bzl", "ts_library")

package(default_visibility = ["//:__subpackages__"])

Expand Down
2 changes: 1 addition & 1 deletion examples/angular/src/lib/shorten/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm_bazel_typescript//:defs.bzl", "ts_library")
load("@npm_bazel_typescript//:index.bzl", "ts_library")

package(default_visibility = ["//:__subpackages__"])

Expand Down
2 changes: 1 addition & 1 deletion examples/protocol_buffers/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ browser_repositories(
firefox = True,
)

load("@npm_bazel_typescript//:defs.bzl", "ts_setup_workspace")
load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")

ts_setup_workspace()

Expand Down
2 changes: 1 addition & 1 deletion examples/web_testing/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ load("@npm_bazel_karma//:browser_repositories.bzl", "browser_repositories")

browser_repositories()

load("@npm_bazel_typescript//:defs.bzl", "ts_setup_workspace")
load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")

ts_setup_workspace()
7 changes: 0 additions & 7 deletions internal/node/node_labels.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,3 @@ def get_yarn_label(rctx):
else:
label = Label("@nodejs_%s//:bin/yarn" % os_name(rctx))
return label

def get_yarn_node_repositories_label(rctx):
if is_windows_os(rctx):
label = Label("@nodejs%s//:bin/yarn_node_repositories.cmd" % os_name(rctx))
else:
label = Label("@nodejs_%s//:bin/yarn_node_repositories" % os_name(rctx))
return label
23 changes: 0 additions & 23 deletions internal/node/node_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ load("//internal/common:os_name.bzl", "OS_ARCH_NAMES", "is_windows_os", "os_name
load("//internal/npm_install:npm_install.bzl", "yarn_install")
load("//third_party/github.com/bazelbuild/bazel-skylib:lib/paths.bzl", "paths")
load("//toolchains/node:node_toolchain_configure.bzl", "node_toolchain_configure")
load(":node_labels.bzl", "get_yarn_node_repositories_label")

_DOC = """To be run in user's WORKSPACE to install rules_nodejs dependencies.
Expand All @@ -49,10 +48,6 @@ This rule exposes the `@nodejs` workspace containing some rules the user can cal
- Install dependencies using npm: `bazel run @nodejs//:npm install`
- Install dependencies using yarn: `bazel run @nodejs//:yarn`
This rule also exposes the `@yarn` workspace for backwards compatibility:
- Alternately install dependencies using yarn: `bazel run @yarn//:yarn`
Note that the dependency installation scripts will run in each subpackage indicated by the `package_json` attribute.
This approach uses npm/yarn as the package manager. You could instead have Bazel act as the package manager, running the install behind the scenes.
Expand Down Expand Up @@ -608,18 +603,6 @@ node_repositories_rule = repository_rule(
attrs = _ATTRS,
)

def _yarn_repo_impl(repository_ctx):
# Base build file for this repository - exposes yarn
repository_ctx.file("BUILD.bazel", content = """# Generated by node_repositories.bzl
package(default_visibility = ["//visibility:public"])
alias(name = "yarn", actual = "{yarn}")
""".format(yarn = get_yarn_node_repositories_label(repository_ctx)))

_yarn_repo = repository_rule(
_yarn_repo_impl,
attrs = {"package_json": attr.label_list()},
)

def _nodejs_host_os_alias_impl(repository_ctx):
host_os = os_name(repository_ctx)
node_repository = "@nodejs_%s" % host_os
Expand Down Expand Up @@ -687,12 +670,6 @@ def node_repositories(package_json = [], **kwargs):
name = "nodejs",
)

_maybe(
_yarn_repo,
name = "yarn",
package_json = package_json,
)

_maybe(
yarn_install,
name = "build_bazel_rules_nodejs_rollup_deps",
Expand Down
36 changes: 0 additions & 36 deletions packages/karma/src/defs.bzl

This file was deleted.

32 changes: 0 additions & 32 deletions packages/typescript/src/defs.bzl

This file was deleted.

8 changes: 0 additions & 8 deletions packages/typescript/src/package.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

def rules_typescript_dependencies():
print("""DEPRECATION WARNING:
rules_typescript_dependencies is no longer needed, and will be removed in a future release.
We assume you will fetch rules_nodejs in your WORKSPACE file, and no other dependencies remain here.
Simply remove any calls to this function and the corresponding call to
load("@npm_bazel_typescript//:package.bzl", "rules_typescript_dependencies")
""")

def rules_typescript_dev_dependencies():
"""
Fetch dependencies needed for local development.
Expand Down

0 comments on commit ae2f128

Please sign in to comment.