From 7d5493d922761c3ce0037f0025912cc532c55ad7 Mon Sep 17 00:00:00 2001 From: jcater Date: Thu, 6 May 2021 11:31:47 -0700 Subject: [PATCH] Update creating exec groups that explicitly copy from defaults. Also add an ExecGroupSubject to improve testing. PiperOrigin-RevId: 372387338 --- .../starlark/StarlarkRuleClassFunctions.java | 2 +- .../build/lib/packages/ExecGroup.java | 14 ++-- .../build/lib/packages/RuleClass.java | 9 +-- .../lib/analysis/StarlarkExecGroupTest.java | 14 ++-- .../devtools/build/lib/analysis/testing/BUILD | 1 + .../analysis/testing/ExecGroupSubject.java | 78 +++++++++++++++++++ .../google/devtools/build/lib/packages/BUILD | 1 + .../lib/packages/RuleClassBuilderTest.java | 16 ++-- 8 files changed, 106 insertions(+), 29 deletions(-) create mode 100644 src/test/java/com/google/devtools/build/lib/analysis/testing/ExecGroupSubject.java diff --git a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java index 64825ca315aada..2a0f67134185a0 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java @@ -933,7 +933,7 @@ public ExecGroup execGroup( throw Starlark.errorf( "An exec group cannot set copy_from_rule=True and declare toolchains or constraints."); } - return ExecGroup.COPY_FROM_RULE_EXEC_GROUP; + return ExecGroup.copyFromDefault(); } ImmutableSet