New public plugin and move existing to internal.

All current plugin classes are considered public API
because of how Gradle allows finding plugins. Therefore
we need these classes to not change.

However, we also want to have plugin authors target gradle-api
instead of the 'gradle' artifact. This change forks the current
plugin classes into a new set of public class (name unchanged)
and the actual implementations as private, internal classes.

The new public plugins delegate to the internal plugins
by applying them as separate "internal" plugins. For now
the public plugins stay in gradle-core but we'll move them
to gradle-api at some point. This is currently limited by
the presence of getExtension on BasePlugin, both of which are
now deprecated.

Because our classes have no other public API this should not
break anything.

Bug: N/A
Change-Id: Iedda24f8e363e014a71a93a4fc471ac10a932e64
Test: existing tests have been updated.
diff --git a/build-system/gradle-api/BUILD b/build-system/gradle-api/BUILD
index 0268515..54f67e0 100644
--- a/build-system/gradle-api/BUILD
+++ b/build-system/gradle-api/BUILD
@@ -1,5 +1,14 @@
 load("//tools/base/bazel:maven.bzl", "maven_java_library", "maven_pom")
 load("//tools/base/bazel:kotlin.bzl", "kotlin_library", "kotlin_test")
+load("//tools/base/bazel:utils.bzl", "fileset")
+
+fileset(
+    name = "resources",
+    srcs = glob(["src/main/resources/**"]),
+    mappings = {
+        "src/main/resources/": "",
+    },
+)
 
 kotlin_library(
     name = "gradle-api",
@@ -8,6 +17,7 @@
     ],
     pom = ":pom",
     resource_strip_prefix = "tools/base/build-system/gradle-api",
+    resources = [":resources"],
     visibility = ["//visibility:public"],
     deps = [
         ":builder-model_neverlink",  # Only present for legacy reasons.
diff --git a/build-system/gradle-api/android.sdktools.base.build-system.gradle-api.iml b/build-system/gradle-api/android.sdktools.base.build-system.gradle-api.iml
index 7844b4f..f08d67e 100644
--- a/build-system/gradle-api/android.sdktools.base.build-system.gradle-api.iml
+++ b/build-system/gradle-api/android.sdktools.base.build-system.gradle-api.iml
@@ -5,7 +5,8 @@
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/api/AndroidBasePlugin.java b/build-system/gradle-api/src/main/java/com/android/build/gradle/api/AndroidBasePlugin.kt
similarity index 61%
rename from build-system/gradle-core/src/main/java/com/android/build/gradle/api/AndroidBasePlugin.java
rename to build-system/gradle-api/src/main/java/com/android/build/gradle/api/AndroidBasePlugin.kt
index b0c2528..a250539 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/api/AndroidBasePlugin.java
+++ b/build-system/gradle-api/src/main/java/com/android/build/gradle/api/AndroidBasePlugin.kt
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,19 +14,21 @@
  * limitations under the License.
  */
 
-package com.android.build.gradle.api;
+package com.android.build.gradle.api
 
-import org.gradle.api.Plugin;
-import org.gradle.api.Project;
+import org.gradle.api.Plugin
+import org.gradle.api.Project
 
 /**
  * Common plugin applied by all plugins.
  *
- * <p>The purpose of this no-op plugin is to allow other plugin authors to determine if an Android
+ *
+ * The purpose of this no-op plugin is to allow other plugin authors to determine if an Android
  * plugin was applied.
+ *
+ *
+ * This is tied to the 'com.android.base' plugin string.
  */
-public class AndroidBasePlugin implements Plugin<Project> {
-
-    @Override
-    public void apply(Project project) {}
+class AndroidBasePlugin : Plugin<Project> {
+    override fun apply(project: Project) {}
 }
diff --git a/build-system/gradle-core/lint_baseline.xml b/build-system/gradle-core/lint_baseline.xml
index 24b0201..b128815 100755
--- a/build-system/gradle-core/lint_baseline.xml
+++ b/build-system/gradle-core/lint_baseline.xml
@@ -5,8 +5,8 @@
         id="VisibleForTests"
         message="This method should only be accessed from tests or within private scope">
         <location
-            file="src/main/java/com/android/build/gradle/BasePlugin.java"
-            line="625"/>
+            file="src/main/java/com/android/build/gradle/internal/plugins/BasePlugin.java"
+            line="600"/>
     </issue>
 
     <issue
@@ -62,7 +62,7 @@
         message="This method should only be accessed from tests or within private scope">
         <location
             file="src/main/java/com/android/build/gradle/internal/res/LinkApplicationAndroidResourcesTask.kt"
-            line="833"/>
+            line="821"/>
     </issue>
 
     <issue
@@ -326,7 +326,7 @@
         message="Do not compare java.io.File with `equals` or `==`: will not work correctly on case insensitive file systems! See `go/files-howto`.">
         <location
             file="src/main/java/com/android/build/gradle/tasks/VerifyLibraryResourcesTask.kt"
-            line="281"/>
+            line="279"/>
     </issue>
 
     <issue
@@ -334,23 +334,23 @@
         message="Do not compare java.io.File with `equals` or `==`: will not work correctly on case insensitive file systems! See `go/files-howto`.">
         <location
             file="src/main/java/com/android/build/gradle/tasks/VerifyLibraryResourcesTask.kt"
-            line="281"/>
+            line="279"/>
     </issue>
 
     <issue
         id="CommonForkJoinPool"
         message="Avoid using common ForkJoinPool, directly or indirectly (for example via CompletableFuture). It has a limited set of threads on some machines which leads to hangs. See `go/do-not-freeze`.">
         <location
-            file="src/main/java/com/android/build/gradle/BasePlugin.java"
-            line="241"/>
+            file="src/main/java/com/android/build/gradle/internal/plugins/BasePlugin.java"
+            line="243"/>
     </issue>
 
     <issue
         id="CommonForkJoinPool"
         message="Avoid using common ForkJoinPool, directly or indirectly (for example via CompletableFuture). It has a limited set of threads on some machines which leads to hangs. See `go/do-not-freeze`.">
         <location
-            file="src/main/java/com/android/build/gradle/BasePlugin.java"
-            line="376"/>
+            file="src/main/java/com/android/build/gradle/internal/plugins/BasePlugin.java"
+            line="379"/>
     </issue>
 
     <issue
@@ -374,7 +374,7 @@
         message="Avoid using common ForkJoinPool, directly or indirectly (for example via CompletableFuture). It has a limited set of threads on some machines which leads to hangs. See `go/do-not-freeze`.">
         <location
             file="src/main/java/com/android/build/gradle/internal/tasks/Workers.kt"
-            line="58"/>
+            line="57"/>
     </issue>
 
     <issue
@@ -398,7 +398,7 @@
         message="Avoid using new ForkJoinPool instances when possible. Prefer using the IntelliJ application pool via `com.intellij.openapi.application.Application#executeOnPooledThread`, or for the Android Gradle Plugin use `com.android.build.gradle.internal.tasks.Workers`. See `go/do-not-freeze`.">
         <location
             file="src/main/java/com/android/build/gradle/internal/tasks/Workers.kt"
-            line="166"/>
+            line="175"/>
     </issue>
 
 </issues>
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/AppPlugin.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/AppPlugin.kt
new file mode 100644
index 0000000..77888a5
--- /dev/null
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/AppPlugin.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.build.gradle
+
+import org.gradle.api.Project
+
+/**
+ * The plugin applied with `com.android.application'
+ */
+@Suppress("DEPRECATION")
+class AppPlugin: BasePlugin() {
+    override fun apply(project: Project) {
+        super.apply(project)
+
+        project.apply(INTERNAL_PLUGIN_ID)
+    }
+}
+
+private val INTERNAL_PLUGIN_ID = mapOf("plugin" to "com.android.internal.application")
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/BasePlugin.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/BasePlugin.kt
new file mode 100644
index 0000000..15840eb
--- /dev/null
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/BasePlugin.kt
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.build.gradle
+
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+
+/**
+ * Base class for the plugin.
+ *
+ * @Deprecated Use the plugin classes directly
+ */
+@Deprecated("Do not use")
+open class BasePlugin: Plugin<Project> {
+    private lateinit var project: Project
+
+    override fun apply(project: Project) {
+        this.project = project
+    }
+
+    /**
+     * Returns the Android extension.
+     *
+     * @deprecated Directely call project.extensions.getByName("android") instead.
+     */
+    @Deprecated("Use project.extensions.getByName(\"android\")")
+    fun getExtension(): BaseExtension {
+        return project.extensions.getByName("android") as BaseExtension
+    }
+}
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/DynamicFeaturePlugin.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/DynamicFeaturePlugin.kt
new file mode 100644
index 0000000..c1f6c94
--- /dev/null
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/DynamicFeaturePlugin.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.build.gradle
+
+import org.gradle.api.Project
+
+/**
+ * The plugin applied with `com.android.dynamic-feature'
+ */
+@Suppress("DEPRECATION")
+class DynamicFeaturePlugin: BasePlugin() {
+    override fun apply(project: Project) {
+        super.apply(project)
+
+        project.apply(INTERNAL_PLUGIN_ID)
+    }
+}
+
+private val INTERNAL_PLUGIN_ID = mapOf("plugin" to "com.android.internal.dynamic-feature")
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/FeaturePlugin.java b/build-system/gradle-core/src/main/java/com/android/build/gradle/FeaturePlugin.java
index 2f2f211..c2b4b06 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/FeaturePlugin.java
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/FeaturePlugin.java
@@ -24,6 +24,7 @@
 import com.android.build.gradle.internal.TaskManager;
 import com.android.build.gradle.internal.VariantManager;
 import com.android.build.gradle.internal.dependency.VariantDependencies;
+import com.android.build.gradle.internal.plugins.LibraryPlugin;
 import com.android.build.gradle.internal.scope.GlobalScope;
 import com.android.build.gradle.internal.variant.MultiTypeVariantFactory;
 import com.android.build.gradle.internal.variant.VariantFactory;
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/InstantAppPlugin.java b/build-system/gradle-core/src/main/java/com/android/build/gradle/InstantAppPlugin.java
index c98f344..25b014e 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/InstantAppPlugin.java
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/InstantAppPlugin.java
@@ -28,6 +28,7 @@
 import com.android.build.gradle.internal.dsl.ProductFlavor;
 import com.android.build.gradle.internal.dsl.SigningConfig;
 import com.android.build.gradle.internal.ide.InstantAppModelBuilder;
+import com.android.build.gradle.internal.plugins.BasePlugin;
 import com.android.build.gradle.internal.scope.GlobalScope;
 import com.android.build.gradle.internal.variant.InstantAppVariantFactory;
 import com.android.build.gradle.internal.variant.VariantFactory;
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/PluginExtensions.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/LibraryPlugin.kt
similarity index 60%
copy from build-system/gradle-core/src/test/java/com/android/build/gradle/PluginExtensions.kt
copy to build-system/gradle-core/src/main/java/com/android/build/gradle/LibraryPlugin.kt
index d87dc25..2f76d0b 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/PluginExtensions.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/LibraryPlugin.kt
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,10 +16,18 @@
 
 package com.android.build.gradle
 
+import org.gradle.api.Project
+
 /**
- * extension to call afterEvaluate on a plugin directly. This also works around the
- * package visibility of createAndroidTasks for testing.
+ * The plugin applied with 'com.android.library'
  */
-fun BasePlugin.runAfterEvaluate(force: Boolean = false) {
-    this.createAndroidTasks()
+@Suppress("DEPRECATION")
+class LibraryPlugin: BasePlugin() {
+    override fun apply(project: Project) {
+        super.apply(project)
+
+        project.apply(INTERNAL_PLUGIN_ID)
+    }
 }
+
+private val INTERNAL_PLUGIN_ID = mapOf("plugin" to "com.android.internal.library")
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/LintPlugin.java b/build-system/gradle-core/src/main/java/com/android/build/gradle/LintPlugin.java
index 4f3e43e..07c4eaa 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/LintPlugin.java
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/LintPlugin.java
@@ -20,6 +20,7 @@
 import com.android.annotations.Nullable;
 import com.android.build.gradle.internal.TaskManager;
 import com.android.build.gradle.internal.dsl.LintOptions;
+import com.android.build.gradle.internal.plugins.BasePlugin;
 import com.android.build.gradle.internal.tasks.LintStandaloneTask;
 import java.io.File;
 import org.gradle.api.Action;
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/PluginExtensions.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/ReportingPlugin.kt
similarity index 61%
copy from build-system/gradle-core/src/test/java/com/android/build/gradle/PluginExtensions.kt
copy to build-system/gradle-core/src/main/java/com/android/build/gradle/ReportingPlugin.kt
index d87dc25..9f4e2cd 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/PluginExtensions.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/ReportingPlugin.kt
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,10 +16,16 @@
 
 package com.android.build.gradle
 
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+
 /**
- * extension to call afterEvaluate on a plugin directly. This also works around the
- * package visibility of createAndroidTasks for testing.
+ * The plugin applied with 'com.android.reporting'
  */
-fun BasePlugin.runAfterEvaluate(force: Boolean = false) {
-    this.createAndroidTasks()
+class ReportingPlugin: Plugin<Project> {
+    override fun apply(project: Project) {
+        project.apply(INTERNAL_PLUGIN_ID)
+    }
 }
+
+private val INTERNAL_PLUGIN_ID = mapOf("plugin" to "com.android.internal.reporting")
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/PluginExtensions.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/TestPlugin.kt
similarity index 60%
copy from build-system/gradle-core/src/test/java/com/android/build/gradle/PluginExtensions.kt
copy to build-system/gradle-core/src/main/java/com/android/build/gradle/TestPlugin.kt
index d87dc25..e54809e 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/PluginExtensions.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/TestPlugin.kt
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,10 +16,18 @@
 
 package com.android.build.gradle
 
+import org.gradle.api.Project
+
 /**
- * extension to call afterEvaluate on a plugin directly. This also works around the
- * package visibility of createAndroidTasks for testing.
+ * The plugin applied with 'com.android.test'
  */
-fun BasePlugin.runAfterEvaluate(force: Boolean = false) {
-    this.createAndroidTasks()
+@Suppress("DEPRECATION")
+class TestPlugin: BasePlugin() {
+    override fun apply(project: Project) {
+        super.apply(project)
+
+        project.apply(INTERNAL_PLUGIN_ID)
+    }
 }
+
+private val INTERNAL_PLUGIN_ID = mapOf("plugin" to "com.android.internal.test")
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/AppModelBuilder.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/AppModelBuilder.kt
index deef965..6edb56b 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/AppModelBuilder.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/AppModelBuilder.kt
@@ -16,7 +16,7 @@
 
 package com.android.build.gradle.internal
 
-import com.android.build.gradle.AppPlugin
+import com.android.build.gradle.internal.plugins.AppPlugin
 import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
 import com.android.build.gradle.internal.ide.DefaultAppBundleProjectBuildOutput
 import com.android.build.gradle.internal.ide.DefaultAppBundleVariantBuildOutput
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/AbstractAppPlugin.java b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/AbstractAppPlugin.java
similarity index 95%
rename from build-system/gradle-core/src/main/java/com/android/build/gradle/AbstractAppPlugin.java
rename to build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/AbstractAppPlugin.java
index ae9187d..8dcedee 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/AbstractAppPlugin.java
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/AbstractAppPlugin.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,10 +14,12 @@
  * limitations under the License.
  */
 
-package com.android.build.gradle;
+package com.android.build.gradle.internal.plugins;
 
 import android.databinding.tool.DataBindingBuilder;
 import com.android.annotations.NonNull;
+import com.android.build.gradle.AppExtension;
+import com.android.build.gradle.BaseExtension;
 import com.android.build.gradle.api.BaseVariantOutput;
 import com.android.build.gradle.internal.ApplicationTaskManager;
 import com.android.build.gradle.internal.ExtraModelInfo;
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/AppPlugin.java b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/AppPlugin.java
similarity index 94%
rename from build-system/gradle-core/src/main/java/com/android/build/gradle/AppPlugin.java
rename to build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/AppPlugin.java
index fea41aa..d9bd3f3 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/AppPlugin.java
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/AppPlugin.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,9 +14,11 @@
  * limitations under the License.
  */
 
-package com.android.build.gradle;
+package com.android.build.gradle.internal.plugins;
 
 import com.android.annotations.NonNull;
+import com.android.build.gradle.AppExtension;
+import com.android.build.gradle.BaseExtension;
 import com.android.build.gradle.internal.AppModelBuilder;
 import com.android.build.gradle.internal.ExtraModelInfo;
 import com.android.build.gradle.internal.VariantManager;
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/BasePlugin.java b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/BasePlugin.java
similarity index 99%
rename from build-system/gradle-core/src/main/java/com/android/build/gradle/BasePlugin.java
rename to build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/BasePlugin.java
index 6fdf318..779c2dd 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/BasePlugin.java
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/BasePlugin.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.build.gradle;
+package com.android.build.gradle.internal.plugins;
 
 import static com.google.common.base.Preconditions.checkState;
 import static java.io.File.separator;
@@ -24,6 +24,8 @@
 import com.android.Version;
 import com.android.annotations.NonNull;
 import com.android.annotations.Nullable;
+import com.android.build.gradle.BaseExtension;
+import com.android.build.gradle.FeaturePlugin;
 import com.android.build.gradle.api.AndroidBasePlugin;
 import com.android.build.gradle.api.BaseVariantOutput;
 import com.android.build.gradle.internal.ApiObjectFactory;
@@ -132,7 +134,7 @@
 
     protected ProjectOptions projectOptions;
 
-    private GlobalScope globalScope;
+    GlobalScope globalScope;
 
     private DataBindingBuilder dataBindingBuilder;
 
@@ -153,7 +155,7 @@
 
     private boolean hasCreatedTasks = false;
 
-    BasePlugin(
+    public BasePlugin(
             @NonNull ToolingModelBuilderRegistry registry,
             @NonNull SoftwareComponentFactory componentFactory) {
         ClasspathVerifier.checkClasspathSanity();
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/DynamicFeaturePlugin.java b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/DynamicFeaturePlugin.java
similarity index 92%
rename from build-system/gradle-core/src/main/java/com/android/build/gradle/DynamicFeaturePlugin.java
rename to build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/DynamicFeaturePlugin.java
index 766fbcf..1963569 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/DynamicFeaturePlugin.java
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/DynamicFeaturePlugin.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,9 +14,10 @@
  * limitations under the License.
  */
 
-package com.android.build.gradle;
+package com.android.build.gradle.internal.plugins;
 
 import com.android.annotations.NonNull;
+import com.android.build.gradle.AppExtension;
 import com.android.builder.model.AndroidProject;
 import com.google.wireless.android.sdk.stats.GradleBuildProject;
 import javax.inject.Inject;
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/LibraryPlugin.java b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/LibraryPlugin.java
similarity index 95%
rename from build-system/gradle-core/src/main/java/com/android/build/gradle/LibraryPlugin.java
rename to build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/LibraryPlugin.java
index 7ff9a44..6264357 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/LibraryPlugin.java
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/LibraryPlugin.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -13,10 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.android.build.gradle;
+package com.android.build.gradle.internal.plugins;
 
 import android.databinding.tool.DataBindingBuilder;
 import com.android.annotations.NonNull;
+import com.android.build.gradle.BaseExtension;
+import com.android.build.gradle.LibraryExtension;
 import com.android.build.gradle.api.BaseVariantOutput;
 import com.android.build.gradle.internal.ExtraModelInfo;
 import com.android.build.gradle.internal.LibraryTaskManager;
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/ReportingPlugin.java b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/ReportingPlugin.java
similarity index 97%
rename from build-system/gradle-core/src/main/java/com/android/build/gradle/ReportingPlugin.java
rename to build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/ReportingPlugin.java
index d8deb0a..f52ea8f 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/ReportingPlugin.java
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/ReportingPlugin.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.build.gradle;
+package com.android.build.gradle.internal.plugins;
 
 import static com.android.builder.core.BuilderConstants.FD_ANDROID_RESULTS;
 import static com.android.builder.core.BuilderConstants.FD_ANDROID_TESTS;
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/StructurePlugin.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/StructurePlugin.kt
index 84aa41b..c1e3b96 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/StructurePlugin.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/StructurePlugin.kt
@@ -16,7 +16,6 @@
 
 package com.android.build.gradle.internal.plugins
 
-import com.android.build.gradle.BasePlugin
 import com.android.build.gradle.internal.tasks.structureplugin.CombineModuleInfoTask
 import com.android.build.gradle.internal.tasks.structureplugin.GatherModuleInfoTask
 import org.gradle.api.NamedDomainObjectContainer
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/TestPlugin.java b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/TestPlugin.java
similarity index 95%
rename from build-system/gradle-core/src/main/java/com/android/build/gradle/TestPlugin.java
rename to build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/TestPlugin.java
index 6800780..eebb8ff 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/TestPlugin.java
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/plugins/TestPlugin.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,10 +14,12 @@
  * limitations under the License.
  */
 
-package com.android.build.gradle;
+package com.android.build.gradle.internal.plugins;
 
 import android.databinding.tool.DataBindingBuilder;
 import com.android.annotations.NonNull;
+import com.android.build.gradle.BaseExtension;
+import com.android.build.gradle.TestExtension;
 import com.android.build.gradle.api.BaseVariantOutput;
 import com.android.build.gradle.internal.ExtraModelInfo;
 import com.android.build.gradle.internal.TaskManager;
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/structureplugin/GatherModuleInfoTask.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/structureplugin/GatherModuleInfoTask.kt
index ef1c37c..913caf4 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/structureplugin/GatherModuleInfoTask.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/structureplugin/GatherModuleInfoTask.kt
@@ -16,7 +16,7 @@
 
 package com.android.build.gradle.internal.tasks.structureplugin
 
-import com.android.build.gradle.BasePlugin
+import com.android.build.gradle.internal.plugins.BasePlugin
 import com.android.ide.common.symbols.IdProvider
 import com.android.ide.common.symbols.parseResourceSourceSetDirectory
 import com.android.resources.ResourceType
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/android-library.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/android-library.properties
index c3e8a16..2c3ecdd 100644
--- a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/android-library.properties
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/android-library.properties
@@ -1 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 implementation-class=com.android.build.gradle.LibraryPlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/android-reporting.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/android-reporting.properties
index 38b4622..d890d90 100644
--- a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/android-reporting.properties
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/android-reporting.properties
@@ -1 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 implementation-class=com.android.build.gradle.ReportingPlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/android.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/android.properties
index 88dd73d..17d8300 100644
--- a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/android.properties
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/android.properties
@@ -1 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 implementation-class=com.android.build.gradle.AppPlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.application.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.application.properties
index 88dd73d..17d8300 100644
--- a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.application.properties
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.application.properties
@@ -1 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 implementation-class=com.android.build.gradle.AppPlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.base.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.base.properties
index f013d02..40edd3a 100644
--- a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.base.properties
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.base.properties
@@ -1 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 implementation-class=com.android.build.gradle.api.AndroidBasePlugin
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.debug.structure.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.debug.structure.properties
index aeca120..b49711b 100644
--- a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.debug.structure.properties
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.debug.structure.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2017 The Android Open Source Project
+# Copyright (C) 2019 The Android Open Source Project
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -13,5 +13,4 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-
 implementation-class=com.android.build.gradle.internal.plugins.StructurePlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.dynamic-feature.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.dynamic-feature.properties
index d848446..a85896e 100644
--- a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.dynamic-feature.properties
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.dynamic-feature.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2018 The Android Open Source Project
+# Copyright (C) 2019 The Android Open Source Project
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -13,5 +13,4 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-
 implementation-class=com.android.build.gradle.DynamicFeaturePlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.feature.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.feature.properties
index 1ebcdbf..953a4ee 100644
--- a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.feature.properties
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.feature.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2017 The Android Open Source Project
+# Copyright (C) 2019 The Android Open Source Project
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -13,5 +13,4 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-
 implementation-class=com.android.build.gradle.FeaturePlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.instantapp.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.instantapp.properties
index 1e457d3..8abefec 100644
--- a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.instantapp.properties
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.instantapp.properties
@@ -1 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 implementation-class=com.android.build.gradle.InstantAppPlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.application.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.application.properties
new file mode 100644
index 0000000..f03c5eb
--- /dev/null
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.application.properties
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+implementation-class=com.android.build.gradle.internal.plugins.AppPlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.dynamic-feature.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.dynamic-feature.properties
new file mode 100644
index 0000000..36b8d14
--- /dev/null
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.dynamic-feature.properties
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+implementation-class=com.android.build.gradle.internal.plugins.DynamicFeaturePlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.library.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.library.properties
new file mode 100644
index 0000000..a72faa6
--- /dev/null
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.library.properties
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+implementation-class=com.android.build.gradle.internal.plugins.LibraryPlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.reporting.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.reporting.properties
new file mode 100644
index 0000000..a18477c
--- /dev/null
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.reporting.properties
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+implementation-class=com.android.build.gradle.internal.plugins.ReportingPlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.test.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.test.properties
new file mode 100644
index 0000000..f68eb7c
--- /dev/null
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.internal.test.properties
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+implementation-class=com.android.build.gradle.internal.plugins.TestPlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.library.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.library.properties
index c3e8a16..2c3ecdd 100644
--- a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.library.properties
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.library.properties
@@ -1 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 implementation-class=com.android.build.gradle.LibraryPlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.lint.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.lint.properties
index 4de306b..223f0db 100644
--- a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.lint.properties
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.lint.properties
@@ -1 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 implementation-class=com.android.build.gradle.LintPlugin
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.reporting.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.reporting.properties
new file mode 100644
index 0000000..d890d90
--- /dev/null
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.reporting.properties
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+implementation-class=com.android.build.gradle.ReportingPlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.test.properties b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.test.properties
index 94a932d..328b067 100644
--- a/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.test.properties
+++ b/build-system/gradle-core/src/main/resources/META-INF/gradle-plugins/com.android.test.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2015 The Android Open Source Project
+# Copyright (C) 2019 The Android Open Source Project
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -13,5 +13,5 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+implementation-class=com.android.build.gradle.TestPlugin
 
-implementation-class=com.android.build.gradle.TestPlugin
\ No newline at end of file
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/DefaultVariantTest.kt b/build-system/gradle-core/src/test/java/com/android/build/gradle/DefaultVariantTest.kt
index f992d7e..6f19efb 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/DefaultVariantTest.kt
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/DefaultVariantTest.kt
@@ -20,6 +20,8 @@
 import com.android.build.gradle.internal.fixture.TestConstants
 import com.android.build.gradle.internal.fixture.TestProjects
 import com.android.build.gradle.internal.ide.SyncIssueImpl
+import com.android.build.gradle.internal.plugins.AppPlugin
+import com.android.build.gradle.internal.plugins.LibraryPlugin
 import com.android.builder.errors.EvalIssueException
 import com.android.builder.model.SyncIssue
 import com.google.common.collect.ImmutableList
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/FeaturePluginDslTest.java b/build-system/gradle-core/src/test/java/com/android/build/gradle/FeaturePluginDslTest.java
index 7c000f0..32f8ef2 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/FeaturePluginDslTest.java
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/FeaturePluginDslTest.java
@@ -20,6 +20,7 @@
 
 import com.android.build.gradle.internal.fixture.TestConstants;
 import com.android.build.gradle.internal.fixture.TestProjects;
+import com.android.build.gradle.internal.plugins.PluginExtensionsKt;
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.stream.Collectors;
@@ -54,7 +55,7 @@
 
     @Test
     public void testTasks() throws Exception {
-        plugin.createAndroidTasks();
+        PluginExtensionsKt.runAfterEvaluate(plugin, false);
 
         SortedSet<String> taskNames = project.getTasks().getNames();
 
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/api/AppliedPluginTest.java b/build-system/gradle-core/src/test/java/com/android/build/gradle/api/AppliedPluginTest.java
index 9b5289d..f7a3246 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/api/AppliedPluginTest.java
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/api/AppliedPluginTest.java
@@ -18,10 +18,10 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import com.android.build.gradle.AppPlugin;
 import com.android.build.gradle.FeaturePlugin;
-import com.android.build.gradle.LibraryPlugin;
-import com.android.build.gradle.TestPlugin;
+import com.android.build.gradle.internal.plugins.AppPlugin;
+import com.android.build.gradle.internal.plugins.LibraryPlugin;
+import com.android.build.gradle.internal.plugins.TestPlugin;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/dsl/BuildTypeTest.java b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/dsl/BuildTypeTest.java
index fbcfded..38abd9f 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/dsl/BuildTypeTest.java
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/dsl/BuildTypeTest.java
@@ -21,8 +21,8 @@
 import static org.junit.Assert.assertTrue;
 
 import com.android.build.gradle.AppExtension;
-import com.android.build.gradle.AppPlugin;
 import com.android.build.gradle.internal.errors.DeprecationReporter;
+import com.android.build.gradle.internal.plugins.AppPlugin;
 import com.android.builder.core.BuilderConstants;
 import com.android.builder.errors.EvalIssueReporter;
 import com.android.sdklib.SdkVersionInfo;
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixture/TestProjects.java b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixture/TestProjects.java
index e21bb4b..ff07f4f 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixture/TestProjects.java
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/fixture/TestProjects.java
@@ -19,13 +19,13 @@
 import com.android.annotations.NonNull;
 import com.android.annotations.Nullable;
 import com.android.build.gradle.AppExtension;
-import com.android.build.gradle.AppPlugin;
 import com.android.build.gradle.BaseExtension;
 import com.android.build.gradle.FeatureExtension;
 import com.android.build.gradle.FeaturePlugin;
 import com.android.build.gradle.LibraryExtension;
-import com.android.build.gradle.LibraryPlugin;
 import com.android.build.gradle.internal.SdkLocator;
+import com.android.build.gradle.internal.plugins.AppPlugin;
+import com.android.build.gradle.internal.plugins.LibraryPlugin;
 import com.android.build.gradle.options.Option;
 import com.android.testutils.OsType;
 import com.android.testutils.TestUtils;
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/AppPluginDslTest.java b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/AppPluginDslTest.java
similarity index 98%
rename from build-system/gradle-core/src/test/java/com/android/build/gradle/AppPluginDslTest.java
rename to build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/AppPluginDslTest.java
index 7c4ef2f..1e339f4 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/AppPluginDslTest.java
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/AppPluginDslTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,11 +14,12 @@
  * limitations under the License.
  */
 
-package com.android.build.gradle;
+package com.android.build.gradle.internal.plugins;
 
 import static com.google.common.truth.Truth.assertThat;
 import static org.junit.Assert.fail;
 
+import com.android.build.gradle.AppExtension;
 import com.android.build.gradle.internal.dsl.BuildType;
 import com.android.build.gradle.internal.dsl.PostProcessingBlock;
 import com.android.build.gradle.internal.fixture.TestConstants;
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/AppPluginInternalTest.java b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/AppPluginInternalTest.java
similarity index 98%
rename from build-system/gradle-core/src/test/java/com/android/build/gradle/AppPluginInternalTest.java
rename to build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/AppPluginInternalTest.java
index 8aa7dd1..a80eb88 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/AppPluginInternalTest.java
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/AppPluginInternalTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,11 +14,12 @@
  * limitations under the License.
  */
 
-package com.android.build.gradle;
+package com.android.build.gradle.internal.plugins;
 
 import static com.google.common.truth.Truth.assertThat;
 import static org.junit.Assert.assertNotNull;
 
+import com.android.build.gradle.AppExtension;
 import com.android.build.gradle.internal.BadPluginException;
 import com.android.build.gradle.internal.fixture.TestConstants;
 import com.android.build.gradle.internal.fixture.TestProjects;
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/LibraryPluginDslTest.java b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/LibraryPluginDslTest.java
similarity index 96%
rename from build-system/gradle-core/src/test/java/com/android/build/gradle/LibraryPluginDslTest.java
rename to build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/LibraryPluginDslTest.java
index 006c32a..8e83e3f 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/LibraryPluginDslTest.java
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/LibraryPluginDslTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,13 +14,14 @@
  * limitations under the License.
  */
 
-package com.android.build.gradle;
+package com.android.build.gradle.internal.plugins;
 
 import static com.google.common.truth.Truth.assertThat;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
+import com.android.build.gradle.LibraryExtension;
 import com.android.build.gradle.api.TestVariant;
 import com.android.build.gradle.internal.dsl.BuildType;
 import com.android.build.gradle.internal.fixture.BaseTestedVariant;
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/NoTaskOutputFileOverlapTest.kt b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/NoTaskOutputFileOverlapTest.kt
similarity index 94%
rename from build-system/gradle-core/src/test/java/com/android/build/gradle/NoTaskOutputFileOverlapTest.kt
rename to build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/NoTaskOutputFileOverlapTest.kt
index 75e4640..2133926 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/NoTaskOutputFileOverlapTest.kt
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/NoTaskOutputFileOverlapTest.kt
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,8 +14,10 @@
  * limitations under the License.
  */
 
-package com.android.build.gradle
+package com.android.build.gradle.internal.plugins
 
+import com.android.build.gradle.AppExtension
+import com.android.build.gradle.LibraryExtension
 import com.android.build.gradle.internal.fixture.TestConstants
 import com.android.build.gradle.internal.fixture.TestProjects
 import com.google.common.truth.Expect
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/PluginDslTest.java b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/PluginDslTest.java
similarity index 98%
rename from build-system/gradle-core/src/test/java/com/android/build/gradle/PluginDslTest.java
rename to build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/PluginDslTest.java
index 318c541..f5316a9 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/PluginDslTest.java
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/PluginDslTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,12 +14,14 @@
  * limitations under the License.
  */
 
-package com.android.build.gradle;
+package com.android.build.gradle.internal.plugins;
 
 import static com.google.common.truth.Truth.assertThat;
 
 import com.android.SdkConstants;
 import com.android.Version;
+import com.android.build.gradle.AppExtension;
+import com.android.build.gradle.BaseExtension;
 import com.android.build.gradle.api.TestVariant;
 import com.android.build.gradle.internal.core.GradleVariantConfiguration;
 import com.android.build.gradle.internal.dsl.BuildType;
@@ -680,7 +682,7 @@
     public void testSetOlderBuildToolsVersion() {
         android.setBuildToolsVersion("19.0.0");
         plugin.createAndroidTasks();
-        assertThat(android.globalScope.getSdkComponents().getBuildToolsRevisionProvider().get())
+        assertThat(plugin.globalScope.getSdkComponents().getBuildToolsRevisionProvider().get())
                 .isEqualTo(ToolsRevisionUtils.DEFAULT_BUILD_TOOLS_REVISION);
         // FIXME once we get rid of the component model, we can make this better.
         Collection<SyncIssue> syncIssues =
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/PluginExtensions.kt b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/PluginExtensions.kt
similarity index 88%
rename from build-system/gradle-core/src/test/java/com/android/build/gradle/PluginExtensions.kt
rename to build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/PluginExtensions.kt
index d87dc25..210a3cb 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/PluginExtensions.kt
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/plugins/PluginExtensions.kt
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.build.gradle
+package com.android.build.gradle.internal.plugins
 
 /**
  * extension to call afterEvaluate on a plugin directly. This also works around the
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/tests/ConfigurationExtensionTest.kt b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/tests/ConfigurationExtensionTest.kt
index e81048f..8c2778a 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/tests/ConfigurationExtensionTest.kt
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/tests/ConfigurationExtensionTest.kt
@@ -17,11 +17,11 @@
 package com.android.build.gradle.internal.tests
 
 import com.android.build.gradle.BaseExtension
-import com.android.build.gradle.BasePlugin
+import com.android.build.gradle.internal.plugins.BasePlugin
 import com.android.build.gradle.internal.fixture.TestConstants
 import com.android.build.gradle.internal.fixture.TestProjects
 import com.android.build.gradle.internal.fixture.createAndConfig
-import com.android.build.gradle.runAfterEvaluate
+import com.android.build.gradle.internal.plugins.runAfterEvaluate
 import com.android.ide.common.util.multimapOf
 import com.android.ide.common.util.multimapWithSingleKeyOf
 import com.google.common.collect.ImmutableSetMultimap
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/tests/FlavorSelectionTest.kt b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/tests/FlavorSelectionTest.kt
index 2f050a9..0f32c18 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/tests/FlavorSelectionTest.kt
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/tests/FlavorSelectionTest.kt
@@ -18,12 +18,12 @@
 
 import com.android.build.api.attributes.ProductFlavorAttr
 import com.android.build.gradle.AppExtension
-import com.android.build.gradle.AppPlugin
+import com.android.build.gradle.internal.plugins.AppPlugin
 import com.android.build.gradle.internal.VariantManager
 import com.android.build.gradle.internal.fixture.TestConstants
 import com.android.build.gradle.internal.fixture.TestProjects
 import com.android.build.gradle.internal.fixture.createAndConfig
-import com.android.build.gradle.runAfterEvaluate
+import com.android.build.gradle.internal.plugins.runAfterEvaluate
 import com.google.common.truth.Truth
 import org.gradle.api.Project
 import org.gradle.api.artifacts.Configuration
diff --git a/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/sanity/JarContentsTest.java b/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/sanity/JarContentsTest.java
index fc11dfe..a446c2c 100644
--- a/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/sanity/JarContentsTest.java
+++ b/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/sanity/JarContentsTest.java
@@ -105,6 +105,8 @@
                 "com/android/build/api/sourcesets/",
                 "com/android/build/api/transform/",
                 "com/android/build/api/variant/",
+                "com/android/build/gradle/",
+                "com/android/build/gradle/api/",
                 "META-INF/",
                 "META-INF/MANIFEST.MF",
                 "NOTICE");
@@ -417,18 +419,25 @@
                 "META-INF/",
                 "META-INF/MANIFEST.MF",
                 "META-INF/gradle-plugins/",
-                "META-INF/gradle-plugins/com.android.base.properties",
-                "META-INF/gradle-plugins/android-library.properties",
-                "META-INF/gradle-plugins/android.properties",
-                "META-INF/gradle-plugins/android-reporting.properties",
-                "META-INF/gradle-plugins/com.android.application.properties",
                 "META-INF/gradle-plugins/com.android.debug.structure.properties",
                 "META-INF/gradle-plugins/com.android.feature.properties",
                 "META-INF/gradle-plugins/com.android.instantapp.properties",
-                "META-INF/gradle-plugins/com.android.library.properties",
+                "META-INF/gradle-plugins/com.android.internal.application.properties",
+                "META-INF/gradle-plugins/com.android.internal.dynamic-feature.properties",
+                "META-INF/gradle-plugins/com.android.internal.library.properties",
+                "META-INF/gradle-plugins/com.android.internal.reporting.properties",
+                "META-INF/gradle-plugins/com.android.internal.test.properties",
                 "META-INF/gradle-plugins/com.android.lint.properties",
-                "META-INF/gradle-plugins/com.android.test.properties",
+                // Following to be moved to gradle-api
+                "META-INF/gradle-plugins/android.properties",
+                "META-INF/gradle-plugins/android-library.properties",
+                "META-INF/gradle-plugins/android-reporting.properties",
+                "META-INF/gradle-plugins/com.android.application.properties",
+                "META-INF/gradle-plugins/com.android.base.properties",
                 "META-INF/gradle-plugins/com.android.dynamic-feature.properties",
+                "META-INF/gradle-plugins/com.android.library.properties",
+                "META-INF/gradle-plugins/com.android.reporting.properties",
+                "META-INF/gradle-plugins/com.android.test.properties",
                 "NOTICE");
         expected.putAll(
                 "com/android/tools/sdk-common",
diff --git a/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/GradleTestProject.java b/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/GradleTestProject.java
index 1cd1bfd..cd1be41 100644
--- a/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/GradleTestProject.java
+++ b/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/GradleTestProject.java
@@ -24,11 +24,11 @@
 import com.android.Version;
 import com.android.annotations.NonNull;
 import com.android.annotations.Nullable;
-import com.android.build.gradle.BasePlugin;
 import com.android.build.gradle.integration.BazelIntegrationTestsSuite;
 import com.android.build.gradle.integration.common.truth.ScannerSubjectUtils;
 import com.android.build.gradle.integration.common.utils.TestFileUtils;
 import com.android.build.gradle.internal.cxx.configure.NdkLocatorKt;
+import com.android.build.gradle.internal.plugins.BasePlugin;
 import com.android.build.gradle.options.BooleanOption;
 import com.android.builder.core.ToolsRevisionUtils;
 import com.android.builder.model.AndroidProject;
diff --git a/tracer/deploy.profile b/tracer/deploy.profile
index ae23b37..8754d8c 100644
--- a/tracer/deploy.profile
+++ b/tracer/deploy.profile
@@ -18,7 +18,7 @@
 Trace: com.android.tools.idea.gradle.project.build.invoker.GradleBuildInvoker::*
 
 # Android plugin gradle side
-Trace: com.android.build.gradle.BasePlugin
+Trace: com.android.build.gradle.internal.plugins.BasePlugin
 # START REPO MANAGER (Bug #122905819)
 Trace: com.android.repository.impl.manager.RepoManagerImpl::*
 Trace: com.android.repository.impl.manager.LocalRepoLoaderImpl::*
diff --git a/tracer/gradle.profile b/tracer/gradle.profile
index feb1753..937d746 100644
--- a/tracer/gradle.profile
+++ b/tracer/gradle.profile
@@ -13,7 +13,7 @@
 Trace: org.gradle.execution.DefaultBuildConfigurationActionExecuter::configure
 
 # Android plugin
-Trace: com.android.build.gradle.BasePlugin
+Trace: com.android.build.gradle.internal.plugins.BasePlugin
 Annotation: org.gradle.api.tasks.TaskAction
 
 # Apk step