Skip to content

Commit

Permalink
Refactor the files and runfiles fields from strings to the DefaultInf…
Browse files Browse the repository at this point in the history
…o() provider.

This is the beginning of removing the legacy providers, per bazelbuild/bazel#7347

See https://docs.bazel.build/versions/master/skylark/rules.html#migrating-from-legacy-providers:
"
The fields files, runfiles, data_runfiles, default_runfiles, and executable correspond to the same-named fields of DefaultInfo. It is not allowed to specify any of these fields while also returning a DefaultInfo modern provider.
"

PiperOrigin-RevId: 264941716
  • Loading branch information
alexeagle committed Aug 23, 2019
1 parent ac318d6 commit 8613150
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,18 @@ def compile_ts(
transitive_es6_sources = depset(transitive = [transitive_es6_sources, es6_sources])

return {
"files": depset(transitive = files_depsets),
"providers": [
DefaultInfo(
runfiles = ctx.runfiles(
# Note: don't include files=... here, or they will *always* be built
# by any dependent rule, regardless of whether it needs them.
# But these attributes are needed to pass along any input runfiles:
collect_default = True,
collect_data = True,
),
files = depset(transitive = files_depsets),
),
],
"instrumented_files": {
"dependency_attributes": ["deps", "runtime_deps"],
"extensions": ["ts"],
Expand All @@ -482,13 +493,6 @@ def compile_ts(
"es5_sources": es5_sources,
"es6_sources": es6_sources,
},
"runfiles": ctx.runfiles(
# Note: don't include files=... here, or they will *always* be built
# by any dependent rule, regardless of whether it needs them.
# But these attributes are needed to pass along any input runfiles:
collect_default = True,
collect_data = True,
),
# Expose the tags so that a Skylark aspect can access them.
"tags": ctx.attr.tags if hasattr(ctx.attr, "tags") else ctx.rule.attr.tags,
# TODO(martinprobst): Prune transitive deps, only re-export what's needed.
Expand Down

0 comments on commit 8613150

Please sign in to comment.