Support "mandatoryProvidersList" in Skylark and added necessary tests

The type of attribute "providers" now is a list of lists of string. But a list
of string is still supported.

--
MOS_MIGRATED_REVID=115357326
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
index 4ecfd72..20c9a4c 100644
--- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java
@@ -184,6 +184,27 @@
   }
 
   @Test
+  public void testAttrWithProvidersList() throws Exception {
+    Attribute attr =
+            evalAttributeDefinition("attr.label_list(allow_files = True,"
+                    + " providers = [['a', 'b'], ['c']])")
+                    .build("a1");
+    assertThat(attr.getMandatoryProvidersList()).containsExactly(ImmutableSet.of("a", "b"),
+            ImmutableSet.of("c"));
+  }
+
+  @Test
+  public void testAttrWithWrongProvidersList() throws Exception {
+    checkErrorContains("Illegal argument: element in 'providers' is of unexpected type."
+            + " Should be list of string, but got list with an element of type int.",
+            "attr.label_list(allow_files = True,  providers = [['a', 1], ['c']])");
+
+    checkErrorContains("Illegal argument: element in 'providers' is of unexpected type."
+            + " Should be list of string, but got string.",
+            "attr.label_list(allow_files = True,  providers = [['a', 'b'], 'c'])");
+  }
+
+  @Test
   public void testLabelListWithAspects() throws Exception {
     SkylarkAttr.Descriptor attr =
         (SkylarkAttr.Descriptor) evalRuleClassCode(