Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upbuild: fix //packages/angular_devkit/build_angular:build_angular_<foo>_test on OSX #17624
Conversation
…>_test on OSX These need to be run with "local" tag because puppeteer Chrome has lib files with spaces in them which Bazel does not support in runfiles. However, when tagged "local", this fixes that problem as the files with spaces are visible outside of the sandbox but it introduces the issue of the linker conflicting with the node_modules symlinks created by yarn workspaces. So in order for a test to work with "local" we need to also disable yarn workspaces.
@@ -16,6 +17,17 @@ licenses(["notice"]) # MIT License | |||
|
|||
# @angular-devkit/core | |||
|
|||
copy_to_bin( |
gregmagolan
May 4, 2020
Author
Contributor
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.
gregmagolan
May 4, 2020
Author
Contributor
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
For reference to the spaces/runfiles issue on Bazel, here is the open issue on bazelbuild/bazel: bazelbuild/bazel#4327 and the PR to fix it which passed OSS review but had some internal side-effects so it was dropped: bazelbuild/bazel#9351 |
These need to be run with "local" tag because puppeteer Chrome has lib files with spaces in them which Bazel does not support in runfiles. However, when tagged "local", this fixes that problem as the files with spaces are visible outside of the sandbox but it introduces the issue of the linker conflicting with the node_modules symlinks created by yarn workspaces. So in order for a test to work with "local" we need to also disable yarn workspaces.