diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java b/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java index 6a1e1059372f0e..6e73aa5bc9c15f 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java +++ b/src/main/java/com/google/devtools/build/lib/rules/python/PythonConfigurationLoader.java @@ -40,7 +40,7 @@ public PythonConfiguration create(BuildOptions buildOptions) pythonOptions.buildTransitiveRunfilesTrees, /*oldPyVersionApiAllowed=*/ !pythonOptions.experimentalRemoveOldPythonVersionApi, /*useNewPyVersionSemantics=*/ pythonOptions.experimentalAllowPythonVersionTransitions, - /*disallowLegacyPyProvider=*/ pythonOptions.experimentalDisallowLegacyPyProvider); + /*disallowLegacyPyProvider=*/ pythonOptions.incompatibleDisallowLegacyPyProvider); } @Override diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java b/src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java index 4e0b5b934eb1c6..1c8a9e40c39593 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java +++ b/src/main/java/com/google/devtools/build/lib/rules/python/PythonOptions.java @@ -169,18 +169,20 @@ public String getTypeDescription() { private static final OptionDefinition HOST_FORCE_PYTHON_DEFINITION = OptionsParser.getOptionDefinitionByName(PythonOptions.class, "host_force_python"); - // TODO(#7010): Change the option name to "incompatible_..." and enable the appropriate metadata - // tags. @Option( - name = "experimental_disallow_legacy_py_provider", + name = "incompatible_disallow_legacy_py_provider", defaultValue = "false", documentationCategory = OptionDocumentationCategory.SKYLARK_SEMANTICS, effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS}, + metadataTags = { + OptionMetadataTag.INCOMPATIBLE_CHANGE, + OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES + }, help = "If set to true, native Python rules will neither produce nor consume the legacy \"py\" " + "provider. Use PyInfo instead. Under this flag, passing the legacy provider to a " + "Python target will be an error.") - public boolean experimentalDisallowLegacyPyProvider; + public boolean incompatibleDisallowLegacyPyProvider; @Override public Map getSelectRestrictions() { @@ -284,7 +286,7 @@ public FragmentOptions getHost() { (hostForcePython != null) ? hostForcePython : PythonVersion.DEFAULT_TARGET_VALUE; hostPythonOptions.setPythonVersion(hostVersion); hostPythonOptions.buildPythonZip = buildPythonZip; - hostPythonOptions.experimentalDisallowLegacyPyProvider = experimentalDisallowLegacyPyProvider; + hostPythonOptions.incompatibleDisallowLegacyPyProvider = incompatibleDisallowLegacyPyProvider; return hostPythonOptions; } diff --git a/src/test/java/com/google/devtools/build/lib/rules/python/PyBaseConfiguredTargetTestBase.java b/src/test/java/com/google/devtools/build/lib/rules/python/PyBaseConfiguredTargetTestBase.java index 527b67b6a78d51..ac331bc0373e23 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/python/PyBaseConfiguredTargetTestBase.java +++ b/src/test/java/com/google/devtools/build/lib/rules/python/PyBaseConfiguredTargetTestBase.java @@ -142,7 +142,7 @@ public void srcsPackageNameCannotHaveHyphen() throws Exception { @Test public void producesBothModernAndLegacyProviders_WithoutIncompatibleFlag() throws Exception { - useConfiguration("--experimental_disallow_legacy_py_provider=false"); + useConfiguration("--incompatible_disallow_legacy_py_provider=false"); scratch.file( "pkg/BUILD", // ruleName + "(", @@ -155,7 +155,7 @@ public void producesBothModernAndLegacyProviders_WithoutIncompatibleFlag() throw @Test public void producesOnlyModernProvider_WithIncompatibleFlag() throws Exception { - useConfiguration("--experimental_disallow_legacy_py_provider=true"); + useConfiguration("--incompatible_disallow_legacy_py_provider=true"); scratch.file( "pkg/BUILD", // ruleName + "(", @@ -168,7 +168,7 @@ public void producesOnlyModernProvider_WithIncompatibleFlag() throws Exception { @Test public void consumesLegacyProvider_WithoutIncompatibleFlag() throws Exception { - useConfiguration("--experimental_disallow_legacy_py_provider=false"); + useConfiguration("--incompatible_disallow_legacy_py_provider=false"); scratch.file( "pkg/rules.bzl", "def _myrule_impl(ctx):", @@ -194,7 +194,7 @@ public void consumesLegacyProvider_WithoutIncompatibleFlag() throws Exception { @Test public void rejectsLegacyProvider_WithIncompatibleFlag() throws Exception { - useConfiguration("--experimental_disallow_legacy_py_provider=true"); + useConfiguration("--incompatible_disallow_legacy_py_provider=true"); scratch.file( "pkg/rules.bzl", "def _myrule_impl(ctx):", diff --git a/src/test/java/com/google/devtools/build/lib/rules/python/PythonConfigurationTest.java b/src/test/java/com/google/devtools/build/lib/rules/python/PythonConfigurationTest.java index 60add6fe63cdf7..204383a3ace5a2 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/python/PythonConfigurationTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/python/PythonConfigurationTest.java @@ -165,12 +165,12 @@ public void getHost_CopiesMostValues() throws Exception { "--experimental_allow_python_version_transitions=true", "--experimental_remove_old_python_version_api=true", "--build_python_zip=true", - "--experimental_disallow_legacy_py_provider=true"); + "--incompatible_disallow_legacy_py_provider=true"); PythonOptions hostOpts = (PythonOptions) opts.getHost(); assertThat(hostOpts.experimentalAllowPythonVersionTransitions).isTrue(); assertThat(hostOpts.experimentalRemoveOldPythonVersionApi).isTrue(); assertThat(hostOpts.buildPythonZip).isEqualTo(TriState.YES); - assertThat(hostOpts.experimentalDisallowLegacyPyProvider).isTrue(); + assertThat(hostOpts.incompatibleDisallowLegacyPyProvider).isTrue(); } @Test