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
15package {
16    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "frameworks_base_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["frameworks_base_license"],
22}
23
24// Begin ProtoLog
25java_library {
26    name: "wm_shell_protolog-groups",
27    srcs: [
28        "src/com/android/wm/shell/protolog/ShellProtoLogGroup.java",
29        ":protolog-common-src",
30    ],
31}
32
33filegroup {
34    name: "wm_shell-sources",
35    srcs: [
36        "src/**/*.java",
37    ],
38    path: "src",
39}
40
41// Sources that have no dependencies that can be used directly downstream of this library
42filegroup {
43    name: "wm_shell_util-sources",
44    srcs: [
45        "src/com/android/wm/shell/animation/Interpolators.java",
46        "src/com/android/wm/shell/animation/PhysicsAnimator.kt",
47        "src/com/android/wm/shell/common/bubbles/*.kt",
48        "src/com/android/wm/shell/common/bubbles/*.java",
49        "src/com/android/wm/shell/common/magnetictarget/MagnetizedObject.kt",
50        "src/com/android/wm/shell/common/split/SplitScreenConstants.java",
51        "src/com/android/wm/shell/common/TransactionPool.java",
52        "src/com/android/wm/shell/common/TriangleShape.java",
53        "src/com/android/wm/shell/draganddrop/DragAndDropConstants.java",
54        "src/com/android/wm/shell/pip/PipContentOverlay.java",
55        "src/com/android/wm/shell/startingsurface/SplashScreenExitAnimationUtils.java",
56        "src/com/android/wm/shell/sysui/ShellSharedConstants.java",
57        "src/com/android/wm/shell/util/**/*.java",
58    ],
59    path: "src",
60}
61
62// Aidls which can be used directly downstream of this library
63filegroup {
64    name: "wm_shell-aidls",
65    srcs: [
66        "src/**/*.aidl",
67    ],
68    path: "src",
69}
70
71// TODO(b/168581922) protologtool do not support kotlin(*.kt)
72filegroup {
73    name: "wm_shell-sources-kt",
74    srcs: [
75        "src/**/*.kt",
76    ],
77    path: "src",
78}
79
80genrule {
81    name: "wm_shell_protolog_src",
82    srcs: [
83        ":wm_shell_protolog-groups",
84        ":wm_shell-sources",
85    ],
86    tools: ["protologtool"],
87    cmd: "$(location protologtool) transform-protolog-calls " +
88        "--protolog-class com.android.internal.protolog.common.ProtoLog " +
89        "--protolog-impl-class com.android.wm.shell.protolog.ShellProtoLogImpl " +
90        "--protolog-cache-class com.android.wm.shell.protolog.ShellProtoLogCache " +
91        "--loggroups-class com.android.wm.shell.protolog.ShellProtoLogGroup " +
92        "--loggroups-jar $(location :wm_shell_protolog-groups) " +
93        "--output-srcjar $(out) " +
94        "$(locations :wm_shell-sources)",
95    out: ["wm_shell_protolog.srcjar"],
96}
97
98genrule {
99    name: "generate-wm_shell_protolog.json",
100    srcs: [
101        ":wm_shell_protolog-groups",
102        ":wm_shell-sources",
103    ],
104    tools: ["protologtool"],
105    cmd: "$(location protologtool) generate-viewer-config " +
106        "--protolog-class com.android.internal.protolog.common.ProtoLog " +
107        "--loggroups-class com.android.wm.shell.protolog.ShellProtoLogGroup " +
108        "--loggroups-jar $(location :wm_shell_protolog-groups) " +
109        "--viewer-conf $(out) " +
110        "$(locations :wm_shell-sources)",
111    out: ["wm_shell_protolog.json"],
112}
113
114genrule {
115    name: "protolog.json.gz",
116    srcs: [":generate-wm_shell_protolog.json"],
117    out: ["wmshell.protolog.json.gz"],
118    cmd: "$(location minigzip) -c < $(in) > $(out)",
119    tools: ["minigzip"],
120}
121
122prebuilt_etc {
123    name: "wmshell.protolog.json.gz",
124    system_ext_specific: true,
125    src: ":protolog.json.gz",
126    filename_from_src: true,
127}
128
129// End ProtoLog
130
131java_library {
132    name: "WindowManager-Shell-proto",
133
134    srcs: ["proto/*.proto"],
135
136    proto: {
137        type: "nano",
138    },
139}
140
141android_library {
142    name: "WindowManager-Shell",
143    srcs: [
144        ":wm_shell_protolog_src",
145        // TODO(b/168581922) protologtool do not support kotlin(*.kt)
146        ":wm_shell-sources-kt",
147        ":wm_shell-aidls",
148    ],
149    resource_dirs: [
150        "res",
151    ],
152    static_libs: [
153        "androidx.appcompat_appcompat",
154        "androidx.core_core-animation",
155        "androidx.arch.core_core-runtime",
156        "androidx-constraintlayout_constraintlayout",
157        "androidx.dynamicanimation_dynamicanimation",
158        "androidx.recyclerview_recyclerview",
159        "kotlinx-coroutines-android",
160        "kotlinx-coroutines-core",
161        "iconloader_base",
162        "protolog-lib",
163        "WindowManager-Shell-proto",
164        "dagger2",
165        "jsr330",
166    ],
167    libs: [
168        // Soong fails to automatically add this dependency because all the
169        // *.kt sources are inside a filegroup.
170        "kotlin-annotations",
171    ],
172    kotlincflags: ["-Xjvm-default=enable"],
173    manifest: "AndroidManifest.xml",
174    plugins: ["dagger2-compiler"],
175}
176