Support library gradle improvements

* Define java source compatibility on all build files to avoid
issues that might be caused by compiling with Java8
* Apply the library plugin using the cannonical name
* Define a currentSdkVersion variable instead of embedded string.
We can later load this from a file so that you can checkout
an older branch of support lib and compile it on master and
it won't use master's API by mistake.
This also helps with Android Studio integration.

Bug: 26714403

Change-Id: I0e9f2770b397b761155ac8d4a40fa5fb001264e1
diff --git a/v7/gridlayout/build.gradle b/v7/gridlayout/build.gradle
index 9e55c01..6e363dd 100644
--- a/v7/gridlayout/build.gradle
+++ b/v7/gridlayout/build.gradle
@@ -1,4 +1,4 @@
-apply plugin: 'android-library'
+apply plugin: 'com.android.library'
 
 archivesBaseName = 'gridlayout-v7'
 
@@ -7,7 +7,7 @@
 }
 
 android {
-    compileSdkVersion 'current'
+    compileSdkVersion project.ext.currentSdk
 
     sourceSets {
         main.manifest.srcFile 'AndroidManifest.xml'
@@ -25,6 +25,11 @@
         androidTest.manifest.srcFile 'tests/AndroidManifest.xml'
     }
 
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_7
+        targetCompatibility JavaVersion.VERSION_1_7
+    }
+
     lintOptions {
         // TODO: fix errors and reenable.
         abortOnError false