From e5853693c00bdda133dc8c255a2e436aa1e07318 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Thu, 7 Feb 2019 15:00:05 -0800 Subject: [PATCH 1/4] Add /tools/* to release package --- BUILD.bazel | 1 + examples/test_examples.sh | 3 --- internal/e2e/bazel_workspaces/WORKSPACE | 5 ++++- internal/e2e/bazel_workspaces/package.json | 6 +++--- .../e2e/bazel_workspaces_compat/WORKSPACE | 5 ++++- .../e2e/bazel_workspaces_compat/package.json | 10 +++++----- package.json | 1 + tools/BUILD.bazel | 20 ++++++++++++++++++- 8 files changed, 37 insertions(+), 14 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 7b2c270b4c..940e0ce0da 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -38,6 +38,7 @@ npm_package( "//internal/npm_install:package_contents", "//internal/npm_package:package_contents", "//internal/web_package:package_contents", + "//tools:package_contents", ], ) diff --git a/examples/test_examples.sh b/examples/test_examples.sh index eff3fae881..692a9aa698 100755 --- a/examples/test_examples.sh +++ b/examples/test_examples.sh @@ -6,9 +6,6 @@ set -u -e -o pipefail cd $(dirname $0) -# Make sure the distro is up-to-date and can be referenced at bazel-bin/rules_nodejs_package -bazel build --symlink_prefix=bazel- //:local_testing_package - for testDir in $(ls) ; do [[ -d "$testDir" ]] || continue ( diff --git a/internal/e2e/bazel_workspaces/WORKSPACE b/internal/e2e/bazel_workspaces/WORKSPACE index d9e6bc3479..313582de05 100644 --- a/internal/e2e/bazel_workspaces/WORKSPACE +++ b/internal/e2e/bazel_workspaces/WORKSPACE @@ -2,7 +2,7 @@ workspace(name = "bazel_workspaces") local_repository( name = "build_bazel_rules_nodejs", - path = "../../..", + path = "../../../bazel-bin/local_testing_package", ) load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install") @@ -13,6 +13,9 @@ yarn_install( name = "npm", package_json = "//:package.json", yarn_lock = "//:yarn.lock", + # Need to a reference to this workspace in data so that + # the external/bazel_workspaces is setup before yarn_install runs + data = ["@bazel_workspaces//:package.json"] ) load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies") diff --git a/internal/e2e/bazel_workspaces/package.json b/internal/e2e/bazel_workspaces/package.json index 5b3e92fe17..f502bf39d9 100644 --- a/internal/e2e/bazel_workspaces/package.json +++ b/internal/e2e/bazel_workspaces/package.json @@ -1,8 +1,8 @@ { "dependencies": { - "test_workspaces": "file:../build_bazel_rules_nodejs/internal/e2e/bazel_workspaces/npm/test_workspace" + "test_workspaces": "file:../bazel_workspaces/npm/test_workspace" }, "scripts": { - "test": "bazel test @test_workspace//..." + "test": "bazel test @test_workspace//..." } -} +} \ No newline at end of file diff --git a/internal/e2e/bazel_workspaces_compat/WORKSPACE b/internal/e2e/bazel_workspaces_compat/WORKSPACE index 76aadd6d34..a7e4eccfd3 100644 --- a/internal/e2e/bazel_workspaces_compat/WORKSPACE +++ b/internal/e2e/bazel_workspaces_compat/WORKSPACE @@ -2,7 +2,7 @@ workspace(name = "bazel_workspaces_compat") local_repository( name = "build_bazel_rules_nodejs", - path = "../../..", + path = "../../../bazel-bin/local_testing_package", ) load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install") @@ -13,6 +13,9 @@ yarn_install( name = "npm", package_json = "//:package.json", yarn_lock = "//:yarn.lock", + # Need to a reference to this workspace in data so that + # the external/bazel_workspaces is setup before yarn_install runs + data = ["@bazel_workspaces_compat//:package.json"] ) load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies") diff --git a/internal/e2e/bazel_workspaces_compat/package.json b/internal/e2e/bazel_workspaces_compat/package.json index ed38ed648c..d4b86ae250 100644 --- a/internal/e2e/bazel_workspaces_compat/package.json +++ b/internal/e2e/bazel_workspaces_compat/package.json @@ -1,10 +1,10 @@ { "dependencies": { - "test_workspace_a": "file:../build_bazel_rules_nodejs/internal/e2e/bazel_workspaces_compat/npm/test_workspace_a", - "test_workspace_b": "file:../build_bazel_rules_nodejs/internal/e2e/bazel_workspaces_compat/npm/test_workspace_b", - "test_workspace_c": "file:../build_bazel_rules_nodejs/internal/e2e/bazel_workspaces_compat/npm/test_workspace_c" + "test_workspace_a": "file:../bazel_workspaces_compat/npm/test_workspace_a", + "test_workspace_b": "file:../bazel_workspaces_compat/npm/test_workspace_b", + "test_workspace_c": "file:../bazel_workspaces_compat/npm/test_workspace_c" }, "scripts": { - "test": "bazel test @test_workspace//..." + "test": "bazel test @test_workspace//..." } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 402293e1df..12d1323c0b 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "test:e2e": "yarn internal-e2e-bazel_workspaces && yarn internal-e2e-bazel_workspaces_compat && yarn internal-e2e-fine_grained_symlinks && yarn internal-e2e-node_loader_no_preserve_symlinks && yarn internal-e2e-node_loader_preserve_symlinks", "test:examples": "./examples/test_examples.sh", "test": "yarn test:examples && yarn test:e2e", + "pretest": "bazel build --symlink_prefix=bazel- //:local_testing_package", "bazel:format": "find . -type f \\( -name \"*.bzl\" -or -name WORKSPACE -or -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs buildifier -v --warnings=args-order,attr-cfg,attr-license,attr-non-empty,attr-output-default,attr-single-file,constant-glob,ctx-actions,ctx-args,depset-iteration,depset-union,dict-concatenation,duplicated-name,filetype,git-repository,http-archive,integer-division,load,load-on-top,native-build,native-package,out-of-order-load,output-group,package-name,package-on-top,positional-args,redefined-variable,repository-name,same-origin-load,string-iteration,unsorted-dict-items,unused-variable", "bazel:lint": "yarn bazel:format --lint=warn", "bazel:lint-fix": "yarn bazel:format --lint=fix", diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel index f8b3c38bd8..7a5482e6a5 100644 --- a/tools/BUILD.bazel +++ b/tools/BUILD.bazel @@ -1 +1,19 @@ -# Marker file that this directory is a bazel package +# Copyright 2018 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +filegroup( + name = "package_contents", + srcs = glob(["*"]), + visibility = ["//:__pkg__"], +) From a07836162c8a3869c2441c8565a132473427a086 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Thu, 7 Feb 2019 15:28:55 -0800 Subject: [PATCH 2/4] Fix CI --- examples/test_examples.sh | 3 +++ package.json | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/test_examples.sh b/examples/test_examples.sh index 692a9aa698..eff3fae881 100755 --- a/examples/test_examples.sh +++ b/examples/test_examples.sh @@ -6,6 +6,9 @@ set -u -e -o pipefail cd $(dirname $0) +# Make sure the distro is up-to-date and can be referenced at bazel-bin/rules_nodejs_package +bazel build --symlink_prefix=bazel- //:local_testing_package + for testDir in $(ls) ; do [[ -d "$testDir" ]] || continue ( diff --git a/package.json b/package.json index 12d1323c0b..35ec63a3e5 100644 --- a/package.json +++ b/package.json @@ -25,10 +25,9 @@ "internal-e2e-fine_grained_symlinks": "cd internal/e2e/fine_grained_symlinks && yarn test", "internal-e2e-node_loader_no_preserve_symlinks": "cd internal/e2e/node_loader_no_preserve_symlinks && yarn test", "internal-e2e-node_loader_preserve_symlinks": "cd internal/e2e/node_loader_preserve_symlinks && yarn test", - "test:e2e": "yarn internal-e2e-bazel_workspaces && yarn internal-e2e-bazel_workspaces_compat && yarn internal-e2e-fine_grained_symlinks && yarn internal-e2e-node_loader_no_preserve_symlinks && yarn internal-e2e-node_loader_preserve_symlinks", + "test:e2e": "bazel build --symlink_prefix=bazel- //:local_testing_package && yarn internal-e2e-bazel_workspaces && yarn internal-e2e-bazel_workspaces_compat && yarn internal-e2e-fine_grained_symlinks && yarn internal-e2e-node_loader_no_preserve_symlinks && yarn internal-e2e-node_loader_preserve_symlinks", "test:examples": "./examples/test_examples.sh", "test": "yarn test:examples && yarn test:e2e", - "pretest": "bazel build --symlink_prefix=bazel- //:local_testing_package", "bazel:format": "find . -type f \\( -name \"*.bzl\" -or -name WORKSPACE -or -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs buildifier -v --warnings=args-order,attr-cfg,attr-license,attr-non-empty,attr-output-default,attr-single-file,constant-glob,ctx-actions,ctx-args,depset-iteration,depset-union,dict-concatenation,duplicated-name,filetype,git-repository,http-archive,integer-division,load,load-on-top,native-build,native-package,out-of-order-load,output-group,package-name,package-on-top,positional-args,redefined-variable,repository-name,same-origin-load,string-iteration,unsorted-dict-items,unused-variable", "bazel:lint": "yarn bazel:format --lint=warn", "bazel:lint-fix": "yarn bazel:format --lint=fix", From f261c781d75640f1db101afd3e6588098859ea83 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Thu, 7 Feb 2019 15:31:27 -0800 Subject: [PATCH 3/4] Use local_testing_package in remaining e2e tests --- internal/e2e/bazel_workspaces/npm/test_workspace/WORKSPACE | 2 +- .../e2e/bazel_workspaces_compat/npm/test_workspace_a/WORKSPACE | 2 +- .../e2e/bazel_workspaces_compat/npm/test_workspace_b/WORKSPACE | 2 +- .../e2e/bazel_workspaces_compat/npm/test_workspace_c/WORKSPACE | 2 +- internal/e2e/fine_grained_symlinks/WORKSPACE | 2 +- internal/e2e/node_loader_no_preserve_symlinks/WORKSPACE | 2 +- internal/e2e/node_loader_preserve_symlinks/WORKSPACE | 2 +- internal/e2e/packages/WORKSPACE | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/e2e/bazel_workspaces/npm/test_workspace/WORKSPACE b/internal/e2e/bazel_workspaces/npm/test_workspace/WORKSPACE index 394a623906..c9e9be3289 100644 --- a/internal/e2e/bazel_workspaces/npm/test_workspace/WORKSPACE +++ b/internal/e2e/bazel_workspaces/npm/test_workspace/WORKSPACE @@ -2,7 +2,7 @@ workspace(name = "test_workspace") local_repository( name = "build_bazel_rules_nodejs", - path = "../../../../..", + path = "../../../../../bazel-bin/local_testing_package", ) load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install") diff --git a/internal/e2e/bazel_workspaces_compat/npm/test_workspace_a/WORKSPACE b/internal/e2e/bazel_workspaces_compat/npm/test_workspace_a/WORKSPACE index 394a623906..c9e9be3289 100644 --- a/internal/e2e/bazel_workspaces_compat/npm/test_workspace_a/WORKSPACE +++ b/internal/e2e/bazel_workspaces_compat/npm/test_workspace_a/WORKSPACE @@ -2,7 +2,7 @@ workspace(name = "test_workspace") local_repository( name = "build_bazel_rules_nodejs", - path = "../../../../..", + path = "../../../../../bazel-bin/local_testing_package", ) load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install") diff --git a/internal/e2e/bazel_workspaces_compat/npm/test_workspace_b/WORKSPACE b/internal/e2e/bazel_workspaces_compat/npm/test_workspace_b/WORKSPACE index 394a623906..c9e9be3289 100644 --- a/internal/e2e/bazel_workspaces_compat/npm/test_workspace_b/WORKSPACE +++ b/internal/e2e/bazel_workspaces_compat/npm/test_workspace_b/WORKSPACE @@ -2,7 +2,7 @@ workspace(name = "test_workspace") local_repository( name = "build_bazel_rules_nodejs", - path = "../../../../..", + path = "../../../../../bazel-bin/local_testing_package", ) load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install") diff --git a/internal/e2e/bazel_workspaces_compat/npm/test_workspace_c/WORKSPACE b/internal/e2e/bazel_workspaces_compat/npm/test_workspace_c/WORKSPACE index 394a623906..c9e9be3289 100644 --- a/internal/e2e/bazel_workspaces_compat/npm/test_workspace_c/WORKSPACE +++ b/internal/e2e/bazel_workspaces_compat/npm/test_workspace_c/WORKSPACE @@ -2,7 +2,7 @@ workspace(name = "test_workspace") local_repository( name = "build_bazel_rules_nodejs", - path = "../../../../..", + path = "../../../../../bazel-bin/local_testing_package", ) load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install") diff --git a/internal/e2e/fine_grained_symlinks/WORKSPACE b/internal/e2e/fine_grained_symlinks/WORKSPACE index 4b14a85baf..ce8469667c 100644 --- a/internal/e2e/fine_grained_symlinks/WORKSPACE +++ b/internal/e2e/fine_grained_symlinks/WORKSPACE @@ -2,7 +2,7 @@ workspace(name = "fine_grained_symlinks") local_repository( name = "build_bazel_rules_nodejs", - path = "../../..", + path = "../../../bazel-bin/local_testing_package", ) load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install") diff --git a/internal/e2e/node_loader_no_preserve_symlinks/WORKSPACE b/internal/e2e/node_loader_no_preserve_symlinks/WORKSPACE index 7c5d57151e..be717f4aeb 100644 --- a/internal/e2e/node_loader_no_preserve_symlinks/WORKSPACE +++ b/internal/e2e/node_loader_no_preserve_symlinks/WORKSPACE @@ -2,7 +2,7 @@ workspace(name = "node_loader_e2e_no_preserve_symlinks") local_repository( name = "build_bazel_rules_nodejs", - path = "../../..", + path = "../../../bazel-bin/local_testing_package", ) load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install") diff --git a/internal/e2e/node_loader_preserve_symlinks/WORKSPACE b/internal/e2e/node_loader_preserve_symlinks/WORKSPACE index da2c5398d8..2726510c51 100644 --- a/internal/e2e/node_loader_preserve_symlinks/WORKSPACE +++ b/internal/e2e/node_loader_preserve_symlinks/WORKSPACE @@ -2,7 +2,7 @@ workspace(name = "node_loader_e2e_preserve_symlinks") local_repository( name = "build_bazel_rules_nodejs", - path = "../../..", + path = "../../../bazel-bin/local_testing_package", ) load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install") diff --git a/internal/e2e/packages/WORKSPACE b/internal/e2e/packages/WORKSPACE index f6405d81eb..f50bffa236 100644 --- a/internal/e2e/packages/WORKSPACE +++ b/internal/e2e/packages/WORKSPACE @@ -2,7 +2,7 @@ workspace(name = "packages_example") local_repository( name = "build_bazel_rules_nodejs", - path = "../../..", + path = "../../../bazel-bin/local_testing_package", ) load("@build_bazel_rules_nodejs//:package.bzl", "check_rules_nodejs_version") From d8018c3e98d3957281040c71079ddd407c76f033 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Thu, 7 Feb 2019 15:31:51 -0800 Subject: [PATCH 4/4] Lint fix --- internal/e2e/bazel_workspaces/WORKSPACE | 6 +++--- internal/e2e/bazel_workspaces_compat/WORKSPACE | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/e2e/bazel_workspaces/WORKSPACE b/internal/e2e/bazel_workspaces/WORKSPACE index 313582de05..5af579ec02 100644 --- a/internal/e2e/bazel_workspaces/WORKSPACE +++ b/internal/e2e/bazel_workspaces/WORKSPACE @@ -11,11 +11,11 @@ node_repositories() yarn_install( name = "npm", - package_json = "//:package.json", - yarn_lock = "//:yarn.lock", # Need to a reference to this workspace in data so that # the external/bazel_workspaces is setup before yarn_install runs - data = ["@bazel_workspaces//:package.json"] + data = ["@bazel_workspaces//:package.json"], + package_json = "//:package.json", + yarn_lock = "//:yarn.lock", ) load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies") diff --git a/internal/e2e/bazel_workspaces_compat/WORKSPACE b/internal/e2e/bazel_workspaces_compat/WORKSPACE index a7e4eccfd3..a8ff911225 100644 --- a/internal/e2e/bazel_workspaces_compat/WORKSPACE +++ b/internal/e2e/bazel_workspaces_compat/WORKSPACE @@ -11,11 +11,11 @@ node_repositories() yarn_install( name = "npm", - package_json = "//:package.json", - yarn_lock = "//:yarn.lock", # Need to a reference to this workspace in data so that # the external/bazel_workspaces is setup before yarn_install runs - data = ["@bazel_workspaces_compat//:package.json"] + data = ["@bazel_workspaces_compat//:package.json"], + package_json = "//:package.json", + yarn_lock = "//:yarn.lock", ) load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")