Disable outputs param of rule function
This constitutes an incompatible change guarded by flag --incompatible_no_rule_outputs_param. See #7977 for further details.
Implementation for #7977.
RELNOTES: The `outputs` parameter of the `rule()` function is deprecated and attached to flag `--incompatible_no_rule_outputs_param`. Migrate rules to use `OutputGroupInfo` or `attr.output` instead. See https://github.com/bazelbuild/bazel/issues/7977 for more info.
PiperOrigin-RevId: 244032985
diff --git a/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java b/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java
index 294d329..6b6e84b 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java
+++ b/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java
@@ -151,6 +151,7 @@
"--incompatible_no_attr_license=" + rand.nextBoolean(),
"--incompatible_no_kwargs_in_build_files=" + rand.nextBoolean(),
"--incompatible_no_output_attr_default=" + rand.nextBoolean(),
+ "--incompatible_no_rule_outputs_param=" + rand.nextBoolean(),
"--incompatible_no_support_tools_in_action_inputs=" + rand.nextBoolean(),
"--incompatible_no_target_output_group=" + rand.nextBoolean(),
"--incompatible_no_transitive_loads=" + rand.nextBoolean(),
@@ -199,6 +200,7 @@
.incompatibleNoAttrLicense(rand.nextBoolean())
.incompatibleNoKwargsInBuildFiles(rand.nextBoolean())
.incompatibleNoOutputAttrDefault(rand.nextBoolean())
+ .incompatibleNoRuleOutputsParam(rand.nextBoolean())
.incompatibleNoSupportToolsInActionInputs(rand.nextBoolean())
.incompatibleNoTargetOutputGroup(rand.nextBoolean())
.incompatibleNoTransitiveLoads(rand.nextBoolean())
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java
index 43b5c4b..cb7f3d8 100644
--- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkIntegrationTest.java
@@ -2893,6 +2893,30 @@
+ "--incompatible_disallow_struct_provider_syntax=false");
}
+ @Test
+ public void testNoRuleOutputsParam() throws Exception {
+ setSkylarkSemanticsOptions("--incompatible_no_rule_outputs_param=true");
+ scratch.file(
+ "test/skylark/test_rule.bzl",
+ "def _impl(ctx):",
+ " output = ctx.outputs.out",
+ " ctx.actions.write(output = output, content = 'hello')",
+ "",
+ "my_rule = rule(",
+ " implementation = _impl,",
+ " outputs = {\"out\": \"%{name}.txt\"})");
+ scratch.file(
+ "test/skylark/BUILD",
+ "load('//test/skylark:test_rule.bzl', 'my_rule')",
+ "my_rule(name = 'target')");
+
+ reporter.removeHandler(failFastHandler);
+ getConfiguredTarget("//test/skylark:target");
+ assertContainsEvent(
+ "parameter 'outputs' is deprecated and will be removed soon. It may be temporarily "
+ + "re-enabled by setting --incompatible_no_rule_outputs_param=false");
+ }
+
/**
* Skylark integration test that forces inlining.
*/