Make :assisstant a non-composite project.

Change-Id: I23a72c80ca2db5b9d448a8d5684725172002f9b7
diff --git a/d8_r8/assistant/build.gradle.kts b/d8_r8/assistant/build.gradle.kts
index a00f921..47d3521 100644
--- a/d8_r8/assistant/build.gradle.kts
+++ b/d8_r8/assistant/build.gradle.kts
@@ -17,7 +17,16 @@
   withSourcesJar()
 }
 
-tasks.withType<Jar> {
-  destinationDirectory.set(getRoot().resolveAll("build", "libs"))
-  archiveFileName.set("assistant.jar")
-}
+val jarTask =
+  tasks.named<Jar>("jar") {
+    // This path & name is hardcoded in ToolHelper.
+    destinationDirectory.set(getRoot().resolveAll("build", "libs"))
+    archiveFileName.set("assistant.jar")
+  }
+
+val assistantJar by configurations.consumable("assistantJar") { outgoing.artifact(jarTask) }
+
+val assistantSources by
+  configurations.consumable("assistantSources") {
+    outgoing.artifact(tasks.named<Jar>("sourcesJar"))
+  }
diff --git a/d8_r8/assistant/settings.gradle.kts b/d8_r8/assistant/settings.gradle.kts
deleted file mode 100644
index 351f021..0000000
--- a/d8_r8/assistant/settings.gradle.kts
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2025, the R8 project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-pluginManagement {
-  repositories {
-    maven { url = uri("../../third_party/dependencies_plugin") }
-    maven { url = uri("../../third_party/dependencies") }
-  }
-}
-
-dependencyResolutionManagement {
-  repositories { maven { url = uri("../../third_party/dependencies") } }
-}
-
-rootProject.name = "assistant"
-
-val root = rootProject.projectDir.parentFile
-
-includeBuild(root.resolve("shared"))
-
-includeBuild(root.resolve("keepanno"))
diff --git a/d8_r8/dist/build.gradle.kts b/d8_r8/dist/build.gradle.kts
index d5aa3ed..f0183dc 100644
--- a/d8_r8/dist/build.gradle.kts
+++ b/d8_r8/dist/build.gradle.kts
@@ -80,7 +80,9 @@
   }
 }
 
-val assistantJarTask = projectTask("assistant", "jar")
+val assistantJarScope by configurations.dependencyScope("assistantJarScope")
+val assistantJarConfig by
+  configurations.resolvable("assistantJarConfig") { extendsFrom(assistantJarScope) }
 val blastRadiusJarTask = projectTask("blastradius", "jar")
 val blastRadiusProtoJarTask = projectTask("blastradius", "protoJar")
 val keepAnnoJarTask = projectTask("keepanno", "jar")
@@ -101,6 +103,7 @@
   configurations.resolvable("mainResourcesConfig") { extendsFrom(mainResourcesScope) }
 
 dependencies {
+  assistantJarScope(project(":assistant", "assistantJar"))
   libanalyzerJarScope(project(":libanalyzer", "libanalyzer-jar"))
   libanalyzerProtoJarScope(project(":libanalyzer", "libanalyzer-proto-jar"))
   mainJarScope(project(":main", "mainJar"))
@@ -299,7 +302,7 @@
 
   val swissArmyKnifeJarFiles =
     objects.fileCollection().apply {
-      from(assistantJarTask)
+      from(assistantJarConfig)
       from(blastRadiusJarTask)
       from(keepAnnoJarTask)
       from(libanalyzerJarConfig)
diff --git a/d8_r8/main/build.gradle.kts b/d8_r8/main/build.gradle.kts
index 5223a9c..2e155a9 100644
--- a/d8_r8/main/build.gradle.kts
+++ b/d8_r8/main/build.gradle.kts
@@ -201,7 +201,6 @@
   withSourcesJar()
 }
 
-val assistantJarTask = projectTask("assistant", "jar")
 val blastRadiusJarTask = projectTask("blastradius", "jar")
 val blastRadiusProtoJarTask = projectTask("blastradius", "protoJar")
 val keepAnnoJarTask = projectTask("keepanno", "jar")
@@ -230,7 +229,7 @@
 dependencies {
   internalJarScope(project(":utils", "isolatedJar"))
   internalClassesScope(project(":utils", "isolatedClasses"))
-  implementation(assistantJarTask.outputs.files)
+  implementation(project(":assistant", "assistantJar"))
   implementation(blastRadiusJarTask.outputs.files)
   implementation(blastRadiusProtoJarTask.outputs.files)
   implementation(keepAnnoJarTask.outputs.files)
diff --git a/d8_r8/test/build.gradle.kts b/d8_r8/test/build.gradle.kts
index 2980d56..1f4d003 100644
--- a/d8_r8/test/build.gradle.kts
+++ b/d8_r8/test/build.gradle.kts
@@ -33,7 +33,12 @@
 val mainSourcesConfig by
   configurations.resolvable("mainSourcesConfig") { extendsFrom(mainSourcesScope) }
 
+val assistantJarScope by configurations.dependencyScope("assistantJarScope")
+val assistantJarConfig by
+  configurations.resolvable("assistantJarConfig") { extendsFrom(assistantJarScope) }
+
 dependencies {
+  assistantJarScope(project(":assistant", "assistantJar"))
   testJarsScope(project(":tests_java_8", "testJar"))
   testJarsScope(project(":tests_java_9", "testJar"))
   testJarsScope(project(":tests_java_11", "testJar"))
@@ -58,7 +63,6 @@
 
 dependencies { libanalyzerSourcesScope(project(":libanalyzer", "libanalyzer-sources-jar")) }
 
-val assistantJarTask = projectTask("assistant", "jar")
 val mainProtoJarTask = project(":dist").tasks.getByName("protoJar")
 val mainDepsJarTask = project(":dist").tasks.getByName("depsJar")
 val swissArmyKnifeTask = project(":dist").tasks.getByName("swissArmyKnife")
@@ -230,12 +234,12 @@
       generatedKeepRulesProvider,
       inputJarProvider,
       r8WithRelocatedDepsTask,
-      assistantJarTask,
+      assistantJarConfig,
     )
     dependOnPythonScripts()
     val inputJar = inputJarProvider.getSingleOutputFile()
     val r8WithRelocatedDepsJar = r8WithRelocatedDepsTask.getSingleOutputFile()
-    val assistantJar = assistantJarTask.getSingleOutputFile()
+    val assistantJar = assistantJarConfig.singleFile
     val keepRuleFiles =
       listOf(
         getRoot().resolveAll("src", "main", "keep.txt"),
diff --git a/d8_r8/test_modules/tests_java_21/build.gradle.kts b/d8_r8/test_modules/tests_java_21/build.gradle.kts
index 2b9dd00..845a461 100644
--- a/d8_r8/test_modules/tests_java_21/build.gradle.kts
+++ b/d8_r8/test_modules/tests_java_21/build.gradle.kts
@@ -14,7 +14,9 @@
   toolchain { languageVersion = JavaLanguageVersion.of(21) }
 }
 
-val assistantCompileJavaTask = projectTask("assistant", "compileJava")
+val assistantClassesScope by configurations.dependencyScope("assistantClassesScope")
+val assistantClassesOutput =
+  configurations.resolvable("assistantClassesOutput") { extendsFrom(assistantClassesScope) }
 val sharedDownloadDepsTask = projectTask("shared", "downloadDeps")
 val mainClassesScope by configurations.dependencyScope("mainClassesScope")
 val mainClassesOutput =
@@ -26,10 +28,11 @@
   configurations.resolvable("turboClassesOutput") { extendsFrom(turboClassesScope) }
 
 dependencies {
+  assistantClassesScope(project(":assistant", "assistantJar"))
   mainClassesScope(project(":main", "mainClassesOutput"))
   mainResourcesScope(project(":main", "mainResources"))
   turboClassesScope(project(":main", "turboClassesOutput"))
-  implementation(assistantCompileJavaTask.outputs.files)
+  implementation(project(":assistant", "assistantJar"))
   implementation(project(":main", "mainClassesOutput"))
   implementation(project(":main", "mainResources"))
   implementation(project(":main", "turboClassesOutput"))
@@ -69,7 +72,7 @@
         File.pathSeparator +
         project.files(mainResources).asPath.split(File.pathSeparator)[0] +
         File.pathSeparator +
-        assistantCompileJavaTask.outputs.files.getAsPath().split(File.pathSeparator)[0],
+        project.files(assistantClassesOutput).asPath.split(File.pathSeparator)[0],
     )
   }
 
diff --git a/d8_r8/test_modules/tests_java_8/build.gradle.kts b/d8_r8/test_modules/tests_java_8/build.gradle.kts
index 884862e..7f63732 100644
--- a/d8_r8/test_modules/tests_java_8/build.gradle.kts
+++ b/d8_r8/test_modules/tests_java_8/build.gradle.kts
@@ -28,7 +28,9 @@
 
 // If we depend on keepanno by referencing the project source outputs we get an error regarding
 // incompatible java class file version. By depending on the jar we circumvent that.
-val assistantCompileTask = projectTask("assistant", "compileJava")
+val assistantClassesScope by configurations.dependencyScope("assistantClassesScope")
+val assistantClassesOutput =
+  configurations.resolvable("assistantClassesOutput") { extendsFrom(assistantClassesScope) }
 val blastRadiusCompileTask = projectTask("blastradius", "compileJava")
 val distDepsFilesScope by configurations.dependencyScope("distDepsFilesScope")
 val distDepsFiles by configurations.resolvable("distDepsFiles") { extendsFrom(distDepsFilesScope) }
@@ -50,11 +52,12 @@
 val sharedDownloadDepsInternalTask = projectTask("shared", "downloadDepsInternal")
 
 dependencies {
+  assistantClassesScope(project(":assistant", "assistantJar"))
   distDepsFilesScope(project(":dist", "depsFiles"))
   mainClassesScope(project(":main", "mainClassesOutput"))
   mainResourcesScope(project(":main", "mainResources"))
   turboClassesScope(project(":main", "turboClassesOutput"))
-  implementation(assistantCompileTask.outputs.files)
+  implementation(project(":assistant", "assistantJar"))
   implementation(blastRadiusCompileTask.outputs.files)
   implementation(keepAnnoJarTask.outputs.files)
   implementation(project(":libanalyzer", "libanalyzer-compile-java"))
@@ -166,7 +169,7 @@
         File.pathSeparator +
         keepAnnoCompileJavaTask.outputs.files.getAsPath().split(File.pathSeparator)[0] +
         File.pathSeparator +
-        assistantCompileTask.outputs.files.getAsPath().split(File.pathSeparator)[0] +
+        project.files(assistantClassesOutput).asPath.split(File.pathSeparator)[0] +
         File.pathSeparator +
         resourceShrinkerCompileJavaTask.outputs.files.getAsPath().split(File.pathSeparator)[0] +
         File.pathSeparator +
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 41617a3..2ef47ed 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -18,7 +18,9 @@
 
 includeBuild(rootProject.projectDir.resolve("d8_r8/shared"))
 
-includeBuild(rootProject.projectDir.resolve("d8_r8/assistant"))
+include(":assistant")
+
+project(":assistant").projectDir = file("d8_r8/assistant")
 
 includeBuild(rootProject.projectDir.resolve("d8_r8/blastradius"))