[go: nahoru, domu]

Migrate all projects with CompilationTarget.HOST to use LibraryType.
Adds some more LibraryTypes. Deprecates toolingProject.

Partially inspired by Oussama's recent need to land an enforcement CL
for Lint

Test: verify that everything that used to be published is, everything
that should be CompilationTarget.HOST is, and everything that should be
API checked is. If any of these is not the case, it will trigger
warnings or errors and fail the build.

Change-Id: Ief3ffc23ea1ccf9414eb04cd641cb7a7445116d2
diff --git a/activity/activity-lint/build.gradle b/activity/activity-lint/build.gradle
index 81913ec..367343d 100644
--- a/activity/activity-lint/build.gradle
+++ b/activity/activity-lint/build.gradle
@@ -14,13 +14,10 @@
  * limitations under the License.
  */
 
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.AndroidXExtension
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.SdkHelperKt
-import androidx.build.Publish
+import androidx.build.LibraryType
+
+import static androidx.build.dependencies.DependenciesKt.*
 
 plugins {
     id("AndroidXPlugin")
@@ -44,10 +41,8 @@
 
 androidx {
     name = "Android Activity Lint Checks"
-    toolingProject = true
-    publish = Publish.NONE
+    type = LibraryType.LINT
     mavenGroup = LibraryGroups.ACTIVITY
     inceptionYear = "2020"
     description = "Android Activity Lint Checks"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/annotation/annotation-experimental-lint/build.gradle b/annotation/annotation-experimental-lint/build.gradle
index b2f50d3..6c42ad7 100644
--- a/annotation/annotation-experimental-lint/build.gradle
+++ b/annotation/annotation-experimental-lint/build.gradle
@@ -14,14 +14,12 @@
  * limitations under the License.
  */
 
-
+import androidx.build.LibraryGroups
+import androidx.build.LibraryType
+import androidx.build.LibraryVersions
 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
 
 import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.CompilationTarget
-import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.Publish
 
 plugins {
     id("AndroidXPlugin")
@@ -46,17 +44,14 @@
 
 androidx {
     name = "Experimental annotation lint checks"
-    toolingProject = true
-    publish = Publish.NONE
+    type = LibraryType.LINT
     mavenVersion = LibraryVersions.ANNOTATION_EXPERIMENTAL
     mavenGroup = LibraryGroups.ANNOTATION
     inceptionYear = "2019"
     description = "Lint checks for the Experimental annotation library. Also enforces the " +
             "semantics of Kotlin @Experimental APIs from within Android Java source code."
-    compilationTarget = CompilationTarget.HOST
 }
 
-
 tasks.withType(KotlinCompile).configureEach {
     kotlinOptions {
         freeCompilerArgs += ["-XXLanguage:-NewInference"]
diff --git a/appcompat/appcompat-lint/build.gradle b/appcompat/appcompat-lint/build.gradle
index a9daccd..d6cea5e 100644
--- a/appcompat/appcompat-lint/build.gradle
+++ b/appcompat/appcompat-lint/build.gradle
@@ -14,8 +14,6 @@
  * limitations under the License.
  */
 
-
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
 import androidx.build.LibraryType
 import androidx.build.LibraryVersions
diff --git a/appsearch/compiler/build.gradle b/appsearch/compiler/build.gradle
index e2c57ac..7d67114 100644
--- a/appsearch/compiler/build.gradle
+++ b/appsearch/compiler/build.gradle
@@ -14,9 +14,8 @@
  * limitations under the License.
  */
 
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
-import androidx.build.Publish
+import androidx.build.LibraryType
 
 import static androidx.build.dependencies.DependenciesKt.*
 
@@ -41,11 +40,9 @@
 
 androidx {
     name = 'AndroidX AppSearch Compiler'
-    publish = Publish.SNAPSHOT_AND_RELEASE
-    toolingProject = true
+    type = LibraryType.COMPILER_PLUGIN
     mavenGroup = LibraryGroups.APPSEARCH
     inceptionYear = '2019'
     description = 'Compiler for AndroidX AppSearch data classes'
     failOnDeprecationWarnings = false
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/benchmark/gradle-plugin/build.gradle b/benchmark/gradle-plugin/build.gradle
index 7c7bb0e1..6f34e1c 100644
--- a/benchmark/gradle-plugin/build.gradle
+++ b/benchmark/gradle-plugin/build.gradle
@@ -15,10 +15,8 @@
  */
 
 import androidx.build.BuildServerConfigurationKt
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.Publish
+import androidx.build.LibraryType
 import androidx.build.SdkResourceGenerator
 
 import static androidx.build.dependencies.DependenciesKt.*
@@ -68,10 +66,8 @@
 
 androidx {
     name = "Android Benchmark Gradle Plugin"
-    publish = Publish.SNAPSHOT_AND_RELEASE
-    toolingProject = true
+    type = LibraryType.GRADLE_PLUGIN
     mavenGroup = LibraryGroups.BENCHMARK
     inceptionYear = "2019"
     description = "Android Benchmark Gradle Plugin"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/buildSrc/src/main/kotlin/androidx/build/AndroidXExtension.kt b/buildSrc/src/main/kotlin/androidx/build/AndroidXExtension.kt
index 8cc2514..b182dad 100644
--- a/buildSrc/src/main/kotlin/androidx/build/AndroidXExtension.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/AndroidXExtension.kt
@@ -26,6 +26,7 @@
  * Extension for [AndroidXPlugin] that's responsible for holding configuration options.
  */
 open class AndroidXExtension(val project: Project) {
+
     var name: String? = null
     var mavenVersion: Version? = null
         set(value) {
@@ -138,9 +139,9 @@
     private var licenses: MutableCollection<License> = ArrayList()
 
     // Should only be used to override LibraryType.publish, if a library isn't ready to publish yet
-    var publish: Publish = Publish.NONE
+    var publish: Publish = Publish.UNSET
         // Allow gradual transition from publish to library type
-        get() = if (type != LibraryType.UNSET) type.publish else field
+        get() = if (field == Publish.UNSET && type != LibraryType.UNSET) type.publish else field
     /**
      * Whether to run API tasks such as tracking and linting. The default value is
      * [RunApiTasks.Auto], which automatically picks based on the project's properties.
@@ -148,21 +149,9 @@
     // TODO: decide whether we want to support overriding runApiTasks
     // @Deprecated("Replaced with AndroidXExtension.type: LibraryType.runApiTasks")
     var runApiTasks: RunApiTasks = RunApiTasks.Auto
-        get() = if (type != LibraryType.UNSET) type.checkApi else field
+        get() = if (field == RunApiTasks.Auto && type != LibraryType.UNSET) type.checkApi else field
     var type: LibraryType = LibraryType.UNSET
     var failOnDeprecationWarnings = true
-    // @Deprecated("Replaced with AndroidXExtension.type: LibraryType.compilationTarget")
-    var compilationTarget: CompilationTarget = CompilationTarget.DEVICE
-        get() = if (type != LibraryType.UNSET) type.compilationTarget else field
-
-    /**
-     * It disables docs generation and api tracking for tooling modules like annotation processors.
-     * We don't expect such modules to be used by developers as libraries, so we don't guarantee
-     * any api stability and don't expose any docs about them.
-     */
-    // This is now deprecated in favor of LibraryType
-    // @Deprecated("Replaced with AndroidXExtension.type: LibraryType.LINT and ANNOTATION_PROCESSOR")
-    var toolingProject = false
 
     /**
      * Disables just docs generation for modules that are published and should have their API
@@ -175,7 +164,6 @@
     var generateDocs = true
         get() {
             if (type != LibraryType.UNSET) return type.generateDocs
-            if (toolingProject) return false
             if (!publish.shouldRelease()) return false
             return field
         }
diff --git a/buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt b/buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt
index cf8c578..6f0bbda 100644
--- a/buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt
@@ -505,9 +505,10 @@
                 }
             }
 
-            if (androidXExtension.compilationTarget != CompilationTarget.DEVICE) {
+            if (androidXExtension.type.compilationTarget != CompilationTarget.DEVICE) {
                 throw IllegalStateException(
-                    "Android libraries must use a compilation target of DEVICE"
+                    "${androidXExtension.type.name} libraries cannot apply the android plugin, as" +
+                        " they do not target android devices"
                 )
             }
         }
diff --git a/buildSrc/src/main/kotlin/androidx/build/LibraryType.kt b/buildSrc/src/main/kotlin/androidx/build/LibraryType.kt
index c4420cd..4f2bd6c 100644
--- a/buildSrc/src/main/kotlin/androidx/build/LibraryType.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/LibraryType.kt
@@ -16,8 +16,6 @@
 
 package androidx.build
 
-import org.gradle.api.Project
-
 /**
  * LibraryType represents the purpose and type of a library, whether it is a conventional library,
  * a set of samples showing how to use a conventional library, a set of lint rules for using a
@@ -37,17 +35,24 @@
  *      to our semantic versioning protocol
  *
  * The possible values of LibraryType are as follows:
- * PUBLISHED_LIBRARY: a conventional library, published, sourced, documented, and versioned
+ * PUBLISHED_LIBRARY: a conventional library, published, sourced, documented, and versioned.
  * SAMPLES: a library of samples, published as additional properties to a conventional library,
  *      including published source. Documented in a special way, not API tracked.
  * LINT: a library of lint rules for using a conventional library. Published through lintPublish as
- *      part of an AAR, not published standalone
+ *      part of an AAR, not published standalone.
+ * COMPILER_PLUGIN: a tool that modifies the kotlin or java compiler. Used only while compiling.
+ * GRADLE_PLUGIN: a library that is a gradle plugin.
  * ANNOTATION_PROCESSOR: a library consisting of an annotation processor. Used only while compiling.
+ * OTHER_CODE_PROCESSOR: a library that algorithmically generates and/or alters code
+ *                      but not through hooking into custom annotations or the kotlin compiler.
+ *                      For example, navigation:safe-args-generator or Jetifier.
  * UNSET: a library that has not yet been migrated to using LibraryType. Should never be used.
  *
  * TODO: potential future LibraryTypes:
  * KOTLIN_ONLY_LIBRARY: like PUBLISHED_LIBRARY, but not intended for use from java. ktx and compose.
- * INTERNAL_TEST: compilationTarget varies? Everything else is default.
+ * INTERNAL_TEST
+ * DEMO
+ * IDE_PLUGIN
  *
  */
 enum class LibraryType(
@@ -76,20 +81,47 @@
         checkApi = RunApiTasks.No("Lint Library"),
         compilationTarget = CompilationTarget.HOST
     ),
+    COMPILER_PLUGIN(
+        Publish.SNAPSHOT_AND_RELEASE,
+        sourceJars = false,
+        generateDocs = false,
+        RunApiTasks.No("Compiler Plugin (Host-only)"),
+        CompilationTarget.HOST
+    ),
+    GRADLE_PLUGIN(
+        Publish.SNAPSHOT_AND_RELEASE,
+        sourceJars = false,
+        generateDocs = false,
+        RunApiTasks.No("Gradle Plugin (Host-only)"),
+        CompilationTarget.HOST
+    ),
     ANNOTATION_PROCESSOR(
         publish = Publish.SNAPSHOT_AND_RELEASE,
         sourceJars = false,
-        generateDocs = true,
+        generateDocs = false,
         checkApi = RunApiTasks.No("Annotation Processor"),
         compilationTarget = CompilationTarget.HOST
     ),
+    OTHER_CODE_PROCESSOR(
+        publish = Publish.SNAPSHOT_AND_RELEASE,
+        sourceJars = false,
+        generateDocs = false,
+        checkApi = RunApiTasks.No("Code Processor (Host-only)"),
+        compilationTarget = CompilationTarget.HOST
+    ),
+    IDE_PLUGIN(
+        publish = Publish.NONE,
+        sourceJars = false,
+        generateDocs = false,
+        // TODO: figure out a way to make sure we don't break Studio
+        checkApi = RunApiTasks.No("IDE Plugin (consumed only by Android Studio"),
+        // This is a bit complicated. IDE plugins usually have an on-device component installed by
+        // Android Studio, rather than by a client of the library, but also a host-side component.
+        compilationTarget = CompilationTarget.DEVICE
+    ),
     UNSET()
 }
 
-fun Project.isSamplesProject(): Boolean {
-    return project.extensions.findByType(AndroidXExtension::class.java)?.type == LibraryType.SAMPLES
-}
-
 enum class CompilationTarget {
     /** This library is meant to run on the host machine (like an annotation processor). */
     HOST,
@@ -103,11 +135,14 @@
  *                 or releasable maven artifacts
  * Publish.SNAPSHOT_ONLY -> Only generates snapshot artifacts
  * Publish.SNAPSHOT_AND_RELEASE -> Generates both snapshot artifacts and releasable maven artifact
+ * Publish.UNSET -> Do the default, based on LibraryType. If LibraryType.UNSET -> Publish.NONE
  *
  * TODO: should we introduce a Publish.lintPublish?
+ * TODO: remove Publish.UNSET once we remove LibraryType.UNSET.
+ * It is necessary now in order to be able to override LibraryType.publish (with Publish.None)
  */
 enum class Publish {
-    NONE, SNAPSHOT_ONLY, SNAPSHOT_AND_RELEASE;
+    NONE, SNAPSHOT_ONLY, SNAPSHOT_AND_RELEASE, UNSET;
 
     fun shouldRelease() = this == SNAPSHOT_AND_RELEASE
     fun shouldPublish() = this == SNAPSHOT_ONLY || this == SNAPSHOT_AND_RELEASE
diff --git a/buildSrc/src/main/kotlin/androidx/build/LintConfiguration.kt b/buildSrc/src/main/kotlin/androidx/build/LintConfiguration.kt
index 4745119..5cfe5d0 100644
--- a/buildSrc/src/main/kotlin/androidx/build/LintConfiguration.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/LintConfiguration.kt
@@ -109,7 +109,7 @@
             disable("KtxExtensionAvailable")
             disable("GradleDependency")
 
-            if (extension.compilationTarget != CompilationTarget.HOST) {
+            if (extension.type.compilationTarget != CompilationTarget.HOST) {
                 fatal("Assert")
                 fatal("NewApi")
                 fatal("ObsoleteSdkInt")
diff --git a/buildSrc/src/main/kotlin/androidx/build/Release.kt b/buildSrc/src/main/kotlin/androidx/build/Release.kt
index 305bfa7..66290f6 100644
--- a/buildSrc/src/main/kotlin/androidx/build/Release.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/Release.kt
@@ -156,6 +156,13 @@
             )
             return
         }
+        if (extension.publish == Publish.UNSET) {
+            project.logger.info(
+                "project ${project.name} isn't part of release, because" +
+                    " it does not set the \"publish\" property or the \"type\" property"
+            )
+            return
+        }
         if (extension.publish == Publish.SNAPSHOT_ONLY && !isSnapshotBuild()) {
             project.logger.info(
                 "project ${project.name} isn't part of release, because its" +
diff --git a/buildSrc/src/main/kotlin/androidx/build/checkapi/ApiTasks.kt b/buildSrc/src/main/kotlin/androidx/build/checkapi/ApiTasks.kt
index f4daabc..916a070 100644
--- a/buildSrc/src/main/kotlin/androidx/build/checkapi/ApiTasks.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/checkapi/ApiTasks.kt
@@ -44,7 +44,14 @@
         )
     }
 
+    // API behavior is default for type
+    if (type.checkApi is RunApiTasks.No && runApiTasks is RunApiTasks.No) {
+        project.logger.info("Projects of type ${type.name} do not track API.")
+        return false
+    }
+
     when (runApiTasks) {
+        // API behavior for type must have been overridden, because previous check did not trigger
         is RunApiTasks.No -> {
             project.logger.info(
                 "Project ${project.name} has explicitly disabled API tasks with " +
@@ -53,6 +60,9 @@
             return false
         }
         is RunApiTasks.Yes -> {
+            // API behavior is default for type; not overridden
+            if (type.checkApi is RunApiTasks.Yes) { return true }
+            // API behavior for type is overridden
             (runApiTasks as RunApiTasks.Yes).reason?.let { reason ->
                 project.logger.info(
                     "Project ${project.name} has explicitly enabled API tasks " +
@@ -64,12 +74,6 @@
         else -> {}
     }
 
-    // Tooling projects cannot track APIs.
-    if (toolingProject) {
-        project.logger.info("Project ${project.name} is tooling project, ignoring API tasks.")
-        return false
-    }
-
     if (project.version !is Version) {
         project.logger.info("Project ${project.name} has no version set, ignoring API tasks.")
         return false
diff --git a/buildSrc/src/main/kotlin/androidx/build/dokka/DokkaSourceDocs.kt b/buildSrc/src/main/kotlin/androidx/build/dokka/DokkaSourceDocs.kt
index 3ccab0e..6843af6 100644
--- a/buildSrc/src/main/kotlin/androidx/build/dokka/DokkaSourceDocs.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/dokka/DokkaSourceDocs.kt
@@ -19,8 +19,8 @@
 package androidx.build.dokka
 
 import androidx.build.AndroidXExtension
+import androidx.build.LibraryType
 import androidx.build.defaultPublishVariant
-import androidx.build.isSamplesProject
 import androidx.build.java.JavaCompileInputs
 import com.android.build.gradle.LibraryExtension
 import org.gradle.api.Project
@@ -90,7 +90,7 @@
         library.defaultPublishVariant { variant ->
             project.afterEvaluate {
                 val inputs = JavaCompileInputs.fromLibraryVariant(library, variant, project)
-                registerInputs(inputs, project)
+                registerInputs(inputs, project, extension)
             }
         }
     }
@@ -112,11 +112,11 @@
         val mainSourceSet = javaPluginConvention.sourceSets.getByName("main")
         project.afterEvaluate {
             val inputs = JavaCompileInputs.fromSourceSet(mainSourceSet, project)
-            registerInputs(inputs, project)
+            registerInputs(inputs, project, extension)
         }
     }
 
-    fun registerInputs(inputs: JavaCompileInputs, project: Project) {
+    fun registerInputs(inputs: JavaCompileInputs, project: Project, extension: AndroidXExtension) {
         val dokkaTasks = getDocsTasks(project)
 
         // Avoid depending on or modifying a task that has already been executed.
@@ -127,7 +127,7 @@
 
             // Filter out sample packages from the generated documentation, we only need them in
             // Dokka to resolve @sample links
-            if (project.isSamplesProject()) {
+            if (extension.type == LibraryType.SAMPLES) {
                 val sourceFiles = inputs.sourcePaths.asFileTree.files.filter { file ->
                     file.extension == "kt"
                 }
diff --git a/buildSrc/src/main/kotlin/androidx/build/uptodatedness/TaskUpToDateValidator.kt b/buildSrc/src/main/kotlin/androidx/build/uptodatedness/TaskUpToDateValidator.kt
index 7f28e0c..fb8fedf 100644
--- a/buildSrc/src/main/kotlin/androidx/build/uptodatedness/TaskUpToDateValidator.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/uptodatedness/TaskUpToDateValidator.kt
@@ -103,7 +103,11 @@
     ":camera:integration-tests:camera-testapp-view:camera-testapp" +
         "-viewGenerateTestConfigurationdebugAndroidTest",
     ":camera:integration-tests:camera-testapp-view:mergeLibDexDebug",
-    ":camera:integration-tests:camera-testapp-view:packageDebug"
+    ":camera:integration-tests:camera-testapp-view:packageDebug",
+
+    ":inspection:inspection-gradle-plugin:generatePomFileForInspectionPluginMarkerMavenPublication",
+    ":inspection:inspection-gradle-plugin:" +
+        "publishInspectionPluginMarkerMavenPublicationToMavenRepository"
 )
 class TaskUpToDateValidator {
     companion object {
diff --git a/compose/compiler/compiler-hosted/build.gradle b/compose/compiler/compiler-hosted/build.gradle
index 63b0577..9af08f8 100644
--- a/compose/compiler/compiler-hosted/build.gradle
+++ b/compose/compiler/compiler-hosted/build.gradle
@@ -14,14 +14,12 @@
  * limitations under the License.
  */
 
-
 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
 
 import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
-import androidx.build.Publish
 
 plugins {
     id("AndroidXPlugin")
@@ -42,12 +40,11 @@
 
 androidx {
     name = "AndroidX Compose Hosted Compiler Plugin"
+    // This is only published because that is required when exporting it to g3.
     // Nobody should ever get this artifact from maven; just from studio or from source
-    publish = Publish.SNAPSHOT_AND_RELEASE
-    toolingProject = true
+    type = LibraryType.COMPILER_PLUGIN
     mavenVersion = LibraryVersions.COMPOSE
     mavenGroup = LibraryGroups.Compose.COMPILER
     inceptionYear = "2019"
     description = "Contains the Kotlin compiler plugin for Compose used in Android Studio and IDEA"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/compose/compiler/compiler-hosted/integration-tests/build.gradle b/compose/compiler/compiler-hosted/integration-tests/build.gradle
index c8f3d09..de2946b 100644
--- a/compose/compiler/compiler-hosted/integration-tests/build.gradle
+++ b/compose/compiler/compiler-hosted/integration-tests/build.gradle
@@ -73,7 +73,6 @@
 androidx {
     name = "AndroidX Compiler CLI Tests"
     publish = Publish.NONE
-    toolingProject = true
     inceptionYear = "2019"
     description = "Contains test for the compose compiler plugin"
 }
diff --git a/compose/compiler/compiler/build.gradle b/compose/compiler/compiler/build.gradle
index 5adff18..5ff293c 100644
--- a/compose/compiler/compiler/build.gradle
+++ b/compose/compiler/compiler/build.gradle
@@ -14,11 +14,9 @@
  * limitations under the License.
  */
 
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
-import androidx.build.Publish
 
 buildscript {
     dependencies {
@@ -57,11 +55,9 @@
 
 androidx {
     name = "Compose Compiler"
-    publish = Publish.SNAPSHOT_AND_RELEASE
-    toolingProject = true
+    type = LibraryType.COMPILER_PLUGIN
     mavenVersion = LibraryVersions.COMPOSE
     mavenGroup = LibraryGroups.Compose.COMPILER
     inceptionYear = "2019"
     description = "Compiler plugin that enables Compose"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/compose/internal-lint-checks/build.gradle b/compose/internal-lint-checks/build.gradle
index 070faad..8950d64 100644
--- a/compose/internal-lint-checks/build.gradle
+++ b/compose/internal-lint-checks/build.gradle
@@ -1,7 +1,3 @@
-import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.Publish
-
 /*
  * Copyright 2019 The Android Open Source Project
  *
@@ -18,6 +14,8 @@
  * limitations under the License.
  */
 
+import androidx.build.LibraryType
+
 import static androidx.build.dependencies.DependenciesKt.*
 
 buildscript {
@@ -45,8 +43,7 @@
 
 androidx {
     name = "Compose internal lint checks"
-    publish = Publish.NONE
-    toolingProject = true
+    type = LibraryType.LINT
     inceptionYear = "2019"
     description = "Internal lint checks for Compose"
 }
diff --git a/compose/material/material-icons-extended/build.gradle b/compose/material/material-icons-extended/build.gradle
index 6072319..ec6a2b0 100644
--- a/compose/material/material-icons-extended/build.gradle
+++ b/compose/material/material-icons-extended/build.gradle
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-
 import androidx.build.AndroidXUiPlugin
 import androidx.build.LibraryGroups
 import androidx.build.LibraryVersions
 import androidx.build.Publish
+import androidx.build.RunApiTasks
 import androidx.compose.material.icons.generator.tasks.IconGenerationTask
 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
 
@@ -109,7 +109,8 @@
     mavenGroup = LibraryGroups.Compose.MATERIAL
     // This module has a large number (5000+) of generated source files and so doc generation /
     // API tracking will simply take too long
-    toolingProject = true
+    runApiTasks = new RunApiTasks.No("Five thousand generated source files")
+    generateDocs = false
     inceptionYear = "2020"
     description = "Compose Material Design extended icons. This module contains all Material icons. It is a very large dependency and should not be included directly."
 }
diff --git a/compose/material/material/icons/generator/build.gradle b/compose/material/material/icons/generator/build.gradle
index eeee7f6..59c7c1a 100644
--- a/compose/material/material/icons/generator/build.gradle
+++ b/compose/material/material/icons/generator/build.gradle
@@ -15,6 +15,7 @@
  */
 
 import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
 import androidx.build.Publish
 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@@ -43,8 +44,8 @@
 
 androidx {
     name = "Material Icon Generator"
+    type = LibraryType.OTHER_CODE_PROCESSOR
     publish = Publish.NONE
-    toolingProject = true
     mavenVersion = LibraryVersions.COMPOSE
     mavenGroup = LibraryGroups.Compose.MATERIAL
     inceptionYear = "2020"
diff --git a/contentaccess/contentaccess-annotations/build.gradle b/contentaccess/contentaccess-annotations/build.gradle
index 5704092..c0d5144 100644
--- a/contentaccess/contentaccess-annotations/build.gradle
+++ b/contentaccess/contentaccess-annotations/build.gradle
@@ -14,12 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 import androidx.build.LibraryGroups
 import androidx.build.LibraryVersions
-import androidx.build.AndroidXExtension
-import static androidx.build.dependencies.DependenciesKt.*
 import androidx.build.Publish
 
+import static androidx.build.dependencies.DependenciesKt.*
+
 plugins {
     id("AndroidXPlugin")
     id("kotlin")
diff --git a/contentaccess/contentaccess-compiler/build.gradle b/contentaccess/contentaccess-compiler/build.gradle
index 4ab81e5..e7941b8 100644
--- a/contentaccess/contentaccess-compiler/build.gradle
+++ b/contentaccess/contentaccess-compiler/build.gradle
@@ -14,16 +14,14 @@
  * limitations under the License.
  */
 
-
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
-import androidx.build.AndroidXExtension
+import androidx.build.Publish
 import androidx.build.SdkHelperKt
 import androidx.build.SupportConfig
 
 import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.Publish
 
 plugins {
     id("AndroidXPlugin")
@@ -61,10 +59,10 @@
 
 androidx {
     name = "AndroidX ContentAccess Annotation Compiler"
+    type = LibraryType.ANNOTATION_PROCESSOR
     publish = Publish.SNAPSHOT_ONLY
     mavenVersion = LibraryVersions.CONTENTACCESS
     mavenGroup = LibraryGroups.CONTENTACCESS
     inceptionYear = "2020"
     description = "AndroidX ContentAccess Annotation Compiler"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/fragment/fragment-lint/build.gradle b/fragment/fragment-lint/build.gradle
index fccb3e6..fc8eff6 100644
--- a/fragment/fragment-lint/build.gradle
+++ b/fragment/fragment-lint/build.gradle
@@ -14,13 +14,10 @@
  * limitations under the License.
  */
 
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.AndroidXExtension
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.SdkHelperKt
-import androidx.build.Publish
+import androidx.build.LibraryType
+
+import static androidx.build.dependencies.DependenciesKt.*
 
 plugins {
     id("AndroidXPlugin")
@@ -44,10 +41,8 @@
 
 androidx {
     name = "Android Fragment Lint Checks"
-    toolingProject = true
-    publish = Publish.NONE
+    type = LibraryType.LINT
     mavenGroup = LibraryGroups.FRAGMENT
     inceptionYear = "2019"
     description = "Android Fragment Lint Checks"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/fragment/fragment-testing-lint/build.gradle b/fragment/fragment-testing-lint/build.gradle
index c0cd222..4589718 100644
--- a/fragment/fragment-testing-lint/build.gradle
+++ b/fragment/fragment-testing-lint/build.gradle
@@ -14,13 +14,10 @@
  * limitations under the License.
  */
 
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.AndroidXExtension
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.SdkHelperKt
-import androidx.build.Publish
+import androidx.build.LibraryType
+
+import static androidx.build.dependencies.DependenciesKt.*
 
 plugins {
     id("AndroidXPlugin")
@@ -44,10 +41,8 @@
 
 androidx {
     name = "Android Fragment-Testing Lint Checks"
-    toolingProject = true
-    publish = Publish.NONE
+    type = LibraryType.LINT
     mavenGroup = LibraryGroups.FRAGMENT
     inceptionYear = "2019"
     description = "Lint Checks for the Fragment Testing module"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/hilt/hilt-compiler/build.gradle b/hilt/hilt-compiler/build.gradle
index 7504c2e..44d8d30 100644
--- a/hilt/hilt-compiler/build.gradle
+++ b/hilt/hilt-compiler/build.gradle
@@ -14,16 +14,13 @@
  * limitations under the License.
  */
 
-
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
-import androidx.build.AndroidXExtension
 import androidx.build.SdkHelperKt
 import androidx.build.SupportConfig
 
 import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.Publish
 
 plugins {
     id("AndroidXPlugin")
@@ -77,11 +74,9 @@
 
 androidx {
     name = "AndroidX Hilt Extension Compiler"
-    publish = Publish.SNAPSHOT_AND_RELEASE
+    type = LibraryType.COMPILER_PLUGIN
     mavenVersion = LibraryVersions.HILT
     mavenGroup = LibraryGroups.HILT
     inceptionYear = "2020"
     description = "AndroidX Hilt Extension Compiler"
-    compilationTarget = CompilationTarget.HOST
-    toolingProject = true
 }
diff --git a/inspection/inspection-gradle-plugin/build.gradle b/inspection/inspection-gradle-plugin/build.gradle
index d6f3890..aff9915 100644
--- a/inspection/inspection-gradle-plugin/build.gradle
+++ b/inspection/inspection-gradle-plugin/build.gradle
@@ -14,9 +14,8 @@
  * limitations under the License.
  */
 
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
+import androidx.build.LibraryType
 import androidx.build.Publish
 import androidx.build.SdkResourceGenerator
 
@@ -57,10 +56,9 @@
 
 androidx {
     name = "Android Inspection Gradle Plugin"
+    type = LibraryType.GRADLE_PLUGIN
     publish = Publish.NONE
-    toolingProject = true
     mavenGroup = LibraryGroups.INSPECTION
     inceptionYear = "2019"
     description = "Android Inspection Gradle Plugin"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/inspection/inspection-testing/build.gradle b/inspection/inspection-testing/build.gradle
index ad17ea9..d19bf24 100644
--- a/inspection/inspection-testing/build.gradle
+++ b/inspection/inspection-testing/build.gradle
@@ -14,8 +14,6 @@
  * limitations under the License.
  */
 
-
-import androidx.build.AndroidXExtension
 import androidx.build.LibraryGroups
 import androidx.build.Publish
 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@@ -44,7 +42,6 @@
     name = "AndroidX Inspection Testing"
     publish = Publish.NONE
     mavenGroup = LibraryGroups.INSPECTION
-    toolingProject = true
     inceptionYear = "2019"
     description = "Experimental AndroidX Inspection Project"
 }
diff --git a/ipc/ipc-annotations/build.gradle b/ipc/ipc-annotations/build.gradle
index 5698ded..71d4c8e 100644
--- a/ipc/ipc-annotations/build.gradle
+++ b/ipc/ipc-annotations/build.gradle
@@ -14,12 +14,11 @@
  * limitations under the License.
  */
 
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
 import androidx.build.Publish
 
-
 plugins {
     id("AndroidXPlugin")
     id("java-library")
@@ -30,9 +29,9 @@
 
 androidx {
     name = "AndroidX IPC - Annotations"
-    publish = Publish.SNAPSHOT_AND_RELEASE
+    type = LibraryType.PUBLISHED_LIBRARY
+    publish = Publish.NONE
     mavenVersion = LibraryVersions.IPC
-    compilationTarget = CompilationTarget.HOST
     mavenGroup = LibraryGroups.IPC
     inceptionYear = "2020"
     description = "Annotations for AndroidX AndroidX Inter Process Communication Tools"
diff --git a/ipc/ipc-compiler/build.gradle b/ipc/ipc-compiler/build.gradle
index 783dd0f..067a335 100644
--- a/ipc/ipc-compiler/build.gradle
+++ b/ipc/ipc-compiler/build.gradle
@@ -14,15 +14,12 @@
  * limitations under the License.
  */
 
-
+import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
 
 import static androidx.build.dependencies.DependenciesKt.*
 
-import androidx.build.CompilationTarget
-import androidx.build.LibraryGroups
-import androidx.build.Publish
-
 plugins {
     id("AndroidXPlugin")
     id("kotlin")
@@ -54,10 +51,8 @@
 
 androidx {
     name = "AndroidX IPC - Compiler"
-    publish = Publish.SNAPSHOT_AND_RELEASE
+    type = LibraryType.ANNOTATION_PROCESSOR
     mavenVersion = LibraryVersions.IPC
-    toolingProject = true
-    compilationTarget = CompilationTarget.HOST
     mavenGroup = LibraryGroups.IPC
     inceptionYear = "2020"
     description = "Annotation processor for AndroidX Inter Process Communication Tools"
diff --git a/jetifier/jetifier/core/build.gradle b/jetifier/jetifier/core/build.gradle
index 9d8e1ef..717304d 100644
--- a/jetifier/jetifier/core/build.gradle
+++ b/jetifier/jetifier/core/build.gradle
@@ -14,10 +14,11 @@
  * limitations under the License
  */
 
-import static androidx.build.dependencies.DependenciesKt.*
 import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
-import androidx.build.Publish
+
+import static androidx.build.dependencies.DependenciesKt.*
 
 plugins {
     id("AndroidXPlugin")
@@ -37,10 +38,9 @@
 
 androidx {
     name = "Android Jetifier Core"
-    publish = Publish.SNAPSHOT_AND_RELEASE
+    type = LibraryType.OTHER_CODE_PROCESSOR
     mavenVersion = LibraryVersions.JETIFIER
     mavenGroup = LibraryGroups.JETIFIER
-    toolingProject = true
     inceptionYear = "2017"
     description = "Android Jetifier Core"
 }
diff --git a/jetifier/jetifier/processor/build.gradle b/jetifier/jetifier/processor/build.gradle
index 1e6a32f..286b525 100644
--- a/jetifier/jetifier/processor/build.gradle
+++ b/jetifier/jetifier/processor/build.gradle
@@ -14,10 +14,11 @@
  * limitations under the License
  */
 
-import static androidx.build.dependencies.DependenciesKt.*
 import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
-import androidx.build.Publish
+
+import static androidx.build.dependencies.DependenciesKt.*
 
 plugins {
     id("AndroidXPlugin")
@@ -40,10 +41,9 @@
 
 androidx {
     name = "Android Jetifier Processor"
-    publish = Publish.SNAPSHOT_AND_RELEASE
+    type = LibraryType.OTHER_CODE_PROCESSOR
     mavenVersion = LibraryVersions.JETIFIER
     mavenGroup = LibraryGroups.JETIFIER
-    toolingProject = true
     inceptionYear = "2018"
     description = "Android Jetifier Processor"
 }
diff --git a/lifecycle/lifecycle-compiler/build.gradle b/lifecycle/lifecycle-compiler/build.gradle
index 895d510..1c862f4 100644
--- a/lifecycle/lifecycle-compiler/build.gradle
+++ b/lifecycle/lifecycle-compiler/build.gradle
@@ -1,10 +1,24 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+import androidx.build.LibraryGroups
+import androidx.build.LibraryType
+import androidx.build.LibraryVersions
 
 import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.CompilationTarget
-import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.AndroidXExtension
-import androidx.build.Publish
 
 plugins {
     id("AndroidXPlugin")
@@ -46,11 +60,9 @@
 
 androidx {
     name = "Android Lifecycles Compiler"
-    toolingProject = true
-    publish = Publish.SNAPSHOT_AND_RELEASE
+    type = LibraryType.ANNOTATION_PROCESSOR
     mavenVersion = LibraryVersions.LIFECYCLE
     mavenGroup = LibraryGroups.LIFECYCLE
     inceptionYear = "2017"
     description = "Android Lifecycles annotation processor"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/lifecycle/lifecycle-livedata-core-ktx-lint/build.gradle b/lifecycle/lifecycle-livedata-core-ktx-lint/build.gradle
index 1638244..24901c8 100644
--- a/lifecycle/lifecycle-livedata-core-ktx-lint/build.gradle
+++ b/lifecycle/lifecycle-livedata-core-ktx-lint/build.gradle
@@ -14,13 +14,11 @@
  * limitations under the License.
  */
 
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.AndroidXExtension
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
-import androidx.build.SdkHelperKt
-import androidx.build.Publish
+
+import static androidx.build.dependencies.DependenciesKt.*
 
 plugins {
     id("AndroidXPlugin")
@@ -46,11 +44,9 @@
 
 androidx {
     name = "Android LiveData Kotlin Lint Checks"
-    toolingProject = true
-    publish = Publish.NONE
+    type = LibraryType.LINT
     mavenVersion = LibraryVersions.LIFECYCLE
     mavenGroup = LibraryGroups.LIFECYCLE
     inceptionYear = "2019"
     description = "Lint Checks for LiveData Kotlin Extensions"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/lifecycle/lifecycle-runtime-ktx-lint/build.gradle b/lifecycle/lifecycle-runtime-ktx-lint/build.gradle
index 8d04217..605e5ea 100644
--- a/lifecycle/lifecycle-runtime-ktx-lint/build.gradle
+++ b/lifecycle/lifecycle-runtime-ktx-lint/build.gradle
@@ -14,13 +14,11 @@
  * limitations under the License.
  */
 
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.AndroidXExtension
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
-import androidx.build.SdkHelperKt
-import androidx.build.Publish
+
+import static androidx.build.dependencies.DependenciesKt.*
 
 plugins {
     id("AndroidXPlugin")
@@ -44,11 +42,9 @@
 
 androidx {
     name = "Android Lifecycles Lint Checks"
-    toolingProject = true
-    publish = Publish.NONE
+    type = LibraryType.LINT
     mavenVersion = LibraryVersions.LIFECYCLE
     mavenGroup = LibraryGroups.LIFECYCLE
     inceptionYear = "2019"
     description = "Android Lifecycles Lint Checks"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/lint-checks/build.gradle b/lint-checks/build.gradle
index ac4973a..2ef2502 100644
--- a/lint-checks/build.gradle
+++ b/lint-checks/build.gradle
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-import androidx.build.Publish
+import androidx.build.LibraryType
 
 import static androidx.build.dependencies.DependenciesKt.*
 
@@ -35,8 +35,7 @@
 
 androidx {
     name = "Lint checks"
-    publish = Publish.NONE
-    toolingProject = true
+    type = LibraryType.LINT
     inceptionYear = "2018"
     description = "Internal lint checks"
 }
diff --git a/navigation/navigation-safe-args-generator/build.gradle b/navigation/navigation-safe-args-generator/build.gradle
index 7b519d8..3eb4daf 100644
--- a/navigation/navigation-safe-args-generator/build.gradle
+++ b/navigation/navigation-safe-args-generator/build.gradle
@@ -14,13 +14,12 @@
  * limitations under the License.
  */
 
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
-import androidx.build.SupportConfig
-import androidx.build.AndroidXExtension
+import androidx.build.LibraryType
 import androidx.build.SdkHelperKt
-import androidx.build.Publish
+import androidx.build.SupportConfig
+
+import static androidx.build.dependencies.DependenciesKt.*
 
 plugins {
     id("AndroidXPlugin")
@@ -59,10 +58,8 @@
 
 androidx {
     name = 'Android Navigation TypeSafe Arguments Generator'
-    publish = Publish.SNAPSHOT_AND_RELEASE
-    toolingProject = true
+    type = LibraryType.OTHER_CODE_PROCESSOR
     mavenGroup = LibraryGroups.NAVIGATION
     inceptionYear = '2017'
     description = "Android Navigation TypeSafe Arguments Generator"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/navigation/navigation-safe-args-gradle-plugin/build.gradle b/navigation/navigation-safe-args-gradle-plugin/build.gradle
index d74b2ba..c327f2c 100644
--- a/navigation/navigation-safe-args-gradle-plugin/build.gradle
+++ b/navigation/navigation-safe-args-gradle-plugin/build.gradle
@@ -14,14 +14,12 @@
  * limitations under the License.
  */
 
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.AndroidXExtension
-import androidx.build.Publish
+import androidx.build.LibraryType
 import androidx.build.SdkResourceGenerator
 
+import static androidx.build.dependencies.DependenciesKt.*
+
 plugins {
     id("AndroidXPlugin")
     id("kotlin")
@@ -56,10 +54,8 @@
 
 androidx {
     name = "Android Navigation TypeSafe Arguments Gradle Plugin"
-    publish = Publish.SNAPSHOT_AND_RELEASE
-    toolingProject = true
+    type = LibraryType.GRADLE_PLUGIN
     mavenGroup = LibraryGroups.NAVIGATION
     inceptionYear = "2017"
     description = "Android Navigation TypeSafe Arguments Gradle Plugin"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/recyclerview/recyclerview-lint/build.gradle b/recyclerview/recyclerview-lint/build.gradle
index ed832ad..bb03512 100644
--- a/recyclerview/recyclerview-lint/build.gradle
+++ b/recyclerview/recyclerview-lint/build.gradle
@@ -14,11 +14,8 @@
  * limitations under the License.
  */
 
-
-import androidx.build.AndroidXExtension
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
-import androidx.build.Publish
+import androidx.build.LibraryType
 
 import static androidx.build.dependencies.DependenciesKt.*
 
@@ -44,10 +41,8 @@
 
 androidx {
     name = "RecyclerView Lint Checks"
-    toolingProject = true
-    publish = Publish.NONE
+    type = LibraryType.LINT
     mavenGroup = LibraryGroups.RECYCLERVIEW
     inceptionYear = "2020"
     description = "RecyclerView Lint Checks"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/remotecallback/processor/build.gradle b/remotecallback/processor/build.gradle
index 05f2760..a5d387f 100644
--- a/remotecallback/processor/build.gradle
+++ b/remotecallback/processor/build.gradle
@@ -14,12 +14,10 @@
  * limitations under the License.
  */
 
-import static androidx.build.dependencies.DependenciesKt.*
-
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.Publish
+import androidx.build.LibraryType
+
+import static androidx.build.dependencies.DependenciesKt.JAVAPOET
 
 plugins {
     id("AndroidXPlugin")
@@ -33,11 +31,9 @@
 
 androidx {
     name = "Remote Callback Compiler"
-    publish = Publish.SNAPSHOT_AND_RELEASE
-    toolingProject = true
+    type = LibraryType.COMPILER_PLUGIN
     mavenGroup = LibraryGroups.REMOTECALLBACK
     inceptionYear = "2018"
     description = "Compiler for RemoteCallback implementations"
     failOnDeprecationWarnings = false
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/room/compiler-processing/build.gradle b/room/compiler-processing/build.gradle
index cd84f37..28d7e59 100644
--- a/room/compiler-processing/build.gradle
+++ b/room/compiler-processing/build.gradle
@@ -14,10 +14,8 @@
  * limitations under the License.
  */
 
-import androidx.build.AndroidXExtension
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
-import androidx.build.Publish
+import androidx.build.LibraryType
 
 import static androidx.build.dependencies.DependenciesKt.*
 
@@ -64,10 +62,8 @@
 }
 androidx {
     name = "AndroidX Room XProcessor"
-    publish = Publish.SNAPSHOT_AND_RELEASE
-    toolingProject = true
+    type = LibraryType.ANNOTATION_PROCESSOR
     mavenGroup = LibraryGroups.ROOM
     inceptionYear = "2020"
     description = "Processing Environment Abstraction for AndroidX Room"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/room/compiler/build.gradle b/room/compiler/build.gradle
index 908dc55..fc529d1 100644
--- a/room/compiler/build.gradle
+++ b/room/compiler/build.gradle
@@ -14,18 +14,15 @@
  * limitations under the License.
  */
 
-
+import androidx.build.BuildOnServerKt
+import androidx.build.LibraryGroups
+import androidx.build.LibraryType
+import androidx.build.SupportConfig
+import androidx.build.SdkHelperKt
+import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
 
 import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.BuildOnServerKt
-import androidx.build.CompilationTarget
-import androidx.build.LibraryGroups
-import androidx.build.SupportConfig
-import androidx.build.AndroidXExtension
-import androidx.build.SdkHelperKt
-import androidx.build.Publish
-import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
 
 plugins {
     id("AndroidXPlugin")
@@ -253,10 +250,8 @@
 
 androidx {
     name = "Android Room Compiler"
-    publish = Publish.SNAPSHOT_AND_RELEASE
-    toolingProject = true
+    type = LibraryType.COMPILER_PLUGIN
     mavenGroup = LibraryGroups.ROOM
     inceptionYear = "2017"
     description = "Android Room annotation processor"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/serialization/serialization-annotation/build.gradle b/serialization/serialization-annotation/build.gradle
index 2a82495..6470a4a 100644
--- a/serialization/serialization-annotation/build.gradle
+++ b/serialization/serialization-annotation/build.gradle
@@ -14,14 +14,11 @@
  * limitations under the License.
  */
 
-
+import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
 
-import static androidx.build.dependencies.DependenciesKt.*
-
-import androidx.build.CompilationTarget
-import androidx.build.LibraryGroups
-import androidx.build.Publish
+import static androidx.build.dependencies.DependenciesKt.getKOTLIN_STDLIB
 
 plugins {
     id("AndroidXPlugin")
@@ -37,9 +34,8 @@
 
 androidx {
     name = "AndroidX Serialization - Annotation"
-    publish = Publish.SNAPSHOT_AND_RELEASE
+    type = LibraryType.PUBLISHED_LIBRARY
     mavenVersion = LibraryVersions.SERIALIZATION
-    compilationTarget = CompilationTarget.HOST
     mavenGroup = LibraryGroups.SERIALIZATION
     inceptionYear = "2020"
     description = "Annotations for AndroidX Serialization"
diff --git a/serialization/serialization-compiler/build.gradle b/serialization/serialization-compiler/build.gradle
index 81c263b3..62342d1 100644
--- a/serialization/serialization-compiler/build.gradle
+++ b/serialization/serialization-compiler/build.gradle
@@ -14,15 +14,12 @@
  * limitations under the License.
  */
 
-
+import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
 
 import static androidx.build.dependencies.DependenciesKt.*
 
-import androidx.build.CompilationTarget
-import androidx.build.LibraryGroups
-import androidx.build.Publish
-
 plugins {
     id("AndroidXPlugin")
     id("kotlin")
@@ -56,10 +53,8 @@
 
 androidx {
     name = "AndroidX Serialization - Compiler"
-    publish = Publish.SNAPSHOT_AND_RELEASE
     mavenVersion = LibraryVersions.SERIALIZATION
-    toolingProject = true
-    compilationTarget = CompilationTarget.HOST
+    type = LibraryType.ANNOTATION_PROCESSOR
     mavenGroup = LibraryGroups.SERIALIZATION
     inceptionYear = "2020"
     description = "Annotation processor for AndroidX Serialization"
diff --git a/serialization/serialization-runtime-proto/build.gradle b/serialization/serialization-runtime-proto/build.gradle
index 4dc0f62..efae6b7 100644
--- a/serialization/serialization-runtime-proto/build.gradle
+++ b/serialization/serialization-runtime-proto/build.gradle
@@ -14,10 +14,9 @@
  * limitations under the License.
  */
 
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
-import androidx.build.Publish
 
 plugins {
     id("AndroidXPlugin")
@@ -33,9 +32,8 @@
 
 androidx {
     name = "AndroidX Serialization - Protocol Buffers Runtime"
-    publish = Publish.SNAPSHOT_AND_RELEASE
     mavenVersion = LibraryVersions.SERIALIZATION
-    compilationTarget = CompilationTarget.HOST
+    type = LibraryType.PUBLISHED_LIBRARY
     mavenGroup = LibraryGroups.SERIALIZATION
     inceptionYear = "2020"
     description = "Protocol Buffers runtime for AndroidX Serialization"
diff --git a/serialization/serialization-runtime/build.gradle b/serialization/serialization-runtime/build.gradle
index d742b73..c9267ff 100644
--- a/serialization/serialization-runtime/build.gradle
+++ b/serialization/serialization-runtime/build.gradle
@@ -14,10 +14,9 @@
  * limitations under the License.
  */
 
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
-import androidx.build.Publish
 
 import static androidx.build.dependencies.DependenciesKt.*
 
@@ -38,9 +37,8 @@
 
 androidx {
     name = "AndroidX Serialization - Runtime"
-    publish = Publish.SNAPSHOT_AND_RELEASE
     mavenVersion = LibraryVersions.SERIALIZATION
-    compilationTarget = CompilationTarget.HOST
+    type = LibraryType.PUBLISHED_LIBRARY
     mavenGroup = LibraryGroups.SERIALIZATION
     inceptionYear = "2020"
     description = "Core runtime for AndroidX Serialization"
diff --git a/sqlite/sqlite-inspection/build.gradle b/sqlite/sqlite-inspection/build.gradle
index aef11fb..dda866f 100644
--- a/sqlite/sqlite-inspection/build.gradle
+++ b/sqlite/sqlite-inspection/build.gradle
@@ -14,15 +14,11 @@
  * limitations under the License.
  */
 
-
+import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
 
 import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.AndroidXExtension
-import androidx.build.Publish
-
 
 plugins {
     id("AndroidXPlugin")
@@ -46,12 +42,11 @@
 
 androidx {
     name = "Android SQLite Inspector"
-    publish = Publish.NONE
+    type = LibraryType.IDE_PLUGIN
     // Decouple SQLITE_INSPECTOR because it depends on
     // the inspection protocol, which is alpha
     mavenGroup = LibraryGroups.INSPECTION_EXTENSIONS
     inceptionYear = "2019"
-    toolingProject = true
     description = "The implementation of SQLite Inspector."
 }
 
diff --git a/startup/startup-runtime-lint/build.gradle b/startup/startup-runtime-lint/build.gradle
index 760b972..e8d93fc 100644
--- a/startup/startup-runtime-lint/build.gradle
+++ b/startup/startup-runtime-lint/build.gradle
@@ -14,13 +14,10 @@
  * limitations under the License.
  */
 
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.AndroidXExtension
-import androidx.build.CompilationTarget
-import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
-import androidx.build.SdkHelperKt
-import androidx.build.Publish
+
+import static androidx.build.dependencies.DependenciesKt.*
 
 plugins {
     id("AndroidXPlugin")
@@ -44,10 +41,8 @@
 
 androidx {
     name = "Android App Startup Runtime Lint Checks"
-    toolingProject = true
-    publish = Publish.NONE
+    type = LibraryType.LINT
     mavenVersion = LibraryVersions.STARTUP
     inceptionYear = "2020"
     description = "Android App Startup Runtime"
-    compilationTarget = CompilationTarget.HOST
 }
diff --git a/versionedparcelable/versionedparcelable-compiler/build.gradle b/versionedparcelable/versionedparcelable-compiler/build.gradle
index c493835..72cbdae 100644
--- a/versionedparcelable/versionedparcelable-compiler/build.gradle
+++ b/versionedparcelable/versionedparcelable-compiler/build.gradle
@@ -14,11 +14,9 @@
  * limitations under the License.
  */
 
-
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
+import androidx.build.LibraryType
 import androidx.build.LibraryVersions
-import androidx.build.Publish
 
 import static androidx.build.dependencies.DependenciesKt.*
 
@@ -33,11 +31,9 @@
 
 androidx {
     name = "VersionedParcelable - Compiler"
-    publish = Publish.SNAPSHOT_AND_RELEASE
+    type = LibraryType.ANNOTATION_PROCESSOR
     mavenVersion = LibraryVersions.VERSIONED_PARCELABLE
-    toolingProject = true
-    compilationTarget = CompilationTarget.HOST
     mavenGroup = LibraryGroups.VERSIONEDPARCELABLE
     inceptionYear = "2018"
     description = "Annotation processor for VersionedParcelable"
-}
\ No newline at end of file
+}
diff --git a/work/workmanager-inspection/build.gradle b/work/workmanager-inspection/build.gradle
index b0048db..0a85dbc 100644
--- a/work/workmanager-inspection/build.gradle
+++ b/work/workmanager-inspection/build.gradle
@@ -14,9 +14,8 @@
  * limitations under the License.
  */
 
-
 import androidx.build.LibraryGroups
-import androidx.build.Publish
+import androidx.build.LibraryType
 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
 
 import static androidx.build.dependencies.DependenciesKt.*
@@ -47,10 +46,9 @@
 
 androidx {
     name = "Android WorkManager Inspector"
-    publish = Publish.NONE
+    type = LibraryType.IDE_PLUGIN
     mavenGroup = LibraryGroups.WORK
     inceptionYear = "2020"
-    toolingProject = true
     description = "The implementation of WorkManager Inspector."
 }
 
diff --git a/work/workmanager-lint/build.gradle b/work/workmanager-lint/build.gradle
index a2abbef..80e500f 100644
--- a/work/workmanager-lint/build.gradle
+++ b/work/workmanager-lint/build.gradle
@@ -14,13 +14,10 @@
  * limitations under the License.
  */
 
-import static androidx.build.dependencies.DependenciesKt.*
-import androidx.build.AndroidXExtension
-import androidx.build.CompilationTarget
 import androidx.build.LibraryGroups
-import androidx.build.LibraryVersions
-import androidx.build.SdkHelperKt
-import androidx.build.Publish
+import androidx.build.LibraryType
+
+import static androidx.build.dependencies.DependenciesKt.*
 
 plugins {
     id("AndroidXPlugin")
@@ -44,10 +41,8 @@
 
 androidx {
     name = "Android WorkManager Runtime Lint Checks"
-    toolingProject = true
-    publish = Publish.NONE
+    type = LibraryType.LINT
     mavenGroup = LibraryGroups.WORK
     inceptionYear = "2019"
     description = "Android WorkManager Runtime Lint Checks"
-    compilationTarget = CompilationTarget.HOST
 }