Use a single build tools version for frameworks/support.

Allows apps in the Android tree which depend on these libraries to use
a single build tools version in their own top-level gradle files.

For now the compile SDK is left alone. This means that projects must
still map both API 19 and API 21 full SDKs in their manifests.

Change-Id: I303438ec3f06af6e3a3c7ffcd554b730b1e07a0e
diff --git a/build.gradle b/build.gradle
index ae2f294..2f18675 100644
--- a/build.gradle
+++ b/build.gradle
@@ -12,6 +12,7 @@
 ext.supportVersion = '19.2.0'
 ext.extraVersion = 6
 ext.supportRepoOut = ''
+ext.buildToolsVersion = '19.0.3'
 
 /*
  * With the build server you are given two env variables.
@@ -126,6 +127,12 @@
     release.dependsOn rootProject.tasks.prepareRepo
     // make the mainupload depend on this one.
     mainUpload.dependsOn release
+
+    project.plugins.whenPluginAdded { plugin ->
+        if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
+            project.android.buildToolsVersion = rootProject.buildToolsVersion
+        }
+    }
 }
 
 FileCollection getAndroidPrebuilt(String apiLevel) {
diff --git a/v7/appcompat/build.gradle b/v7/appcompat/build.gradle
index a032c0b..f621c51 100644
--- a/v7/appcompat/build.gradle
+++ b/v7/appcompat/build.gradle
@@ -8,7 +8,6 @@
 
 android {
     compileSdkVersion 19
-    buildToolsVersion '19.0.3'
 
     sourceSets {
         main.manifest.srcFile 'AndroidManifest.xml'
@@ -28,4 +27,4 @@
         // TODO: fix errors and reenable.
         abortOnError false
     }
-}
\ No newline at end of file
+}
diff --git a/v7/gridlayout/build.gradle b/v7/gridlayout/build.gradle
index da73b9e..381d16b 100644
--- a/v7/gridlayout/build.gradle
+++ b/v7/gridlayout/build.gradle
@@ -9,7 +9,6 @@
 
 android {
     compileSdkVersion 19
-    buildToolsVersion '19.0.3'
 
     sourceSets {
         main.manifest.srcFile 'AndroidManifest.xml'
diff --git a/v7/mediarouter/build.gradle b/v7/mediarouter/build.gradle
index a755f5b..9abe938 100644
--- a/v7/mediarouter/build.gradle
+++ b/v7/mediarouter/build.gradle
@@ -41,7 +41,6 @@
 
 android {
     compileSdkVersion 19
-    buildToolsVersion '19.0.3'
 
     sourceSets {
         main.manifest.srcFile 'AndroidManifest.xml'