Move error_prone config to external/error_prone

The error_prone config will likely need to be updated at the same
time as the error_prone prebuilts, so move the config into the same
project.  This requires jumping through some hoops because
external/error_prone may not be present in all manifests.

Bug: 64489631
Test: m -j RUN_ERROR_PRONE=true
Change-Id: I2c59df1148134ffedac0e00d32ac7082a9fb5330
diff --git a/java/builder.go b/java/builder.go
index 6912c87..e359529 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -21,9 +21,10 @@
 import (
 	"strings"
 
-	"android/soong/android"
-
 	"github.com/google/blueprint"
+
+	"android/soong/android"
+	"android/soong/java/config"
 )
 
 var (
@@ -166,6 +167,11 @@
 func RunErrorProne(ctx android.ModuleContext, srcFiles android.Paths, srcFileLists android.Paths,
 	flags javaBuilderFlags, deps android.Paths) android.Path {
 
+	if config.ErrorProneJar == "" {
+		ctx.ModuleErrorf("cannot build with Error Prone, missing external/error_prone?")
+		return nil
+	}
+
 	classDir := android.PathForModuleOut(ctx, "classes-errorprone")
 	annoDir := android.PathForModuleOut(ctx, "anno-errorprone")
 	classFileList := android.PathForModuleOut(ctx, "classes-errorprone.list")