Merge "Move the setup of uploadArchives repository to SupportLibraryPlugin."
diff --git a/buildSrc/src/main/groovy/android/support/SupportLibraryPlugin.groovy b/buildSrc/src/main/groovy/android/support/SupportLibraryPlugin.groovy
index ae23f03..7c6b6ce 100644
--- a/buildSrc/src/main/groovy/android/support/SupportLibraryPlugin.groovy
+++ b/buildSrc/src/main/groovy/android/support/SupportLibraryPlugin.groovy
@@ -26,6 +26,7 @@
 import org.gradle.api.Plugin
 import org.gradle.api.Project
 import org.gradle.api.artifacts.maven.MavenDeployer
+import org.gradle.api.plugins.ExtraPropertiesExtension
 import org.gradle.api.tasks.Upload
 import org.gradle.api.tasks.bundling.Jar
 
@@ -84,6 +85,13 @@
         uploadTask.getRepositories().withType(MavenDeployer.class, new Action<MavenDeployer>() {
             @Override
             public void execute(MavenDeployer mavenDeployer) {
+                ExtraPropertiesExtension ext = project.getRootProject().getExtensions()
+                        .findByType(ExtraPropertiesExtension.class);
+                URI uri = project.uri(ext.get("supportRepoOut"));
+                Map<String, Object> repo = new HashMap<String, Object>();
+                repo.put("url", uri);
+                mavenDeployer.repository(repo);
+
                 mavenDeployer.getPom().project {
                     name supportLibraryExtension.getName()
                     description supportLibraryExtension.getDescription()
diff --git a/compat/build.gradle b/compat/build.gradle
index 99818e9..d5e6aee 100644
--- a/compat/build.gradle
+++ b/compat/build.gradle
@@ -51,12 +51,3 @@
     inceptionYear '2015'
     description "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\'t a part of the framework APIs. Compatible on devices running API 4 or later."
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/core-ui/build.gradle b/core-ui/build.gradle
index 1e7021c..cb68cae 100644
--- a/core-ui/build.gradle
+++ b/core-ui/build.gradle
@@ -47,12 +47,3 @@
     inceptionYear '2011'
     description "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 4 or later."
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/core-utils/build.gradle b/core-utils/build.gradle
index ac1c031..680d91e 100644
--- a/core-utils/build.gradle
+++ b/core-utils/build.gradle
@@ -43,12 +43,3 @@
     inceptionYear '2011'
     description "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 4 or later."
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/customtabs/build.gradle b/customtabs/build.gradle
index d8ab349..0fcf7e8 100644
--- a/customtabs/build.gradle
+++ b/customtabs/build.gradle
@@ -35,12 +35,3 @@
     inceptionYear '2015'
     description 'Android Support Custom Tabs'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/design/build.gradle b/design/build.gradle
index be28dc5..4d9dc01 100644
--- a/design/build.gradle
+++ b/design/build.gradle
@@ -66,12 +66,3 @@
     inceptionYear '2015'
     description "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\'t a part of the framework APIs. Compatible on devices running API 4 or later."
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/exifinterface/build.gradle b/exifinterface/build.gradle
index a01eaec..b9ecadf 100644
--- a/exifinterface/build.gradle
+++ b/exifinterface/build.gradle
@@ -23,12 +23,3 @@
     inceptionYear '2016'
     description 'Android Support ExifInterface'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/fragment/build.gradle b/fragment/build.gradle
index 9d25919..8b48582 100644
--- a/fragment/build.gradle
+++ b/fragment/build.gradle
@@ -41,11 +41,3 @@
     description "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\'t a part of the framework APIs. Compatible on devices running API 4 or later."
 }
 
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/graphics/drawable/animated/build.gradle b/graphics/drawable/animated/build.gradle
index 07484c1..56eafd8 100644
--- a/graphics/drawable/animated/build.gradle
+++ b/graphics/drawable/animated/build.gradle
@@ -39,13 +39,4 @@
     name 'Android Support AnimatedVectorDrawable'
     inceptionYear '2015'
     description 'Android Support AnimatedVectorDrawable'
-}
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
+}
\ No newline at end of file
diff --git a/graphics/drawable/static/build.gradle b/graphics/drawable/static/build.gradle
index ba6b160..bf342b5 100644
--- a/graphics/drawable/static/build.gradle
+++ b/graphics/drawable/static/build.gradle
@@ -36,12 +36,3 @@
     inceptionYear '2015'
     description 'Android Support VectorDrawable'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/media-compat/build.gradle b/media-compat/build.gradle
index e09b56b..4044784 100644
--- a/media-compat/build.gradle
+++ b/media-compat/build.gradle
@@ -43,12 +43,3 @@
     inceptionYear '2011'
     description "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 4 or later."
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/percent/build.gradle b/percent/build.gradle
index 96292d0..30aa2b8 100644
--- a/percent/build.gradle
+++ b/percent/build.gradle
@@ -33,12 +33,3 @@
     inceptionYear '2015'
     description 'Android Percent Support Library'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/recommendation/build.gradle b/recommendation/build.gradle
index 3a6815f..864de0b 100644
--- a/recommendation/build.gradle
+++ b/recommendation/build.gradle
@@ -26,12 +26,3 @@
     inceptionYear '2015'
     description 'Android Support Recommendation'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/transition/build.gradle b/transition/build.gradle
index 7411ef6..637efd5 100644
--- a/transition/build.gradle
+++ b/transition/build.gradle
@@ -44,13 +44,3 @@
     inceptionYear '2016'
     description 'Android Transition Support Library'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
-
diff --git a/v13/build.gradle b/v13/build.gradle
index 7bed2ab..3b3e31c 100644
--- a/v13/build.gradle
+++ b/v13/build.gradle
@@ -40,12 +40,3 @@
     inceptionYear '2011'
     description "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 4 or later."
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/v14/preference/build.gradle b/v14/preference/build.gradle
index 26222c7..5d6dafb 100644
--- a/v14/preference/build.gradle
+++ b/v14/preference/build.gradle
@@ -44,12 +44,3 @@
     inceptionYear '2015'
     description 'Android Support Preference v14'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/v17/leanback/build.gradle b/v17/leanback/build.gradle
index f8468ed..8eb4636 100644
--- a/v17/leanback/build.gradle
+++ b/v17/leanback/build.gradle
@@ -49,12 +49,3 @@
     inceptionYear '2014'
     description 'Android Support Leanback v17'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/v4/build.gradle b/v4/build.gradle
index ae7e723..a12fc83 100644
--- a/v4/build.gradle
+++ b/v4/build.gradle
@@ -24,12 +24,3 @@
     inceptionYear '2011'
     description "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 4 or later."
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/v7/appcompat/build.gradle b/v7/appcompat/build.gradle
index ade9fb1..b571334 100644
--- a/v7/appcompat/build.gradle
+++ b/v7/appcompat/build.gradle
@@ -45,12 +45,3 @@
     inceptionYear '2011'
     description "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\'t a part of the framework APIs. Compatible on devices running API 4 or later."
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/v7/cardview/build.gradle b/v7/cardview/build.gradle
index c9d4db8..665d655 100644
--- a/v7/cardview/build.gradle
+++ b/v7/cardview/build.gradle
@@ -29,12 +29,3 @@
     inceptionYear '2011'
     description 'Android Support CardView v7'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/v7/gridlayout/build.gradle b/v7/gridlayout/build.gradle
index f007373..b2fea02 100644
--- a/v7/gridlayout/build.gradle
+++ b/v7/gridlayout/build.gradle
@@ -34,12 +34,3 @@
     inceptionYear '2013'
     description 'Android Support Grid Layout'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/v7/mediarouter/build.gradle b/v7/mediarouter/build.gradle
index 61f2a8b..936496a 100644
--- a/v7/mediarouter/build.gradle
+++ b/v7/mediarouter/build.gradle
@@ -33,12 +33,3 @@
     inceptionYear '2013'
     description 'Android MediaRouter Support Library'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/v7/palette/build.gradle b/v7/palette/build.gradle
index 70e740a..be16341 100644
--- a/v7/palette/build.gradle
+++ b/v7/palette/build.gradle
@@ -24,12 +24,3 @@
     inceptionYear '2014'
     description 'Android Support Palette v7'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/v7/preference/build.gradle b/v7/preference/build.gradle
index 74d4286..0acb240 100644
--- a/v7/preference/build.gradle
+++ b/v7/preference/build.gradle
@@ -61,12 +61,3 @@
     inceptionYear '2015'
     description 'Android Support Preference v7'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/v7/recyclerview/build.gradle b/v7/recyclerview/build.gradle
index 4fd4b3e..0ab61c9 100644
--- a/v7/recyclerview/build.gradle
+++ b/v7/recyclerview/build.gradle
@@ -49,12 +49,3 @@
     inceptionYear '2014'
     description 'Android Support RecyclerView v7'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}
diff --git a/wearable/build.gradle b/wearable/build.gradle
index e680623..2102c4f 100644
--- a/wearable/build.gradle
+++ b/wearable/build.gradle
@@ -42,12 +42,3 @@
     inceptionYear '2016'
     description 'Android Wear Support UI'
 }
-
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: uri(rootProject.ext.supportRepoOut)) {
-            }
-        }
-    }
-}