Use the blueprint plugin infrastructure

Instead of using this hardcoded list, use the blueprint plugin
infrastructure to find them at build time and load them.

Bug: 23567252
Change-Id: Iae87e8c9bf020f4beb42c418b9a6bf8b0fe8b601
diff --git a/Android.bp b/Android.bp
index 404c478..30cbf15 100644
--- a/Android.bp
+++ b/Android.bp
@@ -16,12 +16,8 @@
         "blueprint",
         "blueprint-bootstrap",
         "soong",
-        "soong-art",
-        "soong-cc",
         "soong-common",
         "soong-env",
-        "soong-genrule",
-        "soong-java",
     ],
     srcs: [
         "cmd/soong_build/main.go",
@@ -133,6 +129,7 @@
     testSrcs: [
         "cc/cc_test.go",
     ],
+    pluginFor: ["soong_build"],
 }
 
 bootstrap_go_package {
@@ -147,6 +144,7 @@
     srcs: [
         "genrule/genrule.go",
     ],
+    pluginFor: ["soong_build"],
 }
 
 bootstrap_go_binary {
@@ -174,6 +172,7 @@
         "java/java.go",
         "java/resources.go",
     ],
+    pluginFor: ["soong_build"],
 }
 
 //
diff --git a/build.ninja.in b/build.ninja.in
index e72166e..8639166 100644
--- a/build.ninja.in
+++ b/build.ninja.in
@@ -64,7 +64,7 @@
 # Module:  blueprint
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·003
 # Defined: build/blueprint/Blueprints:1:1
 
 build $
@@ -154,7 +154,7 @@
 # Module:  blueprint-bootstrap
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·003
 # Defined: build/blueprint/Blueprints:70:1
 
 build $
@@ -182,7 +182,7 @@
 # Module:  blueprint-bootstrap-bpdoc
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·003
 # Defined: build/blueprint/Blueprints:89:1
 
 build $
@@ -203,7 +203,7 @@
 # Module:  blueprint-deptools
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·003
 # Defined: build/blueprint/Blueprints:46:1
 
 build $
@@ -219,7 +219,7 @@
 # Module:  blueprint-parser
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·003
 # Defined: build/blueprint/Blueprints:31:1
 
 build $
@@ -284,7 +284,7 @@
 # Module:  blueprint-pathtools
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·003
 # Defined: build/blueprint/Blueprints:52:1
 
 build $
@@ -344,7 +344,7 @@
 # Module:  blueprint-proptools
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·003
 # Defined: build/blueprint/Blueprints:64:1
 
 build $
@@ -360,7 +360,7 @@
 # Module:  choosestage
 # Variant:
 # Type:    bootstrap_core_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
+# Factory: github.com/google/blueprint/bootstrap.func·005
 # Defined: build/blueprint/Blueprints:127:1
 
 build ${g.bootstrap.buildDir}/.bootstrap/choosestage/obj/choosestage.a: $
@@ -383,7 +383,7 @@
 # Module:  gotestmain
 # Variant:
 # Type:    bootstrap_core_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
+# Factory: github.com/google/blueprint/bootstrap.func·005
 # Defined: build/blueprint/Blueprints:122:1
 
 build ${g.bootstrap.buildDir}/.bootstrap/gotestmain/obj/gotestmain.a: $
@@ -406,7 +406,7 @@
 # Module:  minibp
 # Variant:
 # Type:    bootstrap_core_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
+# Factory: github.com/google/blueprint/bootstrap.func·005
 # Defined: build/blueprint/Blueprints:101:1
 
 build ${g.bootstrap.buildDir}/.bootstrap/minibp/obj/minibp.a: $
@@ -436,7 +436,7 @@
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Singleton: bootstrap
-# Factory:   github.com/google/blueprint/bootstrap.func·008
+# Factory:   github.com/google/blueprint/bootstrap.func·012
 
 rule s.bootstrap.primarybp
     command = ${g.bootstrap.BinDir}/minibp --build-primary ${runTests} -m ${g.bootstrap.bootstrapManifest} --timestamp ${timestamp} --timestampdep ${timestampdep} -b ${g.bootstrap.buildDir} -d ${outfile}.d -o ${outfile} ${in}
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index 33fdd69..6519402 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -24,12 +24,7 @@
 
 	"android/soong"
 
-	// These imports cause the modules to register their ModuleTypes, etc. with the soong package
-	_ "android/soong/art"
-	_ "android/soong/cc"
 	"android/soong/common"
-	_ "android/soong/genrule"
-	_ "android/soong/java"
 )
 
 func main() {