making --incompatible_use_platforms_repo_for_constraints do nothing. Using constraints from @bazel_tools//platforms with or without the flag will error out.

Github: https://github.com/bazelbuild/bazel/issues/16330

RELNOTES: making --incompatible_use_platforms_repo_for_constraints do nothing. Using constraints from @bazel_tools//platforms with or without the flag will throw error with message "Constraints from @bazel_tools//platforms have been removed. Please use constraints from @platforms repository embedded in Bazel, or preferably declare dependency on https://github.com/bazelbuild/platforms"
PiperOrigin-RevId: 514718831
Change-Id: I4c1c2a282c3770eb45f9325323c637485c9db9b7
diff --git a/src/main/java/com/google/devtools/build/lib/rules/Alias.java b/src/main/java/com/google/devtools/build/lib/rules/Alias.java
index c5be0be..c6cadea 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/Alias.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/Alias.java
@@ -24,7 +24,6 @@
 import com.google.devtools.build.lib.analysis.RuleContext;
 import com.google.devtools.build.lib.analysis.RuleDefinition;
 import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
-import com.google.devtools.build.lib.analysis.config.CoreOptions;
 import com.google.devtools.build.lib.packages.RuleClass;
 import com.google.devtools.build.lib.packages.RuleClass.ToolchainResolutionMode;
 import com.google.devtools.build.lib.util.FileTypeSet;
@@ -42,13 +41,8 @@
       throws InterruptedException, RuleErrorException, ActionConflictException {
     ConfiguredTarget actual = (ConfiguredTarget) ruleContext.getPrerequisite("actual");
 
-    // TODO(b/129045294): Remove once the flag is flipped.
-    if (ruleContext.getLabel().getCanonicalForm().startsWith("@bazel_tools//platforms")
-        && ruleContext
-            .getConfiguration()
-            .getOptions()
-            .get(CoreOptions.class)
-            .usePlatformsRepoForConstraints) {
+    // TODO(b/129045294): Remove the logic below completely when repo is deleted.
+    if (ruleContext.getLabel().getCanonicalForm().startsWith("@bazel_tools//platforms")) {
       throw ruleContext.throwWithRuleError(
           "Constraints from @bazel_tools//platforms have been "
               + "removed. Please use constraints from @platforms repository embedded in "
diff --git a/src/test/shell/bazel/platforms_test.sh b/src/test/shell/bazel/platforms_test.sh
index e950bee..8ac86f1 100755
--- a/src/test/shell/bazel/platforms_test.sh
+++ b/src/test/shell/bazel/platforms_test.sh
@@ -101,13 +101,9 @@
 )
 EOF
 
-  bazel build --incompatible_use_platforms_repo_for_constraints //:all &> \
+  bazel build //:all &> \
     $TEST_log && fail "Build passed when we expected an error."
   expect_log "Constraints from @bazel_tools//platforms have been removed."
-
-  bazel build --noincompatible_use_platforms_repo_for_constraints //:all &> \
-    $TEST_log || fail "Build failed when we expected no error."
-  expect_not_log "Constraints from @bazel_tools//platforms have been removed."
 }
 
 function test_platform_accessor() {