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 bazel-contrib#1144
  • Loading branch information
alexeagle committed Sep 20, 2019
1 parent d846f45 commit 876efe6
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 108 deletions.
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 @@ -609,18 +604,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 @@ -688,12 +671,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.

34 changes: 0 additions & 34 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 876efe6

Please sign in to comment.