| Winson Chung | 10a9b4b | 2019-12-18 10:01:36 -0800 | [diff] [blame] | 1 | // Copyright (C) 2019 The Android Open Source Project | 
|  | 2 | // | 
|  | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 4 | // you may not use this file except in compliance with the License. | 
|  | 5 | // You may obtain a copy of the License at | 
|  | 6 | // | 
|  | 7 | //      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 8 | // | 
|  | 9 | // Unless required by applicable law or agreed to in writing, software | 
|  | 10 | // distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 12 | // See the License for the specific language governing permissions and | 
|  | 13 | // limitations under the License. | 
|  | 14 |  | 
| Winson Chung | b754f52 | 2020-08-03 22:17:08 -0700 | [diff] [blame] | 15 | // Begin ProtoLog | 
|  | 16 | java_library { | 
|  | 17 | name: "wm_shell_protolog-groups", | 
|  | 18 | srcs: [ | 
|  | 19 | "src/com/android/wm/shell/protolog/ShellProtoLogGroup.java", | 
|  | 20 | ":protolog-common-src", | 
|  | 21 | ], | 
|  | 22 | } | 
|  | 23 |  | 
|  | 24 | filegroup { | 
|  | 25 | name: "wm_shell-sources", | 
| Bill Lin | 2b3bd57 | 2020-09-03 23:22:14 +0800 | [diff] [blame] | 26 | srcs: [ | 
|  | 27 | "src/**/*.java", | 
|  | 28 | ], | 
|  | 29 | path: "src", | 
|  | 30 | } | 
|  | 31 |  | 
|  | 32 | // TODO(b/168581922) protologtool do not support kotlin(*.kt) | 
|  | 33 | filegroup { | 
|  | 34 | name: "wm_shell-sources-kt", | 
|  | 35 | srcs: [ | 
|  | 36 | "src/**/*.kt", | 
|  | 37 | ], | 
| Winson Chung | b754f52 | 2020-08-03 22:17:08 -0700 | [diff] [blame] | 38 | path: "src", | 
|  | 39 | } | 
|  | 40 |  | 
|  | 41 | genrule { | 
|  | 42 | name: "wm_shell_protolog_src", | 
|  | 43 | srcs: [ | 
|  | 44 | ":wm_shell_protolog-groups", | 
|  | 45 | ":wm_shell-sources", | 
|  | 46 | ], | 
|  | 47 | tools: ["protologtool"], | 
|  | 48 | cmd: "$(location protologtool) transform-protolog-calls " + | 
|  | 49 | "--protolog-class com.android.internal.protolog.common.ProtoLog " + | 
|  | 50 | "--protolog-impl-class com.android.wm.shell.protolog.ShellProtoLogImpl " + | 
|  | 51 | "--protolog-cache-class com.android.wm.shell.protolog.ShellProtoLogCache " + | 
|  | 52 | "--loggroups-class com.android.wm.shell.protolog.ShellProtoLogGroup " + | 
|  | 53 | "--loggroups-jar $(location :wm_shell_protolog-groups) " + | 
|  | 54 | "--output-srcjar $(out) " + | 
|  | 55 | "$(locations :wm_shell-sources)", | 
|  | 56 | out: ["wm_shell_protolog.srcjar"], | 
|  | 57 | } | 
|  | 58 |  | 
|  | 59 | genrule { | 
|  | 60 | name: "generate-wm_shell_protolog.json", | 
|  | 61 | srcs: [ | 
|  | 62 | ":wm_shell_protolog-groups", | 
|  | 63 | ":wm_shell-sources", | 
|  | 64 | ], | 
|  | 65 | tools: ["protologtool"], | 
|  | 66 | cmd: "$(location protologtool) generate-viewer-config " + | 
|  | 67 | "--protolog-class com.android.internal.protolog.common.ProtoLog " + | 
|  | 68 | "--loggroups-class com.android.wm.shell.protolog.ShellProtoLogGroup " + | 
|  | 69 | "--loggroups-jar $(location :wm_shell_protolog-groups) " + | 
|  | 70 | "--viewer-conf $(out) " + | 
|  | 71 | "$(locations :wm_shell-sources)", | 
|  | 72 | out: ["wm_shell_protolog.json"], | 
|  | 73 | } | 
|  | 74 |  | 
|  | 75 | filegroup { | 
|  | 76 | name: "wm_shell_protolog.json", | 
|  | 77 | srcs: ["res/raw/wm_shell_protolog.json"], | 
|  | 78 | } | 
|  | 79 |  | 
|  | 80 | genrule { | 
|  | 81 | name: "checked-wm_shell_protolog.json", | 
|  | 82 | srcs: [ | 
|  | 83 | ":generate-wm_shell_protolog.json", | 
|  | 84 | ":wm_shell_protolog.json", | 
|  | 85 | ], | 
|  | 86 | cmd: "cp $(location :generate-wm_shell_protolog.json) $(out) && " + | 
|  | 87 | "{ ! (diff $(out) $(location :wm_shell_protolog.json) | grep -q '^<') || " + | 
|  | 88 | "{ echo -e '\\n\\n################################################################\\n#\\n" + | 
|  | 89 | "#  ERROR: ProtoLog viewer config is stale.  To update it, run:\\n#\\n" + | 
|  | 90 | "#  cp $(location :generate-wm_shell_protolog.json) " + | 
|  | 91 | "$(location :wm_shell_protolog.json)\\n#\\n" + | 
|  | 92 | "################################################################\\n\\n' >&2 && false; } }", | 
|  | 93 | out: ["wm_shell_protolog.json"], | 
|  | 94 | } | 
|  | 95 | // End ProtoLog | 
|  | 96 |  | 
| Winson Chung | eb1aa3d | 2020-08-25 19:02:29 -0700 | [diff] [blame] | 97 | java_library { | 
|  | 98 | name: "WindowManager-Shell-proto", | 
|  | 99 |  | 
|  | 100 | srcs: ["proto/*.proto"], | 
|  | 101 |  | 
|  | 102 | proto: { | 
|  | 103 | type: "nano", | 
|  | 104 | }, | 
|  | 105 | } | 
|  | 106 |  | 
| Winson Chung | 10a9b4b | 2019-12-18 10:01:36 -0800 | [diff] [blame] | 107 | android_library { | 
|  | 108 | name: "WindowManager-Shell", | 
|  | 109 | srcs: [ | 
| Winson Chung | b754f52 | 2020-08-03 22:17:08 -0700 | [diff] [blame] | 110 | ":wm_shell_protolog_src", | 
| Bill Lin | 2b3bd57 | 2020-09-03 23:22:14 +0800 | [diff] [blame] | 111 | // TODO(b/168581922) protologtool do not support kotlin(*.kt) | 
|  | 112 | ":wm_shell-sources-kt", | 
| Winson Chung | 10a9b4b | 2019-12-18 10:01:36 -0800 | [diff] [blame] | 113 | "src/**/I*.aidl", | 
|  | 114 | ], | 
|  | 115 | resource_dirs: [ | 
|  | 116 | "res", | 
|  | 117 | ], | 
| Winson Chung | b754f52 | 2020-08-03 22:17:08 -0700 | [diff] [blame] | 118 | static_libs: [ | 
| Bill Lin | 2b3bd57 | 2020-09-03 23:22:14 +0800 | [diff] [blame] | 119 | "androidx.dynamicanimation_dynamicanimation", | 
|  | 120 | "kotlinx-coroutines-android", | 
|  | 121 | "kotlinx-coroutines-core", | 
| Winson Chung | b754f52 | 2020-08-03 22:17:08 -0700 | [diff] [blame] | 122 | "protolog-lib", | 
| Winson Chung | eb1aa3d | 2020-08-25 19:02:29 -0700 | [diff] [blame] | 123 | "WindowManager-Shell-proto", | 
| Tony Huang | 1ed148d | 2020-09-07 15:46:28 +0800 | [diff] [blame] | 124 | "androidx.appcompat_appcompat", | 
| Winson Chung | b754f52 | 2020-08-03 22:17:08 -0700 | [diff] [blame] | 125 | ], | 
| Bill Lin | 2b3bd57 | 2020-09-03 23:22:14 +0800 | [diff] [blame] | 126 | kotlincflags: ["-Xjvm-default=enable"], | 
| Winson Chung | 10a9b4b | 2019-12-18 10:01:36 -0800 | [diff] [blame] | 127 | manifest: "AndroidManifest.xml", | 
| Bill Lin | 2b3bd57 | 2020-09-03 23:22:14 +0800 | [diff] [blame] | 128 |  | 
|  | 129 | min_sdk_version: "26", | 
| Winson Chung | b754f52 | 2020-08-03 22:17:08 -0700 | [diff] [blame] | 130 | } |