Replace gensrcs with java_library to deprecate depfile in gensrcs

The depfile concept in Soong and Ninja isn't applicable in Bazel because
Bazel requires listing the deps explicitly. This CL changes the module
type from gensrcs to java_library with proto.type set to "stream".

The end goal is to eventually deprecate depfile in gensrcs to ensure all
gensrcs modules are convertable to Bazel.

Test: CI
Bug: 179452413
Change-Id: Ie8c6a3801a53d2a798335536bace60b7d0791d84
Merged-In: Ie8c6a3801a53d2a798335536bace60b7d0791d84
diff --git a/Android.bp b/Android.bp
index 8d71992..5fdf478 100644
--- a/Android.bp
+++ b/Android.bp
@@ -22,37 +22,21 @@
         "proto/car_rotary_controller.proto",
     ],
 }
-gensrcs {
+
+java_library {
     name: "rotary-service-javastream-protos",
-    depfile: true,
-
-    tools: [
-        "aprotoc",
-        "protoc-gen-javastream",
-        "soong_zip",
-    ],
-
-    cmd: "mkdir -p $(genDir)/$(in) " +
-        "&& $(location aprotoc) " +
-        "  --plugin=$(location protoc-gen-javastream) " +
-        "  --dependency_out=$(depfile) " +
-        "  --javastream_out=$(genDir)/$(in) " +
-        "  -Iexternal/protobuf/src " +
-        "  -I . " +
-        "  $(in) " +
-        "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)",
-
-    srcs: [
-        ":rotary-service-proto-source",
-    ],
-    output_extension: "srcjar",
+    proto: {
+        type: "stream",
+    },
+    srcs: [":rotary-service-proto-source"],
+    installable: false,
+    platform_apis: true,
 }
 
 android_app {
     name: "CarRotaryController",
     srcs: [
         "src/**/*.java",
-        ":rotary-service-javastream-protos",
     ],
     resource_dirs: ["res"],
 
@@ -80,6 +64,7 @@
     ],
     static_libs: [
         "car-ui-lib",
+        "rotary-service-javastream-protos",
     ],
     product_variables: {
         pdk: {
@@ -95,7 +80,6 @@
 
     srcs: [
         "src/**/*.java",
-        ":rotary-service-javastream-protos",
     ],
 
     resource_dirs: [
@@ -116,6 +100,7 @@
     ],
     static_libs: [
         "car-ui-lib",
+        "rotary-service-javastream-protos",
     ],
     product_variables: {
         pdk: {