Skip to content

Commit

Permalink
chore: update to Bazel 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle authored and gregmagolan committed Dec 20, 2019
1 parent ddbae15 commit 365f6dd
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 34 deletions.
14 changes: 9 additions & 5 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
bazel: 1.2.1
bazel: 2.0.0
tasks:
ubuntu1604:
name: ubuntu1604
Expand All @@ -11,7 +11,8 @@ tasks:
- "//internal/node/test:has_deps"
- "//internal/node/test:has_deps_hybrid"
- "//internal/npm_install/test:index"
- "@fine_grained_deps_yarn//typescript/bin:tsc"
# Disabled due to https://github.com/bazelbuild/rules_nodejs/issues/1486
#- "@fine_grained_deps_yarn//typescript/bin:tsc"
- "@bazel_workspace_a//:bin"
- "@bazel_workspace_a//subdir:bin"
- "@bazel_workspace_b//:bin"
Expand Down Expand Up @@ -86,7 +87,8 @@ tasks:
- "//internal/node/test:has_deps"
- "//internal/node/test:has_deps_hybrid"
- "//internal/npm_install/test:index"
- "@fine_grained_deps_yarn//typescript/bin:tsc"
# Disabled due to https://github.com/bazelbuild/rules_nodejs/issues/1486
#- "@fine_grained_deps_yarn//typescript/bin:tsc"
- "@bazel_workspace_a//:bin"
- "@bazel_workspace_a//subdir:bin"
- "@bazel_workspace_b//:bin"
Expand Down Expand Up @@ -201,7 +203,8 @@ tasks:
- "//internal/node/test:has_deps"
- "//internal/node/test:has_deps_hybrid"
- "//internal/npm_install/test:index"
- "@fine_grained_deps_yarn//typescript/bin:tsc"
# Disabled due to https://github.com/bazelbuild/rules_nodejs/issues/1486
#- "@fine_grained_deps_yarn//typescript/bin:tsc"
- "@bazel_workspace_a//:bin"
- "@bazel_workspace_a//subdir:bin"
- "@bazel_workspace_b//:bin"
Expand Down Expand Up @@ -298,7 +301,8 @@ tasks:
- "//internal/node/test:has_deps"
- "//internal/node/test:has_deps_hybrid"
- "//internal/npm_install/test:index"
- "@fine_grained_deps_yarn//typescript/bin:tsc"
# Disabled due to https://github.com/bazelbuild/rules_nodejs/issues/1486
#- "@fine_grained_deps_yarn//typescript/bin:tsc"
- "@bazel_workspace_a//:bin"
- "@bazel_workspace_a//subdir:bin"
- "@bazel_workspace_b//:bin"
Expand Down
1 change: 0 additions & 1 deletion examples/user_managed_deps/.bazelignore

This file was deleted.

2 changes: 1 addition & 1 deletion index.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ VERSION = "0.42.3"
# we will test against multiple versions.
# This version should be updated together with the version of the @bazel/bazel
# package in package.json. This is asserted in //internal:package_json_test.
BAZEL_VERSION = "1.1.0"
BAZEL_VERSION = "2.0.0"

def check_rules_nodejs_version(minimum_version_string):
"""
Expand Down
5 changes: 3 additions & 2 deletions internal/node/node_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,9 @@ _nodejs_repo_host_os_alias = repository_rule(_nodejs_host_os_alias_impl)

def node_repositories(**kwargs):
"""
Wrapper macro around node_repositories_rule to call it for each platform, register bazel toolchains,
and make other convenience repositories.
Wrapper macro around node_repositories_rule to call it for each platform.
Also register bazel toolchains, and make other convenience repositories.
Note, the documentation is generated from the node_repositories_rule, not this macro.
"""
Expand Down
2 changes: 2 additions & 0 deletions package.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def rules_nodejs_dev_dependencies():

http_archive(
name = "io_bazel_stardoc",
# Workaround for https://github.com/bazelbuild/stardoc/issues/43
patches = ["@build_bazel_rules_nodejs//:stardoc.patch"],
sha256 = "6d07d18c15abb0f6d393adbd6075cd661a2219faab56a9517741f0fc755f6f3c",
strip_prefix = "stardoc-0.4.0",
urls = [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@babel/cli": "^7.6.2",
"@babel/core": "^7.6.2",
"@babel/preset-env": "^7.6.2",
"@bazel/bazel": "^1.1.0",
"@bazel/bazel": "^2.0.0",
"@bazel/buildifier": "^0.26.0",
"@bazel/buildozer": "^0.29.0",
"@bazel/hide-bazel-files": "file:./packages/hide-bazel-files",
Expand Down
2 changes: 1 addition & 1 deletion packages/create/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ install_bazel_dependencies()`;
load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
ts_setup_workspace()`;
}
write('WORKSPACE', workspaceContent);
write('WORKSPACE.bazel', workspaceContent);
write('.bazelignore', `node_modules`);
write(
'package.json',
Expand Down
8 changes: 4 additions & 4 deletions packages/create/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,23 @@ const projFiles = fs.readdirSync('some_project');
if (!projFiles.indexOf('.bazelrc') < 0) {
fail('project should have .bazelrc');
}
let wkspContent = read('some_project/WORKSPACE');
let wkspContent = read('some_project/WORKSPACE.bazel');
if (wkspContent.indexOf('npm_install(') < 0) {
fail('should use npm by default');
}
// TODO: run bazel in the new directory to verify a build works

exitCode = main(['configure_pkgMgr', '--packageManager=yarn'], captureError);
if (exitCode != 0) fail('should be success');
wkspContent = read('configure_pkgMgr/WORKSPACE');
wkspContent = read('configure_pkgMgr/WORKSPACE.bazel');
if (wkspContent.indexOf('yarn_install(') < 0) {
fail('should use yarn when requested');
}

process.env['_'] = '/usr/bin/yarn';
exitCode = main(['default_to_yarn']);
if (exitCode != 0) fail('should be success');
wkspContent = read('default_to_yarn/WORKSPACE');
wkspContent = read('default_to_yarn/WORKSPACE.bazel');
if (wkspContent.indexOf('yarn_install(') < 0) {
fail('should use yarn by default');
}
Expand All @@ -74,7 +74,7 @@ let pkgContent = read('with_ts/package.json');
if (pkgContent.indexOf('"@bazel/typescript": "latest"') < 0) {
fail('should install @bazel/typescript dependency', pkgContent);
}
wkspContent = read('with_ts/WORKSPACE');
wkspContent = read('with_ts/WORKSPACE.bazel');
if (wkspContent.indexOf('ts_setup_workspace(') < 0) {
fail('should install extra TS repositories');
}
13 changes: 13 additions & 0 deletions stardoc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git stardoc/stardoc.bzl stardoc/stardoc.bzl
index 456aca7..a065104 100644
--- stardoc/stardoc.bzl
+++ stardoc/stardoc.bzl
@@ -32,7 +32,7 @@ def _stardoc_impl(ctx):
])
stardoc_args = ctx.actions.args()
stardoc_args.add("--input=" + str(ctx.file.input.owner))
- stardoc_args.add("--workspace_name=" + ctx.label.workspace_name)
+ stardoc_args.add("--workspace_name=" + ctx.workspace_name)
stardoc_args.add_all(
ctx.attr.symbol_names,
format_each = "--symbols=%s",
38 changes: 19 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -654,31 +654,31 @@
lodash "^4.17.13"
to-fast-properties "^2.0.0"

"@bazel/bazel-darwin_x64@1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-1.1.0.tgz#9402ecadfaf0383bc366ef5b37b933e0d0e804fc"
integrity sha512-/dnpkjqnl2Qrcy+qFerOe+lV9QZ2HoUHtTplQgRxa+OH8AtQ7mcopdJ9/3Y10GqgT2Kp+AR6G99R59/Si+BOMg==
"@bazel/bazel-darwin_x64@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-2.0.0.tgz#bd678069216dd470c6816a22c405f21e7f048038"
integrity sha512-I/pP+B+2xfY0g+OEpEcVnk8rizuC761pAzBOQjP3b+gz3AzeRgm05CpcSY7tfPIppMSYoy3uTZJ1XlwgUg7IQQ==

"@bazel/bazel-linux_x64@1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-1.1.0.tgz#98d75240e3e9ff5ba14fa48d6241d5d741e89926"
integrity sha512-yDR1URphRQTkXYjl4U2NLmbGR8ar8imhytK3txZZqlPf5pfWI/7wa7gSg0H4VbRRLIGAy/nD2eXZpgSj1eUiqA==
"@bazel/bazel-linux_x64@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-2.0.0.tgz#2c76e3301e9178a90ec3ad00649e89b953eda0b7"
integrity sha512-iOr45G+511IbP7e+ISriG97WpfCAVXekTrTgL5mGg3NDBFCVNs350VquHAvmlXAoP5+IEug2pCOlkdEl4bLl8g==

"@bazel/bazel-win32_x64@1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-1.1.0.tgz#e9c80a8c6495834ee7fc6184c425284d1151ac38"
integrity sha512-mj3ujcifKO+hjAjHvLoutYxzs90YWuc/fYJuVaEQrk4YFrRW5g70OpjN74zzBHRstObOjSZ3cOj+HDB19SIFKw==
"@bazel/bazel-win32_x64@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-2.0.0.tgz#f12ac0738d2eac0fd255f099776194807cedfe50"
integrity sha512-5qs2qoa/paG/YYEM0yvrwuJIShoPVK2FX+Oz9jEWAQJsmU4drHA9Aq+gbBOirEFLmvYhleZ9XORCwu/5uAo8vA==

"@bazel/bazel@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel/-/bazel-1.1.0.tgz#9ce8308e44d76132812e908fcbc9e9051c7c2e1a"
integrity sha512-3NOWRHG1i/tAVQWuStIUuliFLVfjcKMbqIlc2Q206VWQ5pjlKgo0qa+qrWb0G6BYq+N3hxT4IwBz+Z17A8dbbg==
"@bazel/bazel@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel/-/bazel-2.0.0.tgz#feb8cf5a40ea6437ef69cac2a92072118b11c230"
integrity sha512-KQbv5dHNSfutbhXCc3KVMuBXPpUh6Af/hT9IRIaMTuiB6Nq2gEW9Z3aNqncopdZqV848V/qYxnqPnQ+S37fMyQ==
dependencies:
"@bazel/hide-bazel-files" latest
optionalDependencies:
"@bazel/bazel-darwin_x64" "1.1.0"
"@bazel/bazel-linux_x64" "1.1.0"
"@bazel/bazel-win32_x64" "1.1.0"
"@bazel/bazel-darwin_x64" "2.0.0"
"@bazel/bazel-linux_x64" "2.0.0"
"@bazel/bazel-win32_x64" "2.0.0"

"@bazel/[email protected]":
version "0.26.0"
Expand Down

0 comments on commit 365f6dd

Please sign in to comment.