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

build: fix //packages/angular_devkit/build_angular:build_angular_<foo>_test on OSX #17624

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 0 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,6 @@
"url": "https://github.com/angular/angular-cli/issues"
},
"homepage": "https://github.com/angular/angular-cli",
"workspaces": {
"packages": [
"packages/angular/*",
"packages/angular_devkit/*",
"packages/ngtools/*",
"packages/schematics/*"
],
"nohoist": [
"@angular/compiler-cli"
]
},
"devDependencies": {
"@angular/animations": "9.1.4",
"@angular/cdk": "9.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/build_angular/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ LARGE_SPECS = {
# These tests are resource intensive and should not be over-parallized as they will
# compete for the resources of other parallel tests slowing everything down.
# Ask Bazel to allocate multiple CPUs for these tests with "cpu:n" tag.
tags = ["cpu:2"] + LARGE_SPECS[spec].get("tags", []),
tags = ["cpu:2", "local"] + LARGE_SPECS[spec].get("tags", []),
templated_args = ["--nobazel_patch_module_resolver"],
deps = [":build_angular_" + spec + "_test_lib"],
)
Expand Down
20 changes: 13 additions & 7 deletions packages/angular_devkit/core/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("//tools:defaults.bzl", "ts_library")

Expand All @@ -16,6 +17,17 @@ licenses(["notice"]) # MIT License

# @angular-devkit/core

copy_to_bin(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: this copy_to_bin is necessary because the linker is linking to bazel-out so any source files (such as package.json) that are required in the package need to be pushed to bazel-out with copy_to_bin. Not ideal but outside of the sandbox there is no better approach AFAIK. Side-effect is that this works on Windows which does not have a sandbox or runfiles.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, you'll get ```==================== Test output for //packages/angular_devkit/build_angular:build_angular_karma_test (shard 2 of 2):
internal/modules/cjs/loader.js:796
throw err;
^

Error: Cannot find module '@angular-devkit/core'
Require stack:

  • /private/var/tmp/_bazel_greg/dbb005a7eeb5fa8b89a9797588e36854/execroot/angular_cli/bazel-out/darwin-fastbuild/bin/packages/angular_devkit/build_angular/build_angular_karma_test.sh.runfiles/angular_cli/packages/angular_devkit/build_angular/src/karma/code-coverage_spec.js
  • /private/var/tmp/_bazel_greg/dbb005a7eeb5fa8b89a9797588e36854/execroot/angular_cli/bazel-out/darwin-fastbuild/bin/packages/angular_devkit/build_angular/build_angular_karma_test.sh.runfiles/npm/node_modules/jasmine/lib/jasmine.js
because there is no package.json in the bazel-out folder of `@angular-devkit/core` which is linked

name = "core_data",
srcs = glob(
include = ["**/*.json"],
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
exclude = ["node_modules/**"],
) + [
"//packages/angular_devkit/core/third_party/github.com/chalk/supports-color",
],
)

ts_library(
name = "core",
srcs = glob(
Expand All @@ -25,13 +37,7 @@ ts_library(
"src/**/*_benchmark.ts",
],
),
data = glob(
include = ["**/*.json"],
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
exclude = ["node_modules/**"],
) + [
"//packages/angular_devkit/core/third_party/github.com/chalk/supports-color",
],
data = [":core_data"],
module_name = "@angular-devkit/core",
module_root = "src/index.d.ts",
# The attribute below is needed in g3 to turn off strict typechecking
Expand Down
Loading