Fix for Bazel incompatible changes
- Update to the new args API
- Update the dependencies
- Avoid depset concatenation
Fixes #342
Tested:
`bazel-0.21 test //... --all_incompatible_changes --incompatible_disable_deprecated_attr_params=false --incompatible_depset_is_not_iterable=false`
Closes #378
PiperOrigin-RevId: 231994159
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 1f8ff5e..f705ad6 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,3 +1,5 @@
+*Attention Googlers:* This repo has its Source of Truth in Piper. After sending a PR, you can follow http://g3doc/third_party/bazel_rules/rules_typescript/README.google.md#merging-changes to get your change merged.
+
## PR Checklist
Please check if your PR fulfills the following requirements:
diff --git a/internal/build_defs.bzl b/internal/build_defs.bzl
index d194f7e..fbf93d4 100644
--- a/internal/build_defs.bzl
+++ b/internal/build_defs.bzl
@@ -103,7 +103,7 @@
# These deps are identified by the NodeModuleInfo provider.
for d in ctx.attr.deps:
if NodeModuleInfo in d:
- action_inputs.extend(_filter_ts_inputs(d.files))
+ action_inputs.extend(_filter_ts_inputs(d.files.to_list()))
if ctx.file.tsconfig:
action_inputs.append(ctx.file.tsconfig)
diff --git a/internal/common/compilation.bzl b/internal/common/compilation.bzl
index 3672044..99b043a 100644
--- a/internal/common/compilation.bzl
+++ b/internal/common/compilation.bzl
@@ -256,7 +256,7 @@
tsickle_externs = [ctx.actions.declare_file(ctx.label.name + ".externs.js")]
dep_declarations = _collect_dep_declarations(ctx, deps)
- input_declarations = dep_declarations.transitive + src_declarations
+ input_declarations = depset(src_declarations, transitive = [dep_declarations.transitive])
type_blacklisted_declarations = dep_declarations.type_blacklisted
if not is_library and not ctx.attr.generate_externs:
type_blacklisted_declarations += srcs_files
@@ -276,7 +276,7 @@
if "TYPESCRIPT_PERF_TRACE_TARGET" in ctx.var:
perf_trace = str(ctx.label) == ctx.var["TYPESCRIPT_PERF_TRACE_TARGET"]
- compilation_inputs = input_declarations + srcs_files
+ compilation_inputs = depset(srcs_files, transitive = [input_declarations])
tsickle_externs_path = tsickle_externs[0] if tsickle_externs else None
# Calculate allowed dependencies for strict deps enforcement.
@@ -293,7 +293,7 @@
srcs_files,
jsx_factory = jsx_factory,
tsickle_externs = tsickle_externs_path,
- type_blacklisted_declarations = type_blacklisted_declarations,
+ type_blacklisted_declarations = type_blacklisted_declarations.to_list(),
allowed_deps = allowed_deps,
)
@@ -332,7 +332,7 @@
replay_params = None
if has_sources:
- inputs = compilation_inputs + [ctx.outputs.tsconfig]
+ inputs = depset([ctx.outputs.tsconfig], transitive = [compilation_inputs])
replay_params = compile_action(
ctx,
inputs,
@@ -376,7 +376,7 @@
ctx.actions.write(output = tsconfig_json_es5, content = json_marshal(
tsconfig_es5,
))
- inputs = compilation_inputs + [tsconfig_json_es5]
+ inputs = depset([tsconfig_json_es5], transitive = [compilation_inputs])
devmode_compile_action(
ctx,
inputs,
@@ -387,7 +387,7 @@
# TODO(martinprobst): Merge the generated .d.ts files, and enforce strict
# deps (do not re-export transitive types from the transitive closure).
- transitive_decls = dep_declarations.transitive + src_declarations + gen_declarations
+ transitive_decls = depset(src_declarations + gen_declarations, transitive = [dep_declarations.transitive])
# both ts_library and ts_declarations generate .closure.js files:
# - for libraries, this is the ES6/production code
diff --git a/internal/protobufjs/ts_proto_library.bzl b/internal/protobufjs/ts_proto_library.bzl
index 07ae0d3..ee2ea3e 100644
--- a/internal/protobufjs/ts_proto_library.bzl
+++ b/internal/protobufjs/ts_proto_library.bzl
@@ -23,11 +23,11 @@
# Reference of arguments:
# https://github.com/dcodeIO/ProtoBuf.js/#pbjs-for-javascript
args = actions.args()
- args.add(["--target", "static-module"])
- args.add(["--wrap", wrap])
+ args.add_all(["--target", "static-module"])
+ args.add_all(["--wrap", wrap])
args.add("--strict-long") # Force usage of Long type with int64 fields
- args.add(["--out", js_file.path + ".tmpl"])
- args.add([f.path for f in proto_files])
+ args.add_all(["--out", js_file.path + ".tmpl"])
+ args.add_all(proto_files)
actions.run(
executable = executable._pbjs,
@@ -55,7 +55,7 @@
# Reference of arguments:
# https://github.com/dcodeIO/ProtoBuf.js/#pbts-for-typescript
args = actions.args()
- args.add(["--out", ts_file.path])
+ args.add_all(["--out", ts_file.path])
args.add(js_file.path)
actions.run(
diff --git a/package.bzl b/package.bzl
index 68d1afd..5ba34e3 100644
--- a/package.bzl
+++ b/package.bzl
@@ -104,7 +104,8 @@
_maybe(
http_archive,
name = "io_bazel",
- urls = ["https://github.com/bazelbuild/bazel/releases/download/0.17.1/bazel-0.17.1-dist.zip"],
+ urls = ["https://github.com/bazelbuild/bazel/releases/download/0.21.0/bazel-0.21.0-dist.zip"],
+ sha256 = "6ccb831e683179e0cfb351cb11ea297b4db48f9eab987601c038aa0f83037db4",
)
#############################################
@@ -120,9 +121,9 @@
http_archive(
name = "io_bazel_skydoc",
- url = "https://github.com/bazelbuild/skydoc/archive/9bbdf62c03b5c3fed231604f78d3976f47753d79.zip", # 2018-11-20
- strip_prefix = "skydoc-9bbdf62c03b5c3fed231604f78d3976f47753d79",
- sha256 = "07ae937026cb56000fb268d4986b220e868c1bdfe6aac27ecada4b4b3dae246f",
+ url = "https://github.com/bazelbuild/skydoc/archive/82fdbfe797c6591d8732df0c0389a2b1c3e50992.zip", # 2018-12-12
+ strip_prefix = "skydoc-82fdbfe797c6591d8732df0c0389a2b1c3e50992",
+ sha256 = "75fd965a71ca1f0d0406d0d0fb0964d24090146a853f58b432761a1a6c6b47b9",
)
def _maybe(repo_rule, name, **kwargs):