Add metadata for the dimension annotation, and strip typedefs

The support annotations library is a plain Java library, it's not an
Android library, which means it gets built by the Gradle java plugin,
and packaged as a plain jar file. That means that the typedef
annotations (on VisibleForTesting and Dimension) were getting included
in the .jar file, which is pointless.

This CL removes these classes at build time (and to do that, they had
to be top level classes rather than inner classes; removing inner
classes at packaging isn't safe since the outerclass contains
references to its inner classes). This CL also adds external metadata
information about the Dimension's unit attribute, which was missing.

It's unfortunate that we can't just use the android library build
support that handles all this automatically, but a number of users
like that the annotations library is a plain .jar such that they can
include it not just in their Android apps, but in plain Java modules
as well which are contain shared server and app code.

Change-Id: If6ac38f1e5aad7091001ff3749c804b5c0a2452b
diff --git a/annotations/build.gradle b/annotations/build.gradle
index d7e8532..4907e2a 100644
--- a/annotations/build.gradle
+++ b/annotations/build.gradle
@@ -12,6 +12,14 @@
 
 jar {
     from sourceSets.main.output
+    // Strip out typedef classes. For Android libraries, this is done
+    // automatically by the Gradle plugin, but the Annotation library is a
+    // plain jar, built by the regular Gradle java plugin. The typedefs
+    // themselves have been manually extracted into the
+    // external-annotations directory, and those are packaged separately
+    // below by the annotationsZip task.
+    exclude('android/support/annotation/ProductionVisibility.class')
+    exclude('android/support/annotation/DimensionUnit.class')
 }
 
 uploadArchives {