<commit_before># Copyright 2017 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.

"""Skylib module containing a library rule for aggregating rules files."""

StarlarkLibraryInfo = provider(
    "Information on contained Starlark rules.",
    fields = {
        "srcs": "Top level rules files.",
        "transitive_srcs": "Transitive closure of rules files required for " +
                           "interpretation of the srcs",
    },
)

def _bzl_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 `bzl_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.
        StarlarkLibraryInfo(
            srcs = ctx.files.srcs,
            transitive_srcs = all_files,
        ),
    ]

bzl_library = rule(
    implementation = _bzl_library_impl,<commit_msg>Use transitive_files in runfiles instead of a list of files (#69)<commit_after># Copyright 2017 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.

"""Skylib module containing a library rule for aggregating rules files."""

StarlarkLibraryInfo = provider(
    "Information on contained Starlark rules.",
    fields = {
        "srcs": "Top level rules files.",
        "transitive_srcs": "Transitive closure of rules files required for " +
                           "interpretation of the srcs",
    },
)

def _bzl_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 `bzl_library` can be referenced as `data` from
        # a separate program, or from `tools` of a genrule().
        DefaultInfo(
            files = all_files,
            runfiles = ctx.runfiles(transitive_files = all_files),
        ),

        # We also define our own provider struct, for aggregation and testing.
        StarlarkLibraryInfo(
            srcs = ctx.files.srcs,
            transitive_srcs = all_files,
        ),
    ]

bzl_library = rule(
    implementation = _bzl_library_impl,
{'fraction_non_alphanumeric': 0.08276427205681508, 'fraction_numerical': 0.004916689429117728, 'mean_word_length': 2.958918918918919, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6837331', 'n_tokens_mistral': 1022, 'n_tokens_neox': 996, 'n_words': 403}