Add allow_single_file in attr.label, deprecate single_file.

--
MOS_MIGRATED_REVID=126620866
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 0716654..f73d1b9 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
@@ -166,11 +166,28 @@
   }
 
   @Test
+  public void testAttrAllowedSingleFileTypesWrongType() throws Exception {
+    checkErrorContains(
+        "allow_single_file should be a boolean or a string list",
+        "attr.label(allow_single_file = 18)");
+  }
+
+  @Test
   public void testAttrWithList() throws Exception {
     Attribute attr = evalAttributeDefinition("attr.label_list(allow_files = ['.xml'])")
         .build("a1");
     assertTrue(attr.getAllowedFileTypesPredicate().apply("a.xml"));
     assertFalse(attr.getAllowedFileTypesPredicate().apply("a.txt"));
+    assertFalse(attr.isSingleArtifact());
+  }
+
+  @Test
+  public void testAttrSingleFileWithList() throws Exception {
+    Attribute attr = evalAttributeDefinition("attr.label(allow_single_file = ['.xml'])")
+        .build("a1");
+    assertTrue(attr.getAllowedFileTypesPredicate().apply("a.xml"));
+    assertFalse(attr.getAllowedFileTypesPredicate().apply("a.txt"));
+    assertTrue(attr.isSingleArtifact());
   }
 
   @Test