diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2018-06-12 13:09:57 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2018-06-13 10:58:35 -0400 |
commit | e5203c0f5d51cb263f6edc23b8b1722dcde0bd4e (patch) | |
tree | 082ad1c42957b69c0c69cc225ab0a12cee0e338a /skylark_library.bzl | |
parent | a5431b7babb0a646151ffcca7fef47399026448f (diff) | |
download | bazel-skylib-e5203c0f5d51cb263f6edc23b8b1722dcde0bd4e.tar.gz |
Reformat .bzl files with buildifier and add format check.
Buildifier 0.12.0 includes initial support for reformatting .bzl files.
- Reformat all the bzl files.
- Expand the travis check to check the .bzl files also.
Diffstat (limited to 'skylark_library.bzl')
-rw-r--r-- | skylark_library.bzl | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/skylark_library.bzl b/skylark_library.bzl index 5791b00..a91639d 100644 --- a/skylark_library.bzl +++ b/skylark_library.bzl @@ -15,46 +15,46 @@ """Skylib module containing a library rule for aggregating rules files.""" SkylarkLibraryInfo = provider( - 'Information on contained Skylark rules.', - fields={ - 'srcs': 'Top level rules files.', - 'transitive_srcs': 'Transitive closure of rules files required for ' + - 'interpretation of the srcs', + "Information on contained Skylark rules.", + fields = { + "srcs": "Top level rules files.", + "transitive_srcs": "Transitive closure of rules files required for " + + "interpretation of the srcs", }, ) def _skylark_library_impl(ctx): - deps_files = [depset(x.files, order="postorder") for x in ctx.attr.deps] - all_files = depset(ctx.files.srcs, order="postorder", transitive=deps_files) - return [ - # All dependent files should be listed in both `files` and in `runfiles`; - # this ensures that a `skylark_library` can be referenced as `data` from - # a separate program, or from `tools` of a genrule(). - DefaultInfo( - files=all_files, - runfiles=ctx.runfiles(files=list(all_files)), - ), + deps_files = [depset(x.files, order = "postorder") for x in ctx.attr.deps] + all_files = depset(ctx.files.srcs, order = "postorder", transitive = deps_files) + return [ + # All dependent files should be listed in both `files` and in `runfiles`; + # this ensures that a `skylark_library` can be referenced as `data` from + # a separate program, or from `tools` of a genrule(). + DefaultInfo( + files = all_files, + runfiles = ctx.runfiles(files = list(all_files)), + ), - # We also define our own provider struct, for aggregation and testing. - SkylarkLibraryInfo( - srcs=ctx.files.srcs, - transitive_srcs=all_files, - ), - ] + # We also define our own provider struct, for aggregation and testing. + SkylarkLibraryInfo( + srcs = ctx.files.srcs, + transitive_srcs = all_files, + ), + ] skylark_library = rule( - implementation=_skylark_library_impl, - attrs={ + implementation = _skylark_library_impl, + attrs = { "srcs": attr.label_list( - allow_files=[".bzl"], + allow_files = [".bzl"], ), "deps": attr.label_list( - allow_files=[".bzl"], - providers=[ + allow_files = [".bzl"], + providers = [ [SkylarkLibraryInfo], ], - ) - } + ), + }, ) """Creates a logical collection of Skylark .bzl files. |