enable RequiresOptIn for androidx-plugin build.

Bug: 158332707
Test: gw tasks in playground
Change-Id: Ifb0063fbc9e2c7753cce9406b86c11dfc17b3a2c
diff --git a/androidx-plugin/build.gradle b/androidx-plugin/build.gradle
index 2ea079f..37cece5 100644
--- a/androidx-plugin/build.gradle
+++ b/androidx-plugin/build.gradle
@@ -1,3 +1,5 @@
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
 buildscript {
     apply from: '../buildSrc/build_dependencies.gradle'
 
@@ -41,4 +43,15 @@
             }
         }
     }
+    tasks.withType(KotlinCompile).configureEach {
+        kotlinOptions {
+            jvmTarget = "1.8"
+            freeCompilerArgs += [
+                    "-Werror",
+                    "-Xskip-runtime-version-check",
+                    // Allow `@OptIn` and `@UseExperimental`
+                    "-Xopt-in=kotlin.RequiresOptIn"
+            ]
+        }
+    }
 }