Make protolog common srcs a library

This is so that we can import the platform annotations (specifically for the ravenwood annotations) as the library instead of the sources directly which are not visibile at this level.

Flag: EXEMPT build rules only
Change-Id: Iad6e03cc5924ba94941a1737e7a5a3a6bff8e2f1
diff --git a/core/java/Android.bp b/core/java/Android.bp
index 22983d1..7123ee7 100644
--- a/core/java/Android.bp
+++ b/core/java/Android.bp
@@ -657,6 +657,17 @@
 }
 
 java_library {
+    name: "protolog-common-lib",
+    srcs: [
+        ":protolog-common-src",
+    ],
+    host_supported: true,
+    static_libs: [
+        "framework-annotations-lib",
+    ],
+}
+
+java_library {
     name: "protolog-group",
     srcs: [
         "com/android/internal/protolog/common/IProtoLogGroup.java",
@@ -693,9 +704,11 @@
 java_library {
     name: "protolog-groups",
     srcs: [
-        ":protolog-common-src",
         "com/android/internal/protolog/WmProtoLogGroups.java",
     ],
+    static_libs: [
+        "protolog-common-lib",
+    ],
 }
 
 // protolog end
diff --git a/libs/WindowManager/Shell/Android.bp b/libs/WindowManager/Shell/Android.bp
index 753212b..033c934 100644
--- a/libs/WindowManager/Shell/Android.bp
+++ b/libs/WindowManager/Shell/Android.bp
@@ -26,9 +26,11 @@
 java_library {
     name: "wm_shell_protolog-groups",
     srcs: [
-        ":protolog-common-src",
         "src/com/android/wm/shell/protolog/ShellProtoLogGroup.java",
     ],
+    static_libs: [
+        "protolog-common-lib",
+    ],
 }
 
 filegroup {
@@ -159,7 +161,6 @@
 android_library {
     name: "WindowManager-Shell",
     srcs: [
-        ":wm_shell_protolog_src",
         // TODO(b/168581922) protologtool do not support kotlin(*.kt)
         ":wm_shell-aidls",
         ":wm_shell-shared-aidls",
diff --git a/tools/protologtool/Android.bp b/tools/protologtool/Android.bp
index 46874c3..a103d03 100644
--- a/tools/protologtool/Android.bp
+++ b/tools/protologtool/Android.bp
@@ -10,7 +10,6 @@
 java_library_host {
     name: "protologtool-lib",
     srcs: [
-        ":protolog-common-src",
         "src/com/android/protolog/tool/**/*.kt",
     ],
     static_libs: [
@@ -18,6 +17,7 @@
         "jsonlib",
         "perfetto_trace-full",
         "platformprotos",
+        "protolog-common-lib",
     ],
 }