Do not expose platform-related providers to Skylark.

This prevents both creation and access to platform providers from
Skylark.

This is needed so we can load platforms directly from platform-rule
targets without needing a full configured target, and to effiently
distinguish platform providers from non-platform providers.

Change-Id: I6b61f9ee7518d5e9311232908a922596e18fe32f
PiperOrigin-RevId: 188070457
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/platform/ConstraintSettingInfo.java b/src/main/java/com/google/devtools/build/lib/analysis/platform/ConstraintSettingInfo.java
index 907a1b9..d2b5e1e 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/platform/ConstraintSettingInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/platform/ConstraintSettingInfo.java
@@ -14,7 +14,6 @@
 
 package com.google.devtools.build.lib.analysis.platform;
 
-import com.google.common.collect.ImmutableList;
 import com.google.devtools.build.lib.cmdline.Label;
 import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
 import com.google.devtools.build.lib.events.Location;
@@ -25,9 +24,6 @@
 import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
-import com.google.devtools.build.lib.syntax.EvalException;
-import com.google.devtools.build.lib.syntax.FunctionSignature;
-import com.google.devtools.build.lib.syntax.SkylarkType;
 import com.google.devtools.build.lib.util.Fingerprint;
 
 /** Provider for a platform constraint setting that is available to be fulfilled. */
@@ -42,30 +38,9 @@
   /** Name used in Skylark for accessing this provider. */
   public static final String SKYLARK_NAME = "ConstraintSettingInfo";
 
-  private static final FunctionSignature.WithValues<Object, SkylarkType> SIGNATURE =
-      FunctionSignature.WithValues.create(
-          FunctionSignature.of(
-              /*numMandatoryPositionals=*/ 1,
-              /*numOptionalPositionals=*/ 0,
-              /*numMandatoryNamedOnly*/ 0,
-              /*starArg=*/ false,
-              /*kwArg=*/ false,
-              /*names=*/ "label"),
-          /*defaultValues=*/ null,
-          /*types=*/ ImmutableList.<SkylarkType>of(SkylarkType.of(Label.class)));
-
   /** Skylark constructor and identifier for this provider. */
   public static final NativeProvider<ConstraintSettingInfo> PROVIDER =
-      new NativeProvider<ConstraintSettingInfo>(
-          ConstraintSettingInfo.class, SKYLARK_NAME, SIGNATURE) {
-        @Override
-        protected ConstraintSettingInfo createInstanceFromSkylark(Object[] args, Location loc)
-            throws EvalException {
-          // Based on SIGNATURE above, the args are label.
-          Label label = (Label) args[0];
-          return ConstraintSettingInfo.create(label, loc);
-        }
-      };
+      new NativeProvider<ConstraintSettingInfo>(ConstraintSettingInfo.class, SKYLARK_NAME) {};
 
   private final Label label;
 
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/platform/ConstraintValueInfo.java b/src/main/java/com/google/devtools/build/lib/analysis/platform/ConstraintValueInfo.java
index 7603f08..345edb9 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/platform/ConstraintValueInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/platform/ConstraintValueInfo.java
@@ -14,7 +14,6 @@
 
 package com.google.devtools.build.lib.analysis.platform;
 
-import com.google.common.collect.ImmutableList;
 import com.google.devtools.build.lib.cmdline.Label;
 import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
 import com.google.devtools.build.lib.events.Location;
@@ -25,9 +24,6 @@
 import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
-import com.google.devtools.build.lib.syntax.EvalException;
-import com.google.devtools.build.lib.syntax.FunctionSignature;
-import com.google.devtools.build.lib.syntax.SkylarkType;
 import com.google.devtools.build.lib.util.Fingerprint;
 
 /** Provider for a platform constraint value that fulfills a {@link ConstraintSettingInfo}. */
@@ -42,32 +38,9 @@
   /** Name used in Skylark for accessing this provider. */
   public static final String SKYLARK_NAME = "ConstraintValueInfo";
 
-  private static final FunctionSignature.WithValues<Object, SkylarkType> SIGNATURE =
-      FunctionSignature.WithValues.create(
-          FunctionSignature.of(
-              /*numMandatoryPositionals=*/ 2,
-              /*numOptionalPositionals=*/ 0,
-              /*numMandatoryNamedOnly*/ 0,
-              /*starArg=*/ false,
-              /*kwArg=*/ false,
-              /*names=*/ "label",
-              "constraint_setting"),
-          /*defaultValues=*/ null,
-          /*types=*/ ImmutableList.<SkylarkType>of(
-              SkylarkType.of(Label.class), SkylarkType.of(ConstraintSettingInfo.class)));
-
   /** Skylark constructor and identifier for this provider. */
   public static final NativeProvider<ConstraintValueInfo> SKYLARK_CONSTRUCTOR =
-      new NativeProvider<ConstraintValueInfo>(ConstraintValueInfo.class, SKYLARK_NAME, SIGNATURE) {
-        @Override
-        protected ConstraintValueInfo createInstanceFromSkylark(Object[] args, Location loc)
-            throws EvalException {
-          // Based on SIGNATURE above, the args are label, constraint_setting.
-          Label label = (Label) args[0];
-          ConstraintSettingInfo constraint = (ConstraintSettingInfo) args[1];
-          return ConstraintValueInfo.create(constraint, label, loc);
-        }
-      };
+      new NativeProvider<ConstraintValueInfo>(ConstraintValueInfo.class, SKYLARK_NAME) {};
 
   private final ConstraintSettingInfo constraint;
   private final Label label;
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/platform/DeclaredToolchainInfo.java b/src/main/java/com/google/devtools/build/lib/analysis/platform/DeclaredToolchainInfo.java
index b72b889..354969c 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/platform/DeclaredToolchainInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/platform/DeclaredToolchainInfo.java
@@ -21,7 +21,7 @@
 import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
 
 /**
- * Provider for a toolchain declaration, which assosiates a toolchain type, the execution and target
+ * Provider for a toolchain declaration, which associates a toolchain type, the execution and target
  * constraints, and the actual toolchain label. The toolchain is then available for use but will be
  * lazily resolved only when it is actually needed for toolchain-aware rules. Toolchain definitions
  * are exposed to Skylark and Bazel via {@link ToolchainInfo} providers.
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/platform/PlatformInfo.java b/src/main/java/com/google/devtools/build/lib/analysis/platform/PlatformInfo.java
index 6b57ddf..b5e2328 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/platform/PlatformInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/platform/PlatformInfo.java
@@ -34,10 +34,6 @@
 import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
-import com.google.devtools.build.lib.syntax.EvalException;
-import com.google.devtools.build.lib.syntax.FunctionSignature;
-import com.google.devtools.build.lib.syntax.SkylarkList;
-import com.google.devtools.build.lib.syntax.SkylarkType;
 import com.google.devtools.build.lib.util.Fingerprint;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -57,46 +53,9 @@
   /** Name used in Skylark for accessing this provider. */
   public static final String SKYLARK_NAME = "PlatformInfo";
 
-  private static final FunctionSignature.WithValues<Object, SkylarkType> SIGNATURE =
-      FunctionSignature.WithValues.create(
-          FunctionSignature.of(
-              /*numMandatoryPositionals=*/ 2,
-              /*numOptionalPositionals=*/ 0,
-              /*numMandatoryNamedOnly*/ 0,
-              /*starArg=*/ false,
-              /*kwArg=*/ false,
-              /*names=*/ "label",
-              "constraint_values"),
-          /*defaultValues=*/ null,
-          /*types=*/ ImmutableList.<SkylarkType>of(
-              SkylarkType.of(Label.class),
-              SkylarkType.Combination.of(
-                  SkylarkType.LIST, SkylarkType.of(ConstraintValueInfo.class))));
-
   /** Skylark constructor and identifier for this provider. */
   public static final NativeProvider<PlatformInfo> SKYLARK_CONSTRUCTOR =
-      new NativeProvider<PlatformInfo>(PlatformInfo.class, SKYLARK_NAME, SIGNATURE) {
-        @Override
-        protected PlatformInfo createInstanceFromSkylark(Object[] args, Location loc)
-            throws EvalException {
-          // Based on SIGNATURE above, the args are label, constraint_values.
-
-          Label label = (Label) args[0];
-          List<ConstraintValueInfo> constraintValues =
-              SkylarkList.castSkylarkListOrNoneToList(
-                  args[1], ConstraintValueInfo.class, "constraint_values");
-          try {
-            return builder()
-                .setLabel(label)
-                .addConstraints(constraintValues)
-                .setLocation(loc)
-                .build();
-          } catch (DuplicateConstraintException dce) {
-            throw new EvalException(
-                loc, String.format("Cannot create PlatformInfo: %s", dce.getMessage()));
-          }
-        }
-      };
+      new NativeProvider<PlatformInfo>(PlatformInfo.class, SKYLARK_NAME) {};
 
   private final Label label;
   private final ImmutableMap<ConstraintSettingInfo, ConstraintValueInfo> constraints;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/platform/PlatformCommon.java b/src/main/java/com/google/devtools/build/lib/rules/platform/PlatformCommon.java
index 62b3396..e68a461 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/platform/PlatformCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/platform/PlatformCommon.java
@@ -15,9 +15,6 @@
 package com.google.devtools.build.lib.rules.platform;
 
 import com.google.devtools.build.lib.analysis.TemplateVariableInfo;
-import com.google.devtools.build.lib.analysis.platform.ConstraintSettingInfo;
-import com.google.devtools.build.lib.analysis.platform.ConstraintValueInfo;
-import com.google.devtools.build.lib.analysis.platform.PlatformInfo;
 import com.google.devtools.build.lib.analysis.platform.ToolchainInfo;
 import com.google.devtools.build.lib.packages.Provider;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
@@ -43,40 +40,6 @@
   }
 
   @SkylarkCallable(
-    name = PlatformInfo.SKYLARK_NAME,
-    doc =
-        "The provider constructor for PlatformInfo. The constructor takes the list of "
-            + "ConstraintValueInfo providers that defines the platform.",
-    structField = true
-  )
-  public Provider getPlatformInfoConstructor() {
-    return PlatformInfo.SKYLARK_CONSTRUCTOR;
-  }
-
-  @SkylarkCallable(
-    name = ConstraintSettingInfo.SKYLARK_NAME,
-    doc =
-        "The provider constructor for ConstraintSettingInfo. The constructor takes the label that "
-            + "uniquely identifies the constraint (and which should always be ctx.label).",
-    structField = true
-  )
-  public Provider getConstraintSettingInfoConstructor() {
-    return ConstraintSettingInfo.PROVIDER;
-  }
-
-  @SkylarkCallable(
-    name = ConstraintValueInfo.SKYLARK_NAME,
-    doc =
-        "The provider constructor for ConstraintValueInfo. The constructor takes the label that "
-            + "uniquely identifies the constraint value (and which should always be ctx.label), "
-            + "and the ConstraintSettingInfo which the value belongs to.",
-    structField = true
-  )
-  public Provider getConstraintValueInfoConstructor() {
-    return ConstraintValueInfo.SKYLARK_CONSTRUCTOR;
-  }
-
-  @SkylarkCallable(
     name = ToolchainInfo.SKYLARK_NAME,
     doc =
         "The provider constructor for ToolchainInfo. The constructor takes the type of the "
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/platform/ConstraintSettingInfoTest.java b/src/test/java/com/google/devtools/build/lib/analysis/platform/ConstraintSettingInfoTest.java
index ca34b45..ed48aa7 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/platform/ConstraintSettingInfoTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/platform/ConstraintSettingInfoTest.java
@@ -14,12 +14,9 @@
 
 package com.google.devtools.build.lib.analysis.platform;
 
-import static com.google.common.truth.Truth.assertThat;
 
 import com.google.common.testing.EqualsTester;
-import com.google.devtools.build.lib.analysis.ConfiguredTarget;
 import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
-import com.google.devtools.build.lib.cmdline.Label;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
@@ -37,28 +34,4 @@
         .addEqualityGroup(ConstraintSettingInfo.create(makeLabel("//constraint:other")))
         .testEquals();
   }
-
-  @Test
-  public void constraintSettingInfoConstructor() throws Exception {
-    scratch.file(
-        "test/platform/my_constraint_setting.bzl",
-        "def _impl(ctx):",
-        "  constraint_setting = platform_common.ConstraintSettingInfo(label = ctx.label)",
-        "  return [constraint_setting]",
-        "my_constraint_setting = rule(",
-        "  implementation = _impl,",
-        "  attrs = {",
-        "  }",
-        ")");
-    scratch.file(
-        "test/platform/BUILD",
-        "load('//test/platform:my_constraint_setting.bzl', 'my_constraint_setting')",
-        "my_constraint_setting(name = 'custom')");
-
-    ConfiguredTarget setting = getConfiguredTarget("//test/platform:custom");
-    assertThat(setting).isNotNull();
-    assertThat(PlatformProviderUtils.constraintSetting(setting)).isNotNull();
-    assertThat(PlatformProviderUtils.constraintSetting(setting).label())
-        .isEqualTo(Label.parseAbsolute("//test/platform:custom"));
-  }
 }
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/platform/ConstraintValueInfoTest.java b/src/test/java/com/google/devtools/build/lib/analysis/platform/ConstraintValueInfoTest.java
index 9684124..df5178a 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/platform/ConstraintValueInfoTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/platform/ConstraintValueInfoTest.java
@@ -14,12 +14,9 @@
 
 package com.google.devtools.build.lib.analysis.platform;
 
-import static com.google.common.truth.Truth.assertThat;
 
 import com.google.common.testing.EqualsTester;
-import com.google.devtools.build.lib.analysis.ConfiguredTarget;
 import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
-import com.google.devtools.build.lib.cmdline.Label;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
@@ -45,37 +42,4 @@
             ConstraintValueInfo.create(setting2, makeLabel("//constraint:otherValue")))
         .testEquals();
   }
-
-  @Test
-  public void constraintValueInfoConstructor() throws Exception {
-    scratch.file(
-        "test/platform/my_constraint_value.bzl",
-        "def _impl(ctx):",
-        "  setting = ctx.attr.setting[platform_common.ConstraintSettingInfo]",
-        "  constraint_value = platform_common.ConstraintValueInfo(",
-        "    label = ctx.label, constraint_setting = setting)",
-        "  return [constraint_value]",
-        "my_constraint_value = rule(",
-        "  implementation = _impl,",
-        "  attrs = {",
-        "    'setting': attr.label(providers = [platform_common.ConstraintSettingInfo]),",
-        "  }",
-        ")");
-    scratch.file(
-        "test/platform/BUILD",
-        "load('//test/platform:my_constraint_value.bzl', 'my_constraint_value')",
-        "constraint_setting(name = 'basic')",
-        "my_constraint_value(",
-        "  name = 'custom',",
-        "  setting = ':basic',",
-        ")");
-
-    ConfiguredTarget value = getConfiguredTarget("//test/platform:custom");
-    assertThat(value).isNotNull();
-    assertThat(PlatformProviderUtils.constraintValue(value)).isNotNull();
-    assertThat(PlatformProviderUtils.constraintValue(value).constraint().label())
-        .isEqualTo(Label.parseAbsolute("//test/platform:basic"));
-    assertThat(PlatformProviderUtils.constraintValue(value).label())
-        .isEqualTo(Label.parseAbsolute("//test/platform:custom"));
-  }
 }
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/platform/PlatformInfoTest.java b/src/test/java/com/google/devtools/build/lib/analysis/platform/PlatformInfoTest.java
index 6c7c91b..e0b5dde 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/platform/PlatformInfoTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/platform/PlatformInfoTest.java
@@ -128,70 +128,6 @@
   }
 
   @Test
-  public void platformInfoConstructor() throws Exception {
-    scratch.file(
-        "test/platform/my_platform.bzl",
-        "def _impl(ctx):",
-        "  constraints = [val[platform_common.ConstraintValueInfo] "
-            + "for val in ctx.attr.constraints]",
-        "  platform = platform_common.PlatformInfo(",
-        "      label = ctx.label, constraint_values = constraints)",
-        "  return [platform]",
-        "my_platform = rule(",
-        "  implementation = _impl,",
-        "  attrs = {",
-        "    'constraints': attr.label_list(providers = [platform_common.ConstraintValueInfo])",
-        "  }",
-        ")");
-    scratch.file(
-        "test/platform/BUILD",
-        "load('//test/platform:my_platform.bzl', 'my_platform')",
-        "my_platform(name = 'custom',",
-        "    constraints = [",
-        "       '//constraint:foo',",
-        "    ])");
-
-    ConfiguredTarget platform = getConfiguredTarget("//test/platform:custom");
-    assertThat(platform).isNotNull();
-
-    PlatformInfo provider = PlatformProviderUtils.platform(platform);
-    assertThat(provider).isNotNull();
-    assertThat(provider.label()).isEqualTo(makeLabel("//test/platform:custom"));
-    assertThat(provider.constraints()).hasSize(1);
-    ConstraintSettingInfo constraintSetting =
-        ConstraintSettingInfo.create(makeLabel("//constraint:basic"));
-    ConstraintValueInfo constraintValue =
-        ConstraintValueInfo.create(constraintSetting, makeLabel("//constraint:foo"));
-    assertThat(provider.constraints()).containsExactly(constraintValue);
-    assertThat(provider.remoteExecutionProperties()).isNull();
-  }
-
-  @Test
-  public void platformInfoConstructor_error_duplicateConstraints() throws Exception {
-    scratch.file(
-        "test/platform/my_platform.bzl",
-        "def _impl(ctx):",
-        "  platform = platform_common.PlatformInfo()",
-        "  return [platform]",
-        "my_platform = rule(",
-        "  implementation = _impl,",
-        "  attrs = {",
-        "    'constraints': attr.label_list(providers = [platform_common.ConstraintValueInfo])",
-        "  }",
-        ")");
-    checkError(
-        "test/platform",
-        "custom",
-        "Label '//constraint:foo' is duplicated in the 'constraints' attribute of rule 'custom'",
-        "load('//test/platform:my_platform.bzl', 'my_platform')",
-        "my_platform(name = 'custom',",
-        "    constraints = [",
-        "       '//constraint:foo',",
-        "       '//constraint:foo',",
-        "    ])");
-  }
-
-  @Test
   public void proxyTemplateVariableInfo() throws Exception {
     scratch.file(
         "a/rule.bzl",
diff --git a/src/test/java/com/google/devtools/build/lib/rules/platform/ConstraintTest.java b/src/test/java/com/google/devtools/build/lib/rules/platform/ConstraintTest.java
index 23ff526..200d9f7 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/platform/ConstraintTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/platform/ConstraintTest.java
@@ -64,36 +64,4 @@
     assertThat(PlatformProviderUtils.constraintValue(barValue).label())
         .isEqualTo(Label.parseAbsolute("//constraint:bar"));
   }
-
-  @Test
-  public void testConstraint_skylark() throws Exception {
-
-    scratch.file(
-        "test/platform/constraints.bzl",
-        "def _impl(ctx):",
-        "  constraint_value = ctx.attr.constraint[platform_common.ConstraintValueInfo]",
-        "  return struct(",
-        "    setting = constraint_value.constraint.label,",
-        "    value = constraint_value.label)",
-        "my_rule = rule(",
-        "  implementation = _impl,",
-        "  attrs = { 'constraint': attr.label(providers = [platform_common.ConstraintValueInfo])},",
-        ")");
-
-    scratch.file(
-        "test/platform/BUILD",
-        "load('//test/platform:constraints.bzl', 'my_rule')",
-        "my_rule(name = 'r',",
-        "  constraint = '//constraint:foo')");
-
-    ConfiguredTarget configuredTarget = getConfiguredTarget("//test/platform:r");
-    assertThat(configuredTarget).isNotNull();
-
-    Label settingLabel = (Label) configuredTarget.get("setting");
-    assertThat(settingLabel).isNotNull();
-    assertThat(settingLabel).isEqualTo(makeLabel("//constraint:basic"));
-    Label valueLabel = (Label) configuredTarget.get("value");
-    assertThat(valueLabel).isNotNull();
-    assertThat(valueLabel).isEqualTo(makeLabel("//constraint:foo"));
-  }
 }
diff --git a/src/test/java/com/google/devtools/build/lib/rules/platform/PlatformTest.java b/src/test/java/com/google/devtools/build/lib/rules/platform/PlatformTest.java
index bfbca10..cbe1edc 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/platform/PlatformTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/platform/PlatformTest.java
@@ -22,7 +22,6 @@
 import com.google.devtools.build.lib.analysis.platform.PlatformInfo;
 import com.google.devtools.build.lib.analysis.platform.PlatformProviderUtils;
 import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
-import com.google.devtools.build.lib.cmdline.Label;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -156,40 +155,4 @@
     assertThat(provider).isNotNull();
     assertThat(provider.remoteExecutionProperties()).isEqualTo("foo: val1");
   }
-
-  @Test
-  public void testPlatform_skylark() throws Exception {
-
-    scratch.file(
-        "test/platform/platform.bzl",
-        "def _impl(ctx):",
-        "  platform = ctx.attr.platform[platform_common.PlatformInfo]",
-        "  return struct(",
-        "    count = len(platform.constraints),",
-        "    first_setting = platform.constraints[0].constraint.label,",
-        "    first_value = platform.constraints[0].label)",
-        "my_rule = rule(",
-        "  implementation = _impl,",
-        "  attrs = { 'platform': attr.label(providers = [platform_common.PlatformInfo])},",
-        ")");
-
-    scratch.file(
-        "test/platform/BUILD",
-        "load('//test/platform:platform.bzl', 'my_rule')",
-        "my_rule(name = 'r',",
-        "  platform = '//constraint:plat1')");
-
-    ConfiguredTarget configuredTarget = getConfiguredTarget("//test/platform:r");
-    assertThat(configuredTarget).isNotNull();
-
-    int count = (int) configuredTarget.get("count");
-    assertThat(count).isEqualTo(1);
-
-    Label settingLabel = (Label) configuredTarget.get("first_setting");
-    assertThat(settingLabel).isNotNull();
-    assertThat(settingLabel).isEqualTo(makeLabel("//constraint:basic"));
-    Label valueLabel = (Label) configuredTarget.get("first_value");
-    assertThat(valueLabel).isNotNull();
-    assertThat(valueLabel).isEqualTo(makeLabel("//constraint:foo"));
-  }
 }