Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade to rules_js 2.0 #144

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .aspect/bazelrc/ci.bazelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# We recommend enforcing a policy that keeps your CI from being slowed down
# by individual test targets that should be optimized
# or split up into multiple test targets with sharding or manually.
# Set this flag to exclude targets that have their timeout set to eternal (>15m) from running on CI.
# Docs: https://bazel.build/docs/user-manual#test-timeout-filters
test --test_timeout_filters=-eternal

# Set this flag to enable re-tries of failed tests on CI.
# When any test target fails, try one or more times. This applies regardless of whether the "flaky"
# tag appears on the target definition.
Expand Down
1 change: 1 addition & 0 deletions .aspect/bazelrc/javascript.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
# details.
# Docs: https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options
run:debug -- --node_options=--inspect-brk
test:debug --test_env=NODE_OPTIONS=--inspect-brk
7 changes: 3 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ module(
)

# Lower-bounds (minimum) versions for direct runtime dependencies
bazel_dep(name = "aspect_bazel_lib", version = "1.40.2")
bazel_dep(name = "aspect_rules_js", version = "1.37.1")
bazel_dep(name = "bazel_features", version = "1.4.1")
bazel_dep(name = "aspect_bazel_lib", version = "2.7.3")
bazel_dep(name = "aspect_rules_js", version = "2.0.0-rc0")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "rules_nodejs", version = "5.8.3")
bazel_dep(name = "rules_nodejs", version = "6.1.0")

####### Dev dependencies ########

Expand Down
13 changes: 3 additions & 10 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,11 @@ load("//jasmine:dependencies.bzl", "rules_jasmine_dependencies")
# Fetch dependencies which users need as well
rules_jasmine_dependencies()

load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")

aspect_bazel_lib_dependencies()
rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION)

load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")

nodejs_register_toolchains(
name = "nodejs",
node_version = DEFAULT_NODE_VERSION,
)

load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")

npm_translate_lock(
name = "npm",
Expand Down
3 changes: 2 additions & 1 deletion e2e/jasmine_test/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ local_path_override(
path = "../..",
)

bazel_dep(name = "aspect_rules_js", version = "1.37.1", dev_dependency = True)
bazel_dep(name = "aspect_bazel_lib", version = "2.7.3", dev_dependency = True)
bazel_dep(name = "aspect_rules_js", version = "2.0.0-rc0", dev_dependency = True)

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)
npm.npm_translate_lock(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ load("@aspect_rules_jasmine//jasmine:dependencies.bzl", "rules_jasmine_dependenc

rules_jasmine_dependencies()

load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")

nodejs_register_toolchains(
name = "nodejs",
node_version = DEFAULT_NODE_VERSION,
)
rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION)

load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")

npm_translate_lock(
name = "npm",
Expand Down
3 changes: 2 additions & 1 deletion e2e/smoke/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ local_path_override(
path = "../..",
)

bazel_dep(name = "aspect_rules_js", version = "1.37.1", dev_dependency = True)
bazel_dep(name = "aspect_bazel_lib", version = "2.7.3", dev_dependency = True)
bazel_dep(name = "aspect_rules_js", version = "2.0.0-rc0", dev_dependency = True)

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)
npm.npm_translate_lock(
Expand Down
9 changes: 3 additions & 6 deletions e2e/smoke/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@ load("@aspect_rules_jasmine//jasmine:dependencies.bzl", "rules_jasmine_dependenc
# Fetch dependencies which users need as well
rules_jasmine_dependencies()

load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")

nodejs_register_toolchains(
name = "nodejs",
node_version = DEFAULT_NODE_VERSION,
)
rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION)

load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")

npm_translate_lock(
name = "npm",
Expand Down
6 changes: 1 addition & 5 deletions jasmine/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@ def jasmine_test(
name = name,
config = config,
enable_runfiles = select({
"@aspect_rules_js//js:enable_runfiles": True,
"//conditions:default": False,
}),
unresolved_symlinks_enabled = select({
"@aspect_rules_js//js:allow_unresolved_symlinks": True,
"@aspect_bazel_lib//lib:enable_runfiles": True,
"//conditions:default": False,
}),
entry_point = entry_point,
Expand Down
24 changes: 9 additions & 15 deletions jasmine/dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,21 @@ def rules_jasmine_dependencies():

http_archive(
name = "aspect_bazel_lib",
sha256 = "04feedcd06f71d0497a81fdd3220140a373ff9d2bff94620fbd50b774f96d8e0",
strip_prefix = "bazel-lib-1.40.2",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.40.2/bazel-lib-v1.40.2.tar.gz",
sha256 = "87ab4ec479ebeb00d286266aca2068caeef1bb0b1765e8f71c7b6cfee6af4226",
strip_prefix = "bazel-lib-2.7.3",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.7.3/bazel-lib-v2.7.3.tar.gz",
)

http_archive(
name = "aspect_rules_js",
sha256 = "630a71aba66c4023a5b16ab3efafaeed8b1a2865ccd168a34611eb73876b3fc4",
strip_prefix = "rules_js-1.37.1",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.37.1/rules_js-v1.37.1.tar.gz",
sha256 = "389021e29b3aeed2f6fb3a7a1478f8fc52947a6500b198a7ec0f3358c2842415",
strip_prefix = "rules_js-2.0.0-rc0",
url = "https://github.com/aspect-build/rules_js/releases/download/v2.0.0-rc0/rules_js-v2.0.0-rc0.tar.gz",
)

http_archive(
name = "rules_nodejs",
sha256 = "8fc8e300cb67b89ceebd5b8ba6896ff273c84f6099fc88d23f24e7102319d8fd",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.4/rules_nodejs-core-5.8.4.tar.gz"],
)

http_archive(
name = "bazel_features",
sha256 = "0f23d75c7623d6dba1fd30513a94860447de87c8824570521fcc966eda3151c2",
strip_prefix = "bazel_features-1.4.1",
url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.4.1/bazel_features-v1.4.1.tar.gz",
sha256 = "dddd60acc3f2f30359bef502c9d788f67e33814b0ddd99aa27c5a15eb7a41b8c",
strip_prefix = "rules_nodejs-6.1.0",
url = "https://github.com/bazelbuild/rules_nodejs/releases/download/v6.1.0/rules_nodejs-v6.1.0.tar.gz",
)
13 changes: 6 additions & 7 deletions jasmine/private/jasmine_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ def _impl(ctx):
files = ctx.files.data[:]

fixed_args = []

# TODO(2.0): we can assume fixed_args exists on attr for the 2.0 major release (it comes from rules_js 1.27.0)
if hasattr(ctx.attr, "fixed_args"):
fixed_args.extend(ctx.attr.fixed_args)
fixed_args.extend(ctx.attr.fixed_args)

if ctx.attr.junit_reporter:
files.append(ctx.file.junit_reporter)
Expand All @@ -47,11 +44,13 @@ def _impl(ctx):

runfiles = ctx.runfiles(
files = files,
transitive_files = js_lib_helpers.gather_files_from_js_providers(
transitive_files = js_lib_helpers.gather_files_from_js_infos(
targets = ctx.attr.data,
include_sources = ctx.attr.include_sources,
include_types = ctx.attr.include_types,
include_transitive_sources = ctx.attr.include_transitive_sources,
include_declarations = ctx.attr.include_declarations,
include_npm_linked_packages = ctx.attr.include_npm_linked_packages,
include_transitive_types = ctx.attr.include_transitive_types,
include_npm_sources = ctx.attr.include_npm_sources,
),
).merge(launcher.runfiles).merge_all([
target[DefaultInfo].default_runfiles
Expand Down
Loading