From fd461afdbc9a0a80dc2cafee06c62794063ec224 Mon Sep 17 00:00:00 2001 From: johnjbarton Date: Wed, 14 Apr 2021 13:08:51 -0700 Subject: [PATCH 1/2] Accumulate the depsets in a list then merge them. Building the depsets recursively blows up --- web/internal/runfiles.bzl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/web/internal/runfiles.bzl b/web/internal/runfiles.bzl index b00dc233..9c02331b 100644 --- a/web/internal/runfiles.bzl +++ b/web/internal/runfiles.bzl @@ -25,22 +25,22 @@ def _collect(ctx, files = [], targets = []): A configured runfiles object that include data and default runfiles for the rule, all transitive runfiles from targets, and all files from files. """ - transitive_runfiles = depset() - dep_files = depset() + transitive_runfiles_list = [] + transitive_files = [] default_runfiles = [] data_runfiles = [] - for target in targets: if hasattr(target, "transitive_runfiles"): - transitive_runfiles = depset( - transitive = [transitive_runfiles, target.transitive_runfiles], - ) + transitive_runfiles_list.extend(target.transitive_runfiles) if hasattr(target, "default_runfiles"): - default_runfiles += [target.default_runfiles] + default_runfiles.append(target.default_runfiles) if hasattr(target, "data_runfiles"): - data_runfiles += [target.data_runfiles] + data_runfiles.append(target.data_runfiles) if hasattr(target, "files"): - dep_files = depset(transitive = [dep_files, target.files]) + transitive_files.append(target.files) + + dep_files = depset(transitive = transitive_files) + transitive_runfiles = depset(transitive = transitive_runfiles_list) result = ctx.runfiles( collect_data = True, From 671b5eda5f5262f29a61f1add6aa0105b1dee366 Mon Sep 17 00:00:00 2001 From: johnjbarton Date: Thu, 15 Apr 2021 10:38:23 -0700 Subject: [PATCH 2/2] Accumulate depsets in a single list. Avoid using to_list(). --- web/internal/runfiles.bzl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/web/internal/runfiles.bzl b/web/internal/runfiles.bzl index 9c02331b..945f9103 100644 --- a/web/internal/runfiles.bzl +++ b/web/internal/runfiles.bzl @@ -26,7 +26,6 @@ def _collect(ctx, files = [], targets = []): rule, all transitive runfiles from targets, and all files from files. """ transitive_runfiles_list = [] - transitive_files = [] default_runfiles = [] data_runfiles = [] for target in targets: @@ -37,15 +36,14 @@ def _collect(ctx, files = [], targets = []): if hasattr(target, "data_runfiles"): data_runfiles.append(target.data_runfiles) if hasattr(target, "files"): - transitive_files.append(target.files) + transitive_runfiles_list.append(target.files) - dep_files = depset(transitive = transitive_files) transitive_runfiles = depset(transitive = transitive_runfiles_list) result = ctx.runfiles( collect_data = True, collect_default = True, - files = files + dep_files.to_list(), + files = files, transitive_files = transitive_runfiles, )