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

Symlink user node_modules in yarn_install & npm_install #704

Merged
merged 13 commits into from
May 22, 2019
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
1 change: 1 addition & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
bazel: 0.26.0rc13
platforms:
ubuntu1604:
run_targets:
Expand Down
3 changes: 3 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ packages/
# A subset of legacy e2e tests are nested workspaces
# TODO(gregmagolan): move these to /e2e
internal/e2e/bazel_workspaces_compat
internal/e2e/fine_grained_deps/npm/node_modules
internal/e2e/fine_grained_deps/yarn/node_modules
internal/e2e/fine_grained_no_bin/node_modules
internal/e2e/fine_grained_symlinks
internal/e2e/node_loader_no_preserve_symlinks
internal/e2e/node_loader_preserve_symlinks
Expand Down
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test
# Turn off legacy external runfiles
run --nolegacy_external_runfiles
test --nolegacy_external_runfiles

# Turn on managed_directories
build --experimental_allow_incremental_repository_updates
test --experimental_allow_incremental_repository_updates
run --experimental_allow_incremental_repository_updates
36 changes: 11 additions & 25 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

workspace(name = "build_bazel_rules_nodejs")
workspace(
name = "build_bazel_rules_nodejs",
managed_directories = {
"@fine_grained_deps_npm": ["internal/e2e/fine_grained_deps/npm/node_modules"],
"@fine_grained_deps_yarn": ["internal/e2e/fine_grained_deps/yarn/node_modules"],
"@fine_grained_no_bin": ["internal/e2e/fine_grained_no_bin/node_modules"],
"@npm": ["node_modules"],
},
)

load("//:package.bzl", "rules_nodejs_dev_dependencies")

Expand All @@ -22,7 +30,8 @@ load("//internal/common:check_bazel_version.bzl", "check_bazel_version")

# 0.18.0: support for .bazelignore
# 0.23.0: required fix for pkg_tar strip_prefix
check_bazel_version(minimum_bazel_version = "0.23.0")
# 0.26.0: managed_directories feature added
check_bazel_version(minimum_bazel_version = "0.26.0")

#
# Load and install our dependencies downloaded above.
Expand Down Expand Up @@ -64,29 +73,6 @@ node_repositories(

yarn_install(
name = "npm",
data = [
"@build_bazel_rules_nodejs//:tools/npm_packages/hello/index.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/hello/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index/index.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index_2/index.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index_2/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index_3/index.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index_3/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index_4/index.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index_4/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_main/main.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_main/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_main_2/main.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_main_2/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_nested_main/nested/main.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_nested_main/nested/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_nested_main/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/test_workspace/BUILD.bazel",
"@build_bazel_rules_nodejs//:tools/npm_packages/test_workspace/index.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/test_workspace/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/test_workspace/subdir/BUILD.bazel",
"@build_bazel_rules_nodejs//:tools/npm_packages/test_workspace/subdir/index.js",
],
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
Expand Down
5 changes: 5 additions & 0 deletions e2e/bazel_bin/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test
# Turn off legacy external runfiles
run --nolegacy_external_runfiles
test --nolegacy_external_runfiles

# Turn on managed_directories
build --experimental_allow_incremental_repository_updates
test --experimental_allow_incremental_repository_updates
run --experimental_allow_incremental_repository_updates
9 changes: 4 additions & 5 deletions e2e/bazel_bin/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

workspace(name = "e2e_bazel_bin")
workspace(
name = "e2e_bazel_bin",
managed_directories = {"@npm": ["node_modules"]},
)

local_repository(
name = "build_bazel_rules_nodejs",
Expand All @@ -23,10 +26,6 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "yarn_install")

yarn_install(
name = "npm",
data = [
"@e2e_bazel_bin//:npm/testy/index.js",
"@e2e_bazel_bin//:npm/testy/package.json",
],
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
5 changes: 5 additions & 0 deletions e2e/define_var/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test
# Turn off legacy external runfiles
run --nolegacy_external_runfiles
test --nolegacy_external_runfiles

# Turn on managed_directories
build --experimental_allow_incremental_repository_updates
test --experimental_allow_incremental_repository_updates
run --experimental_allow_incremental_repository_updates
5 changes: 4 additions & 1 deletion e2e/define_var/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

workspace(name = "e2e_define_var")
workspace(
name = "e2e_define_var",
managed_directories = {"@npm": ["node_modules"]},
)

local_repository(
name = "build_bazel_rules_nodejs",
Expand Down
5 changes: 5 additions & 0 deletions e2e/jasmine/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test
# Turn off legacy external runfiles
run --nolegacy_external_runfiles
test --nolegacy_external_runfiles

# Turn on managed_directories
build --experimental_allow_incremental_repository_updates
test --experimental_allow_incremental_repository_updates
run --experimental_allow_incremental_repository_updates
5 changes: 4 additions & 1 deletion e2e/jasmine/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

workspace(name = "e2e_jasmine")
workspace(
name = "e2e_jasmine",
managed_directories = {"@npm": ["node_modules"]},
)

local_repository(
name = "build_bazel_rules_nodejs",
Expand Down
Loading